From 230193e56f323fb69ba0578dc42d118d0f86d057 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 7 Sep 2020 14:53:29 +0300 Subject: [PATCH] Update README.md. --- README.md | 17 +++++- .../build_and_run_from_cli_example.sh | 61 +++++++++++++++++++ tutorials/Getting_Started/main.md | 1 + 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100755 templates/app-template/build_and_run_from_cli_example.sh create mode 100644 tutorials/Getting_Started/main.md diff --git a/README.md b/README.md index 3350979b60..74338a5b9f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ -# compose -Compose monorepository +[![official project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) +# Compose for Desktop, by JetBrains + +Compose Kotlin UI framework port for desktop platforms (macOS, Linux, Windows), components outside of the core Compose repository +at https://android.googlesource.com/platform/frameworks/support. + +## Repository organization ## + + * `ci` - Continuous Integration helpers + * `examples` - examples of multiplatform Compose applications for Desktop and Android + * `imageviewer` - Image Viewer application for Android and Desktop + * `issues` - GitHub issue tracker with an adaptive UI and ktor-client + * `gradle-plugin` - plugin for simpler usage of Compose with Gradle build + * `templates` - new application templates (see `app-template/build_and_run_from_cli_example.sh` for using without Gradle) + * `tutorials` - tutorials on using Compose for Desktop \ No newline at end of file diff --git a/templates/app-template/build_and_run_from_cli_example.sh b/templates/app-template/build_and_run_from_cli_example.sh new file mode 100755 index 0000000000..643a8ba84b --- /dev/null +++ b/templates/app-template/build_and_run_from_cli_example.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -euo pipefail + +# This script is for educational purposes only. +# Its purpose is to demonstrate how to compile & run Compose Desktop App without Gradle. +# Prefer running Gradle directly if your project uses Gradle. + +mkdir -p deps + +function mavenDep { + REPO=$1 + GROUP=$2 + ARTIFACT=$3 + VERSION=$4 + FILE="$ARTIFACT-$VERSION.jar" + if [ ! -f "deps/$FILE" ]; then + wget -P deps/ "$REPO/$GROUP/$ARTIFACT/$VERSION/$FILE" + fi +} + +PLATFORM=macos +SKIKO_VERSION=0.1.5 +KOTLIN_VERSION=1.4.0 +COMPOSE_VERSION=0.1.0-build53 +COROUTINES_VERSION=1.3.6 +COLLECTIONS_VERSION=0.3 +SPACE_REPO="https://packages.jetbrains.team/maven/p/ui/dev" +MAVEN_CENTRAL="https://repo1.maven.org/maven2" +BINTRAY_KOTLINX="https://dl.bintray.com/kotlin/kotlinx" + +mavenDep "$SPACE_REPO" "org/jetbrains/skiko" "skiko-jvm-runtime-$PLATFORM" "$SKIKO_VERSION" +mavenDep "$SPACE_REPO" "org/jetbrains/compose" "compose-full" "$COMPOSE_VERSION" +mavenDep "$SPACE_REPO" "org/jetbrains/compose" "compose-compiler-hosted" "$COMPOSE_VERSION" +mavenDep "$BINTRAY_KOTLINX" "org/jetbrains/kotlinx" "kotlinx-collections-immutable-jvm" "$COLLECTIONS_VERSION" +mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlinx" "kotlinx-coroutines-core" "$COROUTINES_VERSION" +mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlin" "kotlin-stdlib" "$KOTLIN_VERSION" +if [ ! -f "deps/kotlin-compiler-$KOTLIN_VERSION.zip" ]; then + wget -P deps/ "https://github.com/JetBrains/kotlin/releases/download/v$KOTLIN_VERSION/kotlin-compiler-$KOTLIN_VERSION.zip" + pushd deps + unzip kotlin-compiler-$KOTLIN_VERSION.zip + popd +fi + +OUT_DIR=out/ +if [ -d "$OUT_DIR" ]; then + rm -rf $OUT_DIR +fi + +COMPILE_CLASSPATH="deps/compose-full-$COMPOSE_VERSION.jar:deps/skiko-jvm-runtime-$PLATFORM-$SKIKO_VERSION.jar:deps/kotlinx-coroutines-core-$COROUTINES_VERSION.jar" +RUNTIME_CLASSPATH="deps/kotlinx-collections-immutable-jvm-$COLLECTIONS_VERSION.jar:deps/kotlin-stdlib-$KOTLIN_VERSION.jar:$COMPILE_CLASSPATH" +SOURCES=$(find src/main -name "*.kt"|paste -sd " " -) +JAVA_OPTS=-Xmx1G deps/kotlinc/bin/kotlinc-jvm \ +-jvm-target 1.8 \ +-Xuse-ir \ +-Xmulti-platform \ +-Xplugin="deps/compose-compiler-hosted-$COMPOSE_VERSION.jar" \ +-cp "$COMPILE_CLASSPATH" \ +-d $OUT_DIR $SOURCES + +#jar cf result.jar -C "$OUT_DIR" . -C "src/main/resources" . +java -cp "out/:result.jar:$RUNTIME_CLASSPATH" MainKt diff --git a/tutorials/Getting_Started/main.md b/tutorials/Getting_Started/main.md new file mode 100644 index 0000000000..12725242aa --- /dev/null +++ b/tutorials/Getting_Started/main.md @@ -0,0 +1 @@ +Fill me in.