diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..82905da6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "compose/frameworks/support"] + path = compose/frameworks/support + url = https://github.com/JetBrains/androidx +[submodule "compose/golden"] + path = compose/golden + url = https://android.googlesource.com/platform/frameworks/support-golden +[submodule "compose/external/doclava"] + path = compose/external/doclava + url = https://android.googlesource.com/platform/external/doclava diff --git a/README.md b/README.md index 3a108ef2..fe474051 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ at https://android.googlesource.com/platform/frameworks/support. * [artwork](artwork) - design artifacts * [benchmarks](benchmarks) - collection of benchmarks + * [compose](compose) - composite build of [Compose-jb sources](https://github.com/JetBrains/androidx) * [ci](ci) - Continuous Integration helpers * [cef](cef) - CEF integration in Jetpack Compose * [examples](examples) - examples of multiplatform Compose applications for Desktop and Android diff --git a/compose/.gitignore b/compose/.gitignore new file mode 100644 index 00000000..a0023c8f --- /dev/null +++ b/compose/.gitignore @@ -0,0 +1,17 @@ +prebuilds +out +*.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 \ No newline at end of file diff --git a/compose/.run/androidx.benchmark.integration-tests.macrobenchmark-target.run.xml b/compose/.run/androidx.benchmark.integration-tests.macrobenchmark-target.run.xml new file mode 100644 index 00000000..14ed2fe5 --- /dev/null +++ b/compose/.run/androidx.benchmark.integration-tests.macrobenchmark-target.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/androidx.compose.integration-tests.demos.run.xml b/compose/.run/androidx.compose.integration-tests.demos.run.xml new file mode 100644 index 00000000..1e3a1e94 --- /dev/null +++ b/compose/.run/androidx.compose.integration-tests.demos.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/androidx.compose.integration-tests.macrobenchmark-target.run.xml b/compose/.run/androidx.compose.integration-tests.macrobenchmark-target.run.xml new file mode 100644 index 00000000..4e7af657 --- /dev/null +++ b/compose/.run/androidx.compose.integration-tests.macrobenchmark-target.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/androidx.compose.material.material.integration-tests.material-catalog.run.xml b/compose/.run/androidx.compose.material.material.integration-tests.material-catalog.run.xml new file mode 100644 index 00000000..0bd5f3af --- /dev/null +++ b/compose/.run/androidx.compose.material.material.integration-tests.material-catalog.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/androidx.compose.ui.ui-test-manifest.integration-tests.testapp.run.xml b/compose/.run/androidx.compose.ui.ui-test-manifest.integration-tests.testapp.run.xml new file mode 100644 index 00000000..9a5ba33d --- /dev/null +++ b/compose/.run/androidx.compose.ui.ui-test-manifest.integration-tests.testapp.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/androidx.profileinstaller.integration-tests.testapp.run.xml b/compose/.run/androidx.profileinstaller.integration-tests.testapp.run.xml new file mode 100644 index 00000000..adf325a0 --- /dev/null +++ b/compose/.run/androidx.profileinstaller.integration-tests.testapp.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/androidx.wear.compose.integration-tests.demos.run.xml b/compose/.run/androidx.wear.compose.integration-tests.demos.run.xml new file mode 100644 index 00000000..0e585c5c --- /dev/null +++ b/compose/.run/androidx.wear.compose.integration-tests.demos.run.xml @@ -0,0 +1,60 @@ + + + + + \ No newline at end of file diff --git a/compose/.run/build extended icons.run.xml b/compose/.run/build extended icons.run.xml new file mode 100644 index 00000000..d75e655a --- /dev/null +++ b/compose/.run/build extended icons.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/build.run.xml b/compose/.run/build.run.xml new file mode 100644 index 00000000..4f02a631 --- /dev/null +++ b/compose/.run/build.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/publish (without Android Layout Inspector).run.xml b/compose/.run/publish (without Android Layout Inspector).run.xml new file mode 100644 index 00000000..95fcf49e --- /dev/null +++ b/compose/.run/publish (without Android Layout Inspector).run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/run2.run.xml b/compose/.run/run2.run.xml new file mode 100644 index 00000000..e8cf08b4 --- /dev/null +++ b/compose/.run/run2.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/run3.run.xml b/compose/.run/run3.run.xml new file mode 100644 index 00000000..a3381db1 --- /dev/null +++ b/compose/.run/run3.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/run4.run.xml b/compose/.run/run4.run.xml new file mode 100644 index 00000000..dca4e60a --- /dev/null +++ b/compose/.run/run4.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/runVsync.run.xml b/compose/.run/runVsync.run.xml new file mode 100644 index 00000000..aa75c522 --- /dev/null +++ b/compose/.run/runVsync.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/runWindowApi.run.xml b/compose/.run/runWindowApi.run.xml new file mode 100644 index 00000000..66270f92 --- /dev/null +++ b/compose/.run/runWindowApi.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/support_compose_desktop_desktop_samples [run1].run.xml b/compose/.run/support_compose_desktop_desktop_samples [run1].run.xml new file mode 100644 index 00000000..51675133 --- /dev/null +++ b/compose/.run/support_compose_desktop_desktop_samples [run1].run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/test (web).run.xml b/compose/.run/test (web).run.xml new file mode 100644 index 00000000..e6221924 --- /dev/null +++ b/compose/.run/test (web).run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/.run/test.run.xml b/compose/.run/test.run.xml new file mode 100644 index 00000000..a56438a8 --- /dev/null +++ b/compose/.run/test.run.xml @@ -0,0 +1,23 @@ + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/compose/README.md b/compose/README.md new file mode 100644 index 00000000..1cabe0cf --- /dev/null +++ b/compose/README.md @@ -0,0 +1,61 @@ +![Project in Android Studio](screenshots/studio.png) + +Composite build of [Compose-jb sources](https://github.com/JetBrains/androidx) + +## Download submodules after downloading the main project: +``` +git submodule update --init +``` +Set this property to always update submodules on git checkout/pull/reset: +``` +git config --global submodule.recurse true +``` + +## General requirements +- Java 11 (should be specified in JAVA_HOME) +- Android SDK (should be specified in ANDROID_SDK_ROOT. Can be downloaded via `./scripts/downloadAndroidSdk` on Linux/macOS) + - Android 11 + - Build-Tools 30.0.2 + - NDK 21.3.6528147 (in folder $androidSdk/ndk, not in $androidSdk/ndk/$version) + - CMake 3.10.2.4988404 (in folder $androidSdk/cmake, not in $androidSdk/cmake/$version) + +## Requirements to develop in IDE +- Android Studio Arctic Fox | 2020.3.1 Canary 15 +- Custom Gradle 7.0 specified in `Settings -> Build, Execution, Deployment -> Build Tools -> Gradle` (because Android Studio will pick the wrong Gradle in the subproject instead of the Gradle in the root project) +- Specified Gradle JDK 11 in `... -> Build Tools -> Gradle` +- Environment variables: +``` +export ALLOW_PUBLIC_REPOS=1 +export JAVA_TOOLS_JAR=$PWD/external/tools.jar +export ANDROIDX_PROJECTS=COMPOSE +export COMPOSE_CUSTOM_GROUP=org.jetbrains.compose +``` +- Gradle properties in ~/.gradle/gradle.properties: +``` +androidx.compose.multiplatformEnabled=true +androidx.compose.jsCompilerTestsEnabled=true +``` + +## Scripts +Publish artifacts to the local directory `out/androidx/build/support_repo/org/jetbrains/compose`: +``` +./scripts/publish +``` +Publish artifacts without Android Layout Inspector (use it on Windows): +``` +./scripts/publishWithoutInspector +``` +Publish extended icons: +``` +./scripts/publishExtendedIcons +``` + +Run tests for Desktop: +``` +./scripts/testDesktop +``` + +Run tests for Web: +``` +./scripts/testWeb +``` \ No newline at end of file diff --git a/compose/build.gradle.kts b/compose/build.gradle.kts new file mode 100644 index 00000000..e7064e8c --- /dev/null +++ b/compose/build.gradle.kts @@ -0,0 +1,83 @@ +val composeBuild = gradle.includedBuild("support") +fun Task.dependsOnComposeTask(name: String) = dependsOn(composeBuild.task(name)) + +gradle.startParameter.excludedTaskNames.add(":support:compose:ui:ui-inspection:assembleInspectorJarRelease") +gradle.startParameter.excludedTaskNames.add(":support:compose:ui:ui-inspection:dexInspectorRelease") + +// To show all projects which use `xxx` task, run: +// ./gradlew -p frameworks/support help --task xxx + +tasks.register("publishComposeJb") { + dependsOnComposeTask(":compose:compiler:compiler:publishMavenPublicationToMavenRepository") + dependsOnComposeTask(":compose:compiler:compiler-hosted:publishMavenPublicationToMavenRepository") + dependsOnComposeTask(":compose:ui:ui-tooling-data:publishMavenPublicationToMavenRepository") + + dependsOnComposeTask(":compose:desktop:desktop:publishKotlinMultiplatformPublicationToMavenRepository") + dependsOnComposeTask(":compose:desktop:desktop:publishJvmPublicationToMavenRepository") + dependsOnComposeTask(":compose:desktop:desktop:publishJvmlinux-x64PublicationToMavenRepository") + dependsOnComposeTask(":compose:desktop:desktop:publishJvmmacos-x64PublicationToMavenRepository") + dependsOnComposeTask(":compose:desktop:desktop:publishJvmmacos-arm64PublicationToMavenRepository") + dependsOnComposeTask(":compose:desktop:desktop:publishJvmwindows-x64PublicationToMavenRepository") + + listOf( + ":compose:animation:animation", + ":compose:animation:animation-core", + ":compose:foundation:foundation", + ":compose:foundation:foundation-layout", + ":compose:material:material", + ":compose:material:material-icons-core", + ":compose:material:material-ripple", + ":compose:runtime:runtime", + ":compose:runtime:runtime-saveable", + ":compose:ui:ui", + ":compose:ui:ui-geometry", + ":compose:ui:ui-graphics", + ":compose:ui:ui-test", + ":compose:ui:ui-test-junit4", + ":compose:ui:ui-text", + ":compose:ui:ui-tooling", + ":compose:ui:ui-unit", + ":compose:ui:ui-util", + ).forEach { + dependsOnComposeTask("$it:publishKotlinMultiplatformPublicationToMavenRepository") + dependsOnComposeTask("$it:publishDesktopPublicationToMavenRepository") + dependsOnComposeTask("$it:publishAndroidDebugPublicationToMavenRepository") + dependsOnComposeTask("$it:publishAndroidReleasePublicationToMavenRepository") + } + + listOf( + ":compose:runtime:runtime", + ).forEach { + dependsOnComposeTask("$it:publishJsPublicationToMavenRepository") + } +} + +// separate task that cannot be built in parallel (because it requires too much RAM). +// should be run with "--max-workers=1" +tasks.register("publishComposeJbExtendedIcons") { + listOf( + ":compose:material:material-icons-extended", + ).forEach { + dependsOnComposeTask("$it:publishKotlinMultiplatformPublicationToMavenRepository") + dependsOnComposeTask("$it:publishDesktopPublicationToMavenRepository") + dependsOnComposeTask("$it:publishAndroidDebugPublicationToMavenRepository") + dependsOnComposeTask("$it:publishAndroidReleasePublicationToMavenRepository") + } +} + +tasks.register("testComposeJbDesktop") { + dependsOnComposeTask(":compose:desktop:desktop:jvmTest") + dependsOnComposeTask(":compose:animation:animation:desktopTest") + dependsOnComposeTask(":compose:animation:animation-core:desktopTest") + dependsOnComposeTask(":compose:foundation:foundation:desktopTest") + dependsOnComposeTask(":compose:foundation:foundation-layout:desktopTest") + dependsOnComposeTask(":compose:material:material:desktopTest") + dependsOnComposeTask(":compose:material:material-ripple:desktopTest") + dependsOnComposeTask(":compose:runtime:runtime:desktopTest") + dependsOnComposeTask(":compose:runtime:runtime-saveable:desktopTest") +} + +tasks.register("testComposeJbWeb") { + dependsOnComposeTask(":compose:runtime:runtime:jsTest") + dependsOnComposeTask(":compose:runtime:runtime:test") +} \ No newline at end of file diff --git a/compose/external/doclava b/compose/external/doclava new file mode 160000 index 00000000..7b46b5a4 --- /dev/null +++ b/compose/external/doclava @@ -0,0 +1 @@ +Subproject commit 7b46b5a466cda32b8fbf0c5015c2b3d8127488c2 diff --git a/compose/frameworks/support b/compose/frameworks/support new file mode 160000 index 00000000..18a95a29 --- /dev/null +++ b/compose/frameworks/support @@ -0,0 +1 @@ +Subproject commit 18a95a299c8641ccb9581c4b32db9609a0cfec2f diff --git a/compose/golden b/compose/golden new file mode 160000 index 00000000..cd6860e3 --- /dev/null +++ b/compose/golden @@ -0,0 +1 @@ +Subproject commit cd6860e33655776f6533790a27cd37eb04b40e40 diff --git a/compose/gradle.properties b/compose/gradle.properties new file mode 100644 index 00000000..77d50db1 --- /dev/null +++ b/compose/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC +org.gradle.daemon=true +org.gradle.configureondemand=true +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.vfs.watch=true \ No newline at end of file diff --git a/compose/gradle/wrapper/gradle-wrapper.jar b/compose/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..62d4c053 Binary files /dev/null and b/compose/gradle/wrapper/gradle-wrapper.jar differ diff --git a/compose/gradle/wrapper/gradle-wrapper.properties b/compose/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..3c4101c3 --- /dev/null +++ b/compose/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/compose/gradlew b/compose/gradlew new file mode 100755 index 00000000..2fe81a7d --- /dev/null +++ b/compose/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or 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 UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$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 "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + 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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/compose/gradlew.bat b/compose/gradlew.bat new file mode 100644 index 00000000..9618d8d9 --- /dev/null +++ b/compose/gradlew.bat @@ -0,0 +1,100 @@ +@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 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%" == "0" goto init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +: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 %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/compose/screenshots/studio.png b/compose/screenshots/studio.png new file mode 100644 index 00000000..bf542a1b Binary files /dev/null and b/compose/screenshots/studio.png differ diff --git a/compose/scripts/downloadAndroidSdk b/compose/scripts/downloadAndroidSdk new file mode 100755 index 00000000..42ec6735 --- /dev/null +++ b/compose/scripts/downloadAndroidSdk @@ -0,0 +1,48 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +clone() { + mkdir -p $1 + pushd $1 + git init + git config advice.detachedHead false + git fetch --depth=1 $2 $3 + git checkout FETCH_HEAD + popd +} + +downloadLinuxSDK() { + clone ../prebuilts/fullsdk-linux/platforms/android-30 https://android.googlesource.com/platform/prebuilts/fullsdk/platforms/android-30 master + clone ../prebuilts/fullsdk-linux/sources/android-30 https://android.googlesource.com/platform/prebuilts/fullsdk/sources/android-30 master + clone ../prebuilts/fullsdk-linux/ndk https://android.googlesource.com/toolchain/prebuilts/ndk/r21 master + clone ../prebuilts/fullsdk-linux/build-tools/30.0.2 https://android.googlesource.com/platform/prebuilts/fullsdk-linux/build-tools/30.0.2 master + clone ../prebuilts/fullsdk-linux/platform-tools https://android.googlesource.com/platform/prebuilts/fullsdk-linux/platform-tools master + clone ../prebuilts/fullsdk-linux/tools https://android.googlesource.com/platform/prebuilts/fullsdk-linux/tools master + clone ../prebuilts/fullsdk-linux/cmake https://android.googlesource.com/platform/prebuilts/cmake/linux-x86 de5fa1c66d3bdcbf2bbc62d2504ec6b0b0fb74e1 +} + +downloadMacOsSDK() { + clone ../prebuilts/fullsdk-darwin/platforms/android-30 https://android.googlesource.com/platform/prebuilts/fullsdk/platforms/android-30 master + clone ../prebuilts/fullsdk-darwin/sources/android-30 https://android.googlesource.com/platform/prebuilts/fullsdk/sources/android-30 master + clone ../prebuilts/fullsdk-darwin/ndk https://android.googlesource.com/toolchain/prebuilts/ndk-darwin/r21 master + clone ../prebuilts/fullsdk-darwin/build-tools/30.0.2 https://android.googlesource.com/platform/prebuilts/fullsdk-darwin/build-tools/30.0.2 master + clone ../prebuilts/fullsdk-darwin/platform-tools https://android.googlesource.com/platform/prebuilts/fullsdk-darwin/platform-tools master + clone ../prebuilts/fullsdk-darwin/tools https://android.googlesource.com/platform/prebuilts/fullsdk-darwin/tools master + clone ../prebuilts/fullsdk-darwin/cmake https://android.googlesource.com/platform/prebuilts/cmake/darwin-x86 de5fa1c66d3bdcbf2bbc62d2504ec6b0b0fb74e1 +} + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + downloadLinuxSDK +elif [[ "$OSTYPE" == "darwin"* ]]; then + downloadMacOsSDK +elif [[ "$OSTYPE" == "cygwin" ]]; then + echo "Please download Android SDK manually (https://developer.android.com/studio)" +elif [[ "$OSTYPE" == "msys" ]]; then + echo "Please download Android SDK manually (https://developer.android.com/studio)" +elif [[ "$OSTYPE" == "win32" ]]; then + echo "Please download Android SDK manually (https://developer.android.com/studio)" +else + echo "Unknown OS" +fi + diff --git a/compose/scripts/prepare b/compose/scripts/prepare new file mode 100755 index 00000000..63be054c --- /dev/null +++ b/compose/scripts/prepare @@ -0,0 +1,9 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +export ALLOW_PUBLIC_REPOS=1 +export JAVA_TOOLS_JAR=$SCRIPT_DIR/../external/tools.jar +export ANDROIDX_PROJECTS=COMPOSE +export COMPOSE_CUSTOM_GROUP=org.jetbrains.compose +export COMPOSE_DEFAULT_GRADLE_ARGS="-Pandroidx.compose.multiplatformEnabled=true -Pandroidx.versionExtraCheckEnabled=false -Pandroidx.alternativeProjectUrl=https://github.com/JetBrains/compose-jb -Pandroidx.compose.jsCompilerTestsEnabled=true" \ No newline at end of file diff --git a/compose/scripts/publish b/compose/scripts/publish new file mode 100755 index 00000000..adbb4087 --- /dev/null +++ b/compose/scripts/publish @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew publishComposeJb $COMPOSE_DEFAULT_GRADLE_ARGS "$@" || exit 1 +popd \ No newline at end of file diff --git a/compose/scripts/publishExtendedIcons b/compose/scripts/publishExtendedIcons new file mode 100755 index 00000000..54dd4d0b --- /dev/null +++ b/compose/scripts/publishExtendedIcons @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew publishComposeJbExtendedIcons $COMPOSE_DEFAULT_GRADLE_ARGS --max-workers=1 "$@" || exit 1 +popd diff --git a/compose/scripts/publishWithoutInspector b/compose/scripts/publishWithoutInspector new file mode 100755 index 00000000..d1fd6e8f --- /dev/null +++ b/compose/scripts/publishWithoutInspector @@ -0,0 +1,12 @@ +#!/bin/bash + +# Publish artifact without Android Layout Inspector +# Should be used is there are errors building it (on Windows, for example) +# Shouldn't be used for publishing release artifacts + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew publishComposeJb $COMPOSE_DEFAULT_GRADLE_ARGS -x :support:compose:ui:ui-inspection:assembleInspectorJarRelease -x :support:compose:ui:ui-inspection:dexInspectorRelease "$@" || exit 1 +popd \ No newline at end of file diff --git a/compose/scripts/testAll b/compose/scripts/testAll new file mode 100755 index 00000000..a6e9de10 --- /dev/null +++ b/compose/scripts/testAll @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew testComposeJbDesktop testComposeJbWeb $COMPOSE_DEFAULT_GRADLE_ARGS "$@" || exit 1 +popd \ No newline at end of file diff --git a/compose/scripts/testDesktop b/compose/scripts/testDesktop new file mode 100755 index 00000000..948fc2e4 --- /dev/null +++ b/compose/scripts/testDesktop @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew testComposeJbDesktop $COMPOSE_DEFAULT_GRADLE_ARGS "$@" || exit 1 +popd \ No newline at end of file diff --git a/compose/scripts/testWeb b/compose/scripts/testWeb new file mode 100755 index 00000000..958f7a7b --- /dev/null +++ b/compose/scripts/testWeb @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")" +. ./prepare + +pushd .. +./gradlew testComposeJbWeb $COMPOSE_DEFAULT_GRADLE_ARGS "$@" || exit 1 +popd \ No newline at end of file diff --git a/compose/settings.gradle.kts b/compose/settings.gradle.kts new file mode 100644 index 00000000..911b4032 --- /dev/null +++ b/compose/settings.gradle.kts @@ -0,0 +1 @@ +includeBuild("frameworks/support") \ No newline at end of file