From 88f769d14bf5a2233fbb61a0bd52428951f26c7d Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 9 Nov 2020 14:41:38 +0200 Subject: [PATCH 01/39] Update config --- .../kotlin/io/spine/gradle/internal/deps.kt | 39 ++++++++++--------- config | 2 +- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/buildSrc/src/main/kotlin/io/spine/gradle/internal/deps.kt b/buildSrc/src/main/kotlin/io/spine/gradle/internal/deps.kt index 3e9250e7..be5d1d09 100644 --- a/buildSrc/src/main/kotlin/io/spine/gradle/internal/deps.kt +++ b/buildSrc/src/main/kotlin/io/spine/gradle/internal/deps.kt @@ -67,41 +67,41 @@ object Repos { } object Versions { - val checkerFramework = "3.3.0" - val errorProne = "2.3.4" + val checkerFramework = "3.7.1" + val errorProne = "2.4.0" val errorProneJavac = "9+181-r4173-1" // taken from here: https://github.com/tbroyer/gradle-errorprone-plugin/blob/v0.8/build.gradle.kts - val errorPronePlugin = "1.2.1" + val errorPronePlugin = "1.3.0" val pmd = "6.24.0" val checkstyle = "8.29" - val protobufPlugin = "0.8.12" - val appengineApi = "1.9.79" + val protobufPlugin = "0.8.13" + val appengineApi = "1.9.82" val appenginePlugin = "2.2.0" val findBugs = "3.0.2" - val guava = "29.0-jre" - val protobuf = "3.11.4" + val guava = "30.0-jre" + val protobuf = "3.13.0" val grpc = "1.28.1" val flogger = "0.5.1" - val junit4 = "4.12" - val junit5 = "5.6.2" - val junitPlatform = "1.6.2" - val junitPioneer = "0.4.2" - val truth = "1.0.1" + val junit4 = "4.13.1" + val junit5 = "5.7.0" + val junitPlatform = "1.7.0" + val junitPioneer = "1.0.0" + val truth = "1.1" val httpClient = "1.34.2" val apacheHttpClient = "2.1.2" val firebaseAdmin = "6.12.2" val roaster = "2.21.2.Final" val licensePlugin = "1.13" - val javaPoet = "1.12.1" - val autoService = "1.0-rc6" + val javaPoet = "1.13.0" + val autoService = "1.0-rc7" val autoCommon = "0.10" val jackson = "2.9.10.5" - val animalSniffer = "1.18" + val animalSniffer = "1.19" val apiguardian = "1.1.0" val javaxAnnotation = "1.3.2" val klaxon = "5.4" - val ouathJwt = "3.10.3" + val ouathJwt = "3.11.0" val bouncyCastlePkcs = "1.66" - val assertK = "0.22" + val assertK = "0.23" /** * Version of the SLF4J library. @@ -113,7 +113,7 @@ object Versions { * this version and force it via [forceConfiguration(..)][DependencyResolution.forceConfiguration]. */ @Deprecated("Use Flogger over SLF4J.", replaceWith = ReplaceWith("flogger")) - val slf4j = "1.7.29" + val slf4j = "1.7.30" } object GradlePlugins { @@ -312,6 +312,9 @@ object DependencyResolution { Deps.test.junit4, // Transitive dependencies of 3rd party components that we don't use directly. + "org.junit.platform:junit-platform-commons:${Versions.junitPlatform}", + "com.google.auto.value:auto-value-annotations:1.7.4", + "com.google.auto.service:auto-service-annotations:1.0-rc7", "com.google.code.gson:gson:2.8.6", "com.google.j2objc:j2objc-annotations:1.3", "org.codehaus.plexus:plexus-utils:3.3.0", diff --git a/config b/config index 087c8fb2..8ed8f640 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 087c8fb2276f8c5323ef6e986cce642a8667926b +Subproject commit 8ed8f64021dcd5bdfb27f6ee0d00bddad7f92275 From 9f5a170ee4de8d364509e7f726937b3eae811234 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 9 Nov 2020 15:07:16 +0200 Subject: [PATCH 02/39] Update Spine versions --- .../src/main/kotlin/func-test-env.gradle.kts | 27 ----- license-report.md | 105 +++++++++--------- pom.xml | 48 ++++---- version.gradle.kts | 10 +- 4 files changed, 84 insertions(+), 106 deletions(-) diff --git a/buildSrc/src/main/kotlin/func-test-env.gradle.kts b/buildSrc/src/main/kotlin/func-test-env.gradle.kts index ee3f7efd..c186f7c2 100644 --- a/buildSrc/src/main/kotlin/func-test-env.gradle.kts +++ b/buildSrc/src/main/kotlin/func-test-env.gradle.kts @@ -36,30 +36,3 @@ var spineProtocPluginDependency: Dependency? = null dependencies { spineProtocPluginDependency = "fetch"("io.spine.tools:spine-protoc-plugin:${spineBaseVersion}@jar") } - -val spineArtifactDir = file("$projectDir/.spine") - -val downloadProtocPlugin by tasks.registering { - description = "Downloads the Spine Protoc plugin for functional tests." - - doLast { - val executableJar = configurations["fetch"] - .fileCollection(spineProtocPluginDependency) - .getSingleFile() - spineArtifactDir.mkdirs() - copy { - from(executableJar) - into(spineArtifactDir) - } - } - - mustRunAfter(tasks.clean) -} - -tasks.withType(Test::class) { - dependsOn(downloadProtocPlugin) -} - -tasks.clean { - delete(spineArtifactDir) -} diff --git a/license-report.md b/license-report.md index c1f8a136..572fcb8e 100644 --- a/license-report.md +++ b/license-report.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.tools:spine-plugin:1.6.4` +# Dependencies of `io.spine.tools:spine-plugin:1.6.8` ## Runtime 1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2 @@ -10,10 +10,10 @@ 1. **Group:** com.google.code.gson **Name:** gson **Version:** 2.8.6 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_annotations **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_annotations **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_type_annotations **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_type_annotations **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) 1. **Group:** com.google.flogger **Name:** flogger **Version:** 0.5.1 @@ -32,7 +32,7 @@ * **Manifest Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.guava **Name:** guava **Version:** 29.0-jre +1. **Group:** com.google.guava **Name:** guava **Version:** 30.0-jre * **Manifest Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **POM License: Apache License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -43,19 +43,19 @@ * **POM Project URL:** [https://github.com/google/j2objc/](https://github.com/google/j2objc/) * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.protobuf **Name:** protobuf-gradle-plugin **Version:** 0.8.12 +1. **Group:** com.google.protobuf **Name:** protobuf-gradle-plugin **Version:** 0.8.13 * **POM Project URL:** [https://github.com/google/protobuf-gradle-plugin](https://github.com/google/protobuf-gradle-plugin) * **POM License: BSD 3-Clause** - [http://opensource.org/licenses/BSD-3-Clause](http://opensource.org/licenses/BSD-3-Clause) -1. **Group:** com.google.protobuf **Name:** protobuf-java **Version:** 3.11.4 +1. **Group:** com.google.protobuf **Name:** protobuf-java **Version:** 3.13.0 * **Manifest Project URL:** [https://developers.google.com/protocol-buffers/](https://developers.google.com/protocol-buffers/) * **POM License: 3-Clause BSD License** - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -1. **Group:** com.google.protobuf **Name:** protobuf-java-util **Version:** 3.11.4 +1. **Group:** com.google.protobuf **Name:** protobuf-java-util **Version:** 3.13.0 * **Manifest Project URL:** [https://developers.google.com/protocol-buffers/](https://developers.google.com/protocol-buffers/) * **POM License: 3-Clause BSD License** - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -1. **Group:** com.squareup **Name:** javapoet **Version:** 1.12.1 +1. **Group:** com.squareup **Name:** javapoet **Version:** 1.13.0 * **POM Project URL:** [http://github.com/square/javapoet/](http://github.com/square/javapoet/) * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -77,7 +77,7 @@ * **POM License: GNU General Public License, version 2 (GPL2), with the classpath exception** - [http://www.gnu.org/software/classpath/license.html](http://www.gnu.org/software/classpath/license.html) * **POM License: The MIT License** - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) -1. **Group:** org.checkerframework **Name:** checker-qual **Version:** 3.3.0 +1. **Group:** org.checkerframework **Name:** checker-qual **Version:** 3.7.1 * **Manifest License:** MIT (Not packaged) * **POM Project URL:** [https://checkerframework.org](https://checkerframework.org) * **POM License: The MIT License** - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) @@ -95,7 +95,7 @@ * **POM Project URL:** [http://jcommander.org](http://jcommander.org) * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) -1. **Group:** com.github.ben-manes.caffeine **Name:** caffeine **Version:** 2.7.0 +1. **Group:** com.github.ben-manes.caffeine **Name:** caffeine **Version:** 2.8.0 * **POM Project URL:** [https://github.com/ben-manes/caffeine](https://github.com/ben-manes/caffeine) * **POM License: Apache License, Version 2.0** - [https://www.apache.org/licenses/LICENSE-2.0.txt](https://www.apache.org/licenses/LICENSE-2.0.txt) @@ -106,7 +106,12 @@ 1. **Group:** com.google.auto **Name:** auto-common **Version:** 0.10 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.auto.value **Name:** auto-value-annotations **Version:** 1.6.3 +1. **Group:** com.google.auto.service **Name:** auto-service-annotations **Version:** 1.0-rc7 + * **POM Project URL:** [https://github.com/google/auto/tree/master/service](https://github.com/google/auto/tree/master/service) + * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group:** com.google.auto.value **Name:** auto-value-annotations **Version:** 1.7.4 + * **POM Project URL:** [https://github.com/google/auto/tree/master/value](https://github.com/google/auto/tree/master/value) * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) 1. **Group:** com.google.code.findbugs **Name:** jFormatString **Version:** 3.0.0 @@ -120,19 +125,19 @@ 1. **Group:** com.google.code.gson **Name:** gson **Version:** 2.8.6 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_annotation **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_annotation **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_annotations **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_annotations **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_check_api **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_check_api **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_core **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_core **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.errorprone **Name:** error_prone_type_annotations **Version:** 2.3.4 +1. **Group:** com.google.errorprone **Name:** error_prone_type_annotations **Version:** 2.4.0 * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) 1. **Group:** com.google.errorprone **Name:** javac **Version:** 9+181-r4173-1 @@ -155,11 +160,11 @@ * **Manifest Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.guava **Name:** guava **Version:** 29.0-jre +1. **Group:** com.google.guava **Name:** guava **Version:** 30.0-jre * **Manifest Project URL:** [https://github.com/google/guava/](https://github.com/google/guava/) * **POM License: Apache License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.guava **Name:** guava-testlib **Version:** 29.0-jre +1. **Group:** com.google.guava **Name:** guava-testlib **Version:** 30.0-jre * **POM License: Apache License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) 1. **Group:** com.google.guava **Name:** listenablefuture **Version:** 9999.0-empty-to-avoid-conflict-with-guava @@ -169,35 +174,35 @@ * **POM Project URL:** [https://github.com/google/j2objc/](https://github.com/google/j2objc/) * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.protobuf **Name:** protobuf-gradle-plugin **Version:** 0.8.12 +1. **Group:** com.google.protobuf **Name:** protobuf-gradle-plugin **Version:** 0.8.13 * **POM Project URL:** [https://github.com/google/protobuf-gradle-plugin](https://github.com/google/protobuf-gradle-plugin) * **POM License: BSD 3-Clause** - [http://opensource.org/licenses/BSD-3-Clause](http://opensource.org/licenses/BSD-3-Clause) -1. **Group:** com.google.protobuf **Name:** protobuf-java **Version:** 3.11.4 +1. **Group:** com.google.protobuf **Name:** protobuf-java **Version:** 3.13.0 * **Manifest Project URL:** [https://developers.google.com/protocol-buffers/](https://developers.google.com/protocol-buffers/) * **POM License: 3-Clause BSD License** - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -1. **Group:** com.google.protobuf **Name:** protobuf-java-util **Version:** 3.11.4 +1. **Group:** com.google.protobuf **Name:** protobuf-java-util **Version:** 3.13.0 * **Manifest Project URL:** [https://developers.google.com/protocol-buffers/](https://developers.google.com/protocol-buffers/) * **POM License: 3-Clause BSD License** - [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) -1. **Group:** com.google.truth **Name:** truth **Version:** 1.0.1 +1. **Group:** com.google.truth **Name:** truth **Version:** 1.1 * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.truth.extensions **Name:** truth-java8-extension **Version:** 1.0.1 +1. **Group:** com.google.truth.extensions **Name:** truth-java8-extension **Version:** 1.1 * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.truth.extensions **Name:** truth-liteproto-extension **Version:** 1.0.1 +1. **Group:** com.google.truth.extensions **Name:** truth-liteproto-extension **Version:** 1.1 * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.google.truth.extensions **Name:** truth-proto-extension **Version:** 1.0.1 +1. **Group:** com.google.truth.extensions **Name:** truth-proto-extension **Version:** 1.1 * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) 1. **Group:** com.googlecode.java-diff-utils **Name:** diffutils **Version:** 1.3.0 * **POM Project URL:** [http://code.google.com/p/java-diff-utils/](http://code.google.com/p/java-diff-utils/) * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) -1. **Group:** com.squareup **Name:** javapoet **Version:** 1.12.1 +1. **Group:** com.squareup **Name:** javapoet **Version:** 1.13.0 * **POM Project URL:** [http://github.com/square/javapoet/](http://github.com/square/javapoet/) * **POM License: Apache 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -214,7 +219,7 @@ * **POM Project URL:** [http://jcp.org/en/jsr/detail?id=250](http://jcp.org/en/jsr/detail?id=250) * **POM License: CDDL + GPLv2 with classpath exception** - [https://github.com/javaee/javax.annotation/blob/master/LICENSE](https://github.com/javaee/javax.annotation/blob/master/LICENSE) -1. **Group:** junit **Name:** junit **Version:** 4.12 +1. **Group:** junit **Name:** junit **Version:** 4.13.1 * **POM Project URL:** [http://junit.org](http://junit.org) * **POM License: Eclipse Public License 1.0** - [http://www.eclipse.org/legal/epl-v10.html](http://www.eclipse.org/legal/epl-v10.html) @@ -253,18 +258,12 @@ * **POM License: GNU General Public License, version 2 (GPL2), with the classpath exception** - [http://www.gnu.org/software/classpath/license.html](http://www.gnu.org/software/classpath/license.html) * **POM License: The MIT License** - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) -1. **Group:** org.checkerframework **Name:** checker-qual **Version:** 3.3.0 +1. **Group:** org.checkerframework **Name:** checker-qual **Version:** 3.7.1 * **Manifest License:** MIT (Not packaged) * **POM Project URL:** [https://checkerframework.org](https://checkerframework.org) * **POM License: The MIT License** - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) -1. **Group:** org.checkerframework **Name:** dataflow **Version:** 3.0.0 - * **Manifest License:** (GPL-2.0-only WITH Classpath-exception-2.0) (Not packaged) - * **POM Project URL:** [https://checkerframework.org](https://checkerframework.org) - * **POM License: GNU General Public License, version 2 (GPL2), with the classpath exception** - [http://www.gnu.org/software/classpath/license.html](http://www.gnu.org/software/classpath/license.html) - * **POM License: The MIT License** - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) - -1. **Group:** org.checkerframework **Name:** javacutil **Version:** 3.0.0 +1. **Group:** org.checkerframework **Name:** dataflow-shaded **Version:** 3.1.2 * **Manifest License:** (GPL-2.0-only WITH Classpath-exception-2.0) (Not packaged) * **POM Project URL:** [https://checkerframework.org](https://checkerframework.org) * **POM License: GNU General Public License, version 2 (GPL2), with the classpath exception** - [http://www.gnu.org/software/classpath/license.html](http://www.gnu.org/software/classpath/license.html) @@ -284,24 +283,24 @@ * **POM License: Eclipse Public License version 1.0** - [http://www.eclipse.org/legal/epl-v10.html](http://www.eclipse.org/legal/epl-v10.html) * **POM License: Public Domain** - [http://repository.jboss.org/licenses/cc0-1.0.txt](http://repository.jboss.org/licenses/cc0-1.0.txt) -1. **Group:** org.junit **Name:** junit-bom **Version:** 5.6.2 **No license information found** -1. **Group:** org.junit.jupiter **Name:** junit-jupiter-api **Version:** 5.6.2 +1. **Group:** org.junit **Name:** junit-bom **Version:** 5.7.0 **No license information found** +1. **Group:** org.junit.jupiter **Name:** junit-jupiter-api **Version:** 5.7.0 * **POM Project URL:** [https://junit.org/junit5/](https://junit.org/junit5/) * **POM License: Eclipse Public License v2.0** - [https://www.eclipse.org/legal/epl-v20.html](https://www.eclipse.org/legal/epl-v20.html) -1. **Group:** org.junit.jupiter **Name:** junit-jupiter-engine **Version:** 5.6.2 +1. **Group:** org.junit.jupiter **Name:** junit-jupiter-engine **Version:** 5.7.0 * **POM Project URL:** [https://junit.org/junit5/](https://junit.org/junit5/) * **POM License: Eclipse Public License v2.0** - [https://www.eclipse.org/legal/epl-v20.html](https://www.eclipse.org/legal/epl-v20.html) -1. **Group:** org.junit.jupiter **Name:** junit-jupiter-params **Version:** 5.6.2 +1. **Group:** org.junit.jupiter **Name:** junit-jupiter-params **Version:** 5.7.0 * **POM Project URL:** [https://junit.org/junit5/](https://junit.org/junit5/) * **POM License: Eclipse Public License v2.0** - [https://www.eclipse.org/legal/epl-v20.html](https://www.eclipse.org/legal/epl-v20.html) -1. **Group:** org.junit.platform **Name:** junit-platform-commons **Version:** 1.6.2 +1. **Group:** org.junit.platform **Name:** junit-platform-commons **Version:** 1.7.0 * **POM Project URL:** [https://junit.org/junit5/](https://junit.org/junit5/) * **POM License: Eclipse Public License v2.0** - [https://www.eclipse.org/legal/epl-v20.html](https://www.eclipse.org/legal/epl-v20.html) -1. **Group:** org.junit.platform **Name:** junit-platform-engine **Version:** 1.6.2 +1. **Group:** org.junit.platform **Name:** junit-platform-engine **Version:** 1.7.0 * **POM Project URL:** [https://junit.org/junit5/](https://junit.org/junit5/) * **POM License: Eclipse Public License v2.0** - [https://www.eclipse.org/legal/epl-v20.html](https://www.eclipse.org/legal/epl-v20.html) @@ -317,25 +316,25 @@ * **POM License: BSD-3-Clause** - [https://asm.ow2.io/license.html](https://asm.ow2.io/license.html) * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group:** org.ow2.asm **Name:** asm **Version:** 9.0 + * **Manifest Project URL:** [http://asm.ow2.org](http://asm.ow2.org) + * **Manifest License:** BSD-3-Clause;link=https://asm.ow2.io/LICENSE.txt (Not packaged) + * **POM Project URL:** [http://asm.ow2.io/](http://asm.ow2.io/) + * **POM License: BSD-3-Clause** - [https://asm.ow2.io/license.html](https://asm.ow2.io/license.html) + * **POM License: The Apache Software License, Version 2.0** - [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group:** org.pcollections **Name:** pcollections **Version:** 2.1.2 * **POM Project URL:** [http://pcollections.org](http://pcollections.org) * **POM License: The MIT License** - [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php) -1. **Group:** org.plumelib **Name:** plume-util **Version:** 1.0.6 - * **POM Project URL:** [https://github.com/plume-lib/plume-util](https://github.com/plume-lib/plume-util) - * **POM License: MIT License** - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) - -1. **Group:** org.plumelib **Name:** reflection-util **Version:** 0.0.2 - * **POM Project URL:** [https://github.com/plume-lib/reflection-util](https://github.com/plume-lib/reflection-util) - * **POM License: MIT License** - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) - -1. **Group:** org.plumelib **Name:** require-javadoc **Version:** 0.1.0 - * **POM Project URL:** [https://github.com/plume-lib/require-javadoc](https://github.com/plume-lib/require-javadoc) - * **POM License: MIT License** - [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) +1. **Group:** org.threeten **Name:** threeten-extra **Version:** 1.5.0 + * **Manifest Project URL:** [https://www.threeten.org](https://www.threeten.org) + * **POM Project URL:** [https://www.threeten.org/threeten-extra](https://www.threeten.org/threeten-extra) + * **POM License: BSD 3-clause** - [https://raw.githubusercontent.com/ThreeTen/threeten-extra/master/LICENSE.txt](https://raw.githubusercontent.com/ThreeTen/threeten-extra/master/LICENSE.txt) The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Oct 22 13:45:31 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Mon Nov 09 15:00:12 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 22374cfa..288efbc9 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-bootstrap -1.6.4 +1.6.8 2015 @@ -28,91 +28,97 @@ all modules and does not describe the project structure per-subproject. com.google.errorprone error_prone_annotations - 2.3.4 + 2.4.0 compile com.google.errorprone error_prone_type_annotations - 2.3.4 + 2.4.0 compile com.google.guava guava - 29.0-jre + 30.0-jre compile com.google.protobuf protobuf-gradle-plugin - 0.8.12 + 0.8.13 compile io.spine spine-base - 1.6.4 + 1.6.8 compile io.spine.tools spine-model-compiler - 1.6.4 + 1.6.8 compile io.spine.tools spine-plugin-base - 1.6.4 + 1.6.8 + compile + + + io.spine.tools + spine-proto-dart-plugin + 1.6.8 compile io.spine.tools spine-proto-js-plugin - 1.6.4 + 1.6.8 compile org.checkerframework checker-qual - 3.3.0 + 3.7.1 compile com.google.guava guava-testlib - 29.0-jre + 30.0-jre test com.google.truth truth - 1.0.1 + 1.1 test com.google.truth.extensions truth-java8-extension - 1.0.1 + 1.1 test com.google.truth.extensions truth-proto-extension - 1.0.1 + 1.1 test io.spine spine-testlib - 1.6.4 + 1.6.8 test io.spine.tools spine-plugin-testlib - 1.6.4 + 1.6.8 test @@ -124,25 +130,25 @@ all modules and does not describe the project structure per-subproject. org.junit.jupiter junit-jupiter-api - 5.6.2 + 5.7.0 test org.junit.jupiter junit-jupiter-engine - 5.6.2 + 5.7.0 test org.junit.jupiter junit-jupiter-params - 5.6.2 + 5.7.0 test com.google.errorprone error_prone_core - 2.3.4 + 2.4.0 com.google.errorprone @@ -152,7 +158,7 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-protoc-plugin - 1.6.4 + 1.6.8 net.sourceforge.pmd diff --git a/version.gradle.kts b/version.gradle.kts index 9901ff54..41f5770b 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -29,9 +29,9 @@ * already in the root directory. */ -val spineBaseVersion: String by extra("1.6.4") +val spineBaseVersion: String by extra("1.6.8") val spineTimeVersion: String by extra("1.6.0") -val spineVersion: String by extra("1.6.4") -val spineWebVersion: String by extra("1.6.0") -val spineGCloudVersion: String by extra("1.6.0") -val pluginVersion: String by extra("1.6.4") +val spineVersion: String by extra("1.6.6") +val spineWebVersion: String by extra("1.6.6") +val spineGCloudVersion: String by extra("1.6.6") +val pluginVersion: String by extra("1.6.8") From a272c6aefe589fa985d8e33f847a74c08cee0ad9 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 9 Nov 2020 15:07:30 +0200 Subject: [PATCH 03/39] Add `DartExtension` --- plugin/build.gradle.kts | 1 + .../tools/gradle/bootstrap/DartExtension.java | 72 +++++++++++++++++++ .../tools/gradle/bootstrap/Extension.java | 34 ++++++++- .../gradle/bootstrap/JavaScriptExtension.java | 2 +- .../gradle/bootstrap/SpinePluginTarget.java | 9 +++ .../tools/gradle/protoc/ProtocPlugin.java | 1 + 6 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index d0b3054f..82baa02e 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { implementation("io.spine.tools:spine-plugin-base:$spineBaseVersion") implementation("io.spine.tools:spine-model-compiler:$spineBaseVersion") implementation("io.spine.tools:spine-proto-js-plugin:$spineBaseVersion") + implementation("io.spine.tools:spine-proto-dart-plugin:$spineBaseVersion") testImplementation("io.spine:spine-testlib:$spineBaseVersion") testImplementation("io.spine.tools:spine-plugin-testlib:$spineBaseVersion") diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java new file mode 100644 index 00000000..a7d729eb --- /dev/null +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -0,0 +1,72 @@ +/* + * Copyright 2020, TeamDev. All rights reserved. + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.gradle.bootstrap; + +import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper; +import io.spine.tools.gradle.protoc.ProtocPlugin; + +import static io.spine.tools.gradle.protoc.ProtocPlugin.Name.dart; + +final class DartExtension extends CodeGenExtension { + + DartExtension(Builder builder) { + super(builder); + } + + @OverridingMethodsMustInvokeSuper + @Override + void enableGeneration() { + super.enableGeneration(); + pluginTarget().applyProtoDartPlugin(); + } + + /** + * Creates a new instance of {@code Builder} for {@code DartExtension} instances. + * + * @return new instance of {@code Builder} + */ + static Builder newBuilder() { + return new Builder(); + } + + /** + * A builder for the {@code DartExtension} instances. + */ + static final class Builder extends CodeGenExtension.Builder { + + /** + * Prevents direct instantiation. + */ + private Builder() { + super(ProtocPlugin.called(dart)); + } + + @Override + Builder self() { + return this; + } + + @Override + DartExtension doBuild() { + return new DartExtension(this); + } + } +} diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/Extension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/Extension.java index 954c97da..50e11dac 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/Extension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/Extension.java @@ -54,17 +54,17 @@ public final class Extension { private final JavaExtension java; private final JavaScriptExtension javaScript; + private final DartExtension dart; private final ModelExtension modelExtension; private final ArtifactSnapshot artifacts; - private final Project project; - private boolean javaEnabled = false; - + private boolean javaEnabled; private boolean forceDependencies; private Extension(Builder builder) { this.java = builder.buildJavaExtension(); this.javaScript = builder.buildJavaScriptExtension(); + this.dart = builder.buildDartExtension(); this.modelExtension = builder.buildModelExtension(); this.project = builder.project; this.artifacts = builder.artifacts; @@ -139,6 +139,22 @@ public JavaScriptExtension enableJavaScript() { return javaScript; } + /** + * Marks this project as a Dart project and configures the Dart code generation. + * + *

Enables the Dart code generation from Protobuf. If the {@code spine-proto-dart-plugin} is + * not applied to this project, applies it immediately. + */ + @CanIgnoreReturnValue + public DartExtension enableDart() { + dart.enableGeneration(); + if (!this.javaEnabled) { + toggleJavaTasks(false); + } + disableTransitiveProtos(); + return dart; + } + /** * Marks this project as a project that contains the Protobuf model definition. * @@ -336,6 +352,18 @@ private JavaScriptExtension buildJavaScriptExtension() { return javaScriptExtension; } + private DartExtension buildDartExtension() { + DartExtension dartExtension = DartExtension + .newBuilder() + .setProject(project) + .setDependant(dependencyTarget) + .setPluginTarget(pluginTarget) + .setProtobufGenerator(generator) + .setArtifactSnapshot(artifacts) + .build(); + return dartExtension; + } + private ModelExtension buildModelExtension() { ModelExtension modelExtension = ModelExtension .newBuilder() diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/JavaScriptExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/JavaScriptExtension.java index eaf07488..8903442b 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/JavaScriptExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/JavaScriptExtension.java @@ -28,7 +28,7 @@ /** * An extension which configures JavaScript code generation. */ -public final class JavaScriptExtension extends CodeGenExtension { +final class JavaScriptExtension extends CodeGenExtension { private static final String IMPORT_STYLE_OPTION = "import_style=commonjs"; diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java index 95ea6895..a0c8fe2b 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java @@ -21,6 +21,7 @@ package io.spine.tools.gradle.bootstrap; import com.google.protobuf.gradle.ProtobufPlugin; +import io.spine.generate.dart.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; import io.spine.tools.gradle.GradlePlugin; import io.spine.tools.gradle.PluginScript; @@ -105,6 +106,14 @@ public void applyProtoJsPlugin() { apply(plugin); } + /** + * Applies the {@link ProtoDartPlugin}. + */ + public void applyProtoDartPlugin() { + GradlePlugin plugin = GradlePlugin.implementedIn(ProtoDartPlugin.class); + apply(plugin); + } + /** * Checks if the {@code idea} plugin is applied to this project. */ diff --git a/plugin/src/main/java/io/spine/tools/gradle/protoc/ProtocPlugin.java b/plugin/src/main/java/io/spine/tools/gradle/protoc/ProtocPlugin.java index 5f50cfa9..59f4a3df 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/protoc/ProtocPlugin.java +++ b/plugin/src/main/java/io/spine/tools/gradle/protoc/ProtocPlugin.java @@ -71,6 +71,7 @@ public void removeFrom(NamedDomainObjectContainer Date: Mon, 9 Nov 2020 15:07:53 +0200 Subject: [PATCH 04/39] Add `CODE_OF_CONDUCT.md` to git --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..0a1b5f29 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +developers@spine.io. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From 5557a90861c74ad8c8701fcbee07f267ad012c3b Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 9 Nov 2020 15:20:02 +0200 Subject: [PATCH 05/39] Remove redundant config --- .../src/main/kotlin/func-test-env.gradle.kts | 38 ------------------- license-report.md | 2 +- plugin/build.gradle.kts | 1 - pom.xml | 5 --- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/func-test-env.gradle.kts diff --git a/buildSrc/src/main/kotlin/func-test-env.gradle.kts b/buildSrc/src/main/kotlin/func-test-env.gradle.kts deleted file mode 100644 index c186f7c2..00000000 --- a/buildSrc/src/main/kotlin/func-test-env.gradle.kts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -plugins { - base -} - -/* - * Creates a configuration named `fetch`. - * - * The configuration is used in order to download artifacts. The artifacts are NOT added into - * the application classpath. - */ -configurations { create("fetch") } - -val spineBaseVersion: String by extra - -var spineProtocPluginDependency: Dependency? = null -dependencies { - spineProtocPluginDependency = "fetch"("io.spine.tools:spine-protoc-plugin:${spineBaseVersion}@jar") -} diff --git a/license-report.md b/license-report.md index 572fcb8e..3fd617de 100644 --- a/license-report.md +++ b/license-report.md @@ -337,4 +337,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Nov 09 15:00:12 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Mon Nov 09 15:10:12 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 82baa02e..d2160da6 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -27,7 +27,6 @@ plugins { id("com.gradle.plugin-publish").version("0.12.0") id("com.github.johnrengelman.shadow").version("6.0.0") `bootstrap-plugin` - `func-test-env` `prepare-config-resources` } diff --git a/pom.xml b/pom.xml index 288efbc9..018ba784 100644 --- a/pom.xml +++ b/pom.xml @@ -155,11 +155,6 @@ all modules and does not describe the project structure per-subproject. javac 9+181-r4173-1 - - io.spine.tools - spine-protoc-plugin - 1.6.8 - net.sourceforge.pmd pmd-java From e2f11119a438d32b0230c3470dccaea5c9bf63eb Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 10 Nov 2020 13:32:50 +0200 Subject: [PATCH 06/39] Add Gradle tasks to enhance generated Dart code --- license-report.md | 2 +- .../tools/gradle/bootstrap/DartExtension.java | 76 ++++++++++++++++++- .../tools/gradle/bootstrap/DartTaskName.java | 29 +++++++ .../spine/tools/gradle/config/PubCache.java | 51 +++++++++++++ 4 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java create mode 100644 plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java diff --git a/license-report.md b/license-report.md index 3fd617de..2fe1d560 100644 --- a/license-report.md +++ b/license-report.md @@ -337,4 +337,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Nov 09 15:10:12 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Nov 10 13:28:36 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index a7d729eb..758f250e 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -21,14 +21,37 @@ package io.spine.tools.gradle.bootstrap; import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper; +import io.spine.generate.dart.Extension; +import io.spine.tools.gradle.TaskName; +import io.spine.tools.gradle.config.PubCache; import io.spine.tools.gradle.protoc.ProtocPlugin; +import org.apache.tools.ant.taskdefs.condition.Os; +import org.gradle.api.Project; +import org.gradle.api.Task; +import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.provider.Property; +import org.gradle.api.tasks.Exec; +import org.gradle.api.tasks.TaskContainer; +import java.nio.file.Path; + +import static io.spine.tools.gradle.BaseTaskName.assemble; +import static io.spine.tools.gradle.bootstrap.DartTaskName.generateDart; +import static io.spine.tools.gradle.bootstrap.DartTaskName.generateTestDart; import static io.spine.tools.gradle.protoc.ProtocPlugin.Name.dart; +import static java.nio.file.Files.exists; +import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS; +/** + * An extension which configures JavaScript code generation. + */ final class DartExtension extends CodeGenExtension { - DartExtension(Builder builder) { + private final Project project; + + private DartExtension(Builder builder) { super(builder); + this.project = builder.project(); } @OverridingMethodsMustInvokeSuper @@ -36,6 +59,57 @@ final class DartExtension extends CodeGenExtension { void enableGeneration() { super.enableGeneration(); pluginTarget().applyProtoDartPlugin(); + Extension protoDart = project.getExtensions() + .getByType(Extension.class); + Task mainTask = createTask(generateDart, + protoDart.getMainDescriptorSet(), + protoDart.getLibDir()); + Task testTask = createTask(generateTestDart, + protoDart.getTestDescriptorSet(), + protoDart.getTestDir()); + Task assembleTask = project.getTasks() + .getByName(assemble.name()); + assembleTask.dependsOn(mainTask, testTask); + testTask.shouldRunAfter(mainTask); + } + + private Task createTask(TaskName name, + Property descriptorFile, + DirectoryProperty dartDir) { + TaskContainer tasks = project.getTasks(); + Task foundTask = tasks.findByName(name.name()); + if (foundTask != null) { + return foundTask; + } + Exec task = tasks.create(name.name(), Exec.class); + task.getInputs() + .file(descriptorFile); + project.afterEvaluate(p -> { + Path command = dartCodeGenCommand(); + task.commandLine( + command, + "--descriptor", p.file(descriptorFile) + .getAbsolutePath(), + "--destination", dartDir.file("types.dart") + .get() + .getAsFile() + .getAbsolutePath(), + "--standard-types", "spine_client", + "--import_prefix", "." + ); + }); + return task; + } + + private Path dartCodeGenCommand() { + String extension = Os.isFamily(FAMILY_WINDOWS) ? ".bat" : ""; + Path command = PubCache.location().resolve("dart_code_gen" + extension); + if (exists(command)) { + _warn().log("Cannot locate `dart_code_gen` under `%s`. " + + "To install, run `pub global activate dart_code_gen`.", + command); + } + return command; } /** diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java new file mode 100644 index 00000000..3d350026 --- /dev/null +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java @@ -0,0 +1,29 @@ +/* + * Copyright 2020, TeamDev. All rights reserved. + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.gradle.bootstrap; + +import io.spine.tools.gradle.TaskName; + +public enum DartTaskName implements TaskName { + + generateDart, + generateTestDart +} diff --git a/plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java b/plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java new file mode 100644 index 00000000..4d292ba6 --- /dev/null +++ b/plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java @@ -0,0 +1,51 @@ +/* + * Copyright 2020, TeamDev. All rights reserved. + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.gradle.config; + +import org.apache.tools.ant.taskdefs.condition.Os; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS; + +public final class PubCache { + + private static final Path location = findCache(); + + private static Path findCache() { + String pubCache; + if (Os.isFamily(FAMILY_WINDOWS)) { + @SuppressWarnings("CallToSystemGetenv") + String localAppData = System.getenv("LOCALAPPDATA"); + pubCache = localAppData + "/Pub/Cache/bin"; + } else { + @SuppressWarnings("AccessOfSystemProperties") + String userHome = System.getProperty("user.home"); + pubCache = userHome + "/.pub-cache/bin"; + } + return Paths.get(pubCache); + } + + public static Path location() { + return location; + } +} From 01a083043a4bf207b3d374b9dd5f63637be9be11 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Thu, 12 Nov 2020 14:45:26 +0200 Subject: [PATCH 07/39] Add `LICENSE` --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8dada3ed --- /dev/null +++ b/LICENSE @@ -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 {yyyy} {name of copyright owner} + + 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. From 4bb51fd1d1e35cfe9cc3cc9fed3829cbc18630c8 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Thu, 12 Nov 2020 15:34:05 +0200 Subject: [PATCH 08/39] Add a test for `enableDart()` --- license-report.md | 2 +- .../tools/gradle/bootstrap/DartExtension.java | 44 +++++++++++-------- .../func/SpineBootstrapPluginTest.java | 28 ++++++++++++ 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/license-report.md b/license-report.md index 2fe1d560..d85a7bad 100644 --- a/license-report.md +++ b/license-report.md @@ -337,4 +337,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 10 13:28:36 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Thu Nov 12 14:09:09 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index 758f250e..20512297 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -36,6 +36,8 @@ import java.nio.file.Path; import static io.spine.tools.gradle.BaseTaskName.assemble; +import static io.spine.tools.gradle.ProtobufTaskName.generateProto; +import static io.spine.tools.gradle.ProtobufTaskName.generateTestProto; import static io.spine.tools.gradle.bootstrap.DartTaskName.generateDart; import static io.spine.tools.gradle.bootstrap.DartTaskName.generateTestDart; import static io.spine.tools.gradle.protoc.ProtocPlugin.Name.dart; @@ -67,8 +69,11 @@ void enableGeneration() { Task testTask = createTask(generateTestDart, protoDart.getTestDescriptorSet(), protoDart.getTestDir()); - Task assembleTask = project.getTasks() - .getByName(assemble.name()); + Task assembleTask = project.getTasks().getByName(assemble.name()); + project.afterEvaluate((p) -> { + mainTask.dependsOn(generateProto.name()); + testTask.dependsOn(generateTestProto.name()); + }); assembleTask.dependsOn(mainTask, testTask); testTask.shouldRunAfter(mainTask); } @@ -82,29 +87,30 @@ private Task createTask(TaskName name, return foundTask; } Exec task = tasks.create(name.name(), Exec.class); - task.getInputs() - .file(descriptorFile); - project.afterEvaluate(p -> { - Path command = dartCodeGenCommand(); - task.commandLine( - command, - "--descriptor", p.file(descriptorFile) - .getAbsolutePath(), - "--destination", dartDir.file("types.dart") - .get() - .getAsFile() - .getAbsolutePath(), - "--standard-types", "spine_client", - "--import_prefix", "." - ); - }); + project.afterEvaluate(p -> setUpTask(task, dartDir, descriptorFile)); + task.getOutputs().upToDateWhen(t -> project.file(descriptorFile).exists()); return task; } + private void setUpTask(Exec task, DirectoryProperty dartDir, Property descriptorFile) { + Path command = dartCodeGenCommand(); + task.commandLine( + command, + "--descriptor", project.file(descriptorFile) + .getAbsolutePath(), + "--destination", dartDir.file("types.dart") + .get() + .getAsFile() + .getAbsolutePath(), + "--standard-types", "spine_client", + "--import-prefix", "." + ); + } + private Path dartCodeGenCommand() { String extension = Os.isFamily(FAMILY_WINDOWS) ? ".bat" : ""; Path command = PubCache.location().resolve("dart_code_gen" + extension); - if (exists(command)) { + if (!exists(command)) { _warn().log("Cannot locate `dart_code_gen` under `%s`. " + "To install, run `pub global activate dart_code_gen`.", command); diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java index 375e4f8b..a781b387 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java @@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.truth.IterableSubject; +import com.google.common.truth.Truth8; import io.spine.code.proto.FileDescriptors; import io.spine.testing.SlowTest; import io.spine.tools.gradle.testing.GradleProject; @@ -134,6 +135,17 @@ void generateJs() { assertThat(jsFileNames).contains("roller_coaster_pb.js"); } + @Test + @DisplayName("generate Dart if requested") + void generateDart() { + configureDartGeneration(); + GradleProject project = this.project.build(); + project.executeTask(build); + + Collection dartFileNames = generatedDartFileNames(); + assertThat(dartFileNames).contains("roller_coaster_pb.js"); + } + @Test @DisplayName("generate an `index.js` file") void generateIndexJs() { @@ -280,6 +292,12 @@ private void configureJsGeneration() { ); } + private void configureDartGeneration() { + writeConfigGradle( + "spine.enableDart()" + ); + } + @SuppressWarnings("CheckReturnValue") private void configureJavaClient() { writeConfigGradle( @@ -412,4 +430,14 @@ private Collection generatedJsFileNames() { ImmutableSet packageContents = ImmutableSet.copyOf(compiledJsDir.list()); return packageContents; } + + private Collection generatedDartFileNames() { + Path libDir = projectDir.resolve("lib"); + File libDirFile = libDir.toFile(); + assertTrue(libDirFile.exists()); + assertTrue(libDirFile.isDirectory()); + @SuppressWarnings("ConstantConditions") + ImmutableSet packageContents = ImmutableSet.copyOf(libDirFile.list()); + return packageContents; + } } From 79eda9d479a11150f965facbf8d38dd3870aa7ee Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 16:19:51 +0200 Subject: [PATCH 09/39] Use an abstract task instead of `Exec` and update a test --- license-report.md | 7 +-- .../tools/gradle/bootstrap/DartExtension.java | 57 +++++++++++++++---- .../func/SpineBootstrapPluginTest.java | 18 ++++-- pom.xml | 16 +++--- version.gradle.kts | 4 +- 5 files changed, 72 insertions(+), 30 deletions(-) diff --git a/license-report.md b/license-report.md index d85a7bad..a693f902 100644 --- a/license-report.md +++ b/license-report.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.tools:spine-plugin:1.6.8` +# Dependencies of `io.spine.tools:spine-plugin:1.6.10` ## Runtime 1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2 @@ -269,9 +269,6 @@ * **POM License: GNU General Public License, version 2 (GPL2), with the classpath exception** - [http://www.gnu.org/software/classpath/license.html](http://www.gnu.org/software/classpath/license.html) * **POM License: The MIT License** - [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) -1. **Group:** org.hamcrest **Name:** hamcrest-all **Version:** 1.3 - * **POM License: New BSD License** - [http://www.opensource.org/licenses/bsd-license.php](http://www.opensource.org/licenses/bsd-license.php) - 1. **Group:** org.hamcrest **Name:** hamcrest-core **Version:** 1.3 * **POM License: New BSD License** - [http://www.opensource.org/licenses/bsd-license.php](http://www.opensource.org/licenses/bsd-license.php) @@ -337,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Nov 12 14:09:09 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri Nov 13 16:10:40 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index 20512297..8f6498ae 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -20,19 +20,22 @@ package io.spine.tools.gradle.bootstrap; -import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Joiner; import io.spine.generate.dart.Extension; import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.config.PubCache; import io.spine.tools.gradle.protoc.ProtocPlugin; import org.apache.tools.ant.taskdefs.condition.Os; +import org.gradle.api.GradleException; import org.gradle.api.Project; import org.gradle.api.Task; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.provider.Property; -import org.gradle.api.tasks.Exec; import org.gradle.api.tasks.TaskContainer; +import javax.annotation.OverridingMethodsMustInvokeSuper; +import java.io.IOException; import java.nio.file.Path; import static io.spine.tools.gradle.BaseTaskName.assemble; @@ -41,13 +44,18 @@ import static io.spine.tools.gradle.bootstrap.DartTaskName.generateDart; import static io.spine.tools.gradle.bootstrap.DartTaskName.generateTestDart; import static io.spine.tools.gradle.protoc.ProtocPlugin.Name.dart; +import static java.lang.String.format; import static java.nio.file.Files.exists; import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS; /** * An extension which configures JavaScript code generation. */ -final class DartExtension extends CodeGenExtension { +@VisibleForTesting // Would be package private, but needed for integration tests. +public final class DartExtension extends CodeGenExtension { + + public static final String TYPES_FILE = "types.dart"; + private static final Joiner commandJoiner = Joiner.on(' '); private final Project project; @@ -86,25 +94,52 @@ private Task createTask(TaskName name, if (foundTask != null) { return foundTask; } - Exec task = tasks.create(name.name(), Exec.class); - project.afterEvaluate(p -> setUpTask(task, dartDir, descriptorFile)); - task.getOutputs().upToDateWhen(t -> project.file(descriptorFile).exists()); + Task task = tasks.create(name.name()); + task.doLast(t -> runDartTool(descriptorFile, dartDir)); return task; } - private void setUpTask(Exec task, DirectoryProperty dartDir, Property descriptorFile) { + private void runDartTool(Property descriptorFile, DirectoryProperty dartDir) { + if (project.file(descriptorFile).exists()) { + @SuppressWarnings("UseOfProcessBuilder") + ProcessBuilder processBuilder = buildDartToolProcess(descriptorFile, dartDir); + int exitCode; + try { + Process dartToolProcess = processBuilder.start(); + exitCode = dartToolProcess.waitFor(); + } catch (IOException | InterruptedException e) { + throw new GradleException("Failed to execute `dart_code_gen`.", e); + } + if (exitCode != 0) { + throw onProcessError(processBuilder, exitCode); + } + } + } + + private ProcessBuilder buildDartToolProcess(Property descriptorFile, + DirectoryProperty dartDir) { Path command = dartCodeGenCommand(); - task.commandLine( - command, + @SuppressWarnings("UseOfProcessBuilder") + ProcessBuilder processBuilder = new ProcessBuilder( + command.toString(), "--descriptor", project.file(descriptorFile) .getAbsolutePath(), - "--destination", dartDir.file("types.dart") + "--destination", dartDir.file(TYPES_FILE) .get() .getAsFile() .getAbsolutePath(), "--standard-types", "spine_client", "--import-prefix", "." - ); + ).inheritIO(); + return processBuilder; + } + + private static GradleException onProcessError( + @SuppressWarnings("UseOfProcessBuilder") ProcessBuilder processBuilder, + int exitCode + ) { + String command = commandJoiner.join(processBuilder.command()); + throw new GradleException(format("Command `%s` exited with code %s.", command, exitCode)); } private Path dartCodeGenCommand() { diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java index a781b387..68345ece 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.truth.IterableSubject; -import com.google.common.truth.Truth8; import io.spine.code.proto.FileDescriptors; import io.spine.testing.SlowTest; import io.spine.tools.gradle.testing.GradleProject; @@ -41,6 +40,7 @@ import static com.google.common.truth.Truth.assertThat; import static io.spine.tools.gradle.BaseTaskName.build; import static io.spine.tools.gradle.ProtoJsTaskName.generateJsonParsers; +import static io.spine.tools.gradle.bootstrap.DartExtension.TYPES_FILE; import static java.nio.file.Files.exists; import static java.util.Collections.emptySet; import static org.gradle.testkit.runner.TaskOutcome.SUCCESS; @@ -113,7 +113,8 @@ void applyModelCompiler() { project.executeTask(build); Collection resourceFiles = assembledResources(); - String projectDir = this.projectDir.getFileName().toString(); + String projectDir = this.projectDir.getFileName() + .toString(); boolean containsDescriptorSetFile = resourceFiles.stream() .filter(f -> f.endsWith(FileDescriptors.DESC_EXTENSION)) @@ -143,7 +144,15 @@ void generateDart() { project.executeTask(build); Collection dartFileNames = generatedDartFileNames(); - assertThat(dartFileNames).contains("roller_coaster_pb.js"); + String protoName = "roller_coaster"; + assertThat(dartFileNames) + .containsExactly( + TYPES_FILE, + protoName + ".pb.dart", + protoName + ".pbjson.dart", + protoName + ".pbenum.dart", + protoName + ".pbserver.dart" + ); } @Test @@ -270,7 +279,8 @@ void noJsForModelProjects() { GradleProject project = this.project.build(); project.executeTask(build); - assertThat(generatedFiles().toFile().exists()).isFalse(); + assertThat(generatedFiles().toFile() + .exists()).isFalse(); } private void noAdditionalConfig() { diff --git a/pom.xml b/pom.xml index 018ba784..7cfa941f 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-bootstrap -1.6.8 +1.6.10 2015 @@ -52,31 +52,31 @@ all modules and does not describe the project structure per-subproject. io.spine spine-base - 1.6.8 + 1.6.10 compile io.spine.tools spine-model-compiler - 1.6.8 + 1.6.10 compile io.spine.tools spine-plugin-base - 1.6.8 + 1.6.10 compile io.spine.tools spine-proto-dart-plugin - 1.6.8 + 1.6.10 compile io.spine.tools spine-proto-js-plugin - 1.6.8 + 1.6.10 compile @@ -112,13 +112,13 @@ all modules and does not describe the project structure per-subproject. io.spine spine-testlib - 1.6.8 + 1.6.10 test io.spine.tools spine-plugin-testlib - 1.6.8 + 1.6.10 test diff --git a/version.gradle.kts b/version.gradle.kts index 41f5770b..81650e18 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -29,9 +29,9 @@ * already in the root directory. */ -val spineBaseVersion: String by extra("1.6.8") +val spineBaseVersion: String by extra("1.6.10") val spineTimeVersion: String by extra("1.6.0") val spineVersion: String by extra("1.6.6") val spineWebVersion: String by extra("1.6.6") val spineGCloudVersion: String by extra("1.6.6") -val pluginVersion: String by extra("1.6.8") +val pluginVersion: String by extra("1.6.10") From 9ffc4870c8eab8dabce6683903ffd92d35e5da6c Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 16:23:38 +0200 Subject: [PATCH 10/39] Update report --- license-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license-report.md b/license-report.md index a693f902..5dbeb245 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Nov 13 16:10:40 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri Nov 13 16:20:57 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file From c978b5e28472caa51d66b3bf1ef9ab56ee10407d Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 17:07:39 +0200 Subject: [PATCH 11/39] Use a real Project to check applied plugins instead of a fake --- license-report.md | 2 +- .../tools/gradle/bootstrap/ExtensionTest.java | 51 ++++++++++++++++--- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/license-report.md b/license-report.md index 5dbeb245..e0bf9c30 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Nov 13 16:20:57 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri Nov 13 16:52:13 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index c51bd15d..0410dc71 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -21,20 +21,27 @@ package io.spine.tools.gradle.bootstrap; import com.google.common.collect.ImmutableSet; +import com.google.common.truth.Correspondence; import com.google.common.truth.IterableSubject; import com.google.protobuf.gradle.ProtobufPlugin; +import io.spine.generate.dart.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; import io.spine.tools.gradle.GradlePlugin; +import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.bootstrap.given.FakeArtifacts; import io.spine.tools.gradle.compiler.ModelCompilerPlugin; +import io.spine.tools.gradle.project.PlugableProject; import io.spine.tools.gradle.project.PluginTarget; import io.spine.tools.gradle.testing.MemoizingDependant; import io.spine.tools.gradle.testing.MemoizingPluginRegistry; import io.spine.tools.gradle.testing.MemoizingSourceSuperset; import io.spine.tools.groovy.ConsumerClosure; +import org.checkerframework.checker.nullness.qual.NonNull; import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.Task; import org.gradle.api.plugins.JavaPlugin; +import org.gradle.api.tasks.TaskContainer; import org.gradle.testfixtures.ProjectBuilder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -58,22 +65,29 @@ @DisplayName("`spine` extension should") class ExtensionTest { + private static final + Correspondence<@NonNull Task, @NonNull TaskName> names = Correspondence.from( + (@NonNull Task task, @NonNull TaskName name) -> task.getName().equals(name.name()), + "names" + ); + private PluginTarget pluginTarget; private Extension extension; private MemoizingSourceSuperset codeLayout; private MemoizingDependant dependencyTarget; private Path projectDir; + private Project project; @BeforeEach void setUp(@TempDir Path projectDir) { - Project project = ProjectBuilder + this.project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) .withProjectDir(projectDir.toFile()) .build(); this.projectDir = project.getProjectDir() .toPath(); - pluginTarget = new MemoizingPluginRegistry(); + pluginTarget = new PlugableProject(project); dependencyTarget = new MemoizingDependant(); codeLayout = new MemoizingSourceSuperset(); extension = Extension @@ -84,9 +98,6 @@ void setUp(@TempDir Path projectDir) { .setDependencyTarget(dependencyTarget) .setArtifactSnapshot(FakeArtifacts.snapshot()) .build(); - project.getExtensions() - .add(ModelCompilerPlugin.extensionName(), - new io.spine.tools.gradle.compiler.Extension()); } @Nested @@ -369,6 +380,22 @@ void disableCodegen() { assertFalse(codegen.getProtobuf()); } + @Test + @DisplayName("apply Proto Dart plugin to a Dart project") + void applyProtoDart() { + DartExtension dartExtension = extension.enableDart(); + assertThat(dartExtension) + .isNotNull(); + assertApplied(ProtoDartPlugin.class); + } + + @Test + @DisplayName("apply Protobuf plugin to a Dart project") + void applyProtobufToDart() { + extension.enableDart(); + assertApplied(ProtobufPlugin.class); + } + private String baseDependency() { return "io.spine:spine-base:" + spineVersion; } @@ -414,13 +441,13 @@ private String datastoreDependency() { } private void assertApplied(Class> pluginClass) { - GradlePlugin plugin = GradlePlugin.implementedIn(pluginClass); + GradlePlugin plugin = GradlePlugin.implementedIn(pluginClass); assertTrue(pluginTarget.isApplied(plugin), format("Plugin %s must be applied.", plugin)); } private void assertNotApplied(Class> pluginClass) { - GradlePlugin plugin = GradlePlugin.implementedIn(pluginClass); + GradlePlugin plugin = GradlePlugin.implementedIn(pluginClass); assertFalse(pluginTarget.isApplied(plugin), format("Plugin %s must NOT be applied.", plugin)); } @@ -580,4 +607,14 @@ void exposeWhetherConfigurationForced() { extension.setForceDependencies(true); assertThat(extension.getForceDependencies()).isTrue(); } + + @Test + @DisplayName("add `generateDart` tasks if needed") + void addDartTasks() { + extension.enableDart(); + TaskContainer tasks = project.getTasks(); + assertThat(tasks) + .comparingElementsUsing(names) + .containsAtLeastElementsIn(DartTaskName.values()); + } } From 432caa07aa08f0a98551da4668b50ee9fdeadc49 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 17:08:09 +0200 Subject: [PATCH 12/39] Optimize imports --- .../test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index 0410dc71..2867875b 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -33,7 +33,6 @@ import io.spine.tools.gradle.project.PlugableProject; import io.spine.tools.gradle.project.PluginTarget; import io.spine.tools.gradle.testing.MemoizingDependant; -import io.spine.tools.gradle.testing.MemoizingPluginRegistry; import io.spine.tools.gradle.testing.MemoizingSourceSuperset; import io.spine.tools.groovy.ConsumerClosure; import org.checkerframework.checker.nullness.qual.NonNull; From 896d5908a8e9099f64bba39488d378f1b62f8a7f Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 18:25:02 +0200 Subject: [PATCH 13/39] Add doc --- .../spine/tools/gradle/bootstrap/DartTaskName.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java index 3d350026..cf5e8f8b 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartTaskName.java @@ -22,8 +22,20 @@ import io.spine.tools.gradle.TaskName; +/** + * Tasks which launch the `dart_code_gen` tool. + */ public enum DartTaskName implements TaskName { + /** + * Name of the task which launches the `dart_code_gen` tool for generating extra Dart code for + * the main scope. + */ generateDart, + + /** + * Name of the task which launches the `dart_code_gen` tool for generating extra Dart code for + * the test scope. + */ generateTestDart } From a575705b18feac2daf3ee6d7caf3e387192052e4 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 18:25:18 +0200 Subject: [PATCH 14/39] Use `PubCache` from `base` --- license-report.md | 4 +- .../tools/gradle/bootstrap/DartExtension.java | 13 +++-- .../spine/tools/gradle/config/PubCache.java | 51 ------------------- pom.xml | 16 +++--- version.gradle.kts | 4 +- 5 files changed, 20 insertions(+), 68 deletions(-) delete mode 100644 plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java diff --git a/license-report.md b/license-report.md index e0bf9c30..6e3f3965 100644 --- a/license-report.md +++ b/license-report.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.tools:spine-plugin:1.6.10` +# Dependencies of `io.spine.tools:spine-plugin:1.6.11` ## Runtime 1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2 @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Nov 13 16:52:13 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri Nov 13 18:21:58 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index 8f6498ae..9652b12e 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -23,8 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import io.spine.generate.dart.Extension; +import io.spine.generate.dart.PubCache; import io.spine.tools.gradle.TaskName; -import io.spine.tools.gradle.config.PubCache; import io.spine.tools.gradle.protoc.ProtocPlugin; import org.apache.tools.ant.taskdefs.condition.Os; import org.gradle.api.GradleException; @@ -49,7 +49,7 @@ import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS; /** - * An extension which configures JavaScript code generation. + * An extension which configures Dart code generation. */ @VisibleForTesting // Would be package private, but needed for integration tests. public final class DartExtension extends CodeGenExtension { @@ -77,7 +77,8 @@ void enableGeneration() { Task testTask = createTask(generateTestDart, protoDart.getTestDescriptorSet(), protoDart.getTestDir()); - Task assembleTask = project.getTasks().getByName(assemble.name()); + Task assembleTask = project.getTasks() + .getByName(assemble.name()); project.afterEvaluate((p) -> { mainTask.dependsOn(generateProto.name()); testTask.dependsOn(generateTestProto.name()); @@ -100,7 +101,8 @@ private Task createTask(TaskName name, } private void runDartTool(Property descriptorFile, DirectoryProperty dartDir) { - if (project.file(descriptorFile).exists()) { + if (project.file(descriptorFile) + .exists()) { @SuppressWarnings("UseOfProcessBuilder") ProcessBuilder processBuilder = buildDartToolProcess(descriptorFile, dartDir); int exitCode; @@ -144,7 +146,8 @@ private static GradleException onProcessError( private Path dartCodeGenCommand() { String extension = Os.isFamily(FAMILY_WINDOWS) ? ".bat" : ""; - Path command = PubCache.location().resolve("dart_code_gen" + extension); + Path command = PubCache.bin() + .resolve("dart_code_gen" + extension); if (!exists(command)) { _warn().log("Cannot locate `dart_code_gen` under `%s`. " + "To install, run `pub global activate dart_code_gen`.", diff --git a/plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java b/plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java deleted file mode 100644 index 4d292ba6..00000000 --- a/plugin/src/main/java/io/spine/tools/gradle/config/PubCache.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020, TeamDev. All rights reserved. - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.tools.gradle.config; - -import org.apache.tools.ant.taskdefs.condition.Os; - -import java.nio.file.Path; -import java.nio.file.Paths; - -import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS; - -public final class PubCache { - - private static final Path location = findCache(); - - private static Path findCache() { - String pubCache; - if (Os.isFamily(FAMILY_WINDOWS)) { - @SuppressWarnings("CallToSystemGetenv") - String localAppData = System.getenv("LOCALAPPDATA"); - pubCache = localAppData + "/Pub/Cache/bin"; - } else { - @SuppressWarnings("AccessOfSystemProperties") - String userHome = System.getProperty("user.home"); - pubCache = userHome + "/.pub-cache/bin"; - } - return Paths.get(pubCache); - } - - public static Path location() { - return location; - } -} diff --git a/pom.xml b/pom.xml index 7cfa941f..b42aac32 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-bootstrap -1.6.10 +1.6.11 2015 @@ -52,31 +52,31 @@ all modules and does not describe the project structure per-subproject. io.spine spine-base - 1.6.10 + 1.6.11 compile io.spine.tools spine-model-compiler - 1.6.10 + 1.6.11 compile io.spine.tools spine-plugin-base - 1.6.10 + 1.6.11 compile io.spine.tools spine-proto-dart-plugin - 1.6.10 + 1.6.11 compile io.spine.tools spine-proto-js-plugin - 1.6.10 + 1.6.11 compile @@ -112,13 +112,13 @@ all modules and does not describe the project structure per-subproject. io.spine spine-testlib - 1.6.10 + 1.6.11 test io.spine.tools spine-plugin-testlib - 1.6.10 + 1.6.11 test diff --git a/version.gradle.kts b/version.gradle.kts index 81650e18..31e5132f 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -29,9 +29,9 @@ * already in the root directory. */ -val spineBaseVersion: String by extra("1.6.10") +val spineBaseVersion: String by extra("1.6.11") val spineTimeVersion: String by extra("1.6.0") val spineVersion: String by extra("1.6.6") val spineWebVersion: String by extra("1.6.6") val spineGCloudVersion: String by extra("1.6.6") -val pluginVersion: String by extra("1.6.10") +val pluginVersion: String by extra("1.6.11") From f6656e1022ec85d5bd82c50fd8e89ec82a034553 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Fri, 13 Nov 2020 18:29:43 +0200 Subject: [PATCH 15/39] Extract tool name to a constant --- license-report.md | 2 +- .../io/spine/tools/gradle/bootstrap/DartExtension.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/license-report.md b/license-report.md index 6e3f3965..c657c89a 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Nov 13 18:21:58 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri Nov 13 18:28:39 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index 9652b12e..c84a689c 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -55,6 +55,7 @@ public final class DartExtension extends CodeGenExtension { public static final String TYPES_FILE = "types.dart"; + private static final String DART_TOOL_NAME = "dart_code_gen"; private static final Joiner commandJoiner = Joiner.on(' '); private final Project project; @@ -110,7 +111,7 @@ private void runDartTool(Property descriptorFile, DirectoryProperty dart Process dartToolProcess = processBuilder.start(); exitCode = dartToolProcess.waitFor(); } catch (IOException | InterruptedException e) { - throw new GradleException("Failed to execute `dart_code_gen`.", e); + throw new GradleException(format("Failed to execute `%s`.", DART_TOOL_NAME), e); } if (exitCode != 0) { throw onProcessError(processBuilder, exitCode); @@ -147,11 +148,11 @@ private static GradleException onProcessError( private Path dartCodeGenCommand() { String extension = Os.isFamily(FAMILY_WINDOWS) ? ".bat" : ""; Path command = PubCache.bin() - .resolve("dart_code_gen" + extension); + .resolve(DART_TOOL_NAME + extension); if (!exists(command)) { _warn().log("Cannot locate `dart_code_gen` under `%s`. " + - "To install, run `pub global activate dart_code_gen`.", - command); + "To install, run `pub global activate %s`.", + command, DART_TOOL_NAME); } return command; } From 704dc8ef64c8b27838cbe35859b83d9efe75364c Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 16:16:48 +0200 Subject: [PATCH 16/39] Remove verbose build logging --- gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 23a9c161..33d60558 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,3 @@ # org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=1024m -org.gradle.logging.level=info From 7b8cdaab709390f94b692f10dd8b1570fd65780f Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 16:18:24 +0200 Subject: [PATCH 17/39] Update use of `base` --- license-report.md | 2 +- .../java/io/spine/tools/gradle/bootstrap/DartExtension.java | 3 +-- .../io/spine/tools/gradle/bootstrap/SpinePluginTarget.java | 2 +- .../java/io/spine/tools/gradle/bootstrap/ExtensionTest.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/license-report.md b/license-report.md index c657c89a..99fa12c7 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Nov 13 18:28:39 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Mon Nov 16 16:13:16 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index c84a689c..c207801f 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -22,8 +22,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; -import io.spine.generate.dart.Extension; -import io.spine.generate.dart.PubCache; +import io.spine.dart.PubCache; import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.protoc.ProtocPlugin; import org.apache.tools.ant.taskdefs.condition.Os; diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java index a0c8fe2b..2a121a15 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/SpinePluginTarget.java @@ -21,7 +21,7 @@ package io.spine.tools.gradle.bootstrap; import com.google.protobuf.gradle.ProtobufPlugin; -import io.spine.generate.dart.ProtoDartPlugin; +import io.spine.dart.gradle.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; import io.spine.tools.gradle.GradlePlugin; import io.spine.tools.gradle.PluginScript; diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index 2867875b..c985ef41 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -24,7 +24,7 @@ import com.google.common.truth.Correspondence; import com.google.common.truth.IterableSubject; import com.google.protobuf.gradle.ProtobufPlugin; -import io.spine.generate.dart.ProtoDartPlugin; +import io.spine.dart.gradle.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; import io.spine.tools.gradle.GradlePlugin; import io.spine.tools.gradle.TaskName; From 9a9364d45bcfec7c6118dbbf899db934ef87b771 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 16:30:10 +0200 Subject: [PATCH 18/39] Fix an import --- license-report.md | 2 +- .../java/io/spine/tools/gradle/bootstrap/DartExtension.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/license-report.md b/license-report.md index 99fa12c7..b9439e66 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Nov 16 16:13:16 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Mon Nov 16 16:22:11 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index c207801f..1aae35bf 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -22,6 +22,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; +import io.spine.dart.gradle.Extension; import io.spine.dart.PubCache; import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.protoc.ProtocPlugin; From 27c5b6d049ff1e416787abca9b121ab1b9a8d053 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 17:01:33 +0200 Subject: [PATCH 19/39] Update reports --- license-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license-report.md b/license-report.md index b9439e66..9136e6a0 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Nov 16 16:22:11 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Mon Nov 16 16:41:46 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file From 47b3ef8c49194a9e4745ecef89782ae4e12cbe8f Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 17:22:55 +0200 Subject: [PATCH 20/39] Set up env for Dart on CI --- .github/workflows/win.yml | 4 +++- .travis.yml | 3 +++ script/install-dart.bat | 25 +++++++++++++++++++++++++ script/install-dart.sh | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 script/install-dart.bat create mode 100644 script/install-dart.sh diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 2c9b64c7..e6f47ee3 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -22,5 +22,7 @@ jobs: run: git submodule update --init --recursive - name: Run tests with Gradle - run: gradlew.bat build shell: cmd + run: > + .\script\install-dart.bat + && gradlew.bat build diff --git a/.travis.yml b/.travis.yml index fecd8124..84a32e23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,9 @@ script: # The publishing script should be executed in `script` section in order to # fail the Travis build if execution of this script is failed. - ./config/scripts/publish-artifacts.sh + - chmod +x ./script/install-pub.sh + - ./script/install-pub.sh + after_success: # See: https://github.com/codecov/example-java/blob/master/.travis.yml diff --git a/script/install-dart.bat b/script/install-dart.bat new file mode 100644 index 00000000..8480ea16 --- /dev/null +++ b/script/install-dart.bat @@ -0,0 +1,25 @@ +@rem +@rem Copyright 2020, TeamDev. All rights reserved. +@rem +@rem Redistribution and use in source and/or binary forms, with or without +@rem modification, must retain the above copyright notice and the following +@rem disclaimer. +@rem +@rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +@rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +@rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +@rem A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +@rem OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +@rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +@rem LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@rem + +@echo off + +choco install dart-sdk --limitoutput +refreshenv +pub global activate protoc_plugin diff --git a/script/install-dart.sh b/script/install-dart.sh new file mode 100644 index 00000000..98c71f1f --- /dev/null +++ b/script/install-dart.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# +# Copyright 2020, TeamDev. All rights reserved. +# +# Redistribution and use in source and/or binary forms, with or without +# modification, must retain the above copyright notice and the following +# disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# Standard update procedure. +sudo apt-get install -y libxml2-dev +sudo apt-get update + +# Fetch custom Google indexes. They contain such tools as `dart`. +sudo apt-get install apt-transport-https +sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' +sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' +sudo apt-get update + +# Install Dart, `pub`, etc. +sudo apt-get install dart + +pub global activate protoc_plugin From b4a6d7a6e218aeafb5f2efd2f342123cfe5f4d1d Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 17:40:00 +0200 Subject: [PATCH 21/39] Fix Travis config --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84a32e23..823ecf62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ before_install: install: - openssl aes-256-cbc -K $encrypted_484d6a99d515_key -iv $encrypted_484d6a99d515_iv -in credentials.tar.enc -out credentials.tar -d - tar xvf credentials.tar + - chmod +x ./script/install-pub.sh + - ./script/install-pub.sh script: - ./gradlew check --stacktrace @@ -17,8 +19,6 @@ script: # The publishing script should be executed in `script` section in order to # fail the Travis build if execution of this script is failed. - ./config/scripts/publish-artifacts.sh - - chmod +x ./script/install-pub.sh - - ./script/install-pub.sh after_success: From 3a1f4f8ecf65f82d43a016844b1d60a342fd1ec1 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 17:42:28 +0200 Subject: [PATCH 22/39] Allow echoing commands for a CI script --- script/install-dart.bat | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/install-dart.bat b/script/install-dart.bat index 8480ea16..e92d47c6 100644 --- a/script/install-dart.bat +++ b/script/install-dart.bat @@ -18,8 +18,6 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem -@echo off - choco install dart-sdk --limitoutput refreshenv pub global activate protoc_plugin From f27f3b0e3b82d7c999d04064360707502a805ee1 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 17:59:04 +0200 Subject: [PATCH 23/39] Fix path to a script --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 823ecf62..f957b1f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ before_install: install: - openssl aes-256-cbc -K $encrypted_484d6a99d515_key -iv $encrypted_484d6a99d515_iv -in credentials.tar.enc -out credentials.tar -d - tar xvf credentials.tar - - chmod +x ./script/install-pub.sh - - ./script/install-pub.sh + - chmod +x ./script/install-dart.sh + - ./script/install-dart.sh script: - ./gradlew check --stacktrace From 4c2a58a7e53cd1f90b2d4d10264c507e610d107d Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 18:10:30 +0200 Subject: [PATCH 24/39] Move `pub` command directly to `.travis.yml` --- .travis.yml | 3 ++- script/install-dart.sh | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f957b1f2..a274a6bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,13 @@ jdk: before_install: - chmod +x ./gradlew - chmod +x ./config/scripts/publish-artifacts.sh + - chmod +x ./script/install-dart.sh install: - openssl aes-256-cbc -K $encrypted_484d6a99d515_key -iv $encrypted_484d6a99d515_iv -in credentials.tar.enc -out credentials.tar -d - tar xvf credentials.tar - - chmod +x ./script/install-dart.sh - ./script/install-dart.sh + - pub global activate protoc_plugin script: - ./gradlew check --stacktrace diff --git a/script/install-dart.sh b/script/install-dart.sh index 98c71f1f..57820392 100644 --- a/script/install-dart.sh +++ b/script/install-dart.sh @@ -32,5 +32,3 @@ sudo apt-get update # Install Dart, `pub`, etc. sudo apt-get install dart - -pub global activate protoc_plugin From 90bedfc3be209e49659fb6e5a45ef7d145a0cb86 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Mon, 16 Nov 2020 18:18:08 +0200 Subject: [PATCH 25/39] Move Dart installation to `before_install` --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a274a6bd..cf4b5f13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,12 @@ before_install: - chmod +x ./gradlew - chmod +x ./config/scripts/publish-artifacts.sh - chmod +x ./script/install-dart.sh + - ./script/install-dart.sh + - pub global activate protoc_plugin install: - openssl aes-256-cbc -K $encrypted_484d6a99d515_key -iv $encrypted_484d6a99d515_iv -in credentials.tar.enc -out credentials.tar -d - tar xvf credentials.tar - - ./script/install-dart.sh - - pub global activate protoc_plugin script: - ./gradlew check --stacktrace From 9e8500ff7a56201035ade1ca57d05daa65ebc6ab Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 11:34:22 +0200 Subject: [PATCH 26/39] Add missing PATH element --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index cf4b5f13..d98b24c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,10 @@ language: java jdk: - openjdk8 +env: + global: + - PATH="$PATH:/usr/lib/dart/bin" + before_install: - chmod +x ./gradlew - chmod +x ./config/scripts/publish-artifacts.sh From 39be09c536bc97819c962ac26ae6e49989c9752c Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 12:52:46 +0200 Subject: [PATCH 27/39] Ensure `dart` is a plugin, not a `builtin` --- license-report.md | 2 +- .../tools/gradle/bootstrap/CodeGenExtension.java | 8 ++++++++ .../spine/tools/gradle/bootstrap/DartExtension.java | 12 +++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/license-report.md b/license-report.md index 9136e6a0..f1c6abd0 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Nov 16 16:41:46 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Nov 17 12:46:44 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/CodeGenExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/CodeGenExtension.java index f631024c..a87c9f1d 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/CodeGenExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/CodeGenExtension.java @@ -95,6 +95,14 @@ final SpinePluginTarget pluginTarget() { return pluginTarget; } + /** + * Obtains the {@code ProtobufGenerator} which configures the code generation for the associated + * project. + */ + final ProtobufGenerator protobufGenerator() { + return protobufGenerator; + } + /** * Obtains the dependency container associated with this extension. */ diff --git a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java index 1aae35bf..aed5f20e 100644 --- a/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java +++ b/plugin/src/main/java/io/spine/tools/gradle/bootstrap/DartExtension.java @@ -22,10 +22,9 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; -import io.spine.dart.gradle.Extension; import io.spine.dart.PubCache; +import io.spine.dart.gradle.Extension; import io.spine.tools.gradle.TaskName; -import io.spine.tools.gradle.protoc.ProtocPlugin; import org.apache.tools.ant.taskdefs.condition.Os; import org.gradle.api.GradleException; import org.gradle.api.Project; @@ -44,6 +43,7 @@ import static io.spine.tools.gradle.bootstrap.DartTaskName.generateDart; import static io.spine.tools.gradle.bootstrap.DartTaskName.generateTestDart; import static io.spine.tools.gradle.protoc.ProtocPlugin.Name.dart; +import static io.spine.tools.gradle.protoc.ProtocPlugin.called; import static java.lang.String.format; import static java.nio.file.Files.exists; import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS; @@ -69,7 +69,13 @@ private DartExtension(Builder builder) { @Override void enableGeneration() { super.enableGeneration(); + pluginTarget().applyProtobufPlugin(); + protobufGenerator().enablePlugin(called(dart)); pluginTarget().applyProtoDartPlugin(); + createGenerationTasks(); + } + + private void createGenerationTasks() { Extension protoDart = project.getExtensions() .getByType(Extension.class); Task mainTask = createTask(generateDart, @@ -175,7 +181,7 @@ static final class Builder extends CodeGenExtension.Builder Date: Tue, 17 Nov 2020 13:05:53 +0200 Subject: [PATCH 28/39] Install `dart_code_gen` on CI --- .travis.yml | 1 + script/install-dart.bat | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index d98b24c0..1e0ce7a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ before_install: - chmod +x ./script/install-dart.sh - ./script/install-dart.sh - pub global activate protoc_plugin + - pub global activate dart_code_gen install: - openssl aes-256-cbc -K $encrypted_484d6a99d515_key -iv $encrypted_484d6a99d515_iv -in credentials.tar.enc -out credentials.tar -d diff --git a/script/install-dart.bat b/script/install-dart.bat index e92d47c6..10622a88 100644 --- a/script/install-dart.bat +++ b/script/install-dart.bat @@ -21,3 +21,4 @@ choco install dart-sdk --limitoutput refreshenv pub global activate protoc_plugin +pub global activate dart_code_gen From 999e05cc7c383f11e90cf361be17716d7ee14ed4 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 15:25:25 +0200 Subject: [PATCH 29/39] Use a script from `config` instead of a custom one --- .travis.yml | 5 +++-- script/install-dart.sh | 34 ---------------------------------- 2 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 script/install-dart.sh diff --git a/.travis.yml b/.travis.yml index 1e0ce7a9..69731db0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,9 @@ env: before_install: - chmod +x ./gradlew - chmod +x ./config/scripts/publish-artifacts.sh - - chmod +x ./script/install-dart.sh - - ./script/install-dart.sh + - chmod +x ./config/scripts/update-apt.sh + - ./config/scripts/update-apt.sh + - sudo apt-get install dart - pub global activate protoc_plugin - pub global activate dart_code_gen diff --git a/script/install-dart.sh b/script/install-dart.sh deleted file mode 100644 index 57820392..00000000 --- a/script/install-dart.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# -# Copyright 2020, TeamDev. All rights reserved. -# -# Redistribution and use in source and/or binary forms, with or without -# modification, must retain the above copyright notice and the following -# disclaimer. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# Standard update procedure. -sudo apt-get install -y libxml2-dev -sudo apt-get update - -# Fetch custom Google indexes. They contain such tools as `dart`. -sudo apt-get install apt-transport-https -sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' -sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' -sudo apt-get update - -# Install Dart, `pub`, etc. -sudo apt-get install dart From 8a7368fd9e97258879348651adae7e2f1241bb01 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 15:29:14 +0200 Subject: [PATCH 30/39] More logging on Windows CI --- script/install-dart.bat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/install-dart.bat b/script/install-dart.bat index 10622a88..1626fe41 100644 --- a/script/install-dart.bat +++ b/script/install-dart.bat @@ -20,5 +20,7 @@ choco install dart-sdk --limitoutput refreshenv -pub global activate protoc_plugin -pub global activate dart_code_gen +echo 'Installing packages from Pub...' +pub global activate protoc_plugin -v +pub global activate dart_code_gen -v +echo 'Finished installing packages from Pub.' From b58da67eefaa58e46dc18e9c7c9a5295f60c8c4f Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 16:01:18 +0200 Subject: [PATCH 31/39] Move Windows CI setup from file directly to 'win.yml' --- .github/workflows/win.yml | 5 ++++- script/install-dart.bat | 26 -------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 script/install-dart.bat diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index e6f47ee3..88645cc6 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -24,5 +24,8 @@ jobs: - name: Run tests with Gradle shell: cmd run: > - .\script\install-dart.bat + choco install dart-sdk --limitoutput + && refreshenv + && pub global activate protoc_plugin -v + && pub global activate dart_code_gen -v && gradlew.bat build diff --git a/script/install-dart.bat b/script/install-dart.bat deleted file mode 100644 index 1626fe41..00000000 --- a/script/install-dart.bat +++ /dev/null @@ -1,26 +0,0 @@ -@rem -@rem Copyright 2020, TeamDev. All rights reserved. -@rem -@rem Redistribution and use in source and/or binary forms, with or without -@rem modification, must retain the above copyright notice and the following -@rem disclaimer. -@rem -@rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -@rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -@rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -@rem A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -@rem OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -@rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -@rem LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -@rem - -choco install dart-sdk --limitoutput -refreshenv -echo 'Installing packages from Pub...' -pub global activate protoc_plugin -v -pub global activate dart_code_gen -v -echo 'Finished installing packages from Pub.' From 5ac8a4822158b4367cd5d686921b13142460dc4d Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 16:25:50 +0200 Subject: [PATCH 32/39] Use the new `TempDir` util instead of JUnit's annotation --- .../tools/gradle/bootstrap/BootstrapPluginTest.java | 9 +++++---- .../io/spine/tools/gradle/bootstrap/ExtensionTest.java | 7 +++---- .../gradle/bootstrap/func/SpineBootstrapPluginTest.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java index b10c72cd..f844a7e0 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java @@ -21,14 +21,14 @@ package io.spine.tools.gradle.bootstrap; import com.google.common.truth.Subject; +import io.spine.testing.TempDir; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; -import java.nio.file.Path; +import java.io.File; import static com.google.common.truth.Truth.assertThat; @@ -38,11 +38,12 @@ class BootstrapPluginTest { private Project project; @BeforeEach - void setUp(@TempDir Path projectDir) { + void setUp() { + File projectDir = TempDir.forClass(BootstrapPluginTest.class); project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) - .withProjectDir(projectDir.toFile()) + .withProjectDir(projectDir) .build(); } diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index c985ef41..d380021d 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -26,6 +26,7 @@ import com.google.protobuf.gradle.ProtobufPlugin; import io.spine.dart.gradle.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; +import io.spine.testing.TempDir; import io.spine.tools.gradle.GradlePlugin; import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.bootstrap.given.FakeArtifacts; @@ -46,7 +47,6 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import java.nio.file.Path; import java.util.concurrent.atomic.AtomicBoolean; @@ -78,14 +78,13 @@ class ExtensionTest { private Project project; @BeforeEach - void setUp(@TempDir Path projectDir) { + void setUp() { + this.projectDir = TempDir.forClass(ExtensionTest.class).toPath(); this.project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) .withProjectDir(projectDir.toFile()) .build(); - this.projectDir = project.getProjectDir() - .toPath(); pluginTarget = new PlugableProject(project); dependencyTarget = new MemoizingDependant(); codeLayout = new MemoizingSourceSuperset(); diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java index 68345ece..acc61230 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java @@ -25,12 +25,12 @@ import com.google.common.truth.IterableSubject; import io.spine.code.proto.FileDescriptors; import io.spine.testing.SlowTest; +import io.spine.testing.TempDir; import io.spine.tools.gradle.testing.GradleProject; import org.gradle.testkit.runner.BuildResult; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.nio.file.Path; @@ -59,8 +59,8 @@ class SpineBootstrapPluginTest { private Path projectDir; @BeforeEach - void setUp(@TempDir Path dir) { - this.projectDir = dir; + void setUp() { + this.projectDir = TempDir.forClass(SpineBootstrapPluginTest.class).toPath(); this.project = GradleProject .newBuilder() .setProjectName("func-test") From 28b0bfe39cb985e5cf50f96746d71ca1963a6f42 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 16:26:18 +0200 Subject: [PATCH 33/39] Remove verbose output --- .github/workflows/win.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 88645cc6..03cca76b 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -26,6 +26,6 @@ jobs: run: > choco install dart-sdk --limitoutput && refreshenv - && pub global activate protoc_plugin -v - && pub global activate dart_code_gen -v + && pub global activate protoc_plugin + && pub global activate dart_code_gen && gradlew.bat build From fb7ff0335d9bedcdc3e585bdfef2e6957659f1da Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 17:10:13 +0200 Subject: [PATCH 34/39] Remove empty line --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69731db0..92e13828 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,6 @@ script: # fail the Travis build if execution of this script is failed. - ./config/scripts/publish-artifacts.sh - after_success: # See: https://github.com/codecov/example-java/blob/master/.travis.yml - bash <(curl -s https://codecov.io/bash) From 637c8f0852e41d92dd7d09b6b128340aba6e48a1 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 18:41:14 +0200 Subject: [PATCH 35/39] Use JUnit to create temp directories --- license-report.md | 2 +- .../gradle/bootstrap/BootstrapPluginTest.java | 6 +++-- .../tools/gradle/bootstrap/ExtensionTest.java | 18 +++++++++----- .../func/SpineBootstrapPluginTest.java | 24 +++++++++++-------- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/license-report.md b/license-report.md index f1c6abd0..40a85f13 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 17 12:46:44 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Nov 17 18:35:36 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java index f844a7e0..ec8e07e9 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java @@ -21,12 +21,12 @@ package io.spine.tools.gradle.bootstrap; import com.google.common.truth.Subject; -import io.spine.testing.TempDir; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import java.io.File; @@ -35,11 +35,13 @@ @DisplayName("BootstrapPlugin should") class BootstrapPluginTest { + @TempDir + @SuppressWarnings({"PackageVisibleField", "WeakerAccess"}) + File projectDir; private Project project; @BeforeEach void setUp() { - File projectDir = TempDir.forClass(BootstrapPluginTest.class); project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index d380021d..661106de 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -26,7 +26,6 @@ import com.google.protobuf.gradle.ProtobufPlugin; import io.spine.dart.gradle.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; -import io.spine.testing.TempDir; import io.spine.tools.gradle.GradlePlugin; import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.bootstrap.given.FakeArtifacts; @@ -47,7 +46,10 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import java.io.File; +import java.io.IOException; import java.nio.file.Path; import java.util.concurrent.atomic.AtomicBoolean; @@ -74,16 +76,18 @@ class ExtensionTest { private Extension extension; private MemoizingSourceSuperset codeLayout; private MemoizingDependant dependencyTarget; - private Path projectDir; private Project project; + @TempDir + @SuppressWarnings({"PackageVisibleField", "WeakerAccess"}) + File projectDir; + @BeforeEach void setUp() { - this.projectDir = TempDir.forClass(ExtensionTest.class).toPath(); this.project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) - .withProjectDir(projectDir.toFile()) + .withProjectDir(projectDir) .build(); pluginTarget = new PlugableProject(project); dependencyTarget = new MemoizingDependant(); @@ -333,12 +337,14 @@ void noExclusions() { @Test @DisplayName("declare `generated` directory a source root") - void declareGeneratedDirectory() { + void declareGeneratedDirectory() throws IOException { extension.enableJava(); assertApplied(JavaPlugin.class); ImmutableSet declaredPaths = codeLayout.javaSourceDirs(); - assertThat(declaredPaths).contains(projectDir.resolve("generated")); + Path realProjectPath = projectDir.toPath().toRealPath(); + Path generatedPath = realProjectPath.resolve("generated"); + assertThat(declaredPaths).contains(generatedPath); } @Test diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java index acc61230..2eb725c9 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java @@ -25,12 +25,12 @@ import com.google.common.truth.IterableSubject; import io.spine.code.proto.FileDescriptors; import io.spine.testing.SlowTest; -import io.spine.testing.TempDir; import io.spine.tools.gradle.testing.GradleProject; import org.gradle.testkit.runner.BuildResult; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.nio.file.Path; @@ -55,16 +55,18 @@ class SpineBootstrapPluginTest { private static final String ADDITIONAL_CONFIG_SCRIPT = "config.gradle"; private static final String TRANSITIVE_JS_DEPENDENCY = "any_pb.js"; + @TempDir + @SuppressWarnings({"PackageVisibleField", "WeakerAccess"}) + File projectDir; + private GradleProject.Builder project; - private Path projectDir; @BeforeEach void setUp() { - this.projectDir = TempDir.forClass(SpineBootstrapPluginTest.class).toPath(); this.project = GradleProject .newBuilder() .setProjectName("func-test") - .setProjectFolder(projectDir.toFile()) + .setProjectFolder(projectDir) .withPluginClasspath() .addProtoFile("roller_coaster.proto"); } @@ -113,8 +115,7 @@ void applyModelCompiler() { project.executeTask(build); Collection resourceFiles = assembledResources(); - String projectDir = this.projectDir.getFileName() - .toString(); + String projectDir = this.projectDir.getName(); boolean containsDescriptorSetFile = resourceFiles.stream() .filter(f -> f.endsWith(FileDescriptors.DESC_EXTENSION)) @@ -374,7 +375,8 @@ private void writeConfigGradle(String... lines) { } private Collection assembledResources() { - Path resourcePath = projectDir.resolve("build") + Path resourcePath = projectDir.toPath() + .resolve("build") .resolve("resources") .resolve("main"); File resourceDir = resourcePath.toFile(); @@ -404,7 +406,8 @@ private Collection generatedClassFileNames() { } private Path compiledJavaClasses() { - Path compiledClasses = projectDir.resolve("build") + Path compiledClasses = projectDir.toPath() + .resolve("build") .resolve("classes") .resolve("java") .resolve("main"); @@ -412,7 +415,8 @@ private Path compiledJavaClasses() { } private Path generatedFiles() { - Path generated = projectDir.resolve("generated"); + Path generated = projectDir.toPath() + .resolve("generated"); return generated; } @@ -442,7 +446,7 @@ private Collection generatedJsFileNames() { } private Collection generatedDartFileNames() { - Path libDir = projectDir.resolve("lib"); + Path libDir = projectDir.toPath().resolve("lib"); File libDirFile = libDir.toFile(); assertTrue(libDirFile.exists()); assertTrue(libDirFile.isDirectory()); From ddea4d905ed3e09bfc3d9d20ba96616e72dd2d59 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 18:43:56 +0200 Subject: [PATCH 36/39] Update Gradle --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be52383e..4d9ca164 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 4fcac211f62f8e16ea2fff75d8dc9e7fd16572b2 Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 18:44:15 +0200 Subject: [PATCH 37/39] Document a `Correspondence` --- .../io/spine/tools/gradle/bootstrap/ExtensionTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index 661106de..62d8c019 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -66,10 +66,16 @@ @DisplayName("`spine` extension should") class ExtensionTest { + /** + * A {@link Correspondence} of a Gradle {@link Task} to its {@linkplain TaskName name}. + * + *

Allow to assert facts about a collection of tasks referencing them by names instead of + * looking up individual elements. + */ private static final Correspondence<@NonNull Task, @NonNull TaskName> names = Correspondence.from( (@NonNull Task task, @NonNull TaskName name) -> task.getName().equals(name.name()), - "names" + "has name" ); private PluginTarget pluginTarget; From 50a43c83c72a2cbb7b6308bb8b6dc618a9d9bcda Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 19:19:42 +0200 Subject: [PATCH 38/39] Avoid JUnit and use a custom util to create temp directories This reverts commit 637c8f08 --- license-report.md | 2 +- .../gradle/bootstrap/BootstrapPluginTest.java | 6 ++--- .../tools/gradle/bootstrap/ExtensionTest.java | 18 +++++--------- .../func/SpineBootstrapPluginTest.java | 24 ++++++++----------- 4 files changed, 19 insertions(+), 31 deletions(-) diff --git a/license-report.md b/license-report.md index 40a85f13..f1c6abd0 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 17 18:35:36 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Nov 17 12:46:44 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java index ec8e07e9..f844a7e0 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java @@ -21,12 +21,12 @@ package io.spine.tools.gradle.bootstrap; import com.google.common.truth.Subject; +import io.spine.testing.TempDir; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import java.io.File; @@ -35,13 +35,11 @@ @DisplayName("BootstrapPlugin should") class BootstrapPluginTest { - @TempDir - @SuppressWarnings({"PackageVisibleField", "WeakerAccess"}) - File projectDir; private Project project; @BeforeEach void setUp() { + File projectDir = TempDir.forClass(BootstrapPluginTest.class); project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index 62d8c019..6f0178e6 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -26,6 +26,7 @@ import com.google.protobuf.gradle.ProtobufPlugin; import io.spine.dart.gradle.ProtoDartPlugin; import io.spine.js.gradle.ProtoJsPlugin; +import io.spine.testing.TempDir; import io.spine.tools.gradle.GradlePlugin; import io.spine.tools.gradle.TaskName; import io.spine.tools.gradle.bootstrap.given.FakeArtifacts; @@ -46,10 +47,7 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; -import java.io.File; -import java.io.IOException; import java.nio.file.Path; import java.util.concurrent.atomic.AtomicBoolean; @@ -82,18 +80,16 @@ class ExtensionTest { private Extension extension; private MemoizingSourceSuperset codeLayout; private MemoizingDependant dependencyTarget; + private Path projectDir; private Project project; - @TempDir - @SuppressWarnings({"PackageVisibleField", "WeakerAccess"}) - File projectDir; - @BeforeEach void setUp() { + this.projectDir = TempDir.forClass(ExtensionTest.class).toPath(); this.project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) - .withProjectDir(projectDir) + .withProjectDir(projectDir.toFile()) .build(); pluginTarget = new PlugableProject(project); dependencyTarget = new MemoizingDependant(); @@ -343,14 +339,12 @@ void noExclusions() { @Test @DisplayName("declare `generated` directory a source root") - void declareGeneratedDirectory() throws IOException { + void declareGeneratedDirectory() { extension.enableJava(); assertApplied(JavaPlugin.class); ImmutableSet declaredPaths = codeLayout.javaSourceDirs(); - Path realProjectPath = projectDir.toPath().toRealPath(); - Path generatedPath = realProjectPath.resolve("generated"); - assertThat(declaredPaths).contains(generatedPath); + assertThat(declaredPaths).contains(projectDir.resolve("generated")); } @Test diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java index 2eb725c9..acc61230 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java @@ -25,12 +25,12 @@ import com.google.common.truth.IterableSubject; import io.spine.code.proto.FileDescriptors; import io.spine.testing.SlowTest; +import io.spine.testing.TempDir; import io.spine.tools.gradle.testing.GradleProject; import org.gradle.testkit.runner.BuildResult; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.nio.file.Path; @@ -55,18 +55,16 @@ class SpineBootstrapPluginTest { private static final String ADDITIONAL_CONFIG_SCRIPT = "config.gradle"; private static final String TRANSITIVE_JS_DEPENDENCY = "any_pb.js"; - @TempDir - @SuppressWarnings({"PackageVisibleField", "WeakerAccess"}) - File projectDir; - private GradleProject.Builder project; + private Path projectDir; @BeforeEach void setUp() { + this.projectDir = TempDir.forClass(SpineBootstrapPluginTest.class).toPath(); this.project = GradleProject .newBuilder() .setProjectName("func-test") - .setProjectFolder(projectDir) + .setProjectFolder(projectDir.toFile()) .withPluginClasspath() .addProtoFile("roller_coaster.proto"); } @@ -115,7 +113,8 @@ void applyModelCompiler() { project.executeTask(build); Collection resourceFiles = assembledResources(); - String projectDir = this.projectDir.getName(); + String projectDir = this.projectDir.getFileName() + .toString(); boolean containsDescriptorSetFile = resourceFiles.stream() .filter(f -> f.endsWith(FileDescriptors.DESC_EXTENSION)) @@ -375,8 +374,7 @@ private void writeConfigGradle(String... lines) { } private Collection assembledResources() { - Path resourcePath = projectDir.toPath() - .resolve("build") + Path resourcePath = projectDir.resolve("build") .resolve("resources") .resolve("main"); File resourceDir = resourcePath.toFile(); @@ -406,8 +404,7 @@ private Collection generatedClassFileNames() { } private Path compiledJavaClasses() { - Path compiledClasses = projectDir.toPath() - .resolve("build") + Path compiledClasses = projectDir.resolve("build") .resolve("classes") .resolve("java") .resolve("main"); @@ -415,8 +412,7 @@ private Path compiledJavaClasses() { } private Path generatedFiles() { - Path generated = projectDir.toPath() - .resolve("generated"); + Path generated = projectDir.resolve("generated"); return generated; } @@ -446,7 +442,7 @@ private Collection generatedJsFileNames() { } private Collection generatedDartFileNames() { - Path libDir = projectDir.toPath().resolve("lib"); + Path libDir = projectDir.resolve("lib"); File libDirFile = libDir.toFile(); assertTrue(libDirFile.exists()); assertTrue(libDirFile.isDirectory()); From 9c84692826499ffd8ccb302b631983c51931201f Mon Sep 17 00:00:00 2001 From: Dmytro Dashenkov Date: Tue, 17 Nov 2020 19:27:43 +0200 Subject: [PATCH 39/39] Add shutdown hooks for temp files --- license-report.md | 2 +- .../spine/tools/gradle/bootstrap/BootstrapPluginTest.java | 1 + .../io/spine/tools/gradle/bootstrap/ExtensionTest.java | 7 +++++-- .../gradle/bootstrap/func/SpineBootstrapPluginTest.java | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/license-report.md b/license-report.md index f1c6abd0..eda957af 100644 --- a/license-report.md +++ b/license-report.md @@ -334,4 +334,4 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Nov 17 12:46:44 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Nov 17 19:24:52 EET 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java index f844a7e0..bbc6964b 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/BootstrapPluginTest.java @@ -40,6 +40,7 @@ class BootstrapPluginTest { @BeforeEach void setUp() { File projectDir = TempDir.forClass(BootstrapPluginTest.class); + projectDir.deleteOnExit(); project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java index 6f0178e6..ebb7d4f6 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/ExtensionTest.java @@ -48,6 +48,7 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +import java.io.IOException; import java.nio.file.Path; import java.util.concurrent.atomic.AtomicBoolean; @@ -86,6 +87,7 @@ class ExtensionTest { @BeforeEach void setUp() { this.projectDir = TempDir.forClass(ExtensionTest.class).toPath(); + projectDir.toFile().deleteOnExit(); this.project = ProjectBuilder .builder() .withName(BootstrapPluginTest.class.getSimpleName()) @@ -339,12 +341,13 @@ void noExclusions() { @Test @DisplayName("declare `generated` directory a source root") - void declareGeneratedDirectory() { + void declareGeneratedDirectory() throws IOException { extension.enableJava(); assertApplied(JavaPlugin.class); ImmutableSet declaredPaths = codeLayout.javaSourceDirs(); - assertThat(declaredPaths).contains(projectDir.resolve("generated")); + Path realDirPath = projectDir.toRealPath(); + assertThat(declaredPaths).contains(realDirPath.resolve("generated")); } @Test diff --git a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java index acc61230..e0816280 100644 --- a/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java +++ b/plugin/src/test/java/io/spine/tools/gradle/bootstrap/func/SpineBootstrapPluginTest.java @@ -61,6 +61,7 @@ class SpineBootstrapPluginTest { @BeforeEach void setUp() { this.projectDir = TempDir.forClass(SpineBootstrapPluginTest.class).toPath(); + projectDir.toFile().deleteOnExit(); this.project = GradleProject .newBuilder() .setProjectName("func-test")