diff --git a/benchmarks/ios/README.md b/benchmarks/ios/README.md new file mode 100644 index 0000000000..c75a8dc4fa --- /dev/null +++ b/benchmarks/ios/README.md @@ -0,0 +1 @@ +Collection of test compose multiplatfom applications used for evaluating performance of Compose for iOS. \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/.gitignore b/benchmarks/ios/animation-from-template/.gitignore new file mode 100644 index 0000000000..6e5f30477c --- /dev/null +++ b/benchmarks/ios/animation-from-template/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +build/ +/captures +.externalNativeBuild +.cxx +iosApp/Podfile.lock +iosApp/Pods/* +iosApp/iosApp.xcworkspace/* +iosApp/iosApp.xcodeproj/* +!iosApp/iosApp.xcodeproj/project.pbxproj +shared/shared.podspec diff --git a/benchmarks/ios/animation-from-template/.run/desktopApp.run.xml b/benchmarks/ios/animation-from-template/.run/desktopApp.run.xml new file mode 100644 index 0000000000..95395e11ee --- /dev/null +++ b/benchmarks/ios/animation-from-template/.run/desktopApp.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/LICENSE.txt b/benchmarks/ios/animation-from-template/LICENSE.txt new file mode 100644 index 0000000000..244380c242 --- /dev/null +++ b/benchmarks/ios/animation-from-template/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020-2021 JetBrains s.r.o. and and respective authors and developers. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/benchmarks/ios/animation-from-template/README.md b/benchmarks/ios/animation-from-template/README.md new file mode 100644 index 0000000000..40718c389c --- /dev/null +++ b/benchmarks/ios/animation-from-template/README.md @@ -0,0 +1 @@ +Infinite animation based on: https://github.com/JetBrains/compose-multiplatform-template \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/androidApp/build.gradle.kts b/benchmarks/ios/animation-from-template/androidApp/build.gradle.kts new file mode 100644 index 0000000000..b86596b317 --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + kotlin("multiplatform") + id("com.android.application") + id("org.jetbrains.compose") +} + +kotlin { + android() + sourceSets { + val androidMain by getting { + dependencies { + implementation(project(":shared")) + } + } + } +} + +android { + compileSdk = (findProperty("android.compileSdk") as String).toInt() + namespace = "com.myapplication" + + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + + defaultConfig { + applicationId = "com.myapplication.MyApplication" + minSdk = (findProperty("android.minSdk") as String).toInt() + targetSdk = (findProperty("android.targetSdk") as String).toInt() + versionCode = 1 + versionName = "1.0" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlin { + jvmToolchain(11) + } +} diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/AndroidManifest.xml b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..bc7e861696 --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt new file mode 100644 index 0000000000..fd6e831ceb --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt @@ -0,0 +1,16 @@ +package com.myapplication + +import MainView +import android.os.Bundle +import androidx.activity.compose.setContent +import androidx.appcompat.app.AppCompatActivity + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + MainView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000..2b068d1146 --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..07d5da9cbf --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..a571e60098 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000..61da551c55 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..c41dd28531 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000..db5080a752 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..6dba46dab1 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..da31a871c8 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..15ac681720 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..b216f2d313 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..f25a419744 Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..e96783ccce Binary files /dev/null and b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/values/strings.xml b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/values/strings.xml new file mode 100644 index 0000000000..592270bf53 --- /dev/null +++ b/benchmarks/ios/animation-from-template/androidApp/src/androidMain/res/values/strings.xml @@ -0,0 +1,3 @@ + + My application + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/build.gradle.kts b/benchmarks/ios/animation-from-template/build.gradle.kts new file mode 100644 index 0000000000..b7e1d5d26a --- /dev/null +++ b/benchmarks/ios/animation-from-template/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + // this is necessary to avoid the plugins to be loaded multiple times + // in each subproject's classloader + kotlin("multiplatform").apply(false) + id("com.android.application").apply(false) + id("com.android.library").apply(false) + id("org.jetbrains.compose").apply(false) +} diff --git a/benchmarks/ios/animation-from-template/cleanup.sh b/benchmarks/ios/animation-from-template/cleanup.sh new file mode 100755 index 0000000000..62f9391b86 --- /dev/null +++ b/benchmarks/ios/animation-from-template/cleanup.sh @@ -0,0 +1,10 @@ +#!/bin/sh +rm -rf .idea +./gradlew clean +rm -rf .gradle +rm -rf build +rm -rf */build +rm -rf iosApp/iosApp.xcworkspace +rm -rf iosApp/Pods +rm -rf iosApp/iosApp.xcodeproj/project.xcworkspace +rm -rf iosApp/iosApp.xcodeproj/xcuserdata diff --git a/benchmarks/ios/animation-from-template/desktopApp/build.gradle.kts b/benchmarks/ios/animation-from-template/desktopApp/build.gradle.kts new file mode 100644 index 0000000000..931f3467a2 --- /dev/null +++ b/benchmarks/ios/animation-from-template/desktopApp/build.gradle.kts @@ -0,0 +1,30 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat + +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + jvm() + sourceSets { + val jvmMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + implementation(project(":shared")) + } + } + } +} + +compose.desktop { + application { + mainClass = "MainKt" + + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "KotlinMultiplatformComposeDesktopApplication" + packageVersion = "1.0.0" + } + } +} diff --git a/benchmarks/ios/animation-from-template/desktopApp/src/jvmMain/kotlin/main.kt b/benchmarks/ios/animation-from-template/desktopApp/src/jvmMain/kotlin/main.kt new file mode 100644 index 0000000000..5ffada98e1 --- /dev/null +++ b/benchmarks/ios/animation-from-template/desktopApp/src/jvmMain/kotlin/main.kt @@ -0,0 +1,8 @@ +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application + +fun main() = application { + Window(onCloseRequest = ::exitApplication) { + MainView() + } +} \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/gradle.properties b/benchmarks/ios/animation-from-template/gradle.properties new file mode 100644 index 0000000000..2fa452fa94 --- /dev/null +++ b/benchmarks/ios/animation-from-template/gradle.properties @@ -0,0 +1,25 @@ +#Gradle +org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" + +#Kotlin +kotlin.code.style=official + +#MPP +kotlin.mpp.stability.nowarn=true +kotlin.mpp.enableCInteropCommonization=true +kotlin.mpp.androidSourceSetLayoutVersion=2 + +#Compose +org.jetbrains.compose.experimental.uikit.enabled=true +kotlin.native.cacheKind=none + +#Android +android.useAndroidX=true +android.compileSdk=33 +android.targetSdk=33 +android.minSdk=24 + +#Versions +kotlin.version=1.8.20 +agp.version=7.4.2 +compose.version=1.4.0 \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/gradle/wrapper/gradle-wrapper.jar b/benchmarks/ios/animation-from-template/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..249e5832f0 Binary files /dev/null and b/benchmarks/ios/animation-from-template/gradle/wrapper/gradle-wrapper.jar differ diff --git a/benchmarks/ios/animation-from-template/gradle/wrapper/gradle-wrapper.properties b/benchmarks/ios/animation-from-template/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..e1bef7e873 --- /dev/null +++ b/benchmarks/ios/animation-from-template/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/benchmarks/ios/animation-from-template/gradlew b/benchmarks/ios/animation-from-template/gradlew new file mode 100755 index 0000000000..a69d9cb6c2 --- /dev/null +++ b/benchmarks/ios/animation-from-template/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/benchmarks/ios/animation-from-template/gradlew.bat b/benchmarks/ios/animation-from-template/gradlew.bat new file mode 100644 index 0000000000..f127cfd49d --- /dev/null +++ b/benchmarks/ios/animation-from-template/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/benchmarks/ios/animation-from-template/iosApp/Configuration/Config.xcconfig b/benchmarks/ios/animation-from-template/iosApp/Configuration/Config.xcconfig new file mode 100644 index 0000000000..f391597827 --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/Configuration/Config.xcconfig @@ -0,0 +1,3 @@ +TEAM_ID= +BUNDLE_ID=com.myapplication.MyApplication +APP_NAME=My application diff --git a/benchmarks/ios/animation-from-template/iosApp/Podfile b/benchmarks/ios/animation-from-template/iosApp/Podfile new file mode 100644 index 0000000000..aff9c517b2 --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/Podfile @@ -0,0 +1,5 @@ +target 'iosApp' do + use_frameworks! + platform :ios, '14.1' + pod 'shared', :path => '../shared' +end \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp.xcodeproj/project.pbxproj b/benchmarks/ios/animation-from-template/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..df8fc264e7 --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,418 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF7B242A565900829871 /* My application.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My application.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F85CB1118929364A9C6EFABC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 058557D7273AAEEB004C7B11 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 42799AB246E5F90AF97AA0EF /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + AB1DB47929225F7C00F7AF9C /* Configuration */, + 7555FF7D242A565900829871 /* iosApp */, + 7555FF7C242A565900829871 /* Products */, + FEFF387C0A8D172AA4D59CAE /* Pods */, + 42799AB246E5F90AF97AA0EF /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* My application.app */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 058557BA273AAA24004C7B11 /* Assets.xcassets */, + 7555FF82242A565900829871 /* ContentView.swift */, + 7555FF8C242A565B00829871 /* Info.plist */, + 2152FB032600AC8F00CF470E /* iOSApp.swift */, + 058557D7273AAEEB004C7B11 /* Preview Content */, + ); + path = iosApp; + sourceTree = ""; + }; + AB1DB47929225F7C00F7AF9C /* Configuration */ = { + isa = PBXGroup; + children = ( + AB3632DC29227652001CCB65 /* Config.xcconfig */, + ); + path = Configuration; + sourceTree = ""; + }; + FEFF387C0A8D172AA4D59CAE /* Pods */ = { + isa = PBXGroup; + children = ( + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */, + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */, + 7555FF77242A565900829871 /* Sources */, + 7555FF79242A565900829871 /* Resources */, + F85CB1118929364A9C6EFABC /* Frameworks */, + 2134C13603D0B299603D9F49 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iosApp; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* My application.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = orgName; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* iosApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 2134C13603D0B299603D9F49 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, + 7555FF83242A565900829871 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000000..ee7e3ca03f --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..8edf56e7a9 --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "app-icon-1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png new file mode 100644 index 0000000000..53fc536fb9 Binary files /dev/null and b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png differ diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/Contents.json b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/ContentView.swift b/benchmarks/ios/animation-from-template/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f7f6457b31 --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + + + diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/Info.plist b/benchmarks/ios/animation-from-template/iosApp/iosApp/Info.plist new file mode 100644 index 0000000000..9a269f5eaa --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/benchmarks/ios/animation-from-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/iosApp/iosApp/iOSApp.swift b/benchmarks/ios/animation-from-template/iosApp/iosApp/iOSApp.swift new file mode 100644 index 0000000000..0648e8602f --- /dev/null +++ b/benchmarks/ios/animation-from-template/iosApp/iosApp/iOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/settings.gradle.kts b/benchmarks/ios/animation-from-template/settings.gradle.kts new file mode 100644 index 0000000000..56cae17dbc --- /dev/null +++ b/benchmarks/ios/animation-from-template/settings.gradle.kts @@ -0,0 +1,36 @@ +rootProject.name = "MyApplication" + +include(":androidApp") +include(":shared") +include(":desktopApp") + +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + + id("org.jetbrains.compose").version(composeVersion) + } +} + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + } +} diff --git a/benchmarks/ios/animation-from-template/shared/build.gradle.kts b/benchmarks/ios/animation-from-template/shared/build.gradle.kts new file mode 100644 index 0000000000..8e9b6dadf9 --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/build.gradle.kts @@ -0,0 +1,83 @@ +plugins { + kotlin("multiplatform") + kotlin("native.cocoapods") + id("com.android.library") + id("org.jetbrains.compose") +} + +kotlin { + android() + + jvm("desktop") + + iosX64() + iosArm64() + iosSimulatorArm64() + + cocoapods { + version = "1.0.0" + summary = "Some description for the Shared Module" + homepage = "Link to the Shared Module homepage" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + framework { + baseName = "shared" + isStatic = true + } + extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + implementation(compose.components.resources) + } + } + val androidMain by getting { + dependencies { + api("androidx.activity:activity-compose:1.6.1") + api("androidx.appcompat:appcompat:1.6.1") + api("androidx.core:core-ktx:1.9.0") + } + } + val iosX64Main by getting + val iosArm64Main by getting + val iosSimulatorArm64Main by getting + val iosMain by creating { + dependsOn(commonMain) + iosX64Main.dependsOn(this) + iosArm64Main.dependsOn(this) + iosSimulatorArm64Main.dependsOn(this) + } + val desktopMain by getting { + dependencies { + implementation(compose.desktop.common) + } + } + } +} + +android { + compileSdk = (findProperty("android.compileSdk") as String).toInt() + namespace = "com.myapplication.common" + + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + sourceSets["main"].res.srcDirs("src/androidMain/res") + sourceSets["main"].resources.srcDirs("src/commonMain/resources") + + defaultConfig { + minSdk = (findProperty("android.minSdk") as String).toInt() + targetSdk = (findProperty("android.targetSdk") as String).toInt() + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlin { + jvmToolchain(11) + } +} diff --git a/benchmarks/ios/animation-from-template/shared/src/androidMain/AndroidManifest.xml b/benchmarks/ios/animation-from-template/shared/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..568741e54f --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/benchmarks/ios/animation-from-template/shared/src/androidMain/kotlin/main.android.kt b/benchmarks/ios/animation-from-template/shared/src/androidMain/kotlin/main.android.kt new file mode 100644 index 0000000000..4a1d2a6feb --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/src/androidMain/kotlin/main.android.kt @@ -0,0 +1,3 @@ +import androidx.compose.runtime.Composable + +@Composable fun MainView() = App() diff --git a/benchmarks/ios/animation-from-template/shared/src/commonMain/kotlin/App.kt b/benchmarks/ios/animation-from-template/shared/src/commonMain/kotlin/App.kt new file mode 100644 index 0000000000..79ba129d7f --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/src/commonMain/kotlin/App.kt @@ -0,0 +1,42 @@ +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.Image +import androidx.compose.foundation.MutatePriority +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material.Button +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.runtime.withFrameMillis +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import org.jetbrains.compose.resources.ExperimentalResourceApi +import org.jetbrains.compose.resources.painterResource + +@OptIn(ExperimentalResourceApi::class) +@Composable +fun App() { + MaterialTheme { + var showImage by remember { mutableStateOf(false) } + LaunchedEffect(showImage) { + delay(200) + showImage = !showImage + } + Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { + AnimatedVisibility(showImage) { + Image( + painterResource("compose-multiplatform.xml"), + null + ) + } + } + } +} diff --git a/benchmarks/ios/animation-from-template/shared/src/commonMain/resources/compose-multiplatform.xml b/benchmarks/ios/animation-from-template/shared/src/commonMain/resources/compose-multiplatform.xml new file mode 100644 index 0000000000..d7bf7955f4 --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/src/commonMain/resources/compose-multiplatform.xml @@ -0,0 +1,36 @@ + + + + + + + + diff --git a/benchmarks/ios/animation-from-template/shared/src/desktopMain/kotlin/main.desktop.kt b/benchmarks/ios/animation-from-template/shared/src/desktopMain/kotlin/main.desktop.kt new file mode 100644 index 0000000000..190ff810fd --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/src/desktopMain/kotlin/main.desktop.kt @@ -0,0 +1,4 @@ +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.runtime.Composable + +@Composable fun MainView() = App() diff --git a/benchmarks/ios/animation-from-template/shared/src/iosMain/kotlin/main.ios.kt b/benchmarks/ios/animation-from-template/shared/src/iosMain/kotlin/main.ios.kt new file mode 100644 index 0000000000..fa143d45ce --- /dev/null +++ b/benchmarks/ios/animation-from-template/shared/src/iosMain/kotlin/main.ios.kt @@ -0,0 +1,3 @@ +import androidx.compose.ui.window.ComposeUIViewController + +fun MainViewController() = ComposeUIViewController { App() } \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/.gitignore b/benchmarks/ios/scroll-lazy-grid/.gitignore new file mode 100644 index 0000000000..6e5f30477c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +build/ +/captures +.externalNativeBuild +.cxx +iosApp/Podfile.lock +iosApp/Pods/* +iosApp/iosApp.xcworkspace/* +iosApp/iosApp.xcodeproj/* +!iosApp/iosApp.xcodeproj/project.pbxproj +shared/shared.podspec diff --git a/benchmarks/ios/scroll-lazy-grid/.run/desktopApp.run.xml b/benchmarks/ios/scroll-lazy-grid/.run/desktopApp.run.xml new file mode 100644 index 0000000000..95395e11ee --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/.run/desktopApp.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/LICENSE.txt b/benchmarks/ios/scroll-lazy-grid/LICENSE.txt new file mode 100644 index 0000000000..244380c242 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020-2021 JetBrains s.r.o. and and respective authors and developers. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/benchmarks/ios/scroll-lazy-grid/README.md b/benchmarks/ios/scroll-lazy-grid/README.md new file mode 100644 index 0000000000..beb03aa03c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/README.md @@ -0,0 +1 @@ +A benchmark app extracted from https://github.com/androidx/androidx/blob/androidx-main/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyVerticalGridActivity.kt diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/build.gradle.kts b/benchmarks/ios/scroll-lazy-grid/androidApp/build.gradle.kts new file mode 100644 index 0000000000..b86596b317 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + kotlin("multiplatform") + id("com.android.application") + id("org.jetbrains.compose") +} + +kotlin { + android() + sourceSets { + val androidMain by getting { + dependencies { + implementation(project(":shared")) + } + } + } +} + +android { + compileSdk = (findProperty("android.compileSdk") as String).toInt() + namespace = "com.myapplication" + + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + + defaultConfig { + applicationId = "com.myapplication.MyApplication" + minSdk = (findProperty("android.minSdk") as String).toInt() + targetSdk = (findProperty("android.targetSdk") as String).toInt() + versionCode = 1 + versionName = "1.0" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlin { + jvmToolchain(11) + } +} diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/AndroidManifest.xml b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..bc7e861696 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt new file mode 100644 index 0000000000..fd6e831ceb --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt @@ -0,0 +1,16 @@ +package com.myapplication + +import MainView +import android.os.Bundle +import androidx.activity.compose.setContent +import androidx.appcompat.app.AppCompatActivity + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + MainView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000..2b068d1146 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..07d5da9cbf --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..a571e60098 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000..61da551c55 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..c41dd28531 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000..db5080a752 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..6dba46dab1 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..da31a871c8 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..15ac681720 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..b216f2d313 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..f25a419744 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..e96783ccce Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/values/strings.xml b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/values/strings.xml new file mode 100644 index 0000000000..592270bf53 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/androidApp/src/androidMain/res/values/strings.xml @@ -0,0 +1,3 @@ + + My application + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/build.gradle.kts b/benchmarks/ios/scroll-lazy-grid/build.gradle.kts new file mode 100644 index 0000000000..b7e1d5d26a --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + // this is necessary to avoid the plugins to be loaded multiple times + // in each subproject's classloader + kotlin("multiplatform").apply(false) + id("com.android.application").apply(false) + id("com.android.library").apply(false) + id("org.jetbrains.compose").apply(false) +} diff --git a/benchmarks/ios/scroll-lazy-grid/cleanup.sh b/benchmarks/ios/scroll-lazy-grid/cleanup.sh new file mode 100755 index 0000000000..62f9391b86 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/cleanup.sh @@ -0,0 +1,10 @@ +#!/bin/sh +rm -rf .idea +./gradlew clean +rm -rf .gradle +rm -rf build +rm -rf */build +rm -rf iosApp/iosApp.xcworkspace +rm -rf iosApp/Pods +rm -rf iosApp/iosApp.xcodeproj/project.xcworkspace +rm -rf iosApp/iosApp.xcodeproj/xcuserdata diff --git a/benchmarks/ios/scroll-lazy-grid/desktopApp/build.gradle.kts b/benchmarks/ios/scroll-lazy-grid/desktopApp/build.gradle.kts new file mode 100644 index 0000000000..931f3467a2 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/desktopApp/build.gradle.kts @@ -0,0 +1,30 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat + +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + jvm() + sourceSets { + val jvmMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + implementation(project(":shared")) + } + } + } +} + +compose.desktop { + application { + mainClass = "MainKt" + + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "KotlinMultiplatformComposeDesktopApplication" + packageVersion = "1.0.0" + } + } +} diff --git a/benchmarks/ios/scroll-lazy-grid/desktopApp/src/jvmMain/kotlin/main.kt b/benchmarks/ios/scroll-lazy-grid/desktopApp/src/jvmMain/kotlin/main.kt new file mode 100644 index 0000000000..5ffada98e1 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/desktopApp/src/jvmMain/kotlin/main.kt @@ -0,0 +1,8 @@ +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application + +fun main() = application { + Window(onCloseRequest = ::exitApplication) { + MainView() + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/gradle.properties b/benchmarks/ios/scroll-lazy-grid/gradle.properties new file mode 100644 index 0000000000..2fa452fa94 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/gradle.properties @@ -0,0 +1,25 @@ +#Gradle +org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" + +#Kotlin +kotlin.code.style=official + +#MPP +kotlin.mpp.stability.nowarn=true +kotlin.mpp.enableCInteropCommonization=true +kotlin.mpp.androidSourceSetLayoutVersion=2 + +#Compose +org.jetbrains.compose.experimental.uikit.enabled=true +kotlin.native.cacheKind=none + +#Android +android.useAndroidX=true +android.compileSdk=33 +android.targetSdk=33 +android.minSdk=24 + +#Versions +kotlin.version=1.8.20 +agp.version=7.4.2 +compose.version=1.4.0 \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/gradle/wrapper/gradle-wrapper.jar b/benchmarks/ios/scroll-lazy-grid/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..249e5832f0 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/gradle/wrapper/gradle-wrapper.jar differ diff --git a/benchmarks/ios/scroll-lazy-grid/gradle/wrapper/gradle-wrapper.properties b/benchmarks/ios/scroll-lazy-grid/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..e1bef7e873 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/benchmarks/ios/scroll-lazy-grid/gradlew b/benchmarks/ios/scroll-lazy-grid/gradlew new file mode 100755 index 0000000000..a69d9cb6c2 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/benchmarks/ios/scroll-lazy-grid/gradlew.bat b/benchmarks/ios/scroll-lazy-grid/gradlew.bat new file mode 100644 index 0000000000..f127cfd49d --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/Configuration/Config.xcconfig b/benchmarks/ios/scroll-lazy-grid/iosApp/Configuration/Config.xcconfig new file mode 100644 index 0000000000..f391597827 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/Configuration/Config.xcconfig @@ -0,0 +1,3 @@ +TEAM_ID= +BUNDLE_ID=com.myapplication.MyApplication +APP_NAME=My application diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/Podfile b/benchmarks/ios/scroll-lazy-grid/iosApp/Podfile new file mode 100644 index 0000000000..aff9c517b2 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/Podfile @@ -0,0 +1,5 @@ +target 'iosApp' do + use_frameworks! + platform :ios, '14.1' + pod 'shared', :path => '../shared' +end \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp.xcodeproj/project.pbxproj b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..c888c0443c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,400 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF7B242A565900829871 /* My application.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My application.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F85CB1118929364A9C6EFABC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 058557D7273AAEEB004C7B11 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 42799AB246E5F90AF97AA0EF /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + AB1DB47929225F7C00F7AF9C /* Configuration */, + 7555FF7D242A565900829871 /* iosApp */, + 7555FF7C242A565900829871 /* Products */, + FEFF387C0A8D172AA4D59CAE /* Pods */, + 42799AB246E5F90AF97AA0EF /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* My application.app */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 058557BA273AAA24004C7B11 /* Assets.xcassets */, + 7555FF82242A565900829871 /* ContentView.swift */, + 7555FF8C242A565B00829871 /* Info.plist */, + 2152FB032600AC8F00CF470E /* iOSApp.swift */, + 058557D7273AAEEB004C7B11 /* Preview Content */, + ); + path = iosApp; + sourceTree = ""; + }; + AB1DB47929225F7C00F7AF9C /* Configuration */ = { + isa = PBXGroup; + children = ( + AB3632DC29227652001CCB65 /* Config.xcconfig */, + ); + path = Configuration; + sourceTree = ""; + }; + FEFF387C0A8D172AA4D59CAE /* Pods */ = { + isa = PBXGroup; + children = ( + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */, + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */, + 7555FF77242A565900829871 /* Sources */, + 7555FF79242A565900829871 /* Resources */, + F85CB1118929364A9C6EFABC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iosApp; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* My application.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = orgName; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* iosApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, + 7555FF83242A565900829871 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000000..ee7e3ca03f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..8edf56e7a9 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "app-icon-1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png new file mode 100644 index 0000000000..53fc536fb9 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png differ diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/Contents.json b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/ContentView.swift b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f7f6457b31 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + + + diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Info.plist b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Info.plist new file mode 100644 index 0000000000..9a269f5eaa --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/iOSApp.swift b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/iOSApp.swift new file mode 100644 index 0000000000..0648e8602f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/iosApp/iosApp/iOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/settings.gradle.kts b/benchmarks/ios/scroll-lazy-grid/settings.gradle.kts new file mode 100644 index 0000000000..56cae17dbc --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/settings.gradle.kts @@ -0,0 +1,36 @@ +rootProject.name = "MyApplication" + +include(":androidApp") +include(":shared") +include(":desktopApp") + +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + + id("org.jetbrains.compose").version(composeVersion) + } +} + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + } +} diff --git a/benchmarks/ios/scroll-lazy-grid/shared/build.gradle.kts b/benchmarks/ios/scroll-lazy-grid/shared/build.gradle.kts new file mode 100644 index 0000000000..8e9b6dadf9 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/shared/build.gradle.kts @@ -0,0 +1,83 @@ +plugins { + kotlin("multiplatform") + kotlin("native.cocoapods") + id("com.android.library") + id("org.jetbrains.compose") +} + +kotlin { + android() + + jvm("desktop") + + iosX64() + iosArm64() + iosSimulatorArm64() + + cocoapods { + version = "1.0.0" + summary = "Some description for the Shared Module" + homepage = "Link to the Shared Module homepage" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + framework { + baseName = "shared" + isStatic = true + } + extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + implementation(compose.components.resources) + } + } + val androidMain by getting { + dependencies { + api("androidx.activity:activity-compose:1.6.1") + api("androidx.appcompat:appcompat:1.6.1") + api("androidx.core:core-ktx:1.9.0") + } + } + val iosX64Main by getting + val iosArm64Main by getting + val iosSimulatorArm64Main by getting + val iosMain by creating { + dependsOn(commonMain) + iosX64Main.dependsOn(this) + iosArm64Main.dependsOn(this) + iosSimulatorArm64Main.dependsOn(this) + } + val desktopMain by getting { + dependencies { + implementation(compose.desktop.common) + } + } + } +} + +android { + compileSdk = (findProperty("android.compileSdk") as String).toInt() + namespace = "com.myapplication.common" + + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + sourceSets["main"].res.srcDirs("src/androidMain/res") + sourceSets["main"].resources.srcDirs("src/commonMain/resources") + + defaultConfig { + minSdk = (findProperty("android.minSdk") as String).toInt() + targetSdk = (findProperty("android.targetSdk") as String).toInt() + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlin { + jvmToolchain(11) + } +} diff --git a/benchmarks/ios/scroll-lazy-grid/shared/src/androidMain/AndroidManifest.xml b/benchmarks/ios/scroll-lazy-grid/shared/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..568741e54f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/shared/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/shared/src/androidMain/kotlin/main.android.kt b/benchmarks/ios/scroll-lazy-grid/shared/src/androidMain/kotlin/main.android.kt new file mode 100644 index 0000000000..4a1d2a6feb --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/shared/src/androidMain/kotlin/main.android.kt @@ -0,0 +1,3 @@ +import androidx.compose.runtime.Composable + +@Composable fun MainView() = App() diff --git a/benchmarks/ios/scroll-lazy-grid/shared/src/commonMain/kotlin/App.kt b/benchmarks/ios/scroll-lazy-grid/shared/src/commonMain/kotlin/App.kt new file mode 100644 index 0000000000..b89f8ca451 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/shared/src/commonMain/kotlin/App.kt @@ -0,0 +1,104 @@ +import androidx.compose.foundation.gestures.scrollBy +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items +import androidx.compose.foundation.lazy.grid.rememberLazyGridState +import androidx.compose.material.Card +import androidx.compose.material.Checkbox +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.runtime.withFrameMillis +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp + +@Composable +fun App() { + val itemCount = 12000 + val entries = remember {List(itemCount) { Entry("$it") }} + val state = rememberLazyGridState() + + var smoothScroll by remember { mutableStateOf(false)} + + MaterialTheme { + Column { + Row { + Checkbox( + checked = smoothScroll, + onCheckedChange = { value -> smoothScroll = value} + ) + Text (text = "Smooth scroll", modifier = Modifier.align(Alignment.CenterVertically)) + } + + LazyVerticalGrid( + columns = GridCells.Fixed(4), + modifier = Modifier.fillMaxWidth().semantics { contentDescription = "IamLazy" }, + state = state + ) { + items(entries) { + ListCell(it) + } + } + } + + } + + var curItem by remember { mutableStateOf(0) } + var direct by remember { mutableStateOf(true) } + if (smoothScroll) { + LaunchedEffect(Unit) { + while (smoothScroll) { + withFrameMillis { } + curItem = state.firstVisibleItemIndex + if (curItem == 0) direct = true + if (curItem > itemCount - 100) direct = false + state.scrollBy(if (direct) 5f else -5f) + } + } + } else { + LaunchedEffect(curItem) { + withFrameMillis { } + curItem += if (direct) 50 else -50 + if (curItem >= itemCount) { + direct = false + curItem = itemCount - 1 + } else if (curItem <= 0) { + direct = true + curItem = 0 + } + state.scrollToItem(curItem) + } + } + +} + +data class Entry(val contents: String) + +@Composable +private fun ListCell(entry: Entry) { + Card( + modifier = Modifier + .fillMaxWidth() + .padding(8.dp) + ) { + Text( + text = entry.contents, + textAlign = TextAlign.Center, + style = MaterialTheme.typography.h5, + modifier = Modifier.padding(16.dp) + ) + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-grid/shared/src/desktopMain/kotlin/main.desktop.kt b/benchmarks/ios/scroll-lazy-grid/shared/src/desktopMain/kotlin/main.desktop.kt new file mode 100644 index 0000000000..190ff810fd --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/shared/src/desktopMain/kotlin/main.desktop.kt @@ -0,0 +1,4 @@ +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.runtime.Composable + +@Composable fun MainView() = App() diff --git a/benchmarks/ios/scroll-lazy-grid/shared/src/iosMain/kotlin/main.ios.kt b/benchmarks/ios/scroll-lazy-grid/shared/src/iosMain/kotlin/main.ios.kt new file mode 100644 index 0000000000..fa143d45ce --- /dev/null +++ b/benchmarks/ios/scroll-lazy-grid/shared/src/iosMain/kotlin/main.ios.kt @@ -0,0 +1,3 @@ +import androidx.compose.ui.window.ComposeUIViewController + +fun MainViewController() = ComposeUIViewController { App() } \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/.gitignore b/benchmarks/ios/scroll-lazy-list/.gitignore new file mode 100644 index 0000000000..6e5f30477c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +build/ +/captures +.externalNativeBuild +.cxx +iosApp/Podfile.lock +iosApp/Pods/* +iosApp/iosApp.xcworkspace/* +iosApp/iosApp.xcodeproj/* +!iosApp/iosApp.xcodeproj/project.pbxproj +shared/shared.podspec diff --git a/benchmarks/ios/scroll-lazy-list/.run/desktopApp.run.xml b/benchmarks/ios/scroll-lazy-list/.run/desktopApp.run.xml new file mode 100644 index 0000000000..54bb5c1c5a --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/.run/desktopApp.run.xml @@ -0,0 +1,24 @@ + + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/LICENSE.txt b/benchmarks/ios/scroll-lazy-list/LICENSE.txt new file mode 100644 index 0000000000..244380c242 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020-2021 JetBrains s.r.o. and and respective authors and developers. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/benchmarks/ios/scroll-lazy-list/README.md b/benchmarks/ios/scroll-lazy-list/README.md new file mode 100644 index 0000000000..713e51556c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/README.md @@ -0,0 +1,3 @@ +A benchmark app extracted from the sample described in this issue: https://github.com/JetBrains/compose-multiplatform/issues/2283 + +In general it is a lazy list with some complex content that automaticall scrolls. \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/build.gradle.kts b/benchmarks/ios/scroll-lazy-list/androidApp/build.gradle.kts new file mode 100644 index 0000000000..b86596b317 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + kotlin("multiplatform") + id("com.android.application") + id("org.jetbrains.compose") +} + +kotlin { + android() + sourceSets { + val androidMain by getting { + dependencies { + implementation(project(":shared")) + } + } + } +} + +android { + compileSdk = (findProperty("android.compileSdk") as String).toInt() + namespace = "com.myapplication" + + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + + defaultConfig { + applicationId = "com.myapplication.MyApplication" + minSdk = (findProperty("android.minSdk") as String).toInt() + targetSdk = (findProperty("android.targetSdk") as String).toInt() + versionCode = 1 + versionName = "1.0" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlin { + jvmToolchain(11) + } +} diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/AndroidManifest.xml b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..bc7e861696 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt new file mode 100644 index 0000000000..fd6e831ceb --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/kotlin/com/myapplication/MainActivity.kt @@ -0,0 +1,16 @@ +package com.myapplication + +import MainView +import android.os.Bundle +import androidx.activity.compose.setContent +import androidx.appcompat.app.AppCompatActivity + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + MainView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000..2b068d1146 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..07d5da9cbf --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000..eca70cfe52 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..a571e60098 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000..61da551c55 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..c41dd28531 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000..db5080a752 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..6dba46dab1 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..da31a871c8 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..15ac681720 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..b216f2d313 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..f25a419744 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..e96783ccce Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/values/strings.xml b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/values/strings.xml new file mode 100644 index 0000000000..592270bf53 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/androidApp/src/androidMain/res/values/strings.xml @@ -0,0 +1,3 @@ + + My application + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/build.gradle.kts b/benchmarks/ios/scroll-lazy-list/build.gradle.kts new file mode 100644 index 0000000000..b7e1d5d26a --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + // this is necessary to avoid the plugins to be loaded multiple times + // in each subproject's classloader + kotlin("multiplatform").apply(false) + id("com.android.application").apply(false) + id("com.android.library").apply(false) + id("org.jetbrains.compose").apply(false) +} diff --git a/benchmarks/ios/scroll-lazy-list/cleanup.sh b/benchmarks/ios/scroll-lazy-list/cleanup.sh new file mode 100755 index 0000000000..62f9391b86 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/cleanup.sh @@ -0,0 +1,10 @@ +#!/bin/sh +rm -rf .idea +./gradlew clean +rm -rf .gradle +rm -rf build +rm -rf */build +rm -rf iosApp/iosApp.xcworkspace +rm -rf iosApp/Pods +rm -rf iosApp/iosApp.xcodeproj/project.xcworkspace +rm -rf iosApp/iosApp.xcodeproj/xcuserdata diff --git a/benchmarks/ios/scroll-lazy-list/desktopApp/build.gradle.kts b/benchmarks/ios/scroll-lazy-list/desktopApp/build.gradle.kts new file mode 100644 index 0000000000..931f3467a2 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/desktopApp/build.gradle.kts @@ -0,0 +1,30 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat + +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + jvm() + sourceSets { + val jvmMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + implementation(project(":shared")) + } + } + } +} + +compose.desktop { + application { + mainClass = "MainKt" + + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "KotlinMultiplatformComposeDesktopApplication" + packageVersion = "1.0.0" + } + } +} diff --git a/benchmarks/ios/scroll-lazy-list/desktopApp/src/jvmMain/kotlin/main.kt b/benchmarks/ios/scroll-lazy-list/desktopApp/src/jvmMain/kotlin/main.kt new file mode 100644 index 0000000000..5ffada98e1 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/desktopApp/src/jvmMain/kotlin/main.kt @@ -0,0 +1,8 @@ +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application + +fun main() = application { + Window(onCloseRequest = ::exitApplication) { + MainView() + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/desktopMain/kotlin/main.desktop.kt b/benchmarks/ios/scroll-lazy-list/desktopMain/kotlin/main.desktop.kt new file mode 100644 index 0000000000..5f23de7dd9 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/desktopMain/kotlin/main.desktop.kt @@ -0,0 +1,12 @@ +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.runtime.Composable + +actual fun getPlatformName(): String = "Desktop" + +@Composable fun MainView() = App() + +@Preview +@Composable +fun AppPreview() { + App() +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/gradle.properties b/benchmarks/ios/scroll-lazy-list/gradle.properties new file mode 100644 index 0000000000..2fa452fa94 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/gradle.properties @@ -0,0 +1,25 @@ +#Gradle +org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" + +#Kotlin +kotlin.code.style=official + +#MPP +kotlin.mpp.stability.nowarn=true +kotlin.mpp.enableCInteropCommonization=true +kotlin.mpp.androidSourceSetLayoutVersion=2 + +#Compose +org.jetbrains.compose.experimental.uikit.enabled=true +kotlin.native.cacheKind=none + +#Android +android.useAndroidX=true +android.compileSdk=33 +android.targetSdk=33 +android.minSdk=24 + +#Versions +kotlin.version=1.8.20 +agp.version=7.4.2 +compose.version=1.4.0 \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/gradle/wrapper/gradle-wrapper.jar b/benchmarks/ios/scroll-lazy-list/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..249e5832f0 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/gradle/wrapper/gradle-wrapper.jar differ diff --git a/benchmarks/ios/scroll-lazy-list/gradle/wrapper/gradle-wrapper.properties b/benchmarks/ios/scroll-lazy-list/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..e1bef7e873 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/benchmarks/ios/scroll-lazy-list/gradlew b/benchmarks/ios/scroll-lazy-list/gradlew new file mode 100755 index 0000000000..a69d9cb6c2 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/benchmarks/ios/scroll-lazy-list/gradlew.bat b/benchmarks/ios/scroll-lazy-list/gradlew.bat new file mode 100644 index 0000000000..f127cfd49d --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/Configuration/Config.xcconfig b/benchmarks/ios/scroll-lazy-list/iosApp/Configuration/Config.xcconfig new file mode 100644 index 0000000000..f391597827 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/Configuration/Config.xcconfig @@ -0,0 +1,3 @@ +TEAM_ID= +BUNDLE_ID=com.myapplication.MyApplication +APP_NAME=My application diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/Podfile b/benchmarks/ios/scroll-lazy-list/iosApp/Podfile new file mode 100644 index 0000000000..aff9c517b2 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/Podfile @@ -0,0 +1,5 @@ +target 'iosApp' do + use_frameworks! + platform :ios, '14.1' + pod 'shared', :path => '../shared' +end \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp.xcodeproj/project.pbxproj b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..c888c0443c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,400 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF7B242A565900829871 /* My application.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My application.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F85CB1118929364A9C6EFABC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 058557D7273AAEEB004C7B11 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 42799AB246E5F90AF97AA0EF /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + AB1DB47929225F7C00F7AF9C /* Configuration */, + 7555FF7D242A565900829871 /* iosApp */, + 7555FF7C242A565900829871 /* Products */, + FEFF387C0A8D172AA4D59CAE /* Pods */, + 42799AB246E5F90AF97AA0EF /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* My application.app */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 058557BA273AAA24004C7B11 /* Assets.xcassets */, + 7555FF82242A565900829871 /* ContentView.swift */, + 7555FF8C242A565B00829871 /* Info.plist */, + 2152FB032600AC8F00CF470E /* iOSApp.swift */, + 058557D7273AAEEB004C7B11 /* Preview Content */, + ); + path = iosApp; + sourceTree = ""; + }; + AB1DB47929225F7C00F7AF9C /* Configuration */ = { + isa = PBXGroup; + children = ( + AB3632DC29227652001CCB65 /* Config.xcconfig */, + ); + path = Configuration; + sourceTree = ""; + }; + FEFF387C0A8D172AA4D59CAE /* Pods */ = { + isa = PBXGroup; + children = ( + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */, + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */, + 7555FF77242A565900829871 /* Sources */, + 7555FF79242A565900829871 /* Resources */, + F85CB1118929364A9C6EFABC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iosApp; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* My application.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = orgName; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* iosApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, + 7555FF83242A565900829871 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000000..ee7e3ca03f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..8edf56e7a9 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "app-icon-1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png new file mode 100644 index 0000000000..53fc536fb9 Binary files /dev/null and b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png differ diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/Contents.json b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/ContentView.swift b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f7f6457b31 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + + + diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Info.plist b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Info.plist new file mode 100644 index 0000000000..9a269f5eaa --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/iOSApp.swift b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/iOSApp.swift new file mode 100644 index 0000000000..0648e8602f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/iosApp/iosApp/iOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/settings.gradle.kts b/benchmarks/ios/scroll-lazy-list/settings.gradle.kts new file mode 100644 index 0000000000..2e81b6fa9e --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/settings.gradle.kts @@ -0,0 +1,38 @@ +rootProject.name = "My application" + +include(":androidApp") +include(":shared") +include(":desktopApp") + +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + mavenLocal() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + + id("org.jetbrains.compose").version(composeVersion) + } +} + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + mavenLocal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + } +} diff --git a/benchmarks/ios/scroll-lazy-list/shared/build.gradle.kts b/benchmarks/ios/scroll-lazy-list/shared/build.gradle.kts new file mode 100644 index 0000000000..ad37527fd4 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/build.gradle.kts @@ -0,0 +1,91 @@ +plugins { + kotlin("multiplatform") + kotlin("native.cocoapods") + id("com.android.library") + id("org.jetbrains.compose") +} + +kotlin { + android() + + jvm("desktop") + + iosX64() + iosArm64() + iosSimulatorArm64() + + cocoapods { + version = "1.0.0" + summary = "Some description for the Shared Module" + homepage = "Link to the Shared Module homepage" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + framework { + baseName = "shared" + isStatic = true + } + extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + implementation(compose.components.resources) + } + } + val androidMain by getting { + dependencies { + api("androidx.activity:activity-compose:1.6.1") + api("androidx.appcompat:appcompat:1.6.1") + api("androidx.core:core-ktx:1.9.0") + } + } + val iosX64Main by getting + val iosArm64Main by getting + val iosSimulatorArm64Main by getting + val iosMain by creating { + dependsOn(commonMain) + iosX64Main.dependsOn(this) + iosArm64Main.dependsOn(this) + iosSimulatorArm64Main.dependsOn(this) + } + val desktopMain by getting { + dependencies { + implementation(compose.desktop.common) + } + } + } +} + +android { + compileSdk = (findProperty("android.compileSdk") as String).toInt() + namespace = "com.myapplication.common" + + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + sourceSets["main"].res.srcDirs("src/androidMain/res") + sourceSets["main"].resources.srcDirs("src/commonMain/resources") + + defaultConfig { + minSdk = (findProperty("android.minSdk") as String).toInt() + targetSdk = (findProperty("android.targetSdk") as String).toInt() + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlin { + jvmToolchain(11) +// targets.withType { +// binaries.all { +// freeCompilerArgs += listOf("-Xdisable-phases=VerifyBitcode", +// "-Xgc=noop" +// ) +// } +// } + } + +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/AndroidManifest.xml b/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..568741e54f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/kotlin/listsample/models/FakeItem.kt b/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/kotlin/listsample/models/FakeItem.kt new file mode 100644 index 0000000000..5b6f47f957 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/kotlin/listsample/models/FakeItem.kt @@ -0,0 +1,30 @@ +package listsample.models + +import android.os.Parcel +import android.os.Parcelable + +actual fun createFakeItem(): ICompositionModel = AndroidFakeItem() + +class AndroidFakeItem() : FakeItem(), Parcelable { + constructor(parcel: Parcel) : this() { + } + + override fun writeToParcel(parcel: Parcel, flags: Int) { + + } + + override fun describeContents(): Int { + return 0 + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): AndroidFakeItem { + return AndroidFakeItem(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } + +} diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/kotlin/main.android.kt b/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/kotlin/main.android.kt new file mode 100644 index 0000000000..4a1d2a6feb --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/androidMain/kotlin/main.android.kt @@ -0,0 +1,3 @@ +import androidx.compose.runtime.Composable + +@Composable fun MainView() = App() diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/App.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/App.kt new file mode 100644 index 0000000000..0d17ee9d67 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/App.kt @@ -0,0 +1,8 @@ +import androidx.compose.runtime.Composable + +import listsample.components.MainUiNoImageUseModel + +@Composable +fun App() { + MainUiNoImageUseModel() +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/MainUI.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/MainUI.kt new file mode 100644 index 0000000000..1305cb0658 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/MainUI.kt @@ -0,0 +1,113 @@ +package listsample.components + +import androidx.compose.foundation.gestures.scrollBy +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material.MaterialTheme +import androidx.compose.runtime.* +import listsample.components.refresh.* +import listsample.models.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import listsample.components.refresh.LOADING_MORE +import listsample.components.refresh.LoadingIndicatorDefault +import listsample.components.refresh.NORMAL +import listsample.components.refresh.REFRESHING +import listsample.components.refresh.SwipeRefreshLayout +import listsample.components.refresh.rememberSwipeRefreshState +import listsample.models.IBaseViewModel +import listsample.models.ICompositionModel +import listsample.models.fetchCompositionModels + +// just for demo +internal var models: MutableList = mutableStateListOf() + +@Composable +fun MainUiNoImageUseModel() { + MaterialTheme { + MainLazyColumnItemsList(noImage = true, useJson = false) + DisposableEffect(Unit) { + onDispose { + models.clear() + } + } + } +} + +@Composable +fun MainLazyColumnItemsList(noImage: Boolean, useJson: Boolean) { + val scope = rememberCoroutineScope() + val state = rememberSwipeRefreshState(NORMAL) + + LaunchedEffect(scope) { + scope.launch(Dispatchers.Default) { + fetchCompositionModels(false) { list -> + for (item in list) + models.add(item) + } + } + } + + SwipeRefreshLayout( + state = state, + indicator = { modifier, s, indicatorHeight -> + LoadingIndicatorDefault(modifier, s, indicatorHeight) + }, + onRefresh = { + scope.launch { + state.loadState = REFRESHING + delay(2000) + fetchCompositionModels(useJson) { + models.clear() + for (item in it) + models.add(item) + state.loadState = NORMAL + } + } + + }, + onLoadMore = { + scope.launch { + state.loadState = LOADING_MORE + delay(2000L) + fetchCompositionModels(useJson) { + for (item in it) + models.add(item) + state.loadState = NORMAL + } + } + } + ) { modifier -> + run { + val state = rememberLazyListState() + LaunchedEffect(Unit) { + while (true) { + withFrameMillis { } + state.scrollBy(20f) + } + } + LazyColumn(modifier, state = state) { + itemsIndexed( + items = models, + key = { index, _ -> + models[index] + } + ) { _, item -> + when (item) { + is ICompositionModel -> MultiCellUI(item) + // .. todo need more types + else -> throw RuntimeException("Unexpected") + } + } + } + } + } +} + +@Composable +fun MultiCellUI(item: IBaseViewModel) { + DecoratedCell(item) +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/MultiLevelCell.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/MultiLevelCell.kt new file mode 100644 index 0000000000..228017f374 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/MultiLevelCell.kt @@ -0,0 +1,351 @@ +package listsample.components + +import androidx.compose.animation.core.animate +import androidx.compose.animation.core.animateDpAsState +import androidx.compose.animation.core.tween +import androidx.compose.foundation.* +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.MaterialTheme.typography +import androidx.compose.material.Text +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.scale +import androidx.compose.ui.draw.shadow +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.painter.ColorPainter +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import listsample.models.IBaseViewModel +import listsample.models.ICompositionItem +import listsample.models.ICompositionModel +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch + +@Composable +internal fun DecoratedCell(model: IBaseViewModel) { + Column( + modifier = Modifier + .fillMaxWidth() + .border(1.dp, Color.LightGray, RoundedCornerShape(4.dp)) + .background( + brush = Brush.linearGradient( + colors = listOf( + Color.LightGray.copy(1f), + Color.LightGray.copy(0.5f), + Color.LightGray.copy(0f) + ), + start = Offset(320f, 0f), + end = Offset(320f, 164f) + ) + ), + verticalArrangement = Arrangement.spacedBy((-60).dp) + ) { + CompositionView(model) + Box( + modifier = Modifier.fillMaxWidth() + .heightIn(164.dp), + contentAlignment = Alignment.BottomCenter, + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .heightIn(64.dp) + .padding(8.dp) + .border(1.dp, Color.Cyan.copy(0.3f), RoundedCornerShape(4.dp)) + .padding(8.dp) + .background(color = Color.Cyan.copy(alpha = 0.1f)) + ) { + + Avatar( + modifier = Modifier + .padding(4.dp) + .align(Alignment.CenterVertically) + ) + + TextInfo( + Modifier + .weight(1f) + .align(Alignment.CenterVertically) + ) + + FollowBtn( + Modifier.align(Alignment.CenterVertically) + ) + } + } + } +} + +@Composable +internal fun CompositionView(model: IBaseViewModel) { + if (model !is ICompositionModel) + return + Box( + modifier = Modifier.clip(RoundedCornerShape(10.dp)).background(Color.White).padding(10.dp) + ) { + model.overlyTopLeft?.let { overlyTopLeft(it) } + model.overlyView1?.let { overlyView1(it) } + model.overlyView2?.let { overlyView2(it) } + model.overlyView3?.let { overlyView3(it) } + model.overlyTopRight?.let { overlyTopRight(it) } + model.label?.let { overlyLabel(it) } + } +} + +@Composable +internal fun overlyTopLeft(compositionItem: ICompositionItem) { + compositionItem.bgColor?.let { Color.DarkGray }?.let { ColorPainter(it) }?.let { + compositionItem.alpha?.toFloat()?.let { it1 -> + compositionItem.radius?.toFloat()?.let { RoundedCornerShape(it.dp) }?.let { it2 -> + Modifier + .padding(start = 0.dp, top = 0.dp) + .width(50.dp) + .height(50.dp) + .alpha(it1) + .clip(shape = it2) + .shadow(3.dp) + } + }?.let { it2 -> + Image( + painter = it, + modifier = it2, + contentDescription = null + ) + } + } +} + +@Composable +internal fun overlyView1(compositionItem: ICompositionItem) { + compositionItem.bgColor?.let { Color.Red }?.let { ColorPainter(it) }?.let { + compositionItem.alpha?.toFloat()?.let { it1 -> + compositionItem.radius?.toFloat()?.let { RoundedCornerShape(it.dp) }?.let { it2 -> + Modifier + .padding(start = 20.dp, top = 20.dp) + .width(150.dp) + .height(100.dp) + .alpha(it1) + .clip(shape = it2) + .shadow(3.dp) + } + }?.let { it2 -> + Image( + painter = it, + modifier = it2, + contentDescription = null + ) + } + } +} + +@Composable +internal fun overlyView2(compositionItem: ICompositionItem) { + compositionItem.bgColor?.let { Color.Yellow }?.let { ColorPainter(it) }?.let { + compositionItem.alpha?.toFloat()?.let { it1 -> + compositionItem.radius?.toFloat()?.let { RoundedCornerShape(it.dp) }?.let { it2 -> + Modifier + .padding(start = 100.dp, top = 50.dp) + .width(150.dp) + .height(100.dp) + .alpha(it1) + .clip(shape = it2) + .shadow(3.dp) + } + }?.let { it2 -> + Image( + painter = it, + modifier = it2, + contentDescription = null + ) + } + } +} + +@Composable +internal fun overlyView3(compositionItem: ICompositionItem) { + compositionItem.bgColor?.let { Color.Green }?.let { ColorPainter(it) }?.let { + compositionItem.alpha?.toFloat()?.let { it1 -> + compositionItem.radius?.toFloat()?.let { RoundedCornerShape(it.dp) }?.let { it2 -> + Modifier + .padding(start = 110.dp, top = 60.dp) + .width(130.dp) + .height(80.dp) + .alpha(it1) + .clip(shape = it2) + .shadow(3.dp) + } + }?.let { it2 -> + Image( + painter = it, + modifier = it2, + contentDescription = null + ) + } + } +} + +@Composable +internal fun overlyTopRight(compositionItem: ICompositionItem) { + compositionItem.bgColor?.let { Color.LightGray }?.let { ColorPainter(it) }?.let { + compositionItem.alpha?.toFloat()?.let { it1 -> + compositionItem.radius?.toFloat()?.let { RoundedCornerShape(it.dp) }?.let { it2 -> + Modifier + .padding(start = 160.dp, top = 15.dp) + .width(90.dp) + .height(60.dp) + .alpha(it1) + .clip(shape = it2) + .shadow(3.dp) + } + }?.let { it2 -> + Image( + painter = it, + modifier = it2, + contentDescription = null + ) + } + } +} + +@Composable +internal fun overlyLabel(compositionItem: ICompositionItem) { + Box(modifier = Modifier.fillMaxSize().padding(), contentAlignment = Alignment.TopCenter) { + compositionItem.text?.let { + Text( + text = it, + modifier = Modifier.background(Color.Black.copy(0.5f)).alpha(0.5f) + .padding(start = 10.dp, end = 10.dp).width(200.dp).height(100.dp), + color = Color.Cyan + ) + } + } +} + +@Composable +internal fun Avatar(modifier: Modifier) { + Image( + modifier = modifier + .size(50.dp) + .clip(CircleShape) + .border( + shape = CircleShape, + border = BorderStroke( + width = 2.dp, + brush = Brush.linearGradient( + colors = listOf(Color.Blue, Color.Yellow, Color.Green, Color.Red), + start = Offset(0f, 0f), + end = Offset(100f, 100f) + ) + ) + ) + .border( + shape = CircleShape, + border = BorderStroke(4.dp, SolidColor(Color.White)) + ), + painter = ColorPainter(color = Color.Gray), + contentDescription = null, // decorative + ) +} + +@Composable +internal fun TextInfo(modifier: Modifier) { + Column(modifier = modifier) { + Text( + text = "name", + color = Color.Black, + maxLines = 1, + style = TextStyle( + fontWeight = FontWeight.Bold, + fontSize = 16.sp, + letterSpacing = 0.15.sp + ) + ) + Text( + text = "desc", + color = Color.Black.copy(alpha = 0.75f), + maxLines = 1, + style = TextStyle( // here + fontWeight = FontWeight.Normal, + fontSize = 14.sp, + letterSpacing = 0.25.sp + ) + ) + } +} + +@Composable +internal fun FollowBtn(modifier: Modifier) { + var checked by remember { mutableStateOf(false) } + val backgroundShape: Shape = remember { RoundedCornerShape(4.dp) } + var clickCount by remember { mutableStateOf(1) } + val offsetX by animateDpAsState( + if (checked) (-80).dp else (-10).dp, + animationSpec = tween(durationMillis = 3000) + ) + + var alpha by remember { mutableStateOf(1f) } + var scale by remember { mutableStateOf(1f) } + val scope = rememberCoroutineScope() + Row( + horizontalArrangement = Arrangement.spacedBy(10.dp), + verticalAlignment = Alignment.CenterVertically, + modifier = modifier.offset(x = offsetX), + ) { + Text( + text = if (checked) "unfollow" else "follow", + style = typography.body1.copy(color = Color.White), + textAlign = TextAlign.Center, + modifier = modifier + .width(100.dp) + .clickable(onClick = { + clickCount++ + checked = !checked + scope.launch { + coroutineScope { + launch { + animate(1f, 0.5f) { value, _ -> alpha = value } + } + launch { + animate(1f, 0.5f) { value, _ -> scale = value } + } + } + coroutineScope { + launch { + animate(0.5f, 1f) { value, _ -> alpha = value } + } + launch { + animate(0.5f, 1f) { value, _ -> scale = value } + } + } + } + }) + .shadow(5.dp, shape = backgroundShape) + .clip(backgroundShape) + .background( + brush = Brush.verticalGradient( + colors = listOf( + Color.Red, + Color.Yellow, + ), + startY = 0f, + endY = 80f + ) + ) + .padding(6.dp) + .scale(scale) + .alpha(alpha) + ) + } +} diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/LoadingIndicator.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/LoadingIndicator.kt new file mode 100644 index 0000000000..dca5d7c48c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/LoadingIndicator.kt @@ -0,0 +1,159 @@ +package listsample.components.refresh + +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.core.LinearEasing +import androidx.compose.animation.core.RepeatMode +import androidx.compose.animation.core.animate +import androidx.compose.animation.core.infiniteRepeatable +import androidx.compose.animation.core.tween +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.foundation.Canvas +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxScope +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.rotate +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.graphics.drawscope.Stroke +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.max + +@Composable +internal fun BoxScope.LoadingIndicatorDefault( + modifier: Modifier, + state: SwipeRefreshState, + indicatorHeight: Dp +) { + val height = max(30.dp, with(LocalDensity.current) { + state.progress.offset.toDp() + }) + var prev by remember { mutableStateOf(Offset(0f, 0f)) } + var prevOffsetAngle by remember { mutableStateOf(0f) } + var offsetAngle by remember { mutableStateOf(0f) } + var startAngle by remember { mutableStateOf(prev.x) } + var endAngle by remember { mutableStateOf(prev.y) } + + LaunchedEffect(state.loadState == REFRESHING || state.loadState == LOADING_MORE) { + if (!(state.loadState == REFRESHING || state.loadState == LOADING_MORE)) { + prevOffsetAngle = offsetAngle + return@LaunchedEffect + } + animate( + initialValue = prevOffsetAngle, + targetValue = prevOffsetAngle + 360f, + animationSpec = infiniteRepeatable( + animation = tween(5000, easing = LinearEasing), + repeatMode = RepeatMode.Restart + ) + ) { value, _ -> + offsetAngle = value + } + } + + LaunchedEffect(state.loadState == REFRESHING || state.loadState == LOADING_MORE, endAngle) { + if (!(state.loadState == REFRESHING || state.loadState == LOADING_MORE)) return@LaunchedEffect + if ((endAngle - startAngle).toInt() == 270) { + animate( + initialValue = startAngle, + targetValue = endAngle - 10f, + animationSpec = tween(durationMillis = 700) + ) { value, _ -> + startAngle = value + } + } + } + + LaunchedEffect(state.loadState == REFRESHING || state.loadState == LOADING_MORE, startAngle) { + if (!(state.loadState == REFRESHING || state.loadState == LOADING_MORE)) if (!(state.loadState == REFRESHING || state.loadState == LOADING_MORE)) { + prev = Offset(startAngle, endAngle) + return@LaunchedEffect + } + if ((endAngle - startAngle).toInt() == 10 + || endAngle.toInt() == prev.y.toInt() + ) { + animate( + initialValue = endAngle, + targetValue = startAngle + 270f, + animationSpec = tween(durationMillis = 700), + ) { value, _ -> + endAngle = value + } + } + } + + Box( + modifier + .fillMaxWidth() + .height(height), contentAlignment = Alignment.Center + ) { + if (state.isSwipeInProgress) { + if (state.progress.offset <= with(LocalDensity.current) { indicatorHeight.toPx() }) { + Text(text = if (state.progress.location == TOP) "下拉刷新" else "上拉加载更多") + } else { + Text(text = if (state.progress.location == TOP) "松开刷新" else "松开加载更多") + } + } else { + AnimatedVisibility( + visible = state.loadState == REFRESHING || state.loadState == LOADING_MORE, + modifier = Modifier.align(Alignment.Center), + enter = fadeIn(), + exit = fadeOut() + ) { + Row( + modifier = Modifier + .align(alignment = Alignment.Center), + horizontalArrangement = Arrangement.SpaceEvenly + ) { + Box( + modifier = Modifier + .padding(10.dp) + .height(20.dp).width(20.dp) + .aspectRatio(1f) + .rotate(offsetAngle) + ) { + Canvas( + modifier = Modifier.height(20.dp).width(20.dp) + ) { + drawArc( + color = Color.Gray, + startAngle = startAngle, + sweepAngle = endAngle - startAngle, + useCenter = false, + style = Stroke(width = 5f, cap = StrokeCap.Round) + ) + } + } + + Text( + modifier = Modifier.padding(10.dp), + text = "Loading...", + color = Color.Gray, + fontWeight = FontWeight.W500, + textAlign = TextAlign.Center + ) + } + } + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeProgress.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeProgress.kt new file mode 100644 index 0000000000..28c8294a92 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeProgress.kt @@ -0,0 +1,17 @@ +package listsample.components.refresh + +import androidx.compose.runtime.Immutable + +internal const val NONE = 0 + +internal const val TOP = 1 + +internal const val BOTTOM = 2 + +@Immutable +internal data class SwipeProgress( + val location: Int = NONE, + val offset: Float = 0f, + /*@FloatRange(from = 0.0, to = 1.0)*/ + val fraction: Float = 0f +) diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshLayout.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshLayout.kt new file mode 100644 index 0000000000..e60c81525f --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshLayout.kt @@ -0,0 +1,121 @@ +package listsample.components.refresh + +import androidx.compose.animation.core.animate +import androidx.compose.animation.core.tween +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxScope +import androidx.compose.foundation.layout.BoxWithConstraints +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.rememberUpdatedState +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import kotlin.math.min + +@Composable +internal fun SwipeRefreshLayout( + state: SwipeRefreshState, + onRefresh: () -> Unit, + onLoadMore: () -> Unit, + modifier: Modifier = Modifier, + refreshTriggerDistance: Dp = 120.dp, + indicationHeight: Dp = 60.dp, + refreshEnabled: Boolean = true, + loadMoreEnabled: Boolean = true, + indicator: @Composable BoxScope.(modifier: Modifier, state: SwipeRefreshState, indicatorHeight: Dp) -> Unit = { m, s, height -> + LoadingIndicatorDefault(m, s, height) + }, + content: @Composable (modifier: Modifier) -> Unit, +) { + val refreshTriggerPx = with(LocalDensity.current) { refreshTriggerDistance.toPx() } + val indicationHeightPx = with(LocalDensity.current) { indicationHeight.toPx() } + + // Our LaunchedEffect, which animates the indicator to its resting position + LaunchedEffect(state.isSwipeInProgress) { + if (!state.isSwipeInProgress) { + // If there's not a swipe in progress, rest the indicator at 0f + state.animateOffsetTo(0f) + } + } + + val coroutineScope = rememberCoroutineScope() + val updatedOnRefresh = rememberUpdatedState(onRefresh) + val updatedOnLoadMore = rememberUpdatedState(onLoadMore) + + val nestedScrollConnection = remember(state, coroutineScope) { + SwipeRefreshNestedScrollConnection( + state, + coroutineScope, + onRefresh = { updatedOnRefresh.value.invoke() }, + onLoadMore = { updatedOnLoadMore.value.invoke() } + ) + }.apply { + this.refreshEnabled = refreshEnabled + this.loadMoreEnabled = loadMoreEnabled + this.refreshTrigger = refreshTriggerPx + this.indicatorHeight = indicationHeightPx + } + + BoxWithConstraints(modifier.nestedScroll(connection = nestedScrollConnection)) { + if (!state.isSwipeInProgress) + LaunchedEffect((state.loadState == REFRESHING || state.loadState == LOADING_MORE)) { + animate( + animationSpec = tween(durationMillis = 300), + initialValue = state.progress.offset, + targetValue = when (state.loadState) { + LOADING_MORE -> indicationHeightPx + REFRESHING -> indicationHeightPx + else -> 0f + } + ) { value, _ -> + if (!state.isSwipeInProgress) { + state.progress = state.progress.copy( + offset = value, + fraction = min(1f, value / refreshTriggerPx) + ) + } + } + } + + val offsetDp = with(LocalDensity.current) { + state.progress.offset.toDp() + } + content( + when (state.progress.location) { + TOP -> Modifier.padding(top = offsetDp) + BOTTOM -> Modifier.padding(bottom = offsetDp) + else -> Modifier + } + ) + if (state.progress.location != NONE) { + Box(modifier = Modifier + .fillMaxWidth() + .height(refreshTriggerDistance) + .graphicsLayer { + translationY = + if (state.progress.location == LOADING_MORE) constraints.maxHeight - state.progress.offset + else state.progress.offset - refreshTriggerPx + } + ) { + indicator( + Modifier.align(if (state.progress.location == TOP) Alignment.BottomStart else Alignment.TopStart), + state, + indicationHeight + ) + } + } + } +} + +@Composable +internal fun rememberSwipeRefreshState(state: Int) = remember { SwipeRefreshState(state) } \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshNestedScrollConnection.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshNestedScrollConnection.kt new file mode 100644 index 0000000000..f00b0858c1 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshNestedScrollConnection.kt @@ -0,0 +1,134 @@ +package listsample.components.refresh + +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.input.nestedscroll.NestedScrollConnection +import androidx.compose.ui.input.nestedscroll.NestedScrollSource +import androidx.compose.ui.unit.Velocity +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch +import kotlin.math.abs +import kotlin.math.absoluteValue +import kotlin.math.roundToInt + +internal class SwipeRefreshNestedScrollConnection( + private val state: SwipeRefreshState, + private val coroutineScope: CoroutineScope, + private val onRefresh: () -> Unit, + private val onLoadMore: () -> Unit +) : NestedScrollConnection { + var refreshEnabled: Boolean = false + var loadMoreEnabled: Boolean = false + var refreshTrigger: Float = 100f + var indicatorHeight: Float = 50f + + private var isTop = false + private var isBottom = false + + override fun onPreScroll( + available: Offset, + source: NestedScrollSource + ): Offset = when { + !refreshEnabled && !loadMoreEnabled -> Offset.Zero + state.loadState != NORMAL -> Offset.Zero + source == NestedScrollSource.Drag -> { + if (available.y > 0 && isBottom) { + onScroll(available) + } else if (available.y < 0 && isTop) { + onScroll(available) + } else { + Offset.Zero + } + } + else -> Offset.Zero + } + + override fun onPostScroll( + consumed: Offset, + available: Offset, + source: NestedScrollSource + ): Offset { + + if (!refreshEnabled && !loadMoreEnabled) { + return Offset.Zero + } + + else if (state.loadState != NORMAL) { + return Offset.Zero + } else if (source == NestedScrollSource.Drag) { + if (available.y < 0) { + if (!isBottom) { + isBottom = true + } + if (isBottom) { + return onScroll(available) + } + + } else if (available.y > 0) { + if (!isTop) { + isTop = true + } + if (isTop) { + return onScroll(available) + } + } + } + return Offset.Zero + } + + private fun onScroll(available: Offset): Offset { + if (!isBottom && !isTop) { + return Offset.Zero + } + if (available.y > 0 && isTop) { + state.isSwipeInProgress = true + } else if (available.y < 0 && isBottom) { + state.isSwipeInProgress = true + } else if (state.indicatorOffset.roundToInt() == 0) { + state.isSwipeInProgress = false + } + + val newOffset = (available.y + state.indicatorOffset).let { + if (isTop) it.coerceAtLeast(0.0F) else it.coerceAtMost(0.0F) + } + val dragConsumed = newOffset - state.indicatorOffset + + return if (dragConsumed.absoluteValue >= 0.5f) { + coroutineScope.launch { + state.dispatchScrollDelta( + dragConsumed, + if (isTop) TOP else BOTTOM, + refreshTrigger, + ) + } + // Return the consumed Y + Offset(x = 0f, y = dragConsumed) + } else { + Offset.Zero + } + } + + override suspend fun onPreFling(available: Velocity): Velocity { + // If we're dragging, not currently refreshing and scrolled + // past the trigger point, refresh! + if (state.loadState == NORMAL && abs(state.indicatorOffset) >= indicatorHeight) { + if (isTop) { + onRefresh() + } else if (isBottom) { + onLoadMore() + } + } + + // Reset the drag in progress state + state.isSwipeInProgress = false + + // Don't consume any velocity, to allow the scrolling layout to fling + return Velocity.Zero + } + + override suspend fun onPostFling(consumed: Velocity, available: Velocity): Velocity { + return Velocity.Zero.also { + isTop = false + isBottom = false + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshState.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshState.kt new file mode 100644 index 0000000000..f4bb7fb24d --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/components/refresh/SwipeRefreshState.kt @@ -0,0 +1,79 @@ +package listsample.components.refresh + +import androidx.compose.animation.core.Animatable +import androidx.compose.foundation.MutatePriority +import androidx.compose.foundation.MutatorMutex +import androidx.compose.runtime.Stable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import kotlin.math.abs +import kotlin.math.min + +internal const val NORMAL = 0 + + +internal const val REFRESHING = 1 + + +internal const val LOADING_MORE = 2 + +@Stable +internal class SwipeRefreshState( + loadState: Int, +) { + private val _indicatorOffset = Animatable(0f) + private val mutatorMutex = MutatorMutex() + + var loadState: Int by mutableStateOf(loadState) + + /** + * Whether a swipe/drag is currently in progress. + */ + var isSwipeInProgress: Boolean by mutableStateOf(false) + internal set + + var progress: SwipeProgress by mutableStateOf(SwipeProgress()) + internal set + + /** + * The current offset for the indicator, in pixels. + */ + internal val indicatorOffset: Float get() = _indicatorOffset.value + + internal suspend fun animateOffsetTo( + offset: Float, + ) { + mutatorMutex.mutate { + _indicatorOffset.animateTo(offset) + } + } + + /** + * Dispatch scroll delta in pixels from touch events. + */ + internal suspend fun dispatchScrollDelta( + delta: Float, + location: Int, + maxOffsetY: Float, + ) { + mutatorMutex.mutate(MutatePriority.UserInput) { + _indicatorOffset.snapTo((_indicatorOffset.value + delta).toFloat()) + updateProgress( + location = location, + maxOffsetY = maxOffsetY, + ) + } + } + + private fun updateProgress( + offsetY: Float = abs(indicatorOffset), + location: Int, + maxOffsetY: Float, + ) { + val offsetPercent = min(1f, offsetY / maxOffsetY) + + val offset = min(maxOffsetY, offsetY) + progress = SwipeProgress(location, offset, offsetPercent) + } +} diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/FollowItem.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/FollowItem.kt new file mode 100644 index 0000000000..d159376d61 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/FollowItem.kt @@ -0,0 +1,16 @@ +package listsample.models + +class FollowItem() : IBaseViewModel { + override val blockId: String? + get() = TODO("Not yet implemented") + override val reportInfo: Map? + get() = TODO("Not yet implemented") + override val operations: Map? + get() = TODO("Not yet implemented") + override val flipInfos: Map? + get() = TODO("Not yet implemented") + override val extraData: Map? + get() = TODO("Not yet implemented") + override val data: Map? + get() = TODO("Not yet implemented") +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/HotItem.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/HotItem.kt new file mode 100644 index 0000000000..8eaeb98566 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/HotItem.kt @@ -0,0 +1,16 @@ +package listsample.models + +class HotItem() : IBaseViewModel { + override val blockId: String? + get() = TODO("Not yet implemented") + override val reportInfo: Map? + get() = TODO("Not yet implemented") + override val operations: Map? + get() = TODO("Not yet implemented") + override val flipInfos: Map? + get() = TODO("Not yet implemented") + override val extraData: Map? + get() = TODO("Not yet implemented") + override val data: Map? + get() = TODO("Not yet implemented") +} diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/IBaseViewModel.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/IBaseViewModel.kt new file mode 100644 index 0000000000..3003eaecca --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/IBaseViewModel.kt @@ -0,0 +1,10 @@ +package listsample.models + +interface IBaseViewModel { + val blockId: String? + val reportInfo: Map? + val operations: Map? + val flipInfos: Map? + val extraData: Map? + val data: Map? +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/ICompositionModel.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/ICompositionModel.kt new file mode 100644 index 0000000000..7775fbab9c --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/ICompositionModel.kt @@ -0,0 +1,21 @@ +package listsample.models + +interface ICompositionItem { + val bgColor: String? + val radius: String? + val alpha: String? + val shadowColor: String? + val textColor: String? + val text: String? +} + +interface ICompositionModel : IBaseViewModel { + val title: String? + val subtitle: String? + val overlyTopLeft: ICompositionItem? + val overlyView1: ICompositionItem? + val overlyView2: ICompositionItem? + val overlyView3: ICompositionItem? + val overlyTopRight: ICompositionItem? + val label: ICompositionItem? +} \ No newline at end of file diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/ViewModelFactory.kt b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/ViewModelFactory.kt new file mode 100644 index 0000000000..fdeb70c779 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/commonMain/kotlin/listsample/models/ViewModelFactory.kt @@ -0,0 +1,56 @@ +package listsample.models + + +val fakeItem2 = object : ICompositionItem { + override val bgColor: String? + get() = "" + override val radius: String? + get() = "0.5" + override val alpha: String? + get() = "0.5" + override val shadowColor: String? + get() = "" + override val textColor: String? + get() = "" + override val text: String? + get() = "yqhwjmjdsk" + + "fksghksjhgksjh" + + "gsgjlksgjlk" +} + +open class FakeItem : ICompositionModel { + override val title: String? + get() = "aghjagj" + override val subtitle: String? + get() = "ghjghjghj" + override val overlyTopLeft: ICompositionItem? + get() = fakeItem2 + override val overlyView1: ICompositionItem? + get() = fakeItem2 + override val overlyView2: ICompositionItem? + get() = fakeItem2 + override val overlyView3: ICompositionItem? + get() = fakeItem2 + override val overlyTopRight: ICompositionItem? + get() = fakeItem2 + override val label: ICompositionItem? + get() = fakeItem2 + override val blockId: String? + get() = "" + override val reportInfo: Map? + get() = TODO("Not yet implemented") + override val operations: Map? + get() = TODO("Not yet implemented") + override val flipInfos: Map? + get() = TODO("Not yet implemented") + override val extraData: Map? + get() = TODO("Not yet implemented") + override val data: Map? + get() = TODO("Not yet implemented") +} + +expect fun createFakeItem(): ICompositionModel + +internal fun fetchCompositionModels(useJSON: Boolean, callback: (List) -> Unit) { + callback(List(250, { createFakeItem() })) +} diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/desktopMain/kotlin/listsample/models/FakeItem.kt b/benchmarks/ios/scroll-lazy-list/shared/src/desktopMain/kotlin/listsample/models/FakeItem.kt new file mode 100644 index 0000000000..5c52387f86 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/desktopMain/kotlin/listsample/models/FakeItem.kt @@ -0,0 +1,3 @@ +package listsample.models + +actual fun createFakeItem(): ICompositionModel = FakeItem() diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/desktopMain/kotlin/main.desktop.kt b/benchmarks/ios/scroll-lazy-list/shared/src/desktopMain/kotlin/main.desktop.kt new file mode 100644 index 0000000000..409ab5bcad --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/desktopMain/kotlin/main.desktop.kt @@ -0,0 +1,4 @@ +import androidx.compose.runtime.Composable + +@Composable fun MainView() = App() + diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/iosMain/kotlin/listsample/models/FakeItem.kt b/benchmarks/ios/scroll-lazy-list/shared/src/iosMain/kotlin/listsample/models/FakeItem.kt new file mode 100644 index 0000000000..5c52387f86 --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/iosMain/kotlin/listsample/models/FakeItem.kt @@ -0,0 +1,3 @@ +package listsample.models + +actual fun createFakeItem(): ICompositionModel = FakeItem() diff --git a/benchmarks/ios/scroll-lazy-list/shared/src/iosMain/kotlin/main.ios.kt b/benchmarks/ios/scroll-lazy-list/shared/src/iosMain/kotlin/main.ios.kt new file mode 100644 index 0000000000..fa143d45ce --- /dev/null +++ b/benchmarks/ios/scroll-lazy-list/shared/src/iosMain/kotlin/main.ios.kt @@ -0,0 +1,3 @@ +import androidx.compose.ui.window.ComposeUIViewController + +fun MainViewController() = ComposeUIViewController { App() } \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/.gitignore b/benchmarks/ios/visual-effects-ny/.gitignore new file mode 100644 index 0000000000..180e034383 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/.gitignore @@ -0,0 +1,21 @@ +*.iml +.gradle +/local.properties +/.idea +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +build/ +/captures +.externalNativeBuild +.cxx +iosApp/Podfile.lock +iosApp/Pods/* +iosApp/iosApp.xcworkspace/* +iosApp/iosApp.xcodeproj/* +!iosApp/iosApp.xcodeproj/project.pbxproj +shared/shared.podspec \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/.run/desktopApp.run.xml b/benchmarks/ios/visual-effects-ny/.run/desktopApp.run.xml new file mode 100644 index 0000000000..0de5218670 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/.run/desktopApp.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/README.md b/benchmarks/ios/visual-effects-ny/README.md new file mode 100644 index 0000000000..45d2731886 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/README.md @@ -0,0 +1 @@ +A benchmark app extracted from the NY sample of examples/visual-effects \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/androidApp/build.gradle.kts b/benchmarks/ios/visual-effects-ny/androidApp/build.gradle.kts new file mode 100644 index 0000000000..61a9bd4d72 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/androidApp/build.gradle.kts @@ -0,0 +1,31 @@ +plugins { + kotlin("multiplatform") + id("com.android.application") + id("org.jetbrains.compose") +} + +kotlin { + android() + sourceSets { + val androidMain by getting { + dependencies { + implementation(project(":shared")) + } + } + } +} + +android { + compileSdk = 33 + defaultConfig { + applicationId = "org.jetbrains.VisualEffects" + minSdk = 26 + targetSdk = 33 + versionCode = 1 + versionName = "1.0" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} diff --git a/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/AndroidManifest.xml b/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..0e4d4b8a1b --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/kotlin/MainActivity.kt b/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/kotlin/MainActivity.kt new file mode 100644 index 0000000000..045ce66fb5 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/kotlin/MainActivity.kt @@ -0,0 +1,15 @@ +package org.jetbrains.compose.demo.visuals + +import MainView +import android.os.Bundle +import androidx.activity.compose.setContent +import androidx.appcompat.app.AppCompatActivity + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + MainView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/res/values/strings.xml b/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/res/values/strings.xml new file mode 100644 index 0000000000..d23a35eb38 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/androidApp/src/androidMain/res/values/strings.xml @@ -0,0 +1,3 @@ + + Visual Effects + \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/build.gradle.kts b/benchmarks/ios/visual-effects-ny/build.gradle.kts new file mode 100644 index 0000000000..8d0c1f3d7c --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + // this is necessary to avoid the plugins to be loaded multiple times + // in each subproject's classloader + kotlin("jvm") apply false + kotlin("multiplatform") apply false + kotlin("android") apply false + id("com.android.application") apply false + id("com.android.library") apply false + id("org.jetbrains.compose") apply false +} + +allprojects { + repositories { + google() + mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + mavenLocal() + } +} diff --git a/benchmarks/ios/visual-effects-ny/desktopApp/build.gradle.kts b/benchmarks/ios/visual-effects-ny/desktopApp/build.gradle.kts new file mode 100644 index 0000000000..1cebd3ec6a --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/desktopApp/build.gradle.kts @@ -0,0 +1,55 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat + +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + jvm {} + sourceSets { + val jvmMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + implementation(project(":shared")) + } + } + } +} + +compose.desktop { + application { + mainClass = "org.jetbrains.compose.demo.visuals.MainKt" + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "compose-demo" + packageVersion = "1.0.0" + } + } +} + +afterEvaluate { + val additionalArguments = mutableListOf() + + val runTask = tasks.named("run") { + this.args = additionalArguments + } + + tasks.register("runWords") { + additionalArguments.add("words") + group = "compose desktop" + dependsOn(runTask) + } + + tasks.register("runWave") { + additionalArguments.add("wave") + group = "compose desktop" + dependsOn(runTask) + } + + tasks.register("runNewYear") { + additionalArguments.add("NY") + group = "compose desktop" + dependsOn(runTask) + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/desktopApp/src/jvmMain/kotlin/main.kt b/benchmarks/ios/visual-effects-ny/desktopApp/src/jvmMain/kotlin/main.kt new file mode 100644 index 0000000000..1217cc5b9d --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/desktopApp/src/jvmMain/kotlin/main.kt @@ -0,0 +1,4 @@ +package org.jetbrains.compose.demo.visuals + +fun main() = mainNY() + diff --git a/benchmarks/ios/visual-effects-ny/gradle.properties b/benchmarks/ios/visual-effects-ny/gradle.properties new file mode 100644 index 0000000000..cad8e0734a --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/gradle.properties @@ -0,0 +1,16 @@ +kotlin.code.style=official +xcodeproj=./iosApp +kotlin.native.cocoapods.generate.wrapper=true +android.useAndroidX=true +org.gradle.jvmargs=-Xmx3g +org.jetbrains.compose.experimental.jscanvas.enabled=true +org.jetbrains.compose.experimental.macos.enabled=true +org.jetbrains.compose.experimental.uikit.enabled=true +kotlin.mpp.androidSourceSetLayoutVersion=2 +kotlin.native.cacheKind=none +kotlin.native.useEmbeddableCompilerJar=true +# Enable kotlin/native experimental memory model +kotlin.native.binary.memoryModel=experimental +kotlin.version=1.8.20 +agp.version=7.1.3 +compose.version=1.4.0 diff --git a/benchmarks/ios/visual-effects-ny/gradle/wrapper/gradle-wrapper.jar b/benchmarks/ios/visual-effects-ny/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..249e5832f0 Binary files /dev/null and b/benchmarks/ios/visual-effects-ny/gradle/wrapper/gradle-wrapper.jar differ diff --git a/benchmarks/ios/visual-effects-ny/gradle/wrapper/gradle-wrapper.properties b/benchmarks/ios/visual-effects-ny/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..ae04661ee7 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/benchmarks/ios/visual-effects-ny/gradlew b/benchmarks/ios/visual-effects-ny/gradlew new file mode 100755 index 0000000000..a69d9cb6c2 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/benchmarks/ios/visual-effects-ny/gradlew.bat b/benchmarks/ios/visual-effects-ny/gradlew.bat new file mode 100644 index 0000000000..f127cfd49d --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/benchmarks/ios/visual-effects-ny/iosApp/Configuration/Config.xcconfig b/benchmarks/ios/visual-effects-ny/iosApp/Configuration/Config.xcconfig new file mode 100644 index 0000000000..bad995c745 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/Configuration/Config.xcconfig @@ -0,0 +1,3 @@ +TEAM_ID= +BUNDLE_ID=org.jetbrains.VisualEffects +APP_NAME=VisualEffects diff --git a/benchmarks/ios/visual-effects-ny/iosApp/Podfile b/benchmarks/ios/visual-effects-ny/iosApp/Podfile new file mode 100644 index 0000000000..aff9c517b2 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/Podfile @@ -0,0 +1,5 @@ +target 'iosApp' do + use_frameworks! + platform :ios, '14.1' + pod 'shared', :path => '../shared' +end \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp.xcodeproj/project.pbxproj b/benchmarks/ios/visual-effects-ny/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..0cea2ac59d --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,418 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF7B242A565900829871 /* iosApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F85CB1118929364A9C6EFABC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 058557D7273AAEEB004C7B11 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 42799AB246E5F90AF97AA0EF /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + AB1DB47929225F7C00F7AF9C /* Configuration */, + 7555FF7D242A565900829871 /* iosApp */, + 7555FF7C242A565900829871 /* Products */, + FEFF387C0A8D172AA4D59CAE /* Pods */, + 42799AB246E5F90AF97AA0EF /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* iosApp.app */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 058557BA273AAA24004C7B11 /* Assets.xcassets */, + 7555FF82242A565900829871 /* ContentView.swift */, + 7555FF8C242A565B00829871 /* Info.plist */, + 2152FB032600AC8F00CF470E /* iOSApp.swift */, + 058557D7273AAEEB004C7B11 /* Preview Content */, + ); + path = iosApp; + sourceTree = ""; + }; + AB1DB47929225F7C00F7AF9C /* Configuration */ = { + isa = PBXGroup; + children = ( + AB3632DC29227652001CCB65 /* Config.xcconfig */, + ); + path = Configuration; + sourceTree = ""; + }; + FEFF387C0A8D172AA4D59CAE /* Pods */ = { + isa = PBXGroup; + children = ( + 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */, + FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */, + 7555FF77242A565900829871 /* Sources */, + 7555FF79242A565900829871 /* Resources */, + F85CB1118929364A9C6EFABC /* Frameworks */, + 7694444BC13DD49B4B2626ED /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iosApp; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* iosApp.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = orgName; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* iosApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, + 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 7694444BC13DD49B4B2626ED /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 98D614C51D2DA07C614CC46E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, + 7555FF83242A565900829871 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF8CA3F5360CEAB49D74065F /* Pods-iosApp.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; + PRODUCT_NAME = "${APP_NAME}"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000000..ee7e3ca03f --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..fb88a396bf --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/Contents.json b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/ContentView.swift b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f7f6457b31 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + + + diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Info.plist b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Info.plist new file mode 100644 index 0000000000..9a269f5eaa --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000000..4aa7c5350b --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/iosApp/iosApp/iOSApp.swift b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/iOSApp.swift new file mode 100644 index 0000000000..0648e8602f --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/iosApp/iosApp/iOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/run-configurations.png b/benchmarks/ios/visual-effects-ny/run-configurations.png new file mode 100644 index 0000000000..d859ff0870 Binary files /dev/null and b/benchmarks/ios/visual-effects-ny/run-configurations.png differ diff --git a/benchmarks/ios/visual-effects-ny/settings.gradle.kts b/benchmarks/ios/visual-effects-ny/settings.gradle.kts new file mode 100644 index 0000000000..665c2f3deb --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/settings.gradle.kts @@ -0,0 +1,27 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() + } + + plugins { + val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) + kotlin("multiplatform").version(kotlinVersion) + kotlin("android").version(kotlinVersion) + id("com.android.base").version(agpVersion) + id("com.android.application").version(agpVersion) + id("com.android.library").version(agpVersion) + id("org.jetbrains.compose").version(composeVersion) + } +} + +rootProject.name = "visual-effects" + +include(":androidApp") +include(":shared") +include(":desktopApp") diff --git a/benchmarks/ios/visual-effects-ny/shared/build.gradle.kts b/benchmarks/ios/visual-effects-ny/shared/build.gradle.kts new file mode 100644 index 0000000000..de48622f63 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/build.gradle.kts @@ -0,0 +1,74 @@ +plugins { + kotlin("multiplatform") + kotlin("native.cocoapods") + id("com.android.library") + id("org.jetbrains.compose") +} + +version = "1.0-SNAPSHOT" + +kotlin { + android() + + jvm("desktop") + + ios() + iosSimulatorArm64() + + cocoapods { + summary = "Shared code for the sample" + homepage = "https://github.com/JetBrains/compose-jb" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + framework { + baseName = "shared" + isStatic = true + } + extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.materialIconsExtended) + @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + implementation(compose.components.resources) + } + } + val androidMain by getting { + dependencies { + api("androidx.activity:activity-compose:1.6.1") + api("androidx.appcompat:appcompat:1.6.1") + api("androidx.core:core-ktx:1.9.0") + } + } + val iosMain by getting + val iosSimulatorArm64Main by getting { + dependsOn(iosMain) + } + val desktopMain by getting { + dependencies { + implementation(compose.desktop.common) + } + } + } +} + +android { + compileSdk = 33 + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + sourceSets["main"].res.srcDirs("src/androidMain/res") + sourceSets["main"].resources.srcDirs("src/commonMain/resources") + + defaultConfig { + minSdk = 26 + targetSdk = 33 + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} diff --git a/benchmarks/ios/visual-effects-ny/shared/src/androidMain/AndroidManifest.xml b/benchmarks/ios/visual-effects-ny/shared/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..9382484a7e --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/shared/src/androidMain/kotlin/main.android.kt b/benchmarks/ios/visual-effects-ny/shared/src/androidMain/kotlin/main.android.kt new file mode 100644 index 0000000000..ea20b28f05 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/androidMain/kotlin/main.android.kt @@ -0,0 +1,5 @@ +import androidx.compose.runtime.Composable +import org.jetbrains.compose.demo.visuals.NYContent + +@Composable +fun MainView() = NYContent() \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/shared/src/androidMain/kotlin/platform/NanoTime.kt b/benchmarks/ios/visual-effects-ny/shared/src/androidMain/kotlin/platform/NanoTime.kt new file mode 100644 index 0000000000..ebfd7e4ac6 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/androidMain/kotlin/platform/NanoTime.kt @@ -0,0 +1,3 @@ +package org.jetbrains.compose.demo.visuals.platform + +actual fun nanoTime(): Long = System.nanoTime() \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/shared/src/commonMain/kotlin/HappyNY.kt b/benchmarks/ios/visual-effects-ny/shared/src/commonMain/kotlin/HappyNY.kt new file mode 100644 index 0000000000..72f8c41687 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/commonMain/kotlin/HappyNY.kt @@ -0,0 +1,321 @@ +package org.jetbrains.compose.demo.visuals + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Surface +import androidx.compose.runtime.* +import androidx.compose.runtime.snapshots.SnapshotStateList +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.* +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import org.jetbrains.compose.demo.visuals.platform.nanoTime +import kotlin.math.* +import kotlin.random.Random + +const val width = 400 +const val height = 800 +const val snowCount = 80 +const val starCount = 60 +const val rocketPartsCount = 30 + +data class SnowFlake( + var x: Dp, + var y: Dp, + val scale: Float, + var v: Double, + var alpha: Float, + var angle: Float, + var rotate: Int, + var phase: Double +) + +data class Star(val x: Dp, val y: Dp, val color: Color, val size: Dp) + +fun random(): Float = Random.nextFloat() + +class DoubleRocket(val particle: Particle) { + private val STATE_ROCKET = 0 + private val STATE_SMALL_ROCKETS = 1 + var state = STATE_ROCKET + var rockets: Array = emptyArray() + private fun checkState(time: Long) { + if (particle.vy > -3.0 && state == STATE_ROCKET) { + explode(time) + } + if (state == STATE_SMALL_ROCKETS) { + var done = true + rockets.forEach { + if (!it.exploded) { + it.checkExplode(time) + } + if (!it.checkDone()) { + done = false + } + } + if (done) { + reset() + } + } + } + + private fun reset() { + state = STATE_ROCKET + particle.x = 0.0 + particle.y = 1000.0 + particle.vx = 2.1 + particle.vy = -12.5 + } + + private fun explode(time: Long) { + val colors = arrayOf(Color(0xff, 0, 0), Color(192, 255, 192), Color(192, 212, 255)) + rockets = Array(7) { + val v = 1.2f + 1.0 * random() + val angle = 2 * PI * random() + Rocket( + Particle( + particle.x, + particle.y, + v * sin(angle) + particle.vx, + v * cos(angle) + particle.vy - 0.5f, + colors[it % colors.size] + ), colors[it % colors.size], time + ) + } + state = STATE_SMALL_ROCKETS + } + + fun move(time: Long, prevTime: Long) { + if (rocket.state == rocket.STATE_ROCKET) { + rocket.particle.move(time, prevTime) + rocket.particle.gravity(time, prevTime) + } else { + rocket.rockets.forEach { + it.move(time, prevTime) + } + } + rocket.checkState(time) + } + + @Composable + fun draw() { + if (state == rocket.STATE_ROCKET) { + particle.draw() + } else { + rockets.forEach { + it.draw() + } + } + } + +} + +class Rocket(val particle: Particle, val color: Color, val startTime: Long = 0) { + var exploded = false + var parts: Array = emptyArray() + + fun checkExplode(time: Long) { + if (time - startTime > 1200000000) { + explode() + } + } + + private fun explode() { + parts = Array(rocketPartsCount) { + val v = 0.5f + 1.5 * random() + val angle = 2 * PI * random() + Particle(particle.x, particle.y, v * sin(angle) + particle.vx, v * cos(angle) + particle.vy, color, 1) + } + exploded = true + } + + fun checkDone(): Boolean { + if (!exploded) return false + parts.forEach { + if (it.y < 800) return false + } + return true + } + + fun move(time: Long, prevTime: Long) { + if (!exploded) { + particle.move(time, prevTime) + particle.gravity(time, prevTime) + checkExplode(time) + } else { + parts.forEach { + it.move(time, prevTime) + it.gravity(time, prevTime) + } + } + } + + @Composable + fun draw() { + if (!exploded) { + particle.draw() + } else { + parts.forEach { + it.draw() + } + } + } +} + +class Particle(var x: Double, var y: Double, var vx: Double, var vy: Double, val color: Color, val type: Int = 0) { + fun move(time: Long, prevTime: Long) { + x = (x + vx * (time - prevTime) / 30000000) + y = (y + vy * (time - prevTime) / 30000000) + } + + fun gravity(time: Long, prevTime: Long) { + vy = vy + 1.0f * (time - prevTime) / 300000000 + } + + @Composable + fun draw() { + val alphaFactor = if (type == 0) 1.0f else 1 / (1 + abs(vy / 5)).toFloat() + Box(Modifier.size(5.dp).offset(x.dp, y.dp).alpha(alphaFactor).clip(CircleShape).background(color)) + for (i in 1..5) { + Box( + Modifier.size(4.dp).offset((x - vx / 2 * i).dp, (y - vy / 2 * i).dp) + .alpha(alphaFactor * (1 - 0.18f * i)).clip(CircleShape).background(color) + ) + } + } +} + +val rocket = DoubleRocket(Particle(0.0, 1000.0, 2.1, -12.5, Color.White)) + +fun prepareStarsAndSnowFlakes(stars: SnapshotStateList, snowFlakes: SnapshotStateList) { + for (i in 0..snowCount) { + snowFlakes.add( + SnowFlake( + (50 + (width - 50) * random()).dp, + (height * random()).dp, + 0.1f + 0.2f * random().toFloat(), + 1.5 + 3 * random(), + (0.4f + 0.4 * random()).toFloat(), + 60 * random().toFloat(), + Random.nextInt(1, 5) - 3, + random() * 2 * PI + ) + ) + } + val colors = arrayOf(Color.Red, Color.Yellow, Color.Green, Color.Yellow, Color.Cyan, Color.Magenta, Color.White) + for (i in 0..starCount) { + stars.add( + Star( + (width * random()).dp, + (height * random()).dp, + colors[Random.nextInt(colors.size)], + (3 + 5 * random()).dp + ) + ) + } +} + +@Composable +fun NYContent() { + var time by remember { mutableStateOf(nanoTime()) } + var startTime = remember { nanoTime() } + var prevTime by remember { mutableStateOf(nanoTime()) } + val snowFlakes = remember { mutableStateListOf() } + val stars = remember { mutableStateListOf() } + var flickering2 by remember { mutableStateOf(true) } + remember { prepareStarsAndSnowFlakes(stars, snowFlakes) } + + Surface( + modifier = Modifier.fillMaxSize().padding(5.dp).shadow(3.dp, RoundedCornerShape(20.dp)), + color = Color.Black, + shape = RoundedCornerShape(20.dp) + ) { + + LaunchedEffect(Unit) { + while (true) { + withFrameNanos { + prevTime = time + time = it + } + } + } + + if (flickering2) { + if (time - startTime > 15500000000) { //note, that startTime has been updated above + flickering2 = false + } + } + + rocket.move(time, prevTime) + + Box(Modifier.fillMaxSize()) { + + snow(time, prevTime, snowFlakes, startTime) + + starrySky(stars) + + rocket.draw() + + } + } +} + + +@Composable +fun starrySky(stars: SnapshotStateList) { + stars.forEach { + star(it.x, it.y, it.color, size = it.size) + } +} + +@Composable +fun star(x: Dp, y: Dp, color: Color = Color.White, size: Dp) { + Box(Modifier.offset(x, y).scale(1.0f, 0.2f).rotate(45f).size(size).background(color)) + Box(Modifier.offset(x, y).scale(0.2f, 1.0f).rotate(45f).size(size).background(color)) +} + +@Composable +fun snow(time: Long, prevTime: Long, snowFlakes: SnapshotStateList, startTime: Long) { + val deltaAngle = (time - startTime) / 100000000 + with(LocalDensity.current) { + snowFlakes.forEach { + var y = it.y + ((it.v * (time - prevTime)) / 300000000).dp + if (y > (height + 20).dp) { + y = -20.dp + } + it.y = y + val x = it.x + (15 * sin(time.toDouble() / 3000000000 + it.phase)).dp + snowFlake(Modifier.offset(x, y).scale(it.scale).rotate(it.angle + deltaAngle * it.rotate), it.alpha) + } + } +} + +@Composable +fun snowFlake(modifier: Modifier, alpha: Float = 0.8f) { + Box(modifier) { + snowFlakeInt(0, 0f, 30.dp, 0.dp, alpha) + snowFlakeInt(0, 60f, 15.dp, 25.dp, alpha) + snowFlakeInt(0, 120f, -15.dp, 25.dp, alpha) + snowFlakeInt(0, 180f, -30.dp, 0.dp, alpha) + snowFlakeInt(0, 240f, -15.dp, -25.dp, alpha) + snowFlakeInt(0, 300f, 15.dp, -25.dp, alpha) + } + +} + +@Composable +fun snowFlakeInt(level: Int, angle: Float, shiftX: Dp, shiftY: Dp, alpha: Float) { + if (level > 3) return + Box( + Modifier.offset(shiftX, shiftY).rotate(angle).width(100.dp).height(10.dp).scale(0.6f).alpha(1f) + .background(Color.White.copy(alpha = alpha)) + ) { + snowFlakeInt(level + 1, 30f, 12.dp, 20.dp, alpha * 0.8f) + snowFlakeInt(level + 1, -30f, 12.dp, -20.dp, alpha * 0.8f) + } +} + diff --git a/benchmarks/ios/visual-effects-ny/shared/src/commonMain/kotlin/platform/NanoTime.kt b/benchmarks/ios/visual-effects-ny/shared/src/commonMain/kotlin/platform/NanoTime.kt new file mode 100644 index 0000000000..0fc90a38ca --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/commonMain/kotlin/platform/NanoTime.kt @@ -0,0 +1,3 @@ +package org.jetbrains.compose.demo.visuals.platform + +expect fun nanoTime(): Long \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/shared/src/desktopMain/kotlin/main.desktop.kt b/benchmarks/ios/visual-effects-ny/shared/src/desktopMain/kotlin/main.desktop.kt new file mode 100644 index 0000000000..cc8baa8da6 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/desktopMain/kotlin/main.desktop.kt @@ -0,0 +1,20 @@ +package org.jetbrains.compose.demo.visuals + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.* + +@Composable +fun NYWindow(onCloseRequest: () -> Unit) { + val windowState = remember { WindowState(width = width.dp, height = height.dp) } + Window(onCloseRequest = onCloseRequest, undecorated = false, transparent = false, state = windowState) { + NYContent() + } +} + +fun mainNY() = application { + NYWindow(::exitApplication) +} + + diff --git a/benchmarks/ios/visual-effects-ny/shared/src/desktopMain/kotlin/platform/NanoTime.kt b/benchmarks/ios/visual-effects-ny/shared/src/desktopMain/kotlin/platform/NanoTime.kt new file mode 100644 index 0000000000..ebfd7e4ac6 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/desktopMain/kotlin/platform/NanoTime.kt @@ -0,0 +1,3 @@ +package org.jetbrains.compose.demo.visuals.platform + +actual fun nanoTime(): Long = System.nanoTime() \ No newline at end of file diff --git a/benchmarks/ios/visual-effects-ny/shared/src/iosMain/kotlin/main.ios.kt b/benchmarks/ios/visual-effects-ny/shared/src/iosMain/kotlin/main.ios.kt new file mode 100644 index 0000000000..bcab5fa15a --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/iosMain/kotlin/main.ios.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. + * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. + */ + +import androidx.compose.ui.window.ComposeUIViewController +import org.jetbrains.compose.demo.visuals.NYContent +import platform.UIKit.UIViewController + +fun MainViewController() : UIViewController = ComposeUIViewController { NYContent() } diff --git a/benchmarks/ios/visual-effects-ny/shared/src/iosMain/kotlin/platform/NanoTime.kt b/benchmarks/ios/visual-effects-ny/shared/src/iosMain/kotlin/platform/NanoTime.kt new file mode 100644 index 0000000000..334c22b781 --- /dev/null +++ b/benchmarks/ios/visual-effects-ny/shared/src/iosMain/kotlin/platform/NanoTime.kt @@ -0,0 +1,3 @@ +package org.jetbrains.compose.demo.visuals.platform + +actual fun nanoTime(): Long = kotlin.system.getTimeNanos() \ No newline at end of file