├── samples ├── .gitignore ├── ant │ ├── settings.gradle.kts │ ├── src │ │ └── main │ │ │ └── config │ │ │ ├── copy.properties │ │ │ ├── copy.txt │ │ │ └── copy.xml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── gradlew.bat ├── copy │ ├── settings.gradle.kts │ ├── src │ │ ├── data │ │ │ ├── copy.bak │ │ │ └── copy.data │ │ └── main │ │ │ └── config │ │ │ ├── copy.properties │ │ │ ├── copy.txt │ │ │ └── copy.xml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── gradlew.bat ├── build-scan │ ├── build.gradle.kts │ ├── README.md │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle.kts │ └── gradlew.bat ├── hello-kapt │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── README.md │ ├── src │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── samples │ │ │ │ ├── HelloAutoValue.kt │ │ │ │ └── Writer.kt │ │ └── test │ │ │ └── kotlin │ │ │ └── samples │ │ │ └── WriterTest.kt │ ├── build.gradle.kts │ └── gradlew.bat ├── modularity │ ├── settings.gradle.kts │ ├── bar.gradle.kts │ ├── foo.gradle.kts │ ├── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── lorem.gradle.kts ├── testkit │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ ├── src │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── samples │ │ │ │ └── GreetPlugin.kt │ │ └── test │ │ │ └── kotlin │ │ │ └── samples │ │ │ └── GreetPluginTest.kt │ └── gradlew.bat ├── buildSrc-plugin │ ├── settings.gradle.kts │ ├── buildSrc │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── GreetPlugin.kt │ ├── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── README.md ├── code-quality │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── samples │ │ │ │ └── HelloWorld.java │ │ └── test │ │ │ └── java │ │ │ └── samples │ │ │ └── HelloWorldTest.java │ ├── build.gradle.kts │ └── gradlew.bat ├── domain-objects │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── build.gradle.kts ├── gradle-plugin │ ├── settings.gradle.kts │ ├── plugin │ │ ├── settings.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── plugin │ │ │ └── MyPlugin.kt │ ├── consumer │ │ ├── build.gradle.kts │ │ └── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── README.md ├── groovy-interop │ ├── settings.gradle.kts │ ├── groovy.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── README.md │ └── build.gradle.kts ├── hello-kotlin │ ├── settings.gradle.kts │ ├── src │ │ └── main │ │ │ └── kotlin │ │ │ └── samples │ │ │ └── HelloWorld.kt │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── gradlew.bat ├── hello-world │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── samples │ │ │ │ └── HelloWorld.java │ │ └── test │ │ │ └── java │ │ │ └── samples │ │ │ └── HelloWorldTest.java │ ├── build.gradle.kts │ └── gradlew.bat ├── maven-plugin │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── README.md │ └── build.gradle.kts ├── model-rules │ ├── settings.gradle.kts │ ├── buildSrc │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── my │ │ │ └── model_rules.kt │ ├── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── README.md ├── extra-properties │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── build.gradle.kts ├── hello-android │ ├── app │ │ ├── .gitignore │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ │ ├── layout │ │ │ │ │ │ └── activity_main.xml │ │ │ │ │ └── drawable-v24 │ │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ ├── java │ │ │ │ │ └── org │ │ │ │ │ │ └── gradle │ │ │ │ │ │ └── kotlin │ │ │ │ │ │ └── dsl │ │ │ │ │ │ └── samples │ │ │ │ │ │ └── androidstudio │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── test │ │ │ │ └── java │ │ │ │ │ └── org │ │ │ │ │ └── gradle │ │ │ │ │ └── kotlin │ │ │ │ │ └── dsl │ │ │ │ │ └── samples │ │ │ │ │ └── androidstudio │ │ │ │ │ └── ExampleUnitTest.kt │ │ │ └── androidTest │ │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── gradle │ │ │ │ └── kotlin │ │ │ │ └── dsl │ │ │ │ └── samples │ │ │ │ └── androidstudio │ │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── proguard-rules.pro │ │ └── build.gradle.kts │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ └── gradle.properties ├── hello-coroutines │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── README.md │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ └── samples │ │ └── HelloCoroutines.kt ├── project-properties │ ├── settings.gradle.kts │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── build.gradle.kts ├── provider-properties │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── build.gradle.kts ├── task-dependencies │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── build.gradle.kts ├── precompiled-script-plugin │ ├── settings.gradle.kts │ ├── plugin │ │ ├── settings.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── my-plugin.gradle.kts │ ├── consumer │ │ ├── build.gradle.kts │ │ └── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── README.md ├── project-with-buildSrc │ ├── settings.gradle.kts │ ├── buildSrc │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ ├── HelloTask.kt │ │ │ ├── my-plugin.gradle.kts │ │ │ ├── MyProjectExtension.kt │ │ │ └── extensions.kt │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── README.md ├── kotlin-friendly-groovy-plugin │ ├── settings.gradle.kts │ ├── plugin │ │ ├── settings.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── groovy │ │ │ └── my │ │ │ └── DocumentationPlugin.groovy │ ├── consumer │ │ ├── settings.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ └── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle.kts │ └── README.md ├── build-cache │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── samples │ │ │ │ └── HelloWorld.java │ │ └── test │ │ │ └── java │ │ │ └── samples │ │ │ └── HelloWorldTest.java │ ├── README.md │ ├── build.gradle.kts │ ├── settings.gradle.kts │ └── gradlew.bat ├── multi-project-with-buildSrc │ ├── buildSrc │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── HelloTask.kt │ ├── settings.gradle.kts │ ├── bluewhale │ │ └── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── krill │ │ └── build.gradle.kts │ ├── build.gradle.kts │ └── README.md ├── multi-kotlin-project-with-buildSrc │ ├── buildSrc │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── utils.kt │ ├── settings.gradle.kts │ ├── core │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── core │ │ │ └── DeepThought.kt │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── cli │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── cli │ │ │ └── Main.kt │ ├── build.gradle.kts │ └── README.md ├── multi-kotlin-project │ ├── settings.gradle.kts │ ├── core │ │ ├── src │ │ │ └── main │ │ │ │ └── kotlin │ │ │ │ └── core │ │ │ │ └── DeepThought.kt │ │ └── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── cli │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── cli │ │ │ └── Main.kt │ ├── build.gradle.kts │ └── README.md ├── maven-publish │ ├── settings.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── src │ │ └── main │ │ │ ├── kotlin │ │ │ └── samples │ │ │ │ └── kotlin-source.kt │ │ │ └── java │ │ │ └── samples │ │ │ └── JavaSource.java │ ├── README.md │ └── build.gradle.kts ├── source-control │ ├── external │ │ ├── settings.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── compute │ │ │ │ └── DeepThought.java │ │ └── build.gradle.kts │ ├── sample │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── samples │ │ │ └── HelloWorld.java │ └── README.md ├── composite-builds │ ├── cli │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── cli │ │ │ └── Main.java │ ├── core │ │ ├── settings.gradle.kts │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── core │ │ │ └── DeepThought.java │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle.kts │ ├── build.gradle.kts │ └── README.md ├── multi-kotlin-project-config-injection │ ├── settings.gradle.kts │ ├── core │ │ ├── src │ │ │ └── main │ │ │ │ └── kotlin │ │ │ │ └── core │ │ │ │ └── DeepThought.kt │ │ └── build.gradle.kts │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── cli │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── cli │ │ │ └── Main.kt │ ├── README.md │ └── build.gradle.kts └── hello-js │ ├── src │ └── main │ │ ├── kotlin │ │ └── samples │ │ │ └── HelloWorld.kt │ │ └── resources │ │ └── index.html │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── settings.gradle.kts │ ├── README.md │ ├── build.gradle.kts │ └── gradlew.bat ├── gradle.properties ├── subprojects └── samples-tests │ ├── src │ ├── exemplar │ │ └── samples │ │ │ ├── groovy-interop │ │ │ ├── intSum.sample.out │ │ │ ├── stringSum.sample.out │ │ │ ├── intSum.sample.conf │ │ │ └── stringSum.sample.conf │ │ │ ├── hello-kotlin │ │ │ ├── run.sample.out │ │ │ └── run.sample.conf │ │ │ ├── model-rules │ │ │ ├── hello.sample.out │ │ │ └── hello.sample.conf │ │ │ ├── ant │ │ │ ├── pmd.sample.conf │ │ │ ├── zip.sample.conf │ │ │ ├── hello.sample.out │ │ │ └── hello.sample.conf │ │ │ ├── modularity │ │ │ ├── foo_bar_lorem.sample.out │ │ │ └── foo_bar_lorem.sample.conf │ │ │ ├── hello-coroutines │ │ │ ├── run.sample.out │ │ │ └── run.sample.conf │ │ │ ├── project-with-buildSrc │ │ │ ├── myReport.sample.out │ │ │ ├── printProfile.sample.out │ │ │ ├── printProfile_property.sample.out │ │ │ ├── printProfile.sample.conf │ │ │ ├── myReport.sample.conf │ │ │ └── printProfile_property.sample.conf │ │ │ ├── hello-kapt │ │ │ ├── test.sample.conf │ │ │ ├── run.sample.conf │ │ │ └── run.sample.out │ │ │ ├── hello-world │ │ │ └── test.sample.conf │ │ │ ├── testkit │ │ │ └── test.sample.conf │ │ │ ├── build-cache │ │ │ ├── compileJava.sample.out │ │ │ └── compileJava.sample.conf │ │ │ ├── buildSrc-plugin │ │ │ ├── greet.sample.out │ │ │ └── greet.sample.conf │ │ │ ├── gradle-plugin │ │ │ ├── consumer.sample.out │ │ │ └── consumer.sample.conf │ │ │ ├── composite-builds │ │ │ ├── run.sample.out │ │ │ └── run.sample.conf │ │ │ ├── multi-kotlin-project │ │ │ ├── run.sample.out │ │ │ └── run.sample.conf │ │ │ ├── project-properties │ │ │ ├── compute.sample.out │ │ │ └── compute.sample.conf │ │ │ ├── task-dependencies │ │ │ ├── default.sample.out │ │ │ └── default.sample.conf │ │ │ ├── multi-kotlin-project-config-injection │ │ │ ├── run.sample.out │ │ │ └── run.sample.conf │ │ │ ├── multi-kotlin-project-with-buildSrc │ │ │ ├── run.sample.out │ │ │ └── run.sample.conf │ │ │ ├── extra-properties │ │ │ ├── test.sample.out │ │ │ └── test.sample.conf │ │ │ ├── domain-objects │ │ │ ├── books.sample.out │ │ │ └── books.sample.conf │ │ │ ├── precompiled-script-plugin │ │ │ ├── consumer.sample.out │ │ │ └── consumer.sample.conf │ │ │ ├── multi-project-with-buildSrc │ │ │ ├── hello.sample.conf │ │ │ └── hello.sample.out │ │ │ ├── code-quality │ │ │ ├── check.sample.conf │ │ │ └── check.sample.out │ │ │ └── kotlin-friendly-groovy-plugin │ │ │ ├── consumer.sample.out │ │ │ └── consumer.sample.conf │ └── test │ │ └── kotlin │ │ └── org │ │ └── gradle │ │ └── kotlin │ │ └── dsl │ │ └── samples │ │ ├── SourceControlSampleTest.kt │ │ ├── BuildScanSampleTest.kt │ │ ├── CopySampleTest.kt │ │ ├── ProviderPropertiesSampleTest.kt │ │ ├── HelloKaptSampleTest.kt │ │ ├── HelloAndroidSampleTest.kt │ │ ├── ExemplarExternalSamplesTest.kt │ │ ├── HelloJsSampleTest.kt │ │ ├── MavenPublishSampleTest.kt │ │ ├── AbstractSampleTest.kt │ │ ├── MavenPluginSampleTest.kt │ │ └── SamplesSmokeTest.kt │ └── samples-tests.gradle.kts ├── .github ├── dco.yml ├── workflows │ └── gradle-wrapper-validation.yml ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── init-scripts │ └── build-scan.init.gradle.kts └── shared-with-buildSrc │ └── build-cache-configuration.settings.gradle.kts ├── .gitignore ├── .editorconfig ├── .travis.yml ├── settings.gradle.kts └── gradlew.bat /samples/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /samples/ant/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/copy/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/build-scan/build.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/hello-kapt/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/modularity/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/testkit/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/code-quality/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/copy/src/data/copy.bak: -------------------------------------------------------------------------------- 1 | the data 2 | -------------------------------------------------------------------------------- /samples/domain-objects/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/gradle-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/groovy-interop/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/hello-kotlin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/hello-world/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/maven-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/model-rules/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/copy/src/data/copy.data: -------------------------------------------------------------------------------- 1 | the data 2 | -------------------------------------------------------------------------------- /samples/extra-properties/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/gradle-plugin/plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/hello-android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /samples/hello-coroutines/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/model-rules/buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/project-properties/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/provider-properties/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/task-dependencies/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/project-properties/gradle.properties: -------------------------------------------------------------------------------- 1 | answer=42 2 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/ant/src/main/config/copy.properties: -------------------------------------------------------------------------------- 1 | version=@version@ 2 | -------------------------------------------------------------------------------- /samples/build-cache/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.caching=true 2 | -------------------------------------------------------------------------------- /samples/copy/src/main/config/copy.properties: -------------------------------------------------------------------------------- 1 | version=@version@ 2 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `greet` 3 | } 4 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xms256m -Xmx256m -Dfile.encoding=UTF-8 2 | -------------------------------------------------------------------------------- /samples/ant/src/main/config/copy.txt: -------------------------------------------------------------------------------- 1 | @version@ won't be replaced in this file 2 | -------------------------------------------------------------------------------- /samples/copy/src/main/config/copy.txt: -------------------------------------------------------------------------------- 1 | @version@ won't be replaced in this file 2 | -------------------------------------------------------------------------------- /samples/groovy-interop/groovy.gradle: -------------------------------------------------------------------------------- 1 | 2 | ext.groovySum = { i, j -> i + j } 3 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | include("cli", "core") 3 | -------------------------------------------------------------------------------- /samples/maven-publish/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "maven-publish" 2 | 3 | -------------------------------------------------------------------------------- /samples/model-rules/build.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | apply("plugin" to my.Rules::class.java) 3 | -------------------------------------------------------------------------------- /samples/source-control/external/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "compute" 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/groovy-interop/intSum.sample.out: -------------------------------------------------------------------------------- 1 | 44 2 | -------------------------------------------------------------------------------- /samples/composite-builds/cli/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | // Mark the folder as a Gradle project 2 | -------------------------------------------------------------------------------- /samples/composite-builds/core/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | // Mark the folder as a Gradle project 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-kotlin/run.sample.out: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | include("cli", "core") 3 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | include("cli", "core") 3 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | include("bluewhale", "krill") 3 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/model-rules/hello.sample.out: -------------------------------------------------------------------------------- 1 | Hello John Smith! 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/ant/pmd.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: pmd 3 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/ant/zip.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: zip 3 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/groovy-interop/stringSum.sample.out: -------------------------------------------------------------------------------- 1 | GroovyKotlin 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/modularity/foo_bar_lorem.sample.out: -------------------------------------------------------------------------------- 1 | Foo! 2 | Bar! 3 | -------------------------------------------------------------------------------- /samples/gradle-plugin/consumer/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("my-plugin") version "1.0" 3 | } 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-coroutines/run.sample.out: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-with-buildSrc/myReport.sample.out: -------------------------------------------------------------------------------- 1 | my.flag = true 2 | -------------------------------------------------------------------------------- /samples/ant/src/main/config/copy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "my-documentation-plugin" 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-kapt/test.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: test 3 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-world/test.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: test 3 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/testkit/test.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: test 3 | -------------------------------------------------------------------------------- /samples/copy/src/main/config/copy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /samples/hello-android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.buildFileName = "build.gradle.kts" 2 | 3 | include(":app") 4 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/consumer/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("my-plugin") version "1.0" 3 | } 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/ant/hello.sample.out: -------------------------------------------------------------------------------- 1 | > Task :hello 2 | [ant:echo] Hello from Ant! 3 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/build-cache/compileJava.sample.out: -------------------------------------------------------------------------------- 1 | > Task :compileJava FROM-CACHE 2 | -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | # Disable sign-off chcecking for members of the Gradle GitHub organization 2 | require: 3 | members: false 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/modularity/bar.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | tasks.register("bar") { 3 | group = "sample" 4 | doLast { println("Bar!") } 5 | } 6 | -------------------------------------------------------------------------------- /samples/modularity/foo.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | tasks.register("foo") { 3 | group = "sample" 4 | doLast { println("Foo!") } 5 | } 6 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | kotlinProject() 6 | -------------------------------------------------------------------------------- /samples/model-rules/buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | jcenter() 7 | } 8 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/buildSrc-plugin/greet.sample.out: -------------------------------------------------------------------------------- 1 | > Task :greet 2 | I'm buildSrc-plugin_greet.sample. 3 | -------------------------------------------------------------------------------- /samples/build-scan/README.md: -------------------------------------------------------------------------------- 1 | build-scan 2 | ========== 3 | 4 | Demonstrates how to apply and configure the `org.gradle.build-scan` plugin. 5 | -------------------------------------------------------------------------------- /samples/modularity/build.gradle.kts: -------------------------------------------------------------------------------- 1 | apply(from = "foo.gradle.kts") 2 | apply(from = "bar.gradle.kts") 3 | apply(from = "lorem.gradle.kts") 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/gradle-plugin/consumer.sample.out: -------------------------------------------------------------------------------- 1 | > Task :plugin:publish 2 | > Task :consumer:myCopyTask 3 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | jcenter() 7 | } 8 | -------------------------------------------------------------------------------- /samples/ant/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/ant/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-kotlin-project/core/src/main/kotlin/core/DeepThought.kt: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | object DeepThought { 4 | fun compute() = 42 5 | } 6 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | jcenter() 7 | } 8 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-with-buildSrc/printProfile.sample.out: -------------------------------------------------------------------------------- 1 | The current profile is dev 2 | Here's the profile: dev 3 | -------------------------------------------------------------------------------- /samples/copy/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/copy/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/hello-js/src/main/kotlin/samples/HelloWorld.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | fun main(args: Array) { 4 | println("Hello, world!") 5 | } 6 | -------------------------------------------------------------------------------- /samples/hello-kotlin/src/main/kotlin/samples/HelloWorld.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | fun main(args: Array) { 4 | println("Hello, world!") 5 | } 6 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | jcenter() 7 | } 8 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | dependencies { 6 | compile(kotlin("stdlib")) 7 | } 8 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-kapt/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: run -q 3 | expected-output-file: run.sample.out 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-kotlin/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: run -q 3 | expected-output-file: run.sample.out 4 | -------------------------------------------------------------------------------- /samples/hello-js/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-js/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/core/src/main/kotlin/core/DeepThought.kt: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | object DeepThought { 4 | fun compute() = 42 5 | } 6 | -------------------------------------------------------------------------------- /samples/testkit/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/testkit/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/composite-builds/run.sample.out: -------------------------------------------------------------------------------- 1 | The answer to the ultimate question of Life, the Universe and Everything is 42. 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-coroutines/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: run -q 3 | expected-output-file: run.sample.out 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-with-buildSrc/printProfile_property.sample.out: -------------------------------------------------------------------------------- 1 | The current profile is prod 2 | Here's the profile: prod 3 | -------------------------------------------------------------------------------- /samples/build-scan/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/build-scan/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Kotlin DSL Android Studio Sample 3 | 4 | -------------------------------------------------------------------------------- /samples/hello-kapt/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-kapt/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/modularity/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/modularity/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/core/src/main/kotlin/core/DeepThought.kt: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | object DeepThought { 4 | fun compute() = 42 5 | } 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/groovy-interop/intSum.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: intSum -q 3 | expected-output-file: intSum.sample.out 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-kotlin-project/run.sample.out: -------------------------------------------------------------------------------- 1 | The answer to the ultimate question of Life, the Universe and Everything is 42. 2 | -------------------------------------------------------------------------------- /samples/build-cache/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/build-cache/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/code-quality/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/code-quality/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/gradle-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/gradle-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/hello-android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/hello-kotlin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-kotlin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/hello-world/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-world/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/maven-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/maven-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/maven-publish/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/maven-publish/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/model-rules/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/model-rules/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | dependencies { 6 | compile(kotlin("stdlib")) 7 | } 8 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-properties/compute.sample.out: -------------------------------------------------------------------------------- 1 | The answer to the ultimate question about life, the universe and everything is 42. 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/task-dependencies/default.sample.out: -------------------------------------------------------------------------------- 1 | > Task :hello 2 | Hello! 3 | 4 | > Task :goodbye 5 | Goodbye! 6 | 7 | > Task :chat 8 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/buildSrc-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/composite-builds/core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | plugins { 3 | java 4 | } 5 | 6 | group = "org.gradle.kotlin.dsl.samples.composite-builds" 7 | version = "1.0" 8 | 9 | -------------------------------------------------------------------------------- /samples/domain-objects/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/domain-objects/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/gradle-plugin/consumer/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { url = uri("../plugin/build/repository") } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/groovy-interop/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/groovy-interop/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/groovy-interop/stringSum.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: stringSum -q 3 | expected-output-file: stringSum.sample.out 4 | -------------------------------------------------------------------------------- /samples/composite-builds/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/composite-builds/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/extra-properties/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/extra-properties/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/hello-coroutines/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-coroutines/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/project-properties/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/project-properties/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/task-dependencies/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/task-dependencies/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-kotlin-project-config-injection/run.sample.out: -------------------------------------------------------------------------------- 1 | The answer to the ultimate question of Life, the Universe and Everything is 42. 2 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-kotlin-project-with-buildSrc/run.sample.out: -------------------------------------------------------------------------------- 1 | The answer to the ultimate question of Life, the Universe and Everything is 42. 2 | -------------------------------------------------------------------------------- /samples/gradle-plugin/plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/gradle-plugin/plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-kotlin-project/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/multi-kotlin-project/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/consumer/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { url = uri("../plugin/build/repository") } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/provider-properties/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/provider-properties/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/task-dependencies/default.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | expected-output-file: default.sample.out 3 | allow-additional-output: true 4 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/consumer/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { url = uri("../plugin/build/repository") } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/bluewhale/build.gradle.kts: -------------------------------------------------------------------------------- 1 | hello { 2 | doLast { 3 | println("- I'm the largest animal that has ever lived on this planet.") 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/project-with-buildSrc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/source-control/external/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/source-control/external/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/source-control/sample/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/source-control/sample/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/composite-builds/core/src/main/java/core/DeepThought.java: -------------------------------------------------------------------------------- 1 | package core; 2 | 3 | public class DeepThought { 4 | public static int compute() { 5 | return 42; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/precompiled-script-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/extra-properties/test.sample.out: -------------------------------------------------------------------------------- 1 | myTask.foo = 42 2 | Extra foo property value: 42 3 | myTask.bar = null 4 | Optional extra bar property value: null 5 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/multi-project-with-buildSrc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/krill/build.gradle.kts: -------------------------------------------------------------------------------- 1 | hello { 2 | doLast { 3 | println("- The weight of my species in summer is twice as heavy as all human beings.") 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/domain-objects/books.sample.out: -------------------------------------------------------------------------------- 1 | developerGuide -> src/docs/developerGuide 2 | quickStart -> src/docs/quick-start 3 | userGuide -> src/docs/userGuide 4 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-kotlin-project/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: ":cli:run" 3 | expected-output-file: run.sample.out 4 | allow-additional-output: true 5 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/precompiled-script-plugin/consumer.sample.out: -------------------------------------------------------------------------------- 1 | > Task :plugin:generateScriptPluginAdapters 2 | > Task :plugin:publish 3 | > Task :consumer:myCopyTask 4 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/kotlin-friendly-groovy-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/source-control/external/src/main/java/compute/DeepThought.java: -------------------------------------------------------------------------------- 1 | package compute; 2 | 3 | public class DeepThought { 4 | public static int compute() { 5 | return 42; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-project-with-buildSrc/hello.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: hello 3 | expected-output-file: hello.sample.out 4 | allow-additional-output: true 5 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/hello-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/precompiled-script-plugin/plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-kotlin-project-with-buildSrc/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: run 3 | expected-output-file: run.sample.out 4 | allow-additional-output: true 5 | -------------------------------------------------------------------------------- /samples/hello-coroutines/README.md: -------------------------------------------------------------------------------- 1 | hello-coroutines 2 | ================ 3 | 4 | Demonstrates how to enable experimental support for [coroutines in Kotlin](https://kotlinlang.org/docs/reference/coroutines.html). 5 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/multi-kotlin-project-with-buildSrc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/ant/hello.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: hello 3 | expected-output-file: hello.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /samples/composite-builds/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | includeBuild("core") { 2 | dependencySubstitution { 3 | substitute(module("composite-builds:core")).with(project(":")) 4 | } 5 | } 6 | includeBuild("cli") 7 | -------------------------------------------------------------------------------- /samples/hello-android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/consumer/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/kotlin-friendly-groovy-plugin/consumer/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/kotlin-friendly-groovy-plugin/plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solves/kotlin-dsl-samples/master/samples/multi-kotlin-project-config-injection/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-kotlin-project-config-injection/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: ":cli:run" 3 | expected-output-file: run.sample.out 4 | allow-additional-output: true 5 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/code-quality/check.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: check 3 | expected-output-file: check.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/composite-builds/run.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: run 3 | expected-output-file: run.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/extra-properties/test.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: test 3 | expected-output-file: test.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/model-rules/hello.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: hello 3 | expected-output-file: hello.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/buildSrc-plugin/greet.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: greet 3 | expected-output-file: greet.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/code-quality/check.sample.out: -------------------------------------------------------------------------------- 1 | > Task :checkstyleMain 2 | > Task :checkstyleTest 3 | > Task :test 4 | > Task :jacocoTestCoverageVerification 5 | > Task :pmdMain 6 | > Task :pmdTest 7 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/domain-objects/books.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: books 3 | expected-output-file: books.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | .gradle 3 | build 4 | 5 | # idea 6 | .idea 7 | *.iml 8 | local.properties 9 | out/ 10 | 11 | # mr (see .mrconfig) 12 | wiki 13 | 14 | # vim 15 | *.sw? 16 | 17 | # generated code 18 | .teamcity 19 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/gradle-plugin/consumer.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: consumer 3 | expected-output-file: consumer.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/kotlin-friendly-groovy-plugin/consumer.sample.out: -------------------------------------------------------------------------------- 1 | > Task :consumer:books 2 | developerGuide -> src/docs/developerGuide 3 | quickStart -> src/docs/quick-start 4 | userGuide -> src/docs/userGuide 5 | -------------------------------------------------------------------------------- /samples/composite-builds/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks { 2 | register("run") { 3 | dependsOn(gradle.includedBuild("cli").task(":run")) 4 | group = "Application" 5 | description = "Runs the :cli project :run task" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | allprojects { 2 | declareHelloTask() 3 | } 4 | 5 | subprojects { 6 | hello { 7 | doLast { 8 | println("- I depend on water") 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/kotlin-friendly-groovy-plugin/consumer.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: consumer 3 | expected-output-file: consumer.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/modularity/foo_bar_lorem.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: foo bar lorem 3 | expected-output-file: foo_bar_lorem.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/precompiled-script-plugin/consumer.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: consumer 3 | expected-output-file: consumer.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [gradlew.bat] 12 | end_of_line = crlf 13 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-with-buildSrc/printProfile.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: printProfile 3 | expected-output-file: printProfile.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/maven-publish/src/main/kotlin/samples/kotlin-source.kt: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | /** 4 | * Prints "Hello, from kotlin!" 5 | * @param args Ignored. 6 | */ 7 | fun main(args: Array) { 8 | println("Hello, from kotlin!") 9 | } 10 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/hello-kapt/run.sample.out: -------------------------------------------------------------------------------- 1 | warning: The following options were not recognized by any processor: '[SomeKaptArgument, kapt.kotlin.generated]'Hello Writer{name=Douglas, age=41, books=[THGttG, DGHDA]} 2 | The answer is 42 3 | -------------------------------------------------------------------------------- /samples/ant/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/build-scan/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `gradle-enterprise` 3 | } 4 | 5 | gradleEnterprise { 6 | buildScan { 7 | termsOfServiceUrl = "https://gradle.com/terms-of-service" 8 | termsOfServiceAgree = "yes" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/copy/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-js/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/testkit/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/build-cache/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/build-scan/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/code-quality/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/domain-objects/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/gradle-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/groovy-interop/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-kapt/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-kotlin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-world/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/maven-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/maven-publish/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/model-rules/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/modularity/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-with-buildSrc/myReport.sample.conf: -------------------------------------------------------------------------------- 1 | # test precompiled script plugin 2 | executable: gradle 3 | args: myReport 4 | expected-output-file: myReport.sample.out 5 | allow-additional-output: true 6 | allow-disordered-output: true 7 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/composite-builds/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/extra-properties/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /samples/hello-coroutines/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/cli/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | kotlin("jvm") 4 | } 5 | 6 | application { 7 | mainClassName = "cli.Main" 8 | } 9 | 10 | dependencies { 11 | compile(project(":core")) 12 | compile(kotlin("stdlib")) 13 | } 14 | -------------------------------------------------------------------------------- /samples/project-properties/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/provider-properties/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/task-dependencies/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/gradle-plugin/plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/cli/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | kotlin("jvm") 4 | } 5 | 6 | kotlinProject() 7 | 8 | application { 9 | mainClassName = "cli.Main" 10 | } 11 | 12 | dependencies { 13 | compile(project(":core")) 14 | } 15 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/source-control/external/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/source-control/sample/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/source-control/sample/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | sourceControl { 2 | // A real life example would use a remote git repository 3 | gitRepository(uri("../external/build/git-repo")) { 4 | producesModule("org.gradle.kotlin.dsl.samples.source-control:compute") 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-with-buildSrc/printProfile_property.sample.conf: -------------------------------------------------------------------------------- 1 | executable: gradle 2 | args: "printProfile -Pprofile=prod" 3 | expected-output-file: printProfile_property.sample.out 4 | allow-additional-output: true 5 | allow-disordered-output: true 6 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/source-control/sample/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | } 4 | 5 | application { 6 | mainClassName = "samples.HelloWorld" 7 | } 8 | 9 | dependencies { 10 | implementation("org.gradle.kotlin.dsl.samples.source-control:compute:latest.integration") 11 | } 12 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/consumer/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/cli/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | kotlin("jvm") 4 | } 5 | 6 | application { 7 | mainClassName = "cli.Main" 8 | } 9 | 10 | dependencies { 11 | compile(project(":core")) 12 | compile(kotlin("stdlib")) 13 | } 14 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/hello-js/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | resolutionStrategy { 3 | eachPlugin { 4 | if (requested.id.id == "kotlin2js") { 5 | useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}") 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/hello-kotlin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | kotlin("jvm") version "1.3.70" 4 | } 5 | 6 | application { 7 | mainClassName = "samples.HelloWorldKt" 8 | } 9 | 10 | dependencies { 11 | compile(kotlin("stdlib")) 12 | } 13 | 14 | repositories { 15 | jcenter() 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/gradle-wrapper-validation.yml: -------------------------------------------------------------------------------- 1 | name: "Validate Gradle Wrapper" 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | validation: 6 | name: "Validation" 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: gradle/wrapper-validation-action@v1 11 | 12 | -------------------------------------------------------------------------------- /samples/build-cache/src/main/java/samples/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | public class HelloWorld { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(greeting()); 7 | } 8 | 9 | static String greeting() { 10 | return "Hello, world!"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/code-quality/src/main/java/samples/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | public class HelloWorld { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(greeting()); 7 | } 8 | 9 | static String greeting() { 10 | return "Hello, world!"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/hello-world/src/main/java/samples/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | public class HelloWorld { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(greeting()); 7 | } 8 | 9 | static String greeting() { 10 | return "Hello, world!"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/composite-builds/cli/build.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | plugins { 3 | application 4 | } 5 | 6 | group = "org.gradle.kotlin.dsl.samples.composite-builds" 7 | version = "1.0" 8 | 9 | application { 10 | mainClassName = "cli.Main" 11 | } 12 | 13 | dependencies { 14 | compile("composite-builds:core:1.0") 15 | } 16 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/cli/src/main/kotlin/cli/Main.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("Main") 2 | package cli 3 | 4 | import core.* 5 | 6 | fun main(vararg args: String) { 7 | val answer = DeepThought.compute() 8 | println("The answer to the ultimate question of Life, the Universe and Everything is $answer.") 9 | } 10 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/README.md: -------------------------------------------------------------------------------- 1 | buildSrc-plugin 2 | ===================== 3 | 4 | A build with a [custom plugin](./buildSrc/src/main/kotlin/GreetPlugin.kt) defined in [`buildSrc`](./buildSrc). 5 | 6 | List the available tasks with: 7 | 8 | ./gradlew tasks 9 | 10 | Run with: 11 | 12 | ./gradlew -q greet 13 | 14 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/cli/src/main/kotlin/cli/Main.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("Main") 2 | package cli 3 | 4 | import core.* 5 | 6 | fun main(vararg args: String) { 7 | val answer = DeepThought.compute() 8 | println("The answer to the ultimate question of Life, the Universe and Everything is $answer.") 9 | } 10 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | `maven-publish` 4 | } 5 | 6 | group = "my" 7 | 8 | version = "1.0" 9 | 10 | publishing { 11 | repositories { 12 | maven(url = "build/repository") 13 | } 14 | } 15 | 16 | repositories { 17 | jcenter() 18 | } 19 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | gradlePlugin { 6 | plugins { 7 | register("greet-plugin") { 8 | id = "greet" 9 | implementationClass = "GreetPlugin" 10 | } 11 | } 12 | } 13 | 14 | repositories { 15 | jcenter() 16 | } 17 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/cli/src/main/kotlin/cli/Main.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("Main") 2 | package cli 3 | 4 | import core.* 5 | 6 | fun main(vararg args: String) { 7 | val answer = DeepThought.compute() 8 | println("The answer to the ultimate question of Life, the Universe and Everything is $answer.") 9 | } 10 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/build-cache/compileJava.sample.conf: -------------------------------------------------------------------------------- 1 | commands: [{ 2 | executable: gradle 3 | args: build 4 | },{ 5 | executable: gradle 6 | args: clean build 7 | expected-output-file: compileJava.sample.out 8 | allow-additional-output: true 9 | allow-disordered-output: true 10 | }] 11 | -------------------------------------------------------------------------------- /samples/build-cache/README.md: -------------------------------------------------------------------------------- 1 | build-cache 2 | =========== 3 | 4 | A project that configures Gradle build cache. 5 | 6 | See [settings.gradle.kts](./settings.gradle.kts). 7 | 8 | Populate local cache with: 9 | 10 | ./gradlew build 11 | 12 | Build and fetch cached tasks outputs from local cache with: 13 | 14 | ./gradlew clean build 15 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/project-properties/compute.sample.conf: -------------------------------------------------------------------------------- 1 | # test precompiled script plugin 2 | executable: gradle 3 | args: [ "-Plabel=answer to the ultimate question about life, the universe and everything", "compute" ] 4 | expected-output-file: compute.sample.out 5 | allow-additional-output: true 6 | allow-disordered-output: true 7 | -------------------------------------------------------------------------------- /samples/maven-publish/README.md: -------------------------------------------------------------------------------- 1 | maven-publish 2 | ========== 3 | 4 | Demonstrates how to apply and configure the `maven-publish` plugin to publish a kotlin library with accompanying 5 | sources. 6 | 7 | Run with 8 | 9 | ./gradlew publish 10 | 11 | This will publish the default and source jar files to a temporary repository located at `$buildDir/repo` 12 | -------------------------------------------------------------------------------- /samples/composite-builds/cli/src/main/java/cli/Main.java: -------------------------------------------------------------------------------- 1 | package cli; 2 | 3 | import core.*; 4 | 5 | public class Main { 6 | public static void main(String[] args) { 7 | int answer = DeepThought.compute(); 8 | System.out.println(String.format("The answer to the ultimate question of Life, the Universe and Everything is %d.", answer)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/plugin/src/main/kotlin/my-plugin.gradle.kts: -------------------------------------------------------------------------------- 1 | // This script is automatically exposed to downstream consumers 2 | // as the `my-plugin` org.gradle.api.Project plugin 3 | 4 | tasks { 5 | register("myCopyTask", Copy::class) { 6 | group = "sample" 7 | from("build.gradle.kts") 8 | into("build/copy") 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/hello-coroutines/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.dsl.Coroutines 2 | 3 | plugins { 4 | application 5 | kotlin("jvm") version "1.3.70" 6 | } 7 | 8 | application { 9 | mainClassName = "samples.HelloCoroutinesKt" 10 | } 11 | 12 | dependencies { 13 | compile(kotlin("stdlib")) 14 | } 15 | 16 | repositories { 17 | jcenter() 18 | } 19 | -------------------------------------------------------------------------------- /samples/hello-js/src/main/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Console Output 6 | 7 | 8 | 9 | 10 | 11 |

See console for output!

12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/maven-publish/src/main/java/samples/JavaSource.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | /** 4 | * Java source file. 5 | */ 6 | public class JavaSource { 7 | 8 | /** 9 | * Prints "Hello, from Java!". 10 | * @param args Ignored 11 | */ 12 | public static void main(String... args) { 13 | System.out.println("Hello, from Java!"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/buildSrc/src/main/kotlin/utils.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.api.Project 2 | 3 | import org.gradle.kotlin.dsl.* 4 | 5 | /** 6 | * Configures the current project as a Kotlin project by adding the Kotlin `stdlib` as a dependency. 7 | */ 8 | fun Project.kotlinProject() { 9 | dependencies { 10 | "compile"(kotlin("stdlib")) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/hello-coroutines/src/main/kotlin/samples/HelloCoroutines.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | val fibonacci = sequence { 4 | 5 | var a = 0 6 | var b = 1 7 | 8 | while (true) { 9 | yield(b) 10 | 11 | val next = a + b 12 | a = b; b = next 13 | } 14 | } 15 | 16 | fun main(args: Array) { 17 | fibonacci.take(5).forEach(::println) 18 | } 19 | 20 | -------------------------------------------------------------------------------- /samples/hello-kapt/README.md: -------------------------------------------------------------------------------- 1 | Hello, kapt! 2 | =============== 3 | 4 | This sample shows how to use [kapt](https://kotlinlang.org/docs/reference/kapt.html) (Kotlin Annotation Processing Tool) 5 | 6 | [AutoValue](https://github.com/google/auto/tree/master/value) used as example of Java library that uses annotation processing for code generation. 7 | 8 | AutoValue generates immutable data class and builder. 9 | -------------------------------------------------------------------------------- /samples/modularity/lorem.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.thedeanda.lorem.* 2 | 3 | buildscript { 4 | dependencies { 5 | classpath("com.thedeanda:lorem:2.1") 6 | } 7 | 8 | repositories { 9 | jcenter() 10 | } 11 | } 12 | 13 | tasks.register("lorem") { 14 | group = "sample" 15 | doLast { 16 | println(LoremIpsum.getInstance().getParagraphs(1, 1)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/build-cache/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | } 4 | 5 | application { 6 | mainClassName = "samples.HelloWorld" 7 | } 8 | 9 | java { 10 | sourceCompatibility = JavaVersion.VERSION_1_8 11 | targetCompatibility = JavaVersion.VERSION_1_8 12 | } 13 | 14 | dependencies { 15 | testCompile("junit:junit:4.12") 16 | } 17 | 18 | repositories { 19 | jcenter() 20 | } 21 | -------------------------------------------------------------------------------- /samples/hello-world/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | } 4 | 5 | application { 6 | mainClassName = "samples.HelloWorld" 7 | } 8 | 9 | java { 10 | sourceCompatibility = JavaVersion.VERSION_1_7 11 | targetCompatibility = JavaVersion.VERSION_1_7 12 | } 13 | 14 | dependencies { 15 | testCompile("junit:junit:4.12") 16 | } 17 | 18 | repositories { 19 | jcenter() 20 | } 21 | -------------------------------------------------------------------------------- /samples/testkit/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | gradlePlugin { 6 | plugins { 7 | register("greet") { 8 | id = "greet" 9 | implementationClass = "samples.GreetPlugin" 10 | } 11 | } 12 | } 13 | 14 | dependencies { 15 | testImplementation("junit:junit:4.12") 16 | } 17 | 18 | repositories { 19 | gradlePluginPortal() 20 | } 21 | -------------------------------------------------------------------------------- /samples/gradle-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks { 2 | 3 | val plugin by registering(GradleBuild::class) { 4 | dir = file("plugin") 5 | tasks = listOf("publish") 6 | } 7 | 8 | val consumer by registering(GradleBuild::class) { 9 | dir = file("consumer") 10 | tasks = listOf("myCopyTask") 11 | } 12 | 13 | consumer { 14 | dependsOn(plugin) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/exemplar/samples/multi-project-with-buildSrc/hello.sample.out: -------------------------------------------------------------------------------- 1 | > Task :hello 2 | I'm multi-project-with-buildSrc_hello.sample 3 | 4 | > Task :bluewhale:hello 5 | I'm bluewhale 6 | - I depend on water 7 | - I'm the largest animal that has ever lived on this planet. 8 | 9 | > Task :krill:hello 10 | I'm krill 11 | - I depend on water 12 | - The weight of my species in summer is twice as heavy as all human beings. 13 | -------------------------------------------------------------------------------- /samples/hello-js/README.md: -------------------------------------------------------------------------------- 1 | Hello, JavaScript! 2 | ================== 3 | 4 | This sample demonstrates a simple JavaScript application with a Kotlin based build script. 5 | 6 | Simply import the Gradle project by pointing to the `setting.gradle` file. 7 | 8 | Build the project with `./gradlew build` to create the JavaScript-File (output is `./build/web/`). 9 | 10 | Open the `./build/web/index.html` and check the Browser's console for output. 11 | -------------------------------------------------------------------------------- /samples/groovy-interop/README.md: -------------------------------------------------------------------------------- 1 | groovy-interop 2 | ============== 3 | 4 | This sample demonstrates how to interact with Groovy code from Kotlin. 5 | 6 | The [Kotlin build script](./build.gradle.kts) applies [a Groovy build script](./groovy.gradle) which then exposes a `Closure` as an extra project property. 7 | 8 | The exposed `Closure` is imported in Kotlin as a [delegated property](./build.gradle.kts#L5) and invoked by the registered Kotlin tasks. 9 | 10 | -------------------------------------------------------------------------------- /samples/gradle-plugin/README.md: -------------------------------------------------------------------------------- 1 | # gradle-plugin 2 | 3 | A multi-build sample with: 4 | 5 | 1. [plugin](./plugin) a Gradle plugin implemented in Kotlin and taking advantage of the `kotlin-dsl` plugin, 6 | 2. [consumer](./consumer) a build that uses the Gradle plugin above. 7 | 8 | Run with: 9 | 10 | ./gradlew consumer 11 | 12 | This will build and publish the Gradle `plugin` locally ; and then run the task contributed by this plugin in the `consumer` build. 13 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/java/org/gradle/kotlin/dsl/samples/androidstudio/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples.androidstudio 2 | 3 | import android.support.v7.app.AppCompatActivity 4 | import android.os.Bundle 5 | 6 | class MainActivity : AppCompatActivity() { 7 | 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | setContentView(R.layout.activity_main) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/model-rules/README.md: -------------------------------------------------------------------------------- 1 | # model-rules 2 | 3 | Demonstrates how to write model rules in Kotlin and how to apply them from a `.gradle.kts` file. 4 | 5 | Check out the [rule source](./buildSrc/src/main/kotlin/my/model_rules.kt#L11) written in Kotlin. 6 | 7 | Check out how it is applied in the [build.gradle.kts](./build.gradle.kts) file. 8 | 9 | Run with: 10 | 11 | ./gradlew hello 12 | 13 | This will apply the model rules and run the created `hello` task. 14 | -------------------------------------------------------------------------------- /samples/build-cache/src/test/java/samples/HelloWorldTest.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.hamcrest.core.IsEqual.equalTo; 6 | import static org.junit.Assert.assertThat; 7 | import static samples.HelloWorld.greeting; 8 | 9 | public class HelloWorldTest { 10 | 11 | @Test 12 | public void testGreeting() { 13 | assertThat( 14 | greeting(), 15 | equalTo("Hello, world!")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/code-quality/src/test/java/samples/HelloWorldTest.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.hamcrest.core.IsEqual.equalTo; 6 | import static org.junit.Assert.assertThat; 7 | import static samples.HelloWorld.greeting; 8 | 9 | public class HelloWorldTest { 10 | 11 | @Test 12 | public void testGreeting() { 13 | assertThat( 14 | greeting(), 15 | equalTo("Hello, world!")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/hello-world/src/test/java/samples/HelloWorldTest.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.hamcrest.core.IsEqual.equalTo; 6 | import static org.junit.Assert.assertThat; 7 | import static samples.HelloWorld.greeting; 8 | 9 | public class HelloWorldTest { 10 | 11 | @Test 12 | public void testGreeting() { 13 | assertThat( 14 | greeting(), 15 | equalTo("Hello, world!")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks { 2 | 3 | val plugin by registering(GradleBuild::class) { 4 | group = "sample" 5 | dir = file("plugin") 6 | tasks = listOf("publish") 7 | } 8 | 9 | val consumer by registering(GradleBuild::class) { 10 | group = "sample" 11 | dir = file("consumer") 12 | tasks = listOf("myCopyTask") 13 | } 14 | 15 | consumer { 16 | dependsOn(plugin) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/source-control/sample/src/main/java/samples/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package samples; 2 | 3 | import compute.*; 4 | 5 | public class HelloWorld { 6 | 7 | public static void main(String[] args) { 8 | System.out.println(greeting()); 9 | } 10 | 11 | static String greeting() { 12 | int answer = DeepThought.compute(); 13 | return String.format("The answer to the ultimate question of Life, the Universe and Everything is %d.", answer); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /gradle/init-scripts/build-scan.init.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an init script for internal usage at Gradle Inc. 3 | */ 4 | if ("disableScanPlugin" !in gradle.startParameter.systemPropertiesArgs) { 5 | rootProject { 6 | pluginManager.withPlugin("com.gradle.build-scan") { 7 | extensions["buildScan"].withGroovyBuilder { 8 | "publishAlways"() 9 | setProperty("server", "https://e.grdev.net") 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | base 3 | kotlin("jvm") version "1.3.70" apply false 4 | } 5 | 6 | allprojects { 7 | 8 | group = "org.gradle.kotlin.dsl.samples.multiproject" 9 | 10 | version = "1.0" 11 | 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | 17 | dependencies { 18 | // Make the root project archives configuration depend on every subproject 19 | subprojects.forEach { 20 | archives(it) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/gradle-plugin/plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | `maven-publish` 4 | } 5 | 6 | group = "my" 7 | version = "1.0" 8 | 9 | gradlePlugin { 10 | plugins { 11 | register("myPlugin") { 12 | id = "my-plugin" 13 | implementationClass = "plugin.MyPlugin" 14 | } 15 | } 16 | } 17 | 18 | publishing { 19 | repositories { 20 | maven(url = "build/repository") 21 | } 22 | } 23 | 24 | repositories { 25 | jcenter() 26 | } 27 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/README.md: -------------------------------------------------------------------------------- 1 | multi-project-with-buildSrc 2 | =========================== 3 | 4 | A [multi-project build][1] with common logic defined in [`buildSrc`](./buildSrc) including a [custom task](./buildSrc/src/main/kotlin/HelloTask.kt#L5). 5 | 6 | List the available tasks with: 7 | 8 | ./gradlew tasks --task 9 | 10 | Run with: 11 | 12 | ./gradlew -q hello 13 | 14 | [1]: https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:multi_project_and_buildsrc 15 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | base 3 | kotlin("jvm") version "1.3.70" apply false 4 | } 5 | 6 | allprojects { 7 | 8 | group = "org.gradle.kotlin.dsl.samples.multiproject" 9 | 10 | version = "1.0" 11 | 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | 17 | dependencies { 18 | // Make the root project archives configuration depend on every sub-project 19 | subprojects.forEach { 20 | archives(it) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/groovy-interop/build.gradle.kts: -------------------------------------------------------------------------------- 1 | apply(from = "groovy.gradle") 2 | 3 | val groovySum: groovy.lang.Closure by extra 4 | 5 | tasks { 6 | 7 | register("stringSum") { 8 | group = "My" 9 | description = "groovySum(\"Groovy\", \"Kotlin\")" 10 | 11 | doLast { println(groovySum("Groovy", "Kotlin")) } 12 | } 13 | 14 | register("intSum") { 15 | group = "My" 16 | description = "groovySum(33, 11)" 17 | 18 | doLast { println(groovySum(33, 11)) } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/test/java/org/gradle/kotlin/dsl/samples/androidstudio/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples.androidstudio 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/composite-builds/README.md: -------------------------------------------------------------------------------- 1 | composite-builds 2 | ================ 3 | 4 | Demonstrates how to use [Composite Builds](https://docs.gradle.org/current/userguide/composite_builds.html). 5 | 6 | The build in this directory composes two other included builds, namely [`core`](./core) and [`cli`](./cli). 7 | The `cli` build depends on artifacts produced by the `core` build. 8 | 9 | Run with: 10 | 11 | ./gradlew run 12 | 13 | See [settings.gradle.kts](./settings.gradle.kts) to see how to include builds and do dependency substitution. 14 | -------------------------------------------------------------------------------- /samples/maven-plugin/README.md: -------------------------------------------------------------------------------- 1 | # maven-plugin sample 2 | 3 | Demonstrates the use of the `withConvention` and `withGroovyBuilder` utility extensions for configuring the `uploadArchives` task to [deploy to a Maven repository](https://docs.gradle.org/current/userguide/maven_plugin.html#sec:deploying_to_a_maven_repository) with a [custom pom](./build.gradle.kts#L25). 4 | 5 | ## Running the sample 6 | 7 | Execute the `uploadAchives` tasks: 8 | 9 | ./gradlew uploadArchives 10 | 11 | List the resulting publications: 12 | 13 | find build/m2 14 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/consumer/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Adapted from 2 | // https://docs.gradle.org/4.1/userguide/custom_plugins.html#sec:maintaining_multiple_domain_objects 3 | // 4 | 5 | plugins { 6 | id("my.documentation") version "1.0" 7 | } 8 | 9 | documentation { 10 | 11 | books { 12 | register("quickStart") { 13 | sourceFile = file("src/docs/quick-start") 14 | } 15 | register("userGuide") { 16 | 17 | } 18 | register("developerGuide") { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | // Apply the `my-plugin` defined in buildSrc/src/main/kotlin/my-plugin.gradle.kts 3 | `my-plugin` 4 | } 5 | 6 | my { 7 | flag.set(true) 8 | } 9 | 10 | withHelloTask() 11 | 12 | tasks.register("printProfile") { 13 | description = "Uses the extension property and the extension functions defined in buildSrc. Use with -Pprofile=prod." 14 | group = "sample" 15 | 16 | doLast { 17 | println("The current profile is $profile") 18 | logProfile() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/hello-android/README.md: -------------------------------------------------------------------------------- 1 | Hello, Android! 2 | =============== 3 | 4 | This sample demonstrates a simple Kotlin based Android application with Kotlin 5 | based build scripts. 6 | 7 | It has been tested against _Android Studio 8 | 3.1.3_[*](#android-studio-build) with the latest Kotlin 1.2.50 9 | plugin from the Stable update channel. 10 | 11 | Simply import the Gradle project in Android Studio by pointing it to the 12 | project directory. 13 | 14 | * _Android Studio 3.1.3 (Build #AI-173.4819257, built on June 4, 2018)_ 15 | -------------------------------------------------------------------------------- /samples/project-properties/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Project properties can be accessed via delegation 2 | 3 | /** 4 | * The label for the answer. 5 | * 6 | * Try a different value in the command line with 7 | * ./gradlew -Plabel=answer\ to\ the\ ultimate\ question\ about\ life,\ the\ universe\ and\ everything 8 | */ 9 | val label: String by project 10 | 11 | /** 12 | * The answer (taken from gradle.properties) 13 | */ 14 | val answer: String by project 15 | 16 | tasks.register("compute") { 17 | doLast { println("The ${label ?: "answer"} is $answer.") } 18 | } 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | matrix: 4 | include: 5 | - os: linux 6 | sudo: required 7 | jdk: openjdk11 8 | - os: linux 9 | sudo: required 10 | jdk: openjdk12 11 | 12 | script: ./gradlew check --info --stacktrace --console=plain --max-workers=1 --no-daemon --build-cache -Dkotlin.colors.enabled=false 13 | 14 | before_cache: 15 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 16 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 17 | 18 | cache: 19 | directories: 20 | - $HOME/.gradle/caches/ 21 | - $HOME/.gradle/wrapper/ 22 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/buildSrc/src/main/kotlin/HelloTask.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.api.* 2 | import org.gradle.api.tasks.* 3 | import org.gradle.kotlin.dsl.* 4 | 5 | open class HelloTask : DefaultTask() { 6 | 7 | init { 8 | group = "My" 9 | description = "Prints a description of ${project.name}." 10 | } 11 | 12 | @TaskAction 13 | fun run() { 14 | println("I'm ${project.name}") 15 | } 16 | } 17 | 18 | /** 19 | * Declares a [HelloTask] named `hello`. 20 | */ 21 | fun Project.withHelloTask() = 22 | tasks.register("hello", HelloTask::class) 23 | 24 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "kotlin-dsl-samples" 2 | 3 | apply(from = "gradle/shared-with-buildSrc/build-cache-configuration.settings.gradle.kts") 4 | 5 | include( 6 | "samples-tests" 7 | ) 8 | 9 | for (project in rootProject.children) { 10 | project.apply { 11 | projectDir = file("subprojects/$name") 12 | buildFileName = "$name.gradle.kts" 13 | require(projectDir.isDirectory) { "Project '${project.path} must have a $projectDir directory" } 14 | require(buildFile.isFile) { "Project '${project.path} must have a $buildFile build script" } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /samples/buildSrc-plugin/buildSrc/src/main/kotlin/GreetPlugin.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.api.Plugin 2 | import org.gradle.api.Project 3 | 4 | import org.gradle.kotlin.dsl.* 5 | 6 | 7 | class GreetPlugin : Plugin { 8 | 9 | override fun apply(project: Project): Unit = project.run { 10 | 11 | tasks { 12 | register("greet") { 13 | group = "sample" 14 | description = "Prints a description of ${project.name}." 15 | doLast { 16 | println("I'm ${project.name}.") 17 | } 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/README.md: -------------------------------------------------------------------------------- 1 | project-with-buildSrc 2 | ===================== 3 | 4 | A build with logic defined in [`buildSrc`](./buildSrc) including a [custom task](./buildSrc/src/main/kotlin/HelloTask.kt#L5), a [custom precompiled script plugin](./buildSrc/src/main/kotlin/my-plugin.gradle.kts) as well as [an extension property and an extension function](./buildSrc/src/main/kotlin/extensions.kt). 5 | 6 | List the available tasks with: 7 | 8 | ./gradlew tasks --task 9 | 10 | Run with: 11 | 12 | ./gradlew -q hello 13 | ./gradlew -q printProfile 14 | ./gradlew -q printProfile -Pprofile=prod 15 | 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Context 2 | 3 | 4 | 5 | ### Contributor Checklist 6 | - [ ] Make sure that all commits are [signed off](https://git-scm.com/docs/git-commit#git-commit---signoff) to indicate that you agree to the terms of [Developer Certificate of Origin](https://developercertificate.org/). 7 | - [ ] Provide integration tests to verify changes from a user perspective 8 | - [ ] Provide unit tests to verify logic 9 | - [ ] Ensure that tests pass locally: `./gradlew check --parallel` 10 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks { 2 | 3 | val plugin by registering(GradleBuild::class) { 4 | group = "sample" 5 | description = "Publishes the plugin to the local repository." 6 | dir = file("plugin") 7 | tasks = listOf("publish") 8 | } 9 | 10 | val consumer by registering(GradleBuild::class) { 11 | group = "sample" 12 | description = "Consumes the plugin from the local repository." 13 | dir = file("consumer") 14 | tasks = listOf("books") 15 | } 16 | 17 | consumer { 18 | dependsOn(plugin) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/multi-project-with-buildSrc/buildSrc/src/main/kotlin/HelloTask.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.api.* 2 | import org.gradle.api.tasks.* 3 | import org.gradle.kotlin.dsl.* 4 | 5 | open class HelloTask : DefaultTask() { 6 | 7 | init { 8 | group = "My" 9 | description = "Prints a description of ${project.name}." 10 | } 11 | 12 | @TaskAction 13 | fun run() { 14 | println("I'm ${project.name}") 15 | } 16 | } 17 | 18 | fun Project.declareHelloTask() = 19 | tasks.register("hello") 20 | 21 | val Project.hello: TaskProvider 22 | get() = tasks.named("hello") 23 | -------------------------------------------------------------------------------- /samples/build-cache/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | buildCache { 2 | local { 3 | isEnabled = false 4 | } 5 | local(DirectoryBuildCache::class) { 6 | directory = file("path/to/some/local-cache") 7 | isEnabled = true 8 | isPush = true 9 | removeUnusedEntriesAfterDays = 2 10 | } 11 | remote(HttpBuildCache::class) { 12 | url = uri("http://example.com/cache") 13 | isEnabled = false 14 | isPush = false 15 | isAllowUntrustedServer = false 16 | credentials { 17 | username = "johndoe" 18 | password = "secret" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/hello-kapt/src/main/kotlin/samples/HelloAutoValue.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | fun main(args: Array) { 4 | val user = Writer.builder() 5 | .name("Douglas") 6 | .age(41) 7 | .books(listOf("THGttG", "DGHDA")) 8 | .build() 9 | 10 | println("Hello $user") 11 | 12 | // Create builder from object and create new instance with modified value 13 | val userWithTheAnswer = user.toBuilder() 14 | .age(user.age!! + 1) 15 | .build() 16 | 17 | println("The answer is ${userWithTheAnswer.age}") 18 | } 19 | 20 | interface User { 21 | val name: String 22 | val age: Int? 23 | } 24 | -------------------------------------------------------------------------------- /samples/testkit/src/main/kotlin/samples/GreetPlugin.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | import org.gradle.api.Plugin 4 | import org.gradle.api.Project 5 | 6 | import org.gradle.kotlin.dsl.* 7 | 8 | 9 | class GreetPlugin : Plugin { 10 | 11 | override fun apply(project: Project): Unit = project.run { 12 | val greeting = extensions.create("greeting", Greeting::class) 13 | tasks { 14 | register("greet") { 15 | doLast { 16 | println(greeting.message) 17 | } 18 | } 19 | } 20 | } 21 | } 22 | 23 | 24 | open class Greeting { 25 | var message = "Hello!" 26 | } 27 | 28 | -------------------------------------------------------------------------------- /samples/gradle-plugin/plugin/src/main/kotlin/plugin/MyPlugin.kt: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import org.gradle.api.Plugin 4 | import org.gradle.api.Project 5 | import org.gradle.api.Task 6 | import org.gradle.api.tasks.Copy 7 | 8 | import org.gradle.kotlin.dsl.* 9 | 10 | class MyPlugin : Plugin { 11 | 12 | override fun apply(project: Project) { 13 | project.run { 14 | 15 | tasks { 16 | register("myCopyTask", Copy::class) { 17 | group = "sample" 18 | from("build.gradle.kts") 19 | into("build/copy") 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/extra-properties/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks { 2 | 3 | val myTask by creating { 4 | 5 | val foo by extra { 42 } 6 | val bar by extra(null) 7 | 8 | doLast { 9 | println("Extra foo property value: $foo") 10 | println("Optional extra bar property value: $bar") 11 | } 12 | } 13 | 14 | val test by registering { 15 | 16 | dependsOn(myTask) 17 | 18 | doLast { 19 | val foo: Int by myTask.extra 20 | val bar: Int? by myTask.extra 21 | 22 | println("myTask.foo = $foo") 23 | println("myTask.bar = $bar") 24 | } 25 | } 26 | 27 | defaultTasks(test.name) 28 | } 29 | -------------------------------------------------------------------------------- /samples/hello-android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath("com.android.tools.build:gradle:3.1.3") 10 | classpath(kotlin("gradle-plugin", version = "1.3.70")) 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle.kts files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | tasks.register("clean", Delete::class) { 25 | delete(rootProject.buildDir) 26 | } 27 | -------------------------------------------------------------------------------- /samples/hello-kapt/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | application 3 | kotlin("jvm") version "1.3.70" 4 | kotlin("kapt") version "1.3.70" 5 | } 6 | 7 | application { 8 | mainClassName = "samples.HelloAutoValueKt" 9 | } 10 | 11 | repositories { 12 | jcenter() 13 | } 14 | 15 | dependencies { 16 | compileOnly("com.google.auto.value:auto-value-annotations:1.7") 17 | kapt("com.google.auto.value:auto-value:1.7") 18 | 19 | compile(kotlin("stdlib")) 20 | 21 | testCompile("junit:junit:4.12") 22 | } 23 | 24 | kapt { 25 | correctErrorTypes = true 26 | 27 | javacOptions { 28 | option("SomeJavacOption", "OptionValue") 29 | } 30 | 31 | arguments { 32 | arg("SomeKaptArgument", "ArgumentValue") 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/SourceControlSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.hamcrest.CoreMatchers.containsString 4 | import org.junit.Assert.assertThat 5 | import org.junit.Test 6 | 7 | 8 | class SourceControlSampleTest : AbstractSampleTest("source-control") { 9 | 10 | @Test 11 | fun `source dependencies mapping`() { 12 | 13 | val externalDir = existing("external") 14 | val sampleDir = existing("sample") 15 | 16 | build(externalDir, "generateGitRepo") 17 | 18 | assertThat( 19 | build(sampleDir, "run").output, 20 | containsString("The answer to the ultimate question of Life, the Universe and Everything is 42.")) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project/README.md: -------------------------------------------------------------------------------- 1 | multi-kotlin-project 2 | ==================== 3 | 4 | A [multi-project build](https://docs.gradle.org/current/userguide/multi_project_builds.html) with two Kotlin based projects: 5 | 6 | 1. [core](./core) implements the main algorithm to compute the answer to the ultimate question of Life, the Universe and Everything 7 | 2. [cli](./cli) implements the command line interface 8 | 9 | Common behavior for all projects, such as the configuration of _group_, _version_ and _repositories_, is defined in the [root project build script](./build.gradle.kts). 10 | 11 | Plugin application and dependency configuration is segregated to each separate subproject. 12 | 13 | Run with: 14 | 15 | ./gradlew run 16 | 17 | Check all project dependencies with: 18 | 19 | ./gradlew dependencies 20 | -------------------------------------------------------------------------------- /samples/hello-android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | org.gradle.configureondemand=false 15 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/BuildScanSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.hamcrest.CoreMatchers.allOf 4 | import org.hamcrest.CoreMatchers.containsString 5 | import org.hamcrest.CoreMatchers.not 6 | import org.junit.Assert.assertThat 7 | import org.junit.Test 8 | 9 | 10 | class BuildScanSampleTest : AbstractSampleTest("build-scan") { 11 | 12 | @Test 13 | fun `can publish build scans`() { 14 | build("tasks", "--scan").apply { 15 | assertThat( 16 | output, 17 | allOf( 18 | containsString("Publishing build scan..."), 19 | not(containsString("The build scan plugin was applied after other plugins.")) 20 | ) 21 | ) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/README.md: -------------------------------------------------------------------------------- 1 | multi-kotlin-project-config-injection 2 | ===================================== 3 | 4 | A [multi-project build](https://docs.gradle.org/current/userguide/multi_project_builds.html) with two Kotlin based projects: 5 | 6 | 1. [core](./core) implements the main algorithm to compute the answer to the ultimate question of Life, the Universe and Everything 7 | 2. [cli](./cli) implements the command line interface 8 | 9 | Common behavior for all projects, including `KotlinCompile` task configuration is defined in the [root project build script](./build.gradle.kts). 10 | 11 | Plugin application and dependency configuration is segregated to each separate subproject. 12 | 13 | Run with: 14 | 15 | ./gradlew run 16 | 17 | Check all project dependencies with: 18 | 19 | ./gradlew dependencies 20 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/hello-android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/CopySampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.junit.Assert.assertFalse 4 | import org.junit.Assert.assertTrue 5 | import org.junit.Test 6 | 7 | 8 | class CopySampleTest : AbstractSampleTest("copy") { 9 | 10 | @Test 11 | fun `initConfig task copy spec satisfied`() { 12 | // when: 13 | build("initConfig") 14 | 15 | // then: 16 | val root = projectRoot.toPath().resolve("build").resolve("target").resolve("config") 17 | listOf("copy.data", "copy.xml").map { root.resolve(it).toFile() }.forEach { 18 | assertTrue("File copied $it", it.exists()) 19 | } 20 | listOf("copy.bak", "copy.txt").map { root.resolve(it).toFile() }.forEach { 21 | assertFalse("File not copied $it", it.exists()) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/androidTest/java/org/gradle/kotlin/dsl/samples/androidstudio/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples.androidstudio 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("org.gradle.kotlin.dsl.samples.androidstudio", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/maven-publish/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.gradle.api.tasks.bundling.Jar 2 | 3 | plugins { 4 | kotlin("jvm") version "1.3.70" 5 | `maven-publish` 6 | } 7 | 8 | group = "org.gradle.sample" 9 | version = "1.0.0" 10 | 11 | repositories { 12 | jcenter() 13 | } 14 | 15 | dependencies { 16 | compile(kotlin("stdlib")) 17 | } 18 | 19 | val sourcesJar by tasks.registering(Jar::class) { 20 | classifier = "sources" 21 | from(sourceSets.main.get().allSource) 22 | } 23 | 24 | publishing { 25 | repositories { 26 | maven { 27 | // change to point to your repo, e.g. http://my.org/repo 28 | url = uri("$buildDir/repo") 29 | } 30 | } 31 | publications { 32 | register("mavenJava", MavenPublication::class) { 33 | from(components["java"]) 34 | artifact(sourcesJar.get()) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-config-injection/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile 2 | 3 | plugins { 4 | base 5 | kotlin("jvm") version "1.3.70" apply false 6 | } 7 | 8 | allprojects { 9 | 10 | group = "org.gradle.kotlin.dsl.samples.multiprojectci" 11 | 12 | version = "1.0" 13 | 14 | repositories { 15 | jcenter() 16 | } 17 | } 18 | 19 | // Configure all KotlinCompile tasks on each sub-project 20 | subprojects { 21 | 22 | tasks.withType().configureEach { 23 | println("Configuring $name in project ${project.name}...") 24 | kotlinOptions { 25 | suppressWarnings = true 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | // Make the root project archives configuration depend on every subproject 32 | subprojects.forEach { 33 | archives(it) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/README.md: -------------------------------------------------------------------------------- 1 | # kotlin-friendly-groovy-plugin 2 | 3 | Demonstrates a Gradle plugin implemented in Groovy while still exposing a Kotlin DSL friendly API. 4 | 5 | Check out the [consuming build script](./consumer/build.gradle.kts#L6) to see the friendly API in action. 6 | 7 | Check out the [Groovy plugin source code](./plugin/src/main/groovy/my/DocumentationPlugin.groovy#L5) for tips on how to achieve the same effect. 8 | 9 | 10 | ## Project structure 11 | 12 | This sample contains two projects: 13 | 14 | 1. [plugin](./plugin) - a Gradle plugin implemented in Groovy, 15 | 2. [consumer](./consumer) - a build that uses the Gradle plugin above. 16 | 17 | ## Running 18 | 19 | Run with: 20 | 21 | ./gradlew consumer 22 | 23 | This will build and publish the Gradle `plugin` locally then run the `books` task contributed by the plugin in the `consumer` project. 24 | -------------------------------------------------------------------------------- /samples/copy/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.apache.tools.ant.filters.* 2 | 3 | //for including in the copy task 4 | val dataContent = copySpec { 5 | from("src/data") 6 | include("*.data") 7 | } 8 | 9 | tasks { 10 | register("initConfig", Copy::class) { 11 | 12 | val tokens = mapOf("version" to "2.3.1") 13 | inputs.properties(tokens) 14 | 15 | from("src/main/config") { 16 | include("**/*.properties") 17 | include("**/*.xml") 18 | filter("tokens" to tokens) 19 | } 20 | 21 | from("src/main/languages") { 22 | rename("EN_US_(.*)", "$1") 23 | } 24 | 25 | into("build/target/config") 26 | exclude("**/*.bak") 27 | includeEmptyDirs = false 28 | with(dataContent) 29 | } 30 | register("clean", Delete::class) { 31 | delete(buildDir) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.gradle.api.tasks.bundling.Jar 2 | 3 | plugins { 4 | `java-gradle-plugin` 5 | `maven-publish` 6 | groovy 7 | } 8 | 9 | group = "my" 10 | 11 | version = "1.0" 12 | 13 | gradlePlugin { 14 | plugins { 15 | register("documentation") { 16 | id = "my.documentation" 17 | implementationClass = "my.DocumentationPlugin" 18 | } 19 | } 20 | } 21 | 22 | val sourcesJar by tasks.registering(Jar::class) { 23 | classifier = "sources" 24 | from(sourceSets.main.get().allSource) 25 | } 26 | 27 | publishing { 28 | publications { 29 | register("mavenSources") { 30 | from(components["java"]) 31 | artifact(sourcesJar.get()) 32 | } 33 | } 34 | repositories { 35 | maven(url = "build/repository") 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /samples/source-control/README.md: -------------------------------------------------------------------------------- 1 | source-control 2 | ============== 3 | 4 | A project that depends on external sources using the incubating support for 5 | [source dependencies](https://github.com/gradle/gradle-native/issues/42): 6 | 7 | 1. [external/](./external) implements the main algorithm to compute the answer to the ultimate question of Life, the Universe and Everything 8 | 2. [sample/](./sample) implements the command line interface 9 | 10 | This sample uses a local Git repository, a realistic example would use a remote one. 11 | 12 | **Run `cd external && ./gradlew generateGitRepo` first** to generate the local repository. 13 | 14 | Then run with: 15 | 16 | cd sample 17 | ./gradlew run 18 | 19 | And check compilation dependencies with: 20 | 21 | cd sample 22 | ./gradlew dependencies --configuration compileClasspath 23 | 24 | See [sample/settings.gradle.kts](./sample/settings.gradle.kts). 25 | 26 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/ProviderPropertiesSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.hamcrest.CoreMatchers.containsString 4 | 5 | import org.junit.Assert.assertThat 6 | import org.junit.Test 7 | import java.io.File 8 | 9 | 10 | class ProviderPropertiesSampleTest : AbstractSampleTest("provider-properties") { 11 | 12 | @Test 13 | fun `hello task logs and write message to files`() { 14 | // when: 15 | val output = build("hello", "-i").output 16 | 17 | // then: 18 | val message = "Hi from Gradle" 19 | val files = listOf("a.txt", "b.txt").map { File(File(projectRoot, "build"), it).canonicalFile } 20 | assertThat(output, containsString("Writing message '$message' to files $files")) 21 | files.forEach { 22 | assertThat(it.readText(), containsString(message)) 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samples/multi-kotlin-project-with-buildSrc/README.md: -------------------------------------------------------------------------------- 1 | multi-kotlin-project-with-buildSrc 2 | ================================== 3 | 4 | A [multi-project build](https://docs.gradle.org/current/userguide/multi_project_builds.html) with two Kotlin based projects: 5 | 6 | 1. [core](./core) implements the main algorithm to compute the answer to the ultimate question of Life, the Universe and Everything 7 | 2. [cli](./cli) implements the command line interface 8 | 9 | Common behavior for all projects, such as the configuration of _group_, _version_ and _repositories_, is defined in the [root project build script](./build.gradle.kts). 10 | 11 | Plugin application and dependency configuration is segregated to each 12 | separate subproject with some common build logic in [`buildSrc`](./buildSrc/src/main/kotlin/utils.kt). 13 | 14 | Run with: 15 | 16 | ./gradlew run 17 | 18 | Check all project dependencies with: 19 | 20 | ./gradlew dependencies 21 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/buildSrc/src/main/kotlin/my-plugin.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | val my = extensions.create("my", project.objects) 18 | 19 | tasks.register("myReport") { 20 | doLast { 21 | println("my.flag = ${my.flag.get()}") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/buildSrc/src/main/kotlin/MyProjectExtension.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import org.gradle.api.model.ObjectFactory 17 | 18 | import org.gradle.kotlin.dsl.* 19 | 20 | 21 | open class MyProjectExtension(objects: ObjectFactory) { 22 | 23 | val flag = objects.property() 24 | } 25 | -------------------------------------------------------------------------------- /samples/code-quality/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | checkstyle 3 | pmd 4 | jacoco 5 | application 6 | } 7 | 8 | java { 9 | sourceCompatibility = JavaVersion.VERSION_1_7 10 | targetCompatibility = JavaVersion.VERSION_1_7 11 | } 12 | 13 | dependencies { 14 | testCompile("junit:junit:4.12") 15 | } 16 | 17 | checkstyle { 18 | toolVersion = "8.15" 19 | configFile = file("config/checkstyle/sun_checks.xml") 20 | isIgnoreFailures = true 21 | } 22 | 23 | pmd { 24 | isIgnoreFailures = true 25 | } 26 | 27 | jacoco { 28 | toolVersion = "0.8.2" 29 | } 30 | 31 | tasks { 32 | jacocoTestCoverageVerification { 33 | violationRules { 34 | rule { limit { minimum = BigDecimal.valueOf(0.2) } } 35 | } 36 | } 37 | check { 38 | dependsOn(jacocoTestCoverageVerification) 39 | } 40 | } 41 | 42 | application { 43 | mainClassName = "samples.HelloWorld" 44 | } 45 | 46 | repositories { 47 | jcenter() 48 | } 49 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/HelloKaptSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.hamcrest.CoreMatchers.allOf 4 | import org.hamcrest.CoreMatchers.containsString 5 | import org.junit.Assert.assertThat 6 | import org.junit.Test 7 | 8 | 9 | class HelloKaptSampleTest : AbstractSampleTest("hello-kapt") { 10 | 11 | @Test 12 | fun `kapt javac options and kapt arguments`() { 13 | existing("build.gradle.kts") 14 | .appendText(""" 15 | logger.info("JavacOptions: " + kapt.getJavacOptions().toString()) 16 | """) 17 | 18 | val output = build("run", "--info").output 19 | 20 | assertThat( 21 | output, 22 | allOf( 23 | containsString("The following options were not recognized by any processor: '[SomeKaptArgument"), 24 | containsString("JavacOptions: {SomeJavacOption=OptionValue}") 25 | ) 26 | ) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/domain-objects/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Sample from 2 | // https://docs.gradle.org/3.3/userguide/custom_plugins.html#sec:maintaining_multiple_domain_objects 3 | // ported to Kotlin 4 | 5 | apply() 6 | 7 | val books: NamedDomainObjectContainer by extensions 8 | 9 | books { 10 | register("quickStart") { 11 | sourceFile = file("src/docs/quick-start") 12 | } 13 | register("userGuide") { 14 | 15 | } 16 | register("developerGuide") { 17 | 18 | } 19 | } 20 | 21 | tasks { 22 | register("books") { 23 | doLast { 24 | books.forEach { book -> 25 | println("${book.name} -> ${relativePath(book.sourceFile)}") 26 | } 27 | } 28 | } 29 | } 30 | 31 | class DocumentationPlugin : Plugin { 32 | 33 | override fun apply(project: Project) { 34 | val books = project.container(Book::class) { name -> 35 | Book(name, project.file("src/docs/$name")) 36 | } 37 | project.extensions.add("books", books) 38 | } 39 | } 40 | 41 | data class Book(val name: String, var sourceFile: File) 42 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/HelloAndroidSampleTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.gradle.kotlin.dsl.samples 18 | 19 | import org.junit.Before 20 | import org.junit.Test 21 | 22 | 23 | class HelloAndroidSampleTest : AbstractSampleTest("hello-android") { 24 | 25 | @Before 26 | fun assumeAndroidHome() = 27 | assumeAndroidHomeIsSet() 28 | 29 | @Test 30 | fun `build hello android`() { 31 | build("build") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /samples/model-rules/buildSrc/src/main/kotlin/my/model_rules.kt: -------------------------------------------------------------------------------- 1 | package my 2 | 3 | import org.gradle.api.Task 4 | import org.gradle.model.Managed 5 | import org.gradle.model.Model 6 | import org.gradle.model.ModelMap 7 | import org.gradle.model.Mutate 8 | import org.gradle.model.RuleSource 9 | 10 | 11 | /** 12 | * Model rule source. 13 | * 14 | * See https://docs.gradle.org/current/userguide/software_model.html 15 | */ 16 | open class Rules : RuleSource() { 17 | 18 | @Model fun Person.person() = Unit 19 | 20 | @Mutate fun Person.setSomeName() { 21 | firstName = "John" 22 | lastName = "Smith" 23 | } 24 | 25 | // Create a rule that modifies a ModelMap and takes as input a Person 26 | @Mutate fun ModelMap.createHelloTask(p: Person) { 27 | create("hello") { 28 | group = "sample" 29 | description = "Prints a greeting to the console." 30 | doLast { 31 | println("Hello ${p.firstName} ${p.lastName}!") 32 | } 33 | } 34 | } 35 | } 36 | 37 | @Managed 38 | interface Person { 39 | var firstName: String? 40 | var lastName: String? 41 | } 42 | -------------------------------------------------------------------------------- /samples/project-with-buildSrc/buildSrc/src/main/kotlin/extensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import org.gradle.api.* 18 | 19 | /** 20 | * Defines an extension property of Project that can be used in the build script of the project (or any subproject) 21 | */ 22 | val Project.profile get() = findProperty("profile") ?: "dev" 23 | 24 | /** 25 | * Defines an extension function of Project that can be used in the build script of the project (or any subproject) 26 | */ 27 | fun Project.logProfile() = println("Here's the profile: $profile") 28 | -------------------------------------------------------------------------------- /samples/precompiled-script-plugin/README.md: -------------------------------------------------------------------------------- 1 | # precompiled-script-plugin 2 | 3 | A sample demonstrating _precompiled script plugins_. 4 | 5 | A precompiled script plugin is a Kotlin script compiled as part of a regular Kotlin source-set and distributed 6 | in the usual way, as java class files packaged in some library, meant to be consumed as a binary 7 | Gradle plugin. 8 | 9 | The Gradle plugin id by which the precompiled script can be referenced is derived from its name 10 | and optional package declaration. 11 | 12 | Thus, the script `src/main/kotlin/code-quality.gradle.kts` is exposed as the `code-quality` 13 | plugin (assuming it has no package declaration) whereas the script 14 | `src/main/kotlin/my/code-quality.gradle.kts` is exposed as the `my.code-quality` 15 | plugin, again assuming it has the matching package declaration. 16 | 17 | The sample is comprised of two builds: 18 | 19 | 1. [plugin](./plugin) a Gradle plugin implemented as a precompiled script. 20 | 2. [consumer](./consumer) a build that uses the Gradle plugin above. 21 | 22 | Run with: 23 | 24 | ./gradlew consumer 25 | 26 | This will build and publish the Gradle `plugin` locally ; and then run the task contributed by this plugin in the `consumer` build. 27 | -------------------------------------------------------------------------------- /samples/task-dependencies/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /** 2 | * An example Gradle task. 3 | */ 4 | open class GreetingTask : DefaultTask() { 5 | 6 | val message = project.objects.property() 7 | 8 | @TaskAction 9 | fun greet() = println(message.get()) 10 | } 11 | 12 | tasks { 13 | 14 | // `hello` is a `TaskProvider` 15 | val hello by registering(GreetingTask::class) { 16 | message.set("Hello!") 17 | } 18 | 19 | // `goodbye` is a `TaskProvider` 20 | val goodbye by registering(GreetingTask::class) 21 | 22 | // Every `NamedDomainObjectProvider` can be lazily configured as follows 23 | goodbye { 24 | dependsOn(hello) 25 | } 26 | 27 | // Existing container elements can be lazily configured via the `String` invoke DSL 28 | "goodbye"(GreetingTask::class) { 29 | message.set("Goodbye!") 30 | } 31 | 32 | // Regular API members are also available 33 | register("chat") 34 | } 35 | 36 | // ... 37 | 38 | tasks { 39 | 40 | // Existing container elements can be lazily brought into scope 41 | val goodbye by existing 42 | 43 | "chat" { 44 | dependsOn(goodbye) 45 | } 46 | } 47 | 48 | defaultTasks("chat") 49 | -------------------------------------------------------------------------------- /samples/hello-android/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.config.KotlinCompilerVersion 2 | 3 | plugins { 4 | id("com.android.application") 5 | kotlin("android") 6 | kotlin("android.extensions") 7 | } 8 | 9 | android { 10 | compileSdkVersion(27) 11 | defaultConfig { 12 | applicationId = "org.gradle.kotlin.dsl.samples.androidstudio" 13 | minSdkVersion(15) 14 | targetSdkVersion(27) 15 | versionCode = 1 16 | versionName = "1.0" 17 | testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" 18 | } 19 | buildTypes { 20 | getByName("release") { 21 | isMinifyEnabled = false 22 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 23 | } 24 | } 25 | } 26 | 27 | dependencies { 28 | implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) 29 | implementation(kotlin("stdlib-jdk7", KotlinCompilerVersion.VERSION)) 30 | implementation("com.android.support:appcompat-v7:27.1.1") 31 | implementation("com.android.support.constraint:constraint-layout:1.1.0") 32 | testImplementation("junit:junit:4.12") 33 | androidTestImplementation("com.android.support.test:runner:1.0.2") 34 | androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.2") 35 | } 36 | -------------------------------------------------------------------------------- /samples/hello-kapt/src/test/kotlin/samples/WriterTest.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | import org.junit.Assert.assertEquals 4 | import org.junit.Assert.assertNull 5 | import org.junit.Test 6 | 7 | class WriterTest { 8 | 9 | @Test 10 | fun `name normalization`() { 11 | val writer = Writer.builder() 12 | .name("") 13 | .age(33) 14 | .build() 15 | assertEquals("Anonymous", writer.name) 16 | } 17 | 18 | @Test(expected = IllegalArgumentException::class) 19 | fun `age validation exception`() { 20 | Writer.builder() 21 | .name("Shakespeare") 22 | .age(-453) 23 | .build() 24 | } 25 | 26 | @Test 27 | fun `allow nullable age`() { 28 | val writer = Writer.builder() 29 | .name("Homer") 30 | .build() 31 | 32 | assertNull(writer.age) 33 | } 34 | 35 | @Test(expected = IllegalStateException::class) 36 | fun `builder without required value exception`() { 37 | Writer.builder().build() 38 | } 39 | 40 | @Test 41 | fun `empty list of books as default`() { 42 | val writer = Writer.builder() 43 | .name("Newbie") 44 | .age(18) 45 | .build() 46 | 47 | assertEquals(emptyList(), writer.books) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/ExemplarExternalSamplesTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.gradle.kotlin.dsl.samples 18 | 19 | import org.gradle.samples.test.normalizer.FileSeparatorOutputNormalizer 20 | import org.gradle.samples.test.normalizer.JavaObjectSerializationOutputNormalizer 21 | import org.gradle.samples.test.runner.GradleSamplesRunner 22 | import org.gradle.samples.test.runner.SamplesOutputNormalizers 23 | import org.gradle.samples.test.runner.SamplesRoot 24 | import org.junit.runner.RunWith 25 | 26 | 27 | @RunWith(GradleSamplesRunner::class) 28 | @SamplesRoot("build/samples") 29 | @SamplesOutputNormalizers( 30 | JavaObjectSerializationOutputNormalizer::class, 31 | FileSeparatorOutputNormalizer::class 32 | ) 33 | class ExemplarExternalSamplesTest 34 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/HelloJsSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.hamcrest.CoreMatchers.equalTo 4 | import org.junit.Assert.assertThat 5 | import org.junit.Test 6 | import java.io.File 7 | import java.io.StringWriter 8 | import java.io.Writer 9 | import javax.script.ScriptEngine 10 | import javax.script.ScriptEngineManager 11 | 12 | 13 | class HelloJsSampleTest : AbstractSampleTest("hello-js") { 14 | 15 | @Test 16 | fun `hello world`() { 17 | 18 | build("assemble") 19 | 20 | val javaScriptOutput = StringWriter() 21 | val engine = javaScriptEngine(javaScriptOutput) 22 | 23 | // Load Kotlin JS stdlib 24 | engine.eval(existing("build/web/kotlin.js")) 25 | 26 | // Run build output 27 | engine.eval(existing("build/web/output.js")) 28 | 29 | assertThat( 30 | javaScriptOutput.toString().trim(), 31 | equalTo("Hello, world!")) 32 | } 33 | 34 | private 35 | fun javaScriptEngine(outputWriter: Writer) = 36 | ScriptEngineManager().getEngineByName("nashorn").apply { 37 | 38 | // Redirect output from `print` to this writer 39 | context.writer = outputWriter 40 | 41 | // Wire `console.log` to `print` 42 | eval("var console = {}; console.log = print;") 43 | } 44 | 45 | private 46 | fun ScriptEngine.eval(file: File) = 47 | file.bufferedReader().use { reader -> 48 | eval(reader) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /subprojects/samples-tests/samples-tests.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") version embeddedKotlinVersion 3 | id("org.gradle.kotlin-dsl.ktlint-convention") version "0.4.1" 4 | } 5 | 6 | repositories { 7 | maven(url = "https://repo.gradle.org/gradle/libs") 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | testImplementation(gradleApi()) 13 | testImplementation(gradleKotlinDsl()) 14 | testImplementation(gradleTestKit()) 15 | testImplementation("org.gradle:sample-check:0.7.0") 16 | testImplementation("junit:junit:4.12") 17 | testImplementation(kotlin("stdlib")) 18 | testImplementation("org.xmlunit:xmlunit-matchers:2.5.1") 19 | } 20 | 21 | tasks { 22 | 23 | val samplesDir = file("../../samples") 24 | val samplesTestDir = buildDir.resolve("samples") 25 | 26 | val generatedResourcesDir = buildDir.resolve("generated-resources/test") 27 | 28 | val generateTestProperties by registering(WriteProperties::class) { 29 | property("samplesDir", samplesDir) 30 | outputFile = generatedResourcesDir.resolve("test.properties") 31 | } 32 | 33 | sourceSets.test { 34 | resources.srcDir(files(generatedResourcesDir).builtBy(generateTestProperties)) 35 | } 36 | 37 | val syncSamples by registering(Sync::class) { 38 | from(samplesDir) 39 | from(file("src/exemplar/samples")) 40 | into(samplesTestDir) 41 | } 42 | 43 | test { 44 | dependsOn(syncSamples) 45 | inputs.dir(samplesTestDir).withPathSensitivity(PathSensitivity.RELATIVE) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ### Expected Behavior 7 | 8 | 9 | 10 | ### Current Behavior 11 | 12 | 13 | 14 | ### Context 15 | 16 | 17 | 18 | ### Steps to Reproduce (for bugs) 19 | 20 | 21 | 22 | ### Your Environment 23 | 24 | 25 | * Build scan URL: 26 | * `gradle --version` 27 | * Version of IntelliJ or Android Studio (in `About` menu you can copy version information) 28 | * Version of the Kotlin Plugin used in IntelliJ or Android Studio (in the `Configure Kotlin Plugin Updates` preference panel) 29 | -------------------------------------------------------------------------------- /samples/maven-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | maven 4 | } 5 | 6 | group = "org.gradle.kotlin-dsl" 7 | 8 | version = "1.0" 9 | 10 | tasks { 11 | 12 | // TODO prefer the lazy string invoke once https://github.com/gradle/gradle-native/issues/718 is fixed 13 | getByName("uploadArchives") { 14 | 15 | repositories { 16 | 17 | withConvention(MavenRepositoryHandlerConvention::class) { 18 | 19 | mavenDeployer { 20 | 21 | withGroovyBuilder { 22 | "repository"("url" to uri("$buildDir/m2/releases")) 23 | "snapshotRepository"("url" to uri("$buildDir/m2/snapshots")) 24 | } 25 | 26 | pom.project { 27 | withGroovyBuilder { 28 | "parent" { 29 | "groupId"("org.gradle") 30 | "artifactId"("kotlin-dsl") 31 | "version"("1.0") 32 | } 33 | "licenses" { 34 | "license" { 35 | "name"("The Apache Software License, Version 2.0") 36 | "url"("http://www.apache.org/licenses/LICENSE-2.0.txt") 37 | "distribution"("repo") 38 | } 39 | } 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /samples/testkit/src/test/kotlin/samples/GreetPluginTest.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | import org.gradle.testkit.runner.BuildResult 4 | import org.gradle.testkit.runner.GradleRunner 5 | 6 | import org.hamcrest.CoreMatchers.equalTo 7 | 8 | import org.junit.Assert.assertThat 9 | import org.junit.Rule 10 | import org.junit.Test 11 | import org.junit.rules.TemporaryFolder 12 | 13 | import java.io.File 14 | 15 | 16 | class GreetPluginTest { 17 | 18 | @Test 19 | fun `greeting message can be configured`() { 20 | 21 | val message = "Hello, TestKit!" 22 | 23 | givenBuildScript(""" 24 | plugins { 25 | id("greet") 26 | } 27 | 28 | greeting { 29 | message = "$message" 30 | } 31 | """) 32 | 33 | assertThat( 34 | build("greet", "-q").output.trimEnd(), 35 | equalTo(message)) 36 | } 37 | 38 | private 39 | fun build(vararg arguments: String): BuildResult = 40 | GradleRunner 41 | .create() 42 | .withProjectDir(temporaryFolder.root) 43 | .withPluginClasspath() 44 | .withArguments(*arguments) 45 | // .withDebug(true) 46 | .build() 47 | 48 | private 49 | fun givenBuildScript(script: String) = 50 | newFile("build.gradle.kts").apply { 51 | writeText(script) 52 | } 53 | 54 | private 55 | fun newFile(fileName: String): File = 56 | temporaryFolder.newFile(fileName) 57 | 58 | @Rule 59 | @JvmField 60 | val temporaryFolder = TemporaryFolder() 61 | } -------------------------------------------------------------------------------- /samples/ant/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Using Ant from Gradle via the Ant Groovy Builder 2 | // See https://docs.gradle.org/current/userguide/ant.html 3 | 4 | tasks { 5 | register("hello") { 6 | group = "sample" 7 | doLast { 8 | ant.withGroovyBuilder { 9 | "echo"("message" to "Hello from Ant!") 10 | } 11 | } 12 | } 13 | 14 | register("zip") { 15 | group = "sample" 16 | doLast { 17 | ant.withGroovyBuilder { 18 | "zip"("destfile" to "$buildDir/archive.zip") { 19 | "fileset"("dir" to "src") { 20 | "include"("name" to "**/*.xml") 21 | "include"("name" to "**/*.txt") 22 | } 23 | } 24 | } 25 | } 26 | } 27 | } 28 | 29 | 30 | // Using custom Ant tasks from resolved dependency 31 | 32 | repositories { 33 | jcenter() 34 | } 35 | 36 | val pmd by configurations.creating 37 | 38 | dependencies { 39 | pmd("pmd:pmd:4.2.5") 40 | } 41 | 42 | tasks { 43 | register("pmd") { 44 | group = "sample" 45 | doLast { 46 | ant.withGroovyBuilder { 47 | "taskdef"("name" to "pmd", "classname" to "net.sourceforge.pmd.ant.PMDTask", "classpath" to pmd.asPath) 48 | "pmd"("shortFilenames" to true, "failonruleviolation" to true, "rulesetfiles" to "") { 49 | "formatter"("type" to "text", "toConsole" to "true") 50 | "fileset"("dir" to "src") 51 | } 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/MavenPublishSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.junit.Assert.assertTrue 4 | import org.junit.Test 5 | import java.io.File 6 | import java.util.jar.JarFile 7 | 8 | 9 | class MavenPublishSampleTest : AbstractSampleTest("maven-publish") { 10 | 11 | @Test 12 | fun `publish`() { 13 | 14 | // given: 15 | val projectName = "maven-publish" 16 | val projectVersion = "1.0.0" 17 | val mavenPath = "org/gradle/sample/$projectName/$projectVersion" 18 | 19 | // when: 20 | build("publish") 21 | 22 | // then: repository exists 23 | val repoDir = existing("build/repo") 24 | 25 | // and: repository contains main JAR 26 | val mainJar = File(repoDir, "$mavenPath/$projectName-$projectVersion.jar") 27 | assertTrue("jar file $mainJar exists", mainJar.exists()) 28 | 29 | // and: main JAR contains .class entries 30 | JarFile(mainJar).use { 31 | val numClassEntries = it.stream().filter { it.name.endsWith(".class") }.count() 32 | assertTrue(numClassEntries > 0) 33 | } 34 | 35 | // and: repository contains sources JAR 36 | val sourcesJar = File(repoDir, "$mavenPath/$projectName-$projectVersion-sources.jar") 37 | assertTrue("source file $sourcesJar exists", sourcesJar.exists()) 38 | 39 | // and: sources JAR contains .java and .kt files 40 | JarFile(sourcesJar).use { 41 | assertTrue(it.stream().anyMatch { it.name.endsWith(".java") }) 42 | assertTrue(it.stream().anyMatch { it.name.endsWith(".kt") }) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /samples/hello-js/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile 2 | 3 | plugins { 4 | id("kotlin2js") version "1.3.70" 5 | } 6 | 7 | dependencies { 8 | compile(kotlin("stdlib-js")) 9 | } 10 | 11 | repositories { 12 | jcenter() 13 | } 14 | 15 | tasks { 16 | compileKotlin2Js { 17 | kotlinOptions { 18 | outputFile = "${sourceSets.main.get().output.resourcesDir}/output.js" 19 | sourceMap = true 20 | } 21 | } 22 | val unpackKotlinJsStdlib by registering { 23 | group = "build" 24 | description = "Unpack the Kotlin JavaScript standard library" 25 | val outputDir = file("$buildDir/$name") 26 | inputs.property("compileClasspath", configurations.compileClasspath.get()) 27 | outputs.dir(outputDir) 28 | doLast { 29 | val kotlinStdLibJar = configurations.compileClasspath.get().single { 30 | it.name.matches(Regex("kotlin-stdlib-js-.+\\.jar")) 31 | } 32 | copy { 33 | includeEmptyDirs = false 34 | from(zipTree(kotlinStdLibJar)) 35 | into(outputDir) 36 | include("**/*.js") 37 | exclude("META-INF/**") 38 | } 39 | } 40 | } 41 | val assembleWeb by registering(Copy::class) { 42 | group = "build" 43 | description = "Assemble the web application" 44 | includeEmptyDirs = false 45 | from(unpackKotlinJsStdlib) 46 | from(sourceSets.main.get().output) { 47 | exclude("**/*.kjsm") 48 | } 49 | into("$buildDir/web") 50 | } 51 | assemble { 52 | dependsOn(assembleWeb) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /samples/provider-properties/build.gradle.kts: -------------------------------------------------------------------------------- 1 | apply() 2 | 3 | fun buildFile(path: String) = layout.buildDirectory.file(path) 4 | 5 | configure { 6 | 7 | message.set("Hi from Gradle") 8 | 9 | outputFiles.from( 10 | buildFile("a.txt"), 11 | buildFile("b.txt")) 12 | } 13 | 14 | class GreetingPlugin : Plugin { 15 | 16 | override fun apply(project: Project): Unit = project.run { 17 | 18 | // Add the 'greeting' extension object 19 | val greeting = extensions.create( 20 | "greeting", 21 | GreetingPluginExtension::class, 22 | project) 23 | 24 | // Add a task that uses the configuration 25 | tasks { 26 | register("hello", Greeting::class) { 27 | group = "Greeting" 28 | message.set(greeting.message) 29 | outputFiles.setFrom(greeting.outputFiles) 30 | } 31 | } 32 | } 33 | } 34 | 35 | open class GreetingPluginExtension(project: Project) { 36 | 37 | val message = project.objects.property() 38 | 39 | val outputFiles: ConfigurableFileCollection = project.files() 40 | } 41 | 42 | open class Greeting : DefaultTask() { 43 | 44 | @get:Input 45 | val message = project.objects.property() 46 | 47 | @get:OutputFiles 48 | val outputFiles: ConfigurableFileCollection = project.files() 49 | 50 | @TaskAction 51 | fun printMessage() { 52 | val message = message.get() 53 | val outputFiles = outputFiles.files 54 | logger.info("Writing message '$message' to files $outputFiles") 55 | outputFiles.forEach { it.writeText(message) } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/AbstractSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.gradle.samples.test.rule.Sample 4 | import org.gradle.testkit.runner.BuildResult 5 | import org.gradle.testkit.runner.GradleRunner 6 | import org.junit.Assume.assumeTrue 7 | import org.junit.Rule 8 | 9 | import java.io.File 10 | import java.util.Properties 11 | 12 | 13 | abstract class AbstractSampleTest(sampleDirName: String) { 14 | 15 | @Rule 16 | @JvmField 17 | val sample: Sample = Sample.from(samplesDir).intoTemporaryFolder().withDefaultSample(sampleDirName) 18 | 19 | protected 20 | val projectRoot: File 21 | get() = sample.dir 22 | 23 | protected 24 | fun build(vararg arguments: String): BuildResult = 25 | build(projectRoot, *arguments) 26 | 27 | protected 28 | fun build(projectDir: File, vararg arguments: String): BuildResult = 29 | GradleRunner.create() 30 | .withProjectDir(projectDir) 31 | .withArguments(*arguments) 32 | .build() 33 | .apply { println(output) } 34 | 35 | 36 | protected 37 | fun existing(path: String): File = 38 | sample.dir.resolve(path) 39 | 40 | protected 41 | fun assumeAndroidHomeIsSet() = 42 | assumeTrue(System.getenv().containsKey("ANDROID_HOME")) 43 | } 44 | 45 | 46 | private 47 | val testProperties = 48 | Properties().also { properties -> 49 | AbstractSampleTest::class.java.getResourceAsStream("/test.properties")?.use { input -> 50 | properties.load(input) 51 | } 52 | } 53 | 54 | 55 | private 56 | val samplesDir = 57 | testProperties["samplesDir"].toString() 58 | 59 | 60 | internal 61 | val samplesDirFile = 62 | File(samplesDir) 63 | -------------------------------------------------------------------------------- /samples/source-control/external/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.eclipse.jgit.api.Git 2 | 3 | buildscript { 4 | 5 | repositories { 6 | jcenter() 7 | } 8 | 9 | dependencies { 10 | classpath("org.eclipse.jgit:org.eclipse.jgit:5.0.1.201806211838-r") 11 | } 12 | } 13 | 14 | plugins { 15 | java 16 | } 17 | 18 | group = "org.gradle.kotlin.dsl.samples.source-control" 19 | 20 | version = "1.0" 21 | 22 | tasks { 23 | 24 | register("generateGitRepo") { 25 | 26 | inputs.dir("src") 27 | inputs.files("build.gradle.kts", "settings.gradle.kts") 28 | 29 | val gitRepoDir = file("$buildDir/git-repo") 30 | outputs.dir(gitRepoDir) 31 | 32 | doLast { 33 | delete(gitRepoDir) 34 | delete(temporaryDir) 35 | 36 | val bareUri = Git.init().setDirectory(gitRepoDir).setBare(true).call().use { bare -> 37 | bare.repository.directory.toURI().toString() 38 | } 39 | 40 | Git.cloneRepository().setURI(bareUri).setDirectory(temporaryDir).call().use { clone -> 41 | copy { 42 | from(".") { 43 | include("src/**") 44 | include("*.gradle.kts") 45 | } 46 | into(temporaryDir) 47 | } 48 | 49 | clone.add() 50 | .addFilepattern("build.gradle.kts") 51 | .addFilepattern("settings.gradle.kts") 52 | .addFilepattern("src") 53 | .call() 54 | clone.commit() 55 | .setMessage("Initial import") 56 | .setAuthor("name", "email") 57 | .call() 58 | 59 | clone.push().call() 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /samples/hello-kapt/src/main/kotlin/samples/Writer.kt: -------------------------------------------------------------------------------- 1 | package samples 2 | 3 | import com.google.auto.value.AutoValue 4 | 5 | /** 6 | * Example of AutoValue class that implements [User] interface and provides builder 7 | * 8 | * Can be easily used from java and with AutoValue plugins 9 | */ 10 | @AutoValue 11 | abstract class Writer : User { 12 | /** 13 | * Define only additional property [books] 14 | * other properties will be implicitly generated from properties of [User] 15 | */ 16 | abstract val books: List 17 | 18 | /** 19 | * Create prefilled builder from current object 20 | */ 21 | abstract fun toBuilder(): Builder 22 | 23 | /** 24 | * Define builder fields. 25 | * We must provide all fields and build() method otherwise will get compile error 26 | */ 27 | @AutoValue.Builder 28 | abstract class Builder { 29 | abstract fun name(name: String): Builder 30 | abstract fun age(age: Int?): Builder 31 | abstract fun books(books: List): Builder 32 | 33 | fun build(): Writer { 34 | // Example of builder value normalization 35 | if (name == "") name("Anonymous") 36 | 37 | // Example of builder value validation 38 | val age = age 39 | require(age == null || age >= 0) { "Age can not be negative" } 40 | 41 | return internalBuild() 42 | } 43 | 44 | // getters to get builder value 45 | protected abstract val name: String 46 | protected abstract val age: Int? 47 | 48 | // Real build method hidden from user to allow us validate and normalize values 49 | protected abstract fun internalBuild(): Writer 50 | } 51 | 52 | companion object { 53 | /** 54 | * Creates empty [Builder] 55 | */ 56 | @JvmStatic 57 | fun builder(): Builder = AutoValue_Writer.Builder() 58 | // Default value for builder 59 | .books(emptyList()) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /samples/hello-android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /gradle/shared-with-buildSrc/build-cache-configuration.settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.URI 17 | 18 | /* 19 | * This script is applied to the settings in buildSrc and the main build. That is why we 20 | * need this to be a script unless we can model dual usage better with composite/included builds or another solution. 21 | */ 22 | 23 | val remoteCacheUrl = System.getProperty("gradle.cache.remote.url")?.let(::URI) 24 | val isCiServer = "CI" in System.getenv() 25 | val remotePush = System.getProperty("gradle.cache.remote.push") != "false" 26 | val remoteCacheUsername = System.getProperty("gradle.cache.remote.username", "") 27 | val remoteCachePassword = System.getProperty("gradle.cache.remote.password", "") 28 | 29 | buildCache { 30 | local { 31 | isEnabled = !isCiServer 32 | } 33 | } 34 | 35 | val isRemoteBuildCacheEnabled = remoteCacheUrl != null 36 | && gradle.startParameter.run { isBuildCacheEnabled && !isOffline } 37 | 38 | if (isRemoteBuildCacheEnabled) { 39 | buildCache { 40 | remote { 41 | url = remoteCacheUrl 42 | isPush = isCiServer && remotePush 43 | if (remoteCacheUsername.isNotEmpty() && remoteCachePassword.isNotEmpty()) { 44 | credentials { 45 | username = remoteCacheUsername 46 | password = remoteCachePassword 47 | } 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/MavenPluginSampleTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.junit.Test 4 | import org.junit.Assert.assertThat 5 | 6 | import org.xmlunit.matchers.CompareMatcher.isIdenticalTo 7 | import java.io.File 8 | 9 | 10 | class MavenPluginSampleTest : AbstractSampleTest("maven-plugin") { 11 | 12 | @Test 13 | fun `uploadArchives publishes custom pom`() { 14 | build("uploadArchives", "-Dmaven.repo.local=$tempMavenLocalDir") 15 | assertPom(""" 16 | 17 | 19 | 4.0.0 20 | 21 | org.gradle 22 | kotlin-dsl 23 | 1.0 24 | 25 | org.gradle.kotlin-dsl 26 | $projectName 27 | 1.0 28 | 29 | 30 | The Apache Software License, Version 2.0 31 | http://www.apache.org/licenses/LICENSE-2.0.txt 32 | repo 33 | 34 | 35 | 36 | """) 37 | } 38 | 39 | private 40 | fun assertPom(expectedPom: String) = 41 | assertThat(pomFile(), isIdenticalTo(expectedPom.trim()).ignoreWhitespace()) 42 | 43 | private 44 | fun pomFile(): File = 45 | existing("build/m2/releases/org/gradle/kotlin-dsl/$projectName/1.0/$projectName-1.0.pom") 46 | 47 | private 48 | val projectName by lazy { 49 | projectRoot.name 50 | } 51 | 52 | private 53 | val tempMavenLocalDir by lazy { 54 | existing("build/m2/local") 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /subprojects/samples-tests/src/test/kotlin/org/gradle/kotlin/dsl/samples/SamplesSmokeTest.kt: -------------------------------------------------------------------------------- 1 | package org.gradle.kotlin.dsl.samples 2 | 3 | import org.gradle.kotlin.dsl.embeddedKotlinVersion 4 | 5 | import org.hamcrest.CoreMatchers.containsString 6 | import org.junit.Assert.assertThat 7 | import org.junit.Assume.assumeTrue 8 | import org.junit.Before 9 | import org.junit.Test 10 | import org.junit.runner.RunWith 11 | import org.junit.runners.Parameterized 12 | 13 | import java.io.File 14 | 15 | 16 | @RunWith(Parameterized::class) 17 | class SamplesSmokeTest( 18 | 19 | private 20 | val sampleDirName: String 21 | 22 | ) : AbstractSampleTest(sampleDirName) { 23 | 24 | companion object { 25 | @Parameterized.Parameters(name = "{0}") 26 | @JvmStatic 27 | fun testCases(): List = 28 | samplesDirFile.listFiles { file: File -> file.isDirectory }.map { it.name } 29 | } 30 | 31 | @Before 32 | fun ignoreAndroidSampleUnlessAndroidHomeIsSet() { 33 | if (sampleDirName.contains("android")) { 34 | assumeAndroidHomeIsSet() 35 | } 36 | } 37 | 38 | @Test 39 | fun `tasks task succeeds on `() { 40 | build("tasks") 41 | } 42 | 43 | @Test 44 | fun `uses the right Kotlin Gradle Plugin version on `() { 45 | 46 | val projectPaths = listOf(":") + listSubProjectPaths().map { "$it:" } 47 | val projectBuilds = projectPaths.map { buildSpec("${it}buildEnvironment") } 48 | val buildsToCheck = 49 | if (samplesDirFile.resolve("buildSrc").isDirectory) { 50 | projectBuilds + listOf(buildSpec("-p", "buildSrc", "buildEnvironment")) 51 | } else { 52 | projectBuilds 53 | } 54 | 55 | val foundKotlinGradlePlugin = buildsToCheck.map(::assertKotlinGradlePluginVersion) 56 | 57 | // Mark that test as ignored if not using the kotlin-gradle-plugin 58 | assumeTrue(foundKotlinGradlePlugin.any { it }) 59 | } 60 | 61 | private 62 | fun buildSpec(vararg arguments: String) = arguments 63 | 64 | private 65 | fun assertKotlinGradlePluginVersion(buildSpec: Array): Boolean = 66 | build("-q", *buildSpec).run { 67 | if (output.contains(":kotlin-gradle-plugin:")) { 68 | assertThat(output, containsString(":kotlin-gradle-plugin:$embeddedKotlinVersion")) 69 | true 70 | } else { 71 | false 72 | } 73 | } 74 | 75 | private 76 | val extractSubProjectPaths = Regex("""Project '(:.*)'""") 77 | 78 | private 79 | fun listSubProjectPaths() = 80 | build("projects", "-q").output.lines() 81 | .mapNotNull { extractSubProjectPaths.find(it)?.run { groupValues[1] } } 82 | } 83 | -------------------------------------------------------------------------------- /samples/kotlin-friendly-groovy-plugin/plugin/src/main/groovy/my/DocumentationPlugin.groovy: -------------------------------------------------------------------------------- 1 | package my 2 | 3 | import org.gradle.api.* 4 | 5 | // TIP #1: Provide documentation comments and they will be available in IntelliJ IDEA when editing the consumer 6 | // project's build script. 7 | 8 | /** 9 | * The documentation plugin. Configurable via the {@code documentation} extension. 10 | * 11 | * @see my.DocumentationExtension 12 | */ 13 | class DocumentationPlugin implements Plugin { 14 | 15 | void apply(Project project) { 16 | project.with { 17 | def books = container(Book) 18 | books.all { book -> 19 | book.sourceFile = file("src/docs/$name") 20 | } 21 | extensions.create("documentation", DocumentationExtension, books) 22 | tasks.create("books") { task -> 23 | task.doLast { 24 | books.each { book -> 25 | println "$book.name -> ${relativePath(book.sourceFile)}" 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | 33 | /** 34 | * Configuration options for the {@link my.DocumentationPlugin}. 35 | * 36 | * @see #getBooks 37 | */ 38 | // TIP #2: Make sure all types exposed in the API are publicly visible. 39 | class DocumentationExtension { 40 | 41 | private final NamedDomainObjectContainer books 42 | 43 | DocumentationExtension(books) { 44 | this.books = books 45 | } 46 | 47 | /** 48 | * The book collection. 49 | */ 50 | // TIP #3: Explicitly declare the full generic return type of any methods. 51 | NamedDomainObjectContainer getBooks() { 52 | books 53 | } 54 | 55 | // TIP #4: For best results, avoid declaring Action based configuration helpers for collections such as: 56 | // 57 | // def books(Action> action) { ... } 58 | // 59 | // First, they are unnecessary. The Kotlin DSL already treats any NamedDomainObjectContainer as configurable 60 | // via a lambda expression. 61 | // 62 | // Second, they might cause naming resolution conflicts as both `getBooks()` and `books(Action)` are visible as `books` 63 | // in Kotlin (incidentally, that's the reason behind the `(plugins) { ... }` and `(publications) { ... }` syntax in 64 | // this project's build.gradle.kts, to force the Kotlin compiler to resolve to the property instead of the method). 65 | // 66 | // A Closure based method would be ok as those are still required by the Groovy DSL and don't cause any conflict 67 | // in Kotlin. 68 | } 69 | 70 | /** 71 | * A book. 72 | */ 73 | class Book { 74 | 75 | /** 76 | * The name of the book. 77 | */ 78 | final String name 79 | 80 | /** 81 | * The book source file. 82 | */ 83 | File sourceFile 84 | 85 | Book(String name) { 86 | this.name = name 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/ant/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/copy/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/testkit/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/build-cache/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/build-scan/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/code-quality/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/hello-js/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/hello-kapt/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/hello-kotlin/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /samples/hello-world/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | --------------------------------------------------------------------------------