From bdcb23fbc2d549fce6100850f33c9608cd857953 Mon Sep 17 00:00:00 2001 From: Yuri Sergiichuk Date: Tue, 8 Dec 2020 14:34:58 +0200 Subject: [PATCH 01/11] Add ability to use `pub` from a custom `PUB_CACHE` location as per the `PubCache` implementation in `base`. --- buildSrc/src/main/kotlin/codegen.gradle.kts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/kotlin/codegen.gradle.kts b/buildSrc/src/main/kotlin/codegen.gradle.kts index 5dcad25767..bc235d4c37 100644 --- a/buildSrc/src/main/kotlin/codegen.gradle.kts +++ b/buildSrc/src/main/kotlin/codegen.gradle.kts @@ -22,17 +22,15 @@ import org.apache.tools.ant.taskdefs.condition.Os import java.io.File val windows = Os.isFamily(Os.FAMILY_WINDOWS) -var pubCache: String -var scriptExtension: String -if (windows) { - pubCache = "${System.getenv("LOCALAPPDATA")}/Pub/Cache/bin" - scriptExtension = ".bat" -} else { - pubCache = "${System.getProperty("user.home")}/.pub-cache/bin" - scriptExtension = "" +var pubCache: String = System.getenv("PUB_CACHE") +var scriptExtension: String = if (windows) ".bat" else "" +if (pubCache.isBlank() && windows) { + pubCache = "${System.getenv("LOCALAPPDATA")}/Pub/Cache" +} else if (pubCache.isBlank()) { + pubCache = "${System.getProperty("user.home")}/.pub-cache" } -val command = "$pubCache/dart_code_gen$scriptExtension" +val command = "$pubCache/bin/dart_code_gen$scriptExtension" if (!file(command).exists()) { logger.warn("Cannot locate `dart_code_gen` under `$command`.") From eb72af6cfb56e69f1d07b08dc0f3c31e50cce4eb Mon Sep 17 00:00:00 2001 From: Yuri Sergiichuk Date: Tue, 8 Dec 2020 14:35:23 +0200 Subject: [PATCH 02/11] Add some notes on setting up the dev env. --- README.md | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/README.md b/README.md index a25e69ba25..17fc9251be 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,110 @@ # Spine Dart Components for developing Dart client-side applications based on Spine. + +## Prerequisites + +1. [JDK 1.8][openjdk]. +2. [Dart SDK][dart] or [Flutter SDK][flutter]. + +[openjdk]: https://openjdk.java.net/install/index.html +[dart]: https://dart.dev/get-dart +[flutter]: https://flutter.dev/docs/get-started/install + +## How to configure pub + +[pub][pub] is a Dart package manager that is used by both Dart itself and Flutter. + +In order to be able to compile Protobuf messages into Dart code, one must +configure the [Dart Protoc plugin][dart-protoc] available for install via `pub`. +Please follow the steps below to configure the plugin. + +[pub]: https://dart.dev/tools/pub/cmd +[dart-protoc]: https://pub.dev/packages/protoc_plugin + +### With Dart SDK + +If you're using Dart SDK, please execute the following steps to configure +your local Path environment variable if not yet configured. + +In the snippets it is assumed that you have the Dart SDK installed at the +`~/.dart` folder. + +1. Define `DART_HOME` environment variable as follows: + + ```bash + export DART_HOME="~/.dart" + export PATH="$DART_HOME/bin:$PATH" + ``` + +2. Define `PUB_CACHE` environment variable as follows: + + The Pub cache may be available either in the user home directory or in the Dart SDK home + directory. + + ```bash + export PUB_CACHE="~/.dart/.pub_cache" + export PATH="$PUB_CACHE/bin:$PATH" + ``` + +You may want to add the above snippet to your `.bashrc` or `.zshrc` files +in order to have the Dart in available all the time. + +3. Activate Dart Protoc plugin by running the following command. + + ```bash + pub global activate protoc_plugin + ``` + + +### With Flutter SDK + +If you're using Flutter SDK, please execute the following steps to configure +your local Path environment variable if not yet configured. + +In the snippets it is assumed that you have the Flutter SDK installed at the +`~/.flutter` folder. + +1. Define `FLUTTER_HOME` environment variable as follows: + + ```bash + export FLUTTER_HOME="~/.flutter" + export PATH="$FLUTTER_HOME/bin:$PATH" + ``` + +2. Define `PUB_CACHE` environment variable as follows: + + The Pub cache may be available either in the user home directory or in the Dart SDK home + directory. + + ```bash + export PUB_CACHE="~/.flutter/.pub_cache" + export PATH="$PUB_CACHE/bin:$PATH" + ``` + +3. Create `pub` alias. + + By default, flutter provides its own `pub` reference available with `flutter pub` + command, but the tooling is expecting `pub` to be available. + + ```bash + alias pub="flutter pub" + ``` + + On Windows, you may create a `pub.bat` script with the following content and + store it under `${FLUTTER_HOME}/bin` folder: + + ```bat + @ECHO OFF + echo. + flutter pub %* + ``` + +You may want to add the above snippets to your `.bashrc` or `.zshrc` files +in order to have the Dart in available all the time. + +3. Activate Dart Protoc plugin by running the following command. + + ```bash + flutter pub global activate protoc_plugin + ``` From a701becf034f53fda709d24e1e3e0f15e64b55aa Mon Sep 17 00:00:00 2001 From: Yuri Sergiichuk Date: Tue, 8 Dec 2020 15:07:39 +0200 Subject: [PATCH 03/11] Update version. --- version.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.gradle.kts b/version.gradle.kts index 76e88e8208..713ba787b5 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -29,6 +29,6 @@ * already in the root directory. */ -val spineBaseVersion: String by extra("1.6.11") -val spineWebVersion: String by extra("1.6.6") +val spineBaseVersion: String by extra("1.6.16") +val spineWebVersion: String by extra("1.6.16") val versionToPublish: String by extra(spineBaseVersion) From 30075eb5a5858a6a6070c973b7b83dcb156ba821 Mon Sep 17 00:00:00 2001 From: Yuri Sergiichuk Date: Tue, 8 Dec 2020 15:08:57 +0200 Subject: [PATCH 04/11] Update `config`. --- .idea/codeStyles/Project.xml | 26 +++- .idea/codeStyles/codeStyleConfig.xml | 2 +- .idea/inspectionProfiles/Project_Default.xml | 33 +---- .idea/misc.xml | 21 ++- .../spine/gradle/internal/IncrementGuard.kt | 36 ++++-- .../io/spine/gradle/internal/RunBuild.kt | 16 +-- .../kotlin/io/spine/gradle/internal/deps.kt | 121 +++++++++--------- config | 2 +- 8 files changed, 144 insertions(+), 113 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index d1143f7669..5a399bd1a8 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -25,6 +25,27 @@ + + + + @@ -71,5 +92,8 @@ + + - \ No newline at end of file + diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index 79ee123c2b..0f7bc519db 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 03926c8cc3..44917ef5e3 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -74,7 +74,6 @@ - @@ -215,7 +214,6 @@ - @@ -252,7 +250,6 @@ - @@ -327,11 +324,7 @@ - - -