├── .gitattributes ├── .github ├── dco.yml ├── dependabot.yml └── workflows │ ├── combine-dependabot-prs.yml │ ├── convention-develocity-gradle-plugin-verification.yml │ ├── convention-develocity-maven-extension-verification.yml │ ├── convention-develocity-shared-verification.yml │ ├── gradle-data-capturing-samples-verification.yml │ ├── maven-build-caching-samples-verification.yml │ ├── maven-data-capturing-samples-verification.yml │ └── shell-script-validation.yml ├── .gitignore ├── LICENSE ├── README.md ├── build-caching-maven-samples ├── .gitignore ├── .mvn │ ├── develocity.xml │ ├── extensions.xml │ └── wrapper │ │ └── maven-wrapper.properties ├── README.md ├── animal-sniffer-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── antlr3-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── antlr3 │ │ │ ├── com │ │ │ │ └── example │ │ │ │ │ └── antlr │ │ │ │ │ ├── TLexer.g │ │ │ │ │ ├── TParser.g │ │ │ │ │ └── TTree.g │ │ │ └── imports │ │ │ │ └── Ruleb.g │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── asciidoctor-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── docs │ │ └── asciidoc │ │ │ ├── docinfo.html │ │ │ ├── example-manual.adoc │ │ │ ├── images │ │ │ └── sunset.jpg │ │ │ └── subdir │ │ │ ├── _b.adoc │ │ │ └── _c.adoc │ │ └── main │ │ └── java │ │ └── example │ │ └── StringUtils.java ├── aspectj-project │ ├── README.md │ ├── api │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── gradle │ │ │ └── example │ │ │ └── api │ │ │ └── Api.java │ ├── impl │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── aspect │ │ │ │ └── Aspect.aj │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── gradle │ │ │ │ └── example │ │ │ │ └── impl │ │ │ │ └── Impl.java │ │ │ └── test │ │ │ ├── aspect │ │ │ └── TestAspect.aj │ │ │ └── java │ │ │ └── com │ │ │ └── gradle │ │ │ └── example │ │ │ └── impl │ │ │ └── ImplTest.java │ └── pom.xml ├── avro-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── avro │ │ │ └── user.avsc │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── clojure-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── clojure │ │ │ └── packaging.clj │ │ └── test │ │ └── clojure │ │ └── succeeding.clj ├── duplicate-finder-project │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── enforcer-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── exec-yarn-project │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── pom.xml │ ├── public │ │ └── index.html │ ├── src │ │ └── dummy.js │ └── yarn.lock ├── java-project │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── kotlin-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ └── App.kt │ │ └── test │ │ └── kotlin │ │ └── com │ │ └── example │ │ └── AppTest.kt ├── mvnw ├── mvnw.cmd ├── pmd-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── pom.xml ├── protobuf-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── App.java │ │ └── protobuf │ │ │ └── person.proto │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── spotbugs-project │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── App.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── AppTest.java ├── spring-cloud-contract-project │ ├── README.md │ ├── pom.xml │ └── src │ │ └── test │ │ └── resources │ │ └── contracts │ │ └── Sample.groovy └── webstart-project │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── example │ │ └── App.java │ └── test │ └── java │ └── com │ └── example │ └── AppTest.java ├── build-data-capturing-gradle-samples ├── README.md ├── capture-git-diffs │ ├── gradle-git-diffs.gradle │ └── gradle-git-diffs.gradle.kts ├── capture-max-parallel-forks │ ├── gradle-max-parallel-forks.gradle │ └── gradle-max-parallel-forks.gradle.kts ├── capture-os-processes │ ├── gradle-os-processes.gradle │ └── gradle-os-processes.gradle.kts ├── capture-processor-arch │ ├── gradle-processor-arch.gradle │ └── gradle-processor-arch.gradle.kts ├── capture-quality-check-issues │ ├── gradle-quality-check-issues.gradle │ └── gradle-quality-check-issues.gradle.kts ├── capture-slow-workunit-executions │ ├── gradle-slow-task-executions.gradle │ └── gradle-slow-task-executions.gradle.kts ├── capture-test-execution-system-properties │ ├── gradle-test-execution-system-properties.gradle │ └── gradle-test-execution-system-properties.gradle.kts ├── capture-test-pts-support │ ├── gradle-test-pts-support.gradle │ └── gradle-test-pts-support.gradle.kts └── capture-thermal-throttling │ ├── gradle-thermal-throttling.gradle │ └── gradle-thermal-throttling.gradle.kts ├── build-data-capturing-maven-samples ├── README.md ├── capture-os-processes │ └── maven-os-processes.groovy ├── capture-processor-arch │ └── maven-processor-arch.groovy ├── capture-profiles │ └── maven-profiles.groovy ├── capture-quality-check-issues │ └── maven-quality-check-issues.groovy ├── capture-thermal-throttling │ └── maven-thermal-throttling.groovy └── capture-top-level-project │ └── maven-top-level-project.groovy ├── common-develocity-bazel-configuration ├── .bazelrc └── README.md ├── common-develocity-gradle-configuration-groovy ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── common-develocity-gradle-configuration-kotlin ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts ├── common-develocity-maven-configuration ├── .gitignore ├── .mvn │ ├── develocity.xml │ ├── extensions.xml │ ├── jvm.config │ ├── maven.config │ └── wrapper │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd └── pom.xml ├── common-develocity-sbt-configuration ├── README.md ├── build.sbt └── project │ ├── build.properties │ └── plugins.sbt ├── convention-develocity-gradle-plugin ├── .gitignore ├── README.md ├── examples │ ├── gradle_3_and_earlier │ │ ├── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── gradle_4 │ │ ├── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── gradle_5 │ │ ├── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── gradle_6.9_and_later │ │ ├── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ └── gradle_6 │ │ ├── build.gradle │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle └── plugins │ ├── gradle-2-through-4 │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── myorg │ │ └── ConventionDevelocityGradlePlugin.java │ └── gradle-5-or-newer │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ └── main │ └── java │ └── com │ └── myorg │ └── ConventionDevelocityGradlePlugin.java ├── convention-develocity-maven-extension ├── .gitignore ├── README.md ├── examples │ └── maven_3 │ │ ├── .mvn │ │ ├── extensions.xml │ │ └── wrapper │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ └── pom.xml └── extension │ ├── .mvn │ ├── jvm.config │ ├── maven.config │ └── wrapper │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── myorg │ │ └── ConventionDevelocityListener.java │ └── resources │ └── META-INF │ └── plexus │ └── components.xml ├── convention-develocity-shared ├── README.md ├── buildSrc │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ ├── com.myorg.java-conventions.gradle.kts │ │ └── com.myorg.publishing-conventions.gradle.kts ├── convention-develocity-common │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── myorg │ │ ├── DevelocityConventions.java │ │ └── configurable │ │ ├── BuildCacheConfigurable.java │ │ ├── BuildResult.java │ │ ├── BuildScanCaptureConfigurable.java │ │ ├── BuildScanConfigurable.java │ │ ├── BuildScanObfuscationConfigurable.java │ │ ├── BuildScanPublishingConfigurable.java │ │ ├── DevelocityConfigurable.java │ │ ├── ExecutionContext.java │ │ ├── LocalBuildCacheConfigurable.java │ │ ├── PublishedBuildScan.java │ │ ├── PublishingContext.java │ │ └── RemoteBuildCacheConfigurable.java ├── convention-develocity-gradle-plugin │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── myorg │ │ ├── ConventionDevelocityGradlePlugin.java │ │ └── configurable │ │ ├── GradleBuildCacheConfigurable.java │ │ ├── GradleBuildScanCaptureConfigurable.java │ │ ├── GradleBuildScanConfigurable.java │ │ ├── GradleBuildScanObfuscationConfigurable.java │ │ ├── GradleBuildScanPublishingConfigurable.java │ │ ├── GradleDevelocityConfigurable.java │ │ ├── GradleExecutionContext.java │ │ ├── GradleLocalBuildCacheConfigurable.java │ │ ├── GradleRemoteBuildCacheConfigurable.java │ │ ├── NoopBuildCacheConfigurable.java │ │ ├── NoopLocalBuildCacheConfigurable.java │ │ └── NoopRemoteBuildCacheConfigurable.java ├── convention-develocity-maven-extension │ ├── build.gradle.kts │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── myorg │ │ │ ├── ConventionDevelocityListener.java │ │ │ └── configurable │ │ │ ├── MavenBuildCacheConfigurable.java │ │ │ ├── MavenBuildScanCaptureConfigurable.java │ │ │ ├── MavenBuildScanConfigurable.java │ │ │ ├── MavenBuildScanObfuscationConfigurable.java │ │ │ ├── MavenBuildScanPublishingConfigurable.java │ │ │ ├── MavenDevelocityConfigurable.java │ │ │ ├── MavenExecutionContext.java │ │ │ ├── MavenLocalBuildCacheConfigurable.java │ │ │ └── MavenRemoteBuildCacheConfigurable.java │ │ └── resources │ │ └── META-INF │ │ └── plexus │ │ └── components.xml ├── examples │ ├── gradle_5 │ │ ├── build.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle.kts │ ├── gradle_6.9_and_later │ │ ├── build.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle.kts │ ├── gradle_6 │ │ ├── build.gradle.kts │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle.kts │ └── maven_3 │ │ ├── .mvn │ │ ├── extensions.xml │ │ └── wrapper │ │ │ └── maven-wrapper.properties │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ └── pom.xml ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts ├── custom-maven-distribution └── create-custom-maven-distribution.sh ├── custom-maven-wrapper └── create-custom-maven-wrapper.sh ├── git-user-count ├── README.md ├── repositories.txt ├── unique-git-repos.sh └── user-count.sh ├── kotlin-scripts-caching-experiment ├── README.md └── remote-cache-experiment-kotlin-scripts.sh ├── quarkus-build-caching-extension └── README.md ├── rollout-maven-extension ├── .mvn │ ├── develocity.xml │ └── extensions.xml ├── README.md ├── repositories.txt └── rollout.sh └── transforms-caching-experiment ├── README.md └── remote-cache-experiment-transforms.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | # Disable sign-off check for members of the Gradle GitHub organization 2 | require: 3 | members: false 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | registries: 3 | gradle-plugin-portal: 4 | type: maven-repository 5 | url: https://plugins.gradle.org/m2 6 | username: dummy # Required by dependabot 7 | password: dummy # Required by dependabot 8 | updates: 9 | - package-ecosystem: "maven" 10 | directory: "build-caching-maven-samples" 11 | schedule: 12 | interval: "daily" 13 | time: "02:00" 14 | - package-ecosystem: "maven" 15 | directory: "common-develocity-maven-configuration" 16 | schedule: 17 | interval: "daily" 18 | time: "02:00" 19 | - package-ecosystem: "gradle" 20 | directory: "common-develocity-gradle-configuration-groovy" 21 | registries: 22 | - gradle-plugin-portal 23 | schedule: 24 | interval: "daily" 25 | time: "02:00" 26 | - package-ecosystem: "gradle" 27 | directory: "common-develocity-gradle-configuration-kotlin" 28 | registries: 29 | - gradle-plugin-portal 30 | schedule: 31 | interval: "daily" 32 | time: "02:00" 33 | - package-ecosystem: "gradle" 34 | directory: "convention-develocity-gradle-plugin/plugins/gradle-5-or-newer" 35 | registries: 36 | - gradle-plugin-portal 37 | schedule: 38 | interval: "daily" 39 | time: "02:00" 40 | - package-ecosystem: "gradle" 41 | directory: "convention-develocity-gradle-plugin/plugins/gradle-2-through-4" 42 | registries: 43 | - gradle-plugin-portal 44 | schedule: 45 | interval: "daily" 46 | time: "02:00" 47 | ignore: 48 | - dependency-name: "com.gradle:build-scan-plugin" 49 | - package-ecosystem: "maven" 50 | directory: "convention-develocity-maven-extension/extension" 51 | schedule: 52 | interval: "daily" 53 | time: "02:00" 54 | - package-ecosystem: "gradle" 55 | directory: "convention-develocity-shared" 56 | registries: 57 | - gradle-plugin-portal 58 | schedule: 59 | interval: "daily" 60 | time: "02:00" 61 | - package-ecosystem: "github-actions" 62 | directory: "/" 63 | schedule: 64 | interval: "daily" 65 | time: "02:00" 66 | -------------------------------------------------------------------------------- /.github/workflows/combine-dependabot-prs.yml: -------------------------------------------------------------------------------- 1 | name: Combine Dependabot PRs 2 | 3 | on: 4 | schedule: 5 | - cron: '0 4 * * *' 6 | workflow_dispatch: 7 | 8 | # The minimum permissions required to run this Action 9 | permissions: 10 | contents: write 11 | pull-requests: write 12 | checks: read 13 | 14 | jobs: 15 | combine-dependabot-prs: 16 | if: github.repository == 'gradle/develocity-build-config-samples' 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: combine-dependabot-prs 20 | uses: github/combine-prs@v5.2.0 21 | with: 22 | branch_regex: ^(dependa|wrapper|upgrade)bot\/.*$ 23 | github_token: ${{ secrets.GH_BOT_GITHUB_TOKEN }} 24 | -------------------------------------------------------------------------------- /.github/workflows/convention-develocity-maven-extension-verification.yml: -------------------------------------------------------------------------------- 1 | name: Verify Convention Develocity Maven Extension 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths: [ 'convention-develocity-maven-extension/**', '.github/workflows/**' ] 7 | pull_request: 8 | branches: [ main ] 9 | paths: [ 'convention-develocity-maven-extension/**', '.github/workflows/**' ] 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | name: Build Convention Develocity Maven Extension 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | - name: Set up JDK 21 20 | uses: actions/setup-java@v4 21 | with: 22 | java-version: '21' 23 | distribution: 'temurin' 24 | cache: maven 25 | - name: Set up Maven 26 | uses: gradle/develocity-actions/setup-maven@v1.3 27 | - name: Configure Develocity Solutions instance 28 | working-directory: convention-develocity-maven-extension/extension/src/main/java/com/myorg 29 | run: sed -i 's/develocity-samples.gradle.com/ge.solutions-team.gradle.com/g' ConventionDevelocityListener.java 30 | - name: Build with Maven 31 | working-directory: convention-develocity-maven-extension/extension 32 | run: ./mvnw clean install 33 | - name: Upload extension 34 | uses: actions/upload-artifact@v4 35 | with: 36 | name: convention-develocity-maven-extension 37 | path: ~/.m2/repository/com/myorg 38 | 39 | verification: 40 | name: Verify Example Build for Maven ${{ matrix.versions.version }} 41 | needs: [build] 42 | runs-on: ubuntu-latest 43 | strategy: 44 | fail-fast: false 45 | matrix: 46 | versions: 47 | - sample: '3' 48 | version: '3.6.3' 49 | - sample: '3' 50 | version: '3.8.8' 51 | - sample: '3' 52 | version: '(Current)' 53 | steps: 54 | - name: Checkout 55 | uses: actions/checkout@v4 56 | - name: Set up JDK 8 57 | uses: actions/setup-java@v4 58 | with: 59 | java-version: '8' 60 | distribution: 'temurin' 61 | cache: maven 62 | - name: Set up Maven 63 | uses: gradle/develocity-actions/setup-maven@v1.3 64 | - name: Download extension 65 | uses: actions/download-artifact@v4 66 | with: 67 | name: convention-develocity-maven-extension 68 | path: ~/.m2/repository/com/myorg 69 | - name: Set Maven version 70 | if: ${{ matrix.versions.version != '(Current)' }} 71 | working-directory: convention-develocity-maven-extension/examples/maven_${{ matrix.versions.sample }} 72 | run: ./mvnw wrapper:wrapper -Dmaven=${{ matrix.versions.version }} -Ddevelocity.scan.disabled 73 | - name: Verify example build 74 | id: build 75 | working-directory: convention-develocity-maven-extension/examples/maven_${{ matrix.versions.sample }} 76 | run: ./mvnw clean verify 77 | env: 78 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }} 79 | - name: Verify Build Scan published 80 | if: ${{ !steps.build.outputs.build-scan-url }} 81 | run: echo "::error ::No Build Scan published"; exit 1 82 | -------------------------------------------------------------------------------- /.github/workflows/gradle-data-capturing-samples-verification.yml: -------------------------------------------------------------------------------- 1 | name: Verify Gradle Data Capturing Samples 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths: [ 'build-data-capturing-gradle-samples/**', '.github/workflows/**' ] 7 | pull_request: 8 | branches: [ main ] 9 | paths: [ 'build-data-capturing-gradle-samples/**', '.github/workflows/**' ] 10 | workflow_dispatch: 11 | 12 | jobs: 13 | verification: 14 | name: Verification of ${{ matrix.name }} 15 | runs-on: ubuntu-latest 16 | strategy: 17 | matrix: 18 | include: 19 | - name: 'Git diffs' 20 | sample-file: 'capture-git-diffs/gradle-git-diffs.gradle' 21 | - name: 'Max parallel forks' 22 | sample-file: 'capture-max-parallel-forks/gradle-max-parallel-forks.gradle' 23 | - name: 'OS processes' 24 | sample-file: 'capture-os-processes/gradle-os-processes.gradle' 25 | - name: 'Processor arch' 26 | sample-file: 'capture-processor-arch/gradle-processor-arch.gradle' 27 | - name: 'Quality checks' 28 | sample-file: 'capture-quality-check-issues/gradle-quality-check-issues.gradle' 29 | - name: 'Slow tasks' 30 | sample-file: 'capture-slow-workunit-executions/gradle-slow-task-executions.gradle' 31 | - name: 'Test task system properties' 32 | sample-file: 'capture-test-execution-system-properties/gradle-test-execution-system-properties.gradle' 33 | - name: 'Test PTS support' 34 | sample-file: 'capture-test-pts-support/gradle-test-pts-support.gradle' 35 | - name: 'Thermal throttling' 36 | sample-file: 'capture-thermal-throttling/gradle-thermal-throttling.gradle' 37 | steps: 38 | - name: Checkout 39 | uses: actions/checkout@v4 40 | - name: Set up JDK 21 41 | uses: actions/setup-java@v4 42 | with: 43 | java-version: '21' 44 | distribution: 'temurin' 45 | - name: Set up Gradle 46 | uses: gradle/actions/setup-gradle@v4 47 | with: 48 | develocity-access-key: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }} 49 | - name: Inject data capture script into Gradle build using Groovy DSL 50 | working-directory: common-develocity-gradle-configuration-groovy 51 | run: | 52 | # apply sample file 53 | echo "apply from: file(\"../build-data-capturing-gradle-samples/${{matrix.sample-file}}\")" >> build.gradle 54 | - name: Run Gradle build using Groovy DSL 55 | working-directory: common-develocity-gradle-configuration-groovy 56 | run: ./gradlew tasks -Ddevelocity.url=https://ge.solutions-team.gradle.com 57 | - name: Inject data capture script into Gradle build using Kotlin DSL 58 | working-directory: common-develocity-gradle-configuration-kotlin 59 | run: | 60 | # apply sample file 61 | echo "apply(from = \"../build-data-capturing-gradle-samples/${{matrix.sample-file}}.kts\")" >> build.gradle.kts 62 | - name: Run Gradle build using Kotlin DSL 63 | working-directory: common-develocity-gradle-configuration-kotlin 64 | run: ./gradlew tasks -Ddevelocity.url=https://ge.solutions-team.gradle.com 65 | -------------------------------------------------------------------------------- /.github/workflows/maven-build-caching-samples-verification.yml: -------------------------------------------------------------------------------- 1 | name: Verify Maven Build Caching Samples 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths: [ 'build-caching-maven-samples/**', '.github/workflows/**' ] 7 | pull_request: 8 | branches: [ main ] 9 | paths: [ 'build-caching-maven-samples/**', '.github/workflows/**' ] 10 | workflow_dispatch: 11 | 12 | env: 13 | PROJECT_DIR: build-caching-maven-samples 14 | GOALS: verify 15 | ARGS: -B -Ddevelocity.cache.failOnUnhandledParameters=true 16 | 17 | jobs: 18 | verification: 19 | name: Verification 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Set up JDK 21 23 | uses: actions/setup-java@v4 24 | with: 25 | java-version: '21' 26 | distribution: 'temurin' 27 | - name: Set up Maven 28 | uses: gradle/develocity-actions/setup-maven@v1.3 29 | with: 30 | develocity-access-key: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }} 31 | - name: Setup Node.js and Npm 32 | uses: actions/setup-node@v4 33 | with: 34 | node-version: '14' 35 | - name: Set up Yarn 36 | run: npm install -g yarn 37 | - name: Download latest version of the Develocity Build Validation Scripts 38 | uses: gradle/develocity-build-validation-scripts/.github/actions/maven/download@actions-stable 39 | with: 40 | token: ${{ secrets.GITHUB_TOKEN }} 41 | - name: Run experiment 1 42 | uses: gradle/develocity-build-validation-scripts/.github/actions/maven/experiment-1@actions-stable 43 | with: 44 | gitRepo: ${{ github.server_url }}/${{ github.repository }} 45 | gitCommitId: ${{ github.sha }} 46 | projectDir: ${{ env.PROJECT_DIR }} 47 | goals: ${{ env.GOALS }} 48 | args: ${{ env.ARGS }} 49 | failIfNotFullyCacheable: true 50 | - name: Run experiment 2 51 | uses: gradle/develocity-build-validation-scripts/.github/actions/maven/experiment-2@actions-stable 52 | with: 53 | gitRepo: ${{ github.server_url }}/${{ github.repository }} 54 | gitCommitId: ${{ github.sha }} 55 | projectDir: ${{ env.PROJECT_DIR }} 56 | goals: ${{ env.GOALS }} 57 | args: ${{ env.ARGS }} 58 | failIfNotFullyCacheable: true 59 | -------------------------------------------------------------------------------- /.github/workflows/maven-data-capturing-samples-verification.yml: -------------------------------------------------------------------------------- 1 | name: Verify Maven Data Capturing Samples 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths: [ 'build-data-capturing-maven-samples/**', '.github/workflows/**' ] 7 | pull_request: 8 | branches: [ main ] 9 | paths: [ 'build-data-capturing-maven-samples/**', '.github/workflows/**' ] 10 | workflow_dispatch: 11 | 12 | jobs: 13 | verification: 14 | name: Verification of ${{ matrix.name }} 15 | runs-on: ubuntu-latest 16 | env: 17 | LOG_MSG_EXTENSION_LOADED: "Build operation 'Develocity mojo execution' completed" 18 | LOG_MSG_EXECUTION_FAILED: "Error executing a DevelocityListener callback" 19 | strategy: 20 | matrix: 21 | include: 22 | - name: 'OS processes' 23 | sample-file: 'capture-os-processes/maven-os-processes.groovy' 24 | - name: 'Processor arch' 25 | sample-file: 'capture-processor-arch/maven-processor-arch.groovy' 26 | - name: 'Profiles' 27 | sample-file: 'capture-profiles/maven-profiles.groovy' 28 | - name: 'Quality checks' 29 | sample-file: 'capture-quality-check-issues/maven-quality-check-issues.groovy' 30 | - name: 'Thermal throttling' 31 | sample-file: 'capture-thermal-throttling/maven-thermal-throttling.groovy' 32 | - name: 'Top-level project' 33 | sample-file: 'capture-top-level-project/maven-top-level-project.groovy' 34 | steps: 35 | - name: Checkout 36 | uses: actions/checkout@v4 37 | - name: Set up JDK 21 38 | uses: actions/setup-java@v4 39 | with: 40 | java-version: '21' 41 | distribution: 'temurin' 42 | - name: Provide data capture script to Maven build 43 | run: | 44 | # copy over sample script such that it gets pulled in by the Develocity extension 45 | cp build-data-capturing-maven-samples/${{ matrix.sample-file }} common-develocity-maven-configuration/.mvn/develocity-custom-user-data.groovy 46 | - name: Run Maven build 47 | id: mvn-build 48 | run: | 49 | delimiter="$(openssl rand -hex 8)" 50 | echo "mavenOutput<<${delimiter}" >> $GITHUB_OUTPUT 51 | echo "$(mvn -f common-develocity-maven-configuration/pom.xml -Ddevelocity.url=https://ge.solutions-team.gradle.com -X -B clean validate)" >> $GITHUB_OUTPUT 52 | echo "${delimiter}" >> $GITHUB_OUTPUT 53 | env: 54 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }} 55 | - name: Validate extension loaded 56 | # Asserting that extension was loaded checking a log entry 57 | run: exit 1 58 | if: ${{ !contains(steps.mvn-build.outputs.mavenOutput, env.LOG_MSG_EXTENSION_LOADED) }} 59 | - name: Validate extension executed 60 | # Asserting that extension was run successfully checking absence of an error log entry 61 | run: exit 1 62 | if: contains(steps.mvn-build.outputs.mavenOutput, env.LOG_MSG_EXECUTION_FAILED) 63 | -------------------------------------------------------------------------------- /.github/workflows/shell-script-validation.yml: -------------------------------------------------------------------------------- 1 | name: Validate Shell Scripts 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | validation: 12 | name: Validation 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | - name: Validate 18 | uses: luizm/action-sh-checker@v0.9.0 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 | SHELLCHECK_OPTS: -a -x 22 | with: 23 | sh_checker_comment: true 24 | sh_checker_shfmt_disable: true 25 | sh_checker_exclude: "gradlew mvnw" 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .gradle/ 3 | .tmp/ 4 | out/ 5 | build/ 6 | target/ 7 | *.DS_Store 8 | develocity-unique-users.txt 9 | develocity-users.txt 10 | develocity-users-by-repo.csv 11 | 12 | *.iml 13 | .develocity/ 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > _This repository is maintained by the Develocity Solutions team, as one of several publicly available repositories:_ 2 | > - _[Android Cache Fix Gradle Plugin][android-cache-fix-plugin]_ 3 | > - _[Common Custom User Data Gradle Plugin][ccud-gradle-plugin]_ 4 | > - _[Common Custom User Data Maven Extension][ccud-maven-extension]_ 5 | > - _[Develocity Build Configuration Samples][develocity-build-config-samples] (this repository)_ 6 | > - _[Develocity Build Validation Scripts][develocity-build-validation-scripts]_ 7 | > - _[Develocity Open Source Projects][develocity-oss-projects]_ 8 | > - _[Quarkus Build Caching Extension][quarkus-build-caching-extension]_ 9 | 10 | # Develocity Build Configuration Samples 11 | 12 | [![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.solutions-team.gradle.com/scans) 13 | 14 | This repository contains samples that demonstrate how to customize and optimize your Develocity build configuration using Gradle or Maven. 15 | 16 | The samples aim to demonstrate customizations, optimizations, API usages, as well as patterns for applying and reusing Develocity build configuration across multiple projects. 17 | 18 | ## Samples 19 | 20 | The samples can be grouped into the following categories: 21 | 22 | - Configuration snippets to capture additional data in build scans 23 | - Configuration snippets to optimize build performance 24 | - Template projects for Gradle and Maven when using Develocity 25 | - Scripts and code to apply and reuse Develocity across multiple projects and build tools 26 | 27 | ## Learn more 28 | 29 | Visit our website to learn more about [Develocity][develocity]. 30 | 31 | ## License 32 | 33 | The Develocity build configuration samples are open-source software released under the [Apache 2.0 License][apache-license]. 34 | 35 | [android-cache-fix-plugin]: https://github.com/gradle/android-cache-fix-gradle-plugin 36 | [ccud-gradle-plugin]: https://github.com/gradle/common-custom-user-data-gradle-plugin 37 | [ccud-maven-extension]: https://github.com/gradle/common-custom-user-data-maven-extension 38 | [develocity-build-config-samples]: https://github.com/gradle/develocity-build-config-samples 39 | [develocity-build-validation-scripts]: https://github.com/gradle/develocity-build-validation-scripts 40 | [develocity-oss-projects]: https://github.com/gradle/develocity-oss-projects 41 | [quarkus-build-caching-extension]: https://github.com/gradle/quarkus-build-caching-extension 42 | [develocity]: https://gradle.com/develocity 43 | [apache-license]: https://www.apache.org/licenses/LICENSE-2.0.html 44 | -------------------------------------------------------------------------------- /build-caching-maven-samples/.gitignore: -------------------------------------------------------------------------------- 1 | .mvn/.develocity/develocity-workspace-id 2 | 3 | velocity.log 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/.mvn/develocity.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | https://ge.solutions-team.gradle.com 7 | 8 | 9 | #{isFalse(env['GITHUB_ACTIONS'])} 10 | 11 | 12 | 13 | 14 | 15 | 16 | #{{'0.0.0.0'}} 17 | 18 | 19 | 20 | 21 | true 22 | 23 | 24 | false 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /build-caching-maven-samples/.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.gradle 4 | develocity-maven-extension 5 | 2.0.1 6 | 7 | 8 | com.gradle 9 | common-custom-user-data-maven-extension 10 | 2.0.2 11 | 12 | 13 | -------------------------------------------------------------------------------- /build-caching-maven-samples/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip 20 | -------------------------------------------------------------------------------- /build-caching-maven-samples/README.md: -------------------------------------------------------------------------------- 1 | ## Examples of Develocity build cache configuration for Maven 2 | 3 | This Maven project provides example configuration for enabling build caching for certain Maven plugins that are not supported out of the box by Develocity. 4 | Although the cache configuration does not cover all possible plugin uses, most standard/default plugin settings should work. 5 | 6 | NOTE: These code snippets serve as examples only. It is imperative that you test the build caching configuration with your own project. 7 | Misconfigured build caching can lead to incorrect cache hits, resulting in incorrect goal outputs. 8 | 9 | The following Maven plugins are demonstrated: 10 | - Animal Sniffer: `org.codehaus.mojo:animal-sniffer-maven-plugin` 11 | - Antlr3: `org.antlr:antlr3-maven-plugin` 12 | - AsciiDoctor: `org.asciidoctor:asciidoctor-maven-plugin` 13 | - AspectJ: `org.codehaus.mojo:aspectj-maven-plugin` 14 | - Avro (Apache): `org.apache.avro:avro-maven-plugin` 15 | - Clojure: `com.theoryinpractise:clojure-maven-plugin` 16 | - Duplicate Finder Plugin: `org.basepom.maven:duplicate-finder-maven-plugin` 17 | - Enforcer: `org.apache.maven.plugins:maven-enforcer-plugin` 18 | - Exec (driving Yarn Package Manager): `org.codehaus.mojo:exec-maven-plugin` 19 | - Kotlin: `org.jetbrains.kotlin:kotlin-maven-plugin` 20 | - PMD: `org.apache.maven.plugins:maven-pmd-plugin` 21 | - Protobuf: `com.github.os72:protoc-jar-maven-plugin` 22 | - Spotbugs: `com.github.spotbugs:spotbugs-maven-plugin` 23 | - Spring Cloud Contract: `org.springframework.cloud:spring-cloud-contract-maven-plugin` 24 | - Webstart: `org.codehaus.mojo:webstart-maven-plugin` (Java 1.8 only) 25 | -------------------------------------------------------------------------------- /build-caching-maven-samples/animal-sniffer-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `check` goal of the `animal-sniffer-maven-plugin` cacheable. 2 | 3 | Starting with Java 9, the animal sniffer plugin is usually no longer necessary. Instead, you should configure the `release` parameter of the `maven-compiler-plugin`. However, if you're still on Java 8, you can make the plugin cacheable using the POM DSL. 4 | 5 | The bundled configuration tracks all main Java source files (compileSourceRoots), the class files (outputDirectory is actually the output directory of the maven-compiler-plugin and used as an input for animal sniffer), and the GAV of all configured signatures. If you're using your own artifacts for the signatures and use snapshots or version ranges this will not be sufficient and you shouldn't use the example config. 6 | -------------------------------------------------------------------------------- /build-caching-maven-samples/animal-sniffer-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class App { 6 | public static void main( String[] args ) { 7 | System.out.println( "Hello World!" ); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /build-caching-maven-samples/animal-sniffer-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue( true ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `antlr` source generation goal of the `antlr3-maven-plugin` cacheable. 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/src/main/antlr3/com/example/antlr/TLexer.g: -------------------------------------------------------------------------------- 1 | // This is a sample lexer generated by the ANTLR3 Maven Archetype 2 | // generator. It shows how to use a superclass to implement 3 | // support methods and variables you may use in the lexer actions 4 | // rather than create a messy lexer that has the Java code embedded 5 | // in it. 6 | // 7 | 8 | lexer grammar TLexer; 9 | 10 | options { 11 | 12 | language=Java; // Default 13 | 14 | } 15 | 16 | // What package should the generated source exist in? 17 | // 18 | @header { 19 | 20 | package com.example.antlr; 21 | } 22 | 23 | // This is just a simple lexer that matches the usual suspects 24 | // 25 | 26 | KEYSER : 'Keyser' ; 27 | SOZE : 'Soze' ; 28 | 29 | ADD : '+' ; 30 | SEMI: ';' ; 31 | 32 | ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* 33 | ; 34 | 35 | INT : '0'..'9'+ 36 | ; 37 | 38 | COMMENT 39 | : '//' ~('\n'|'\r')* '\r'? '\n' {skip();} 40 | | '/*' ( options {greedy=false;} : . )* '*/' {skip();} 41 | ; 42 | 43 | WS : ( ' ' 44 | | '\t' 45 | | '\r' 46 | | '\n' 47 | ) {skip();} 48 | ; 49 | 50 | STRING 51 | : '"' ( ESC_SEQ | ~('\\'|'"') )* '"' 52 | ; 53 | 54 | fragment 55 | HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; 56 | 57 | fragment 58 | ESC_SEQ 59 | : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') 60 | | UNICODE_ESC 61 | | OCTAL_ESC 62 | ; 63 | 64 | fragment 65 | OCTAL_ESC 66 | : '\\' ('0'..'3') ('0'..'7') ('0'..'7') 67 | | '\\' ('0'..'7') ('0'..'7') 68 | | '\\' ('0'..'7') 69 | ; 70 | 71 | fragment 72 | UNICODE_ESC 73 | : '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT 74 | ; 75 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/src/main/antlr3/com/example/antlr/TParser.g: -------------------------------------------------------------------------------- 1 | parser grammar TParser; 2 | 3 | options { 4 | 5 | // Default language but name it anyway 6 | // 7 | language = Java; 8 | 9 | // Produce an AST 10 | // 11 | output = AST; 12 | 13 | // Use the vocabulary generated by the accompanying 14 | // lexer. Maven knows how to work out the relationship 15 | // between the lexer and parser and will build the 16 | // lexer before the parser. It will also rebuild the 17 | // parser if the lexer changes. 18 | // 19 | tokenVocab = TLexer; 20 | } 21 | 22 | // Import a grammar file, even though it does not really need it in this 23 | // simle demo parser. We do the import to show where imported grammars should be 24 | // stored for maven builds. 25 | // 26 | import Ruleb; 27 | 28 | // Some imaginary tokens for tree rewrites 29 | // 30 | tokens { 31 | SCRIPT; 32 | } 33 | 34 | // What package should the generated source exist in? 35 | // 36 | @header { 37 | 38 | package com.example.antlr; 39 | } 40 | 41 | 42 | 43 | 44 | // This is just a simple parser for demo purpose 45 | // 46 | a : b* EOF 47 | 48 | -> ^(SCRIPT b*) 49 | ; 50 | 51 | 52 | 53 | keyser 54 | : KEYSER^ SOZE 55 | ; 56 | 57 | expression 58 | : addExpr (ADD^ addExpr)* 59 | ; 60 | 61 | addExpr 62 | : ID 63 | | INT 64 | | STRING 65 | ; 66 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/src/main/antlr3/com/example/antlr/TTree.g: -------------------------------------------------------------------------------- 1 | tree grammar TTree; 2 | 3 | options { 4 | 5 | // Default but name it anyway 6 | // 7 | language = Java; 8 | 9 | // Use the vocab from the parser (not the lexer) 10 | // The ANTLR Maven plugin knows how to work out the 11 | // relationships between the .g files and it will build 12 | // the tree parser after the parser. It will also rebuild 13 | // the tree parser if the parser is rebuilt. 14 | // 15 | tokenVocab = TParser; 16 | 17 | // Use ANTLR built-in CommonToken for tree nodes 18 | // 19 | ASTLabelType = CommonToken; 20 | } 21 | 22 | // What package should the generated source exist in? 23 | // 24 | @header { 25 | 26 | package com.example.antlr; 27 | } 28 | 29 | a : ^(SCRIPT stuff+) 30 | | SCRIPT 31 | ; 32 | 33 | stuff 34 | : keyser 35 | | expression 36 | ; 37 | 38 | keyser 39 | : ^(KEYSER SOZE) 40 | { System.out.println("Found Keyser Soze!!"); } 41 | ; 42 | 43 | expression 44 | : ^(ADD expression expression) 45 | | ID 46 | | INT 47 | | STRING 48 | ; 49 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/src/main/antlr3/imports/Ruleb.g: -------------------------------------------------------------------------------- 1 | // A single rule in a grammar that must be imported by the demo 2 | // parser Tparser.g 3 | // This is just here to show that import grammars are stored in their 4 | // own imports directory: src/main/antlr3/imports 5 | // 6 | parser grammar Ruleb; 7 | 8 | b 9 | : keyser SEMI! 10 | | expression SEMI! 11 | ; 12 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.antlr.TLexer; 4 | import com.example.antlr.TParser; 5 | 6 | import org.antlr.runtime.*; 7 | 8 | public class App { 9 | public static boolean useAntlr3() { 10 | TLexer lexer = new TLexer(new ANTLRStringStream("This is Keiser Soze")); 11 | CommonTokenStream tokenStream = new CommonTokenStream(lexer); 12 | TParser parser = new TParser(tokenStream); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /build-caching-maven-samples/antlr3-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue(App.useAntlr3()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `process-asciidoc` goal of the `asciidoctor-maven-plugin` cacheable. 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/src/docs/asciidoc/docinfo.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/src/docs/asciidoc/example-manual.adoc: -------------------------------------------------------------------------------- 1 | = Example Manual 2 | Doc Writer 3 | 2014-09-09 4 | :revnumber: {project-version} 5 | :example-caption!: 6 | ifndef::imagesdir[:imagesdir: images] 7 | ifndef::sourcedir[:sourcedir: ../../main/java] 8 | 9 | This is a user manual for an example project. 10 | 11 | == Introduction 12 | 13 | This project does something. 14 | We just haven't decided what that is yet. 15 | 16 | == Source Code 17 | 18 | [source,java] 19 | .Java code from project 20 | ---- 21 | include::{sourcedir}/example/StringUtils.java[tags=contains,indent=0] 22 | ---- 23 | 24 | This page was built by the following command: 25 | 26 | $ mvn 27 | 28 | == Images 29 | 30 | [.thumb] 31 | image::sunset.jpg[scaledwidth=75%] 32 | 33 | == Attributes 34 | 35 | .Built-in 36 | asciidoctor-version:: {asciidoctor-version} 37 | safe-mode-name:: {safe-mode-name} 38 | docdir:: {docdir} 39 | docfile:: {docfile} 40 | imagesdir:: {imagesdir} 41 | 42 | .Custom 43 | project-version:: {project-version} 44 | sourcedir:: {sourcedir} 45 | endpoint-url:: {endpoint-url} 46 | 47 | == Includes 48 | 49 | .include::subdir/_b.adoc[] 50 | ==== 51 | include::subdir/_b.adoc[] 52 | ==== 53 | 54 | WARNING: Includes can be tricky! 55 | -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/src/docs/asciidoc/images/sunset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/build-caching-maven-samples/asciidoctor-project/src/docs/asciidoc/images/sunset.jpg -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/src/docs/asciidoc/subdir/_b.adoc: -------------------------------------------------------------------------------- 1 | content from _src/docs/asciidoc/subdir/_b.adoc_. 2 | 3 | .include::_c.adoc[] 4 | [example] 5 | -- 6 | include::_c.adoc[] 7 | -- 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/src/docs/asciidoc/subdir/_c.adoc: -------------------------------------------------------------------------------- 1 | content from _src/docs/asciidoc/subdir/c.adoc_. 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/asciidoctor-project/src/main/java/example/StringUtils.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class StringUtils { 4 | // tag::contains[] 5 | public boolean contains(String haystack, String needle) { 6 | return haystack.contains(needle); 7 | } 8 | // end::contains[] 9 | } 10 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `aspectj:compile` and `aspectj:test-compile` goals of the `aspectj-maven-plugin` cacheable. 2 | 3 | Note that the compiler plugin is disabled on the `impl` module which applies the AspectJ plugin, as the AspectJ plugin overrides the outputs of the compile goal and this is not supported with build caching. 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.gradle 9 | aspectj-parent 10 | 1.0-SNAPSHOT 11 | 12 | 13 | aspectj-api 14 | 15 | 16 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/api/src/main/java/com/gradle/example/api/Api.java: -------------------------------------------------------------------------------- 1 | package com.gradle.example.api; 2 | 3 | public interface Api { 4 | default int getTheAnswer() { 5 | return 42; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/impl/src/main/aspect/Aspect.aj: -------------------------------------------------------------------------------- 1 | public aspect Aspect { 2 | final int CONSTANT = 42; 3 | } 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/impl/src/main/java/com/gradle/example/impl/Impl.java: -------------------------------------------------------------------------------- 1 | package com.gradle.example.impl; 2 | 3 | import com.gradle.example.api.Api; 4 | 5 | public class Impl implements Api { 6 | } 7 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/impl/src/test/aspect/TestAspect.aj: -------------------------------------------------------------------------------- 1 | public aspect TestAspect { 2 | final int CONSTANT = 42; 3 | } 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/aspectj-project/impl/src/test/java/com/gradle/example/impl/ImplTest.java: -------------------------------------------------------------------------------- 1 | package com.gradle.example.impl; 2 | 3 | import org.junit.*; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | public class ImplTest { 8 | 9 | @Test 10 | public void testTheAnswer() { 11 | assertEquals(42, new Impl().getTheAnswer()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /build-caching-maven-samples/avro-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `schema` goal of the `avro-maven-plugin` cacheable. 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/avro-project/src/main/avro/user.avsc: -------------------------------------------------------------------------------- 1 | {"namespace": "com.example.avro", 2 | "type": "record", 3 | "name": "User", 4 | "fields": [ 5 | {"name": "name", "type": "string"}, 6 | {"name": "favorite_number", "type": ["int", "null"]}, 7 | {"name": "favorite_color", "type": ["string", "null"]} 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /build-caching-maven-samples/avro-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.avro.User; 4 | 5 | public class App { 6 | public static User getAvroUser() { 7 | return new User("Andrew", 7, "red"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /build-caching-maven-samples/avro-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.avro.User; 4 | 5 | import junit.framework.Test; 6 | import junit.framework.TestCase; 7 | 8 | public class AppTest extends TestCase { 9 | public void testUser() { 10 | User user = App.getAvroUser(); 11 | assertEquals("Andrew", user.getName()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /build-caching-maven-samples/clojure-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `compile` and `test` goals of the `clojure-maven-plugin` cacheable. 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/clojure-project/src/main/clojure/packaging.clj: -------------------------------------------------------------------------------- 1 | (ns packaging) 2 | 3 | (defn hello-world 4 | [] 5 | (println "Hello World!!!???")) 6 | 7 | (defmacro nestfn [n & body] 8 | (if (> n 0) 9 | `(fn [] (nestfn ~(- n 1) ~@body)) 10 | body)) 11 | 12 | (def myf (nestfn 20 "body")) -------------------------------------------------------------------------------- /build-caching-maven-samples/clojure-project/src/test/clojure/succeeding.clj: -------------------------------------------------------------------------------- 1 | (ns succeeding 2 | (:use 3 | clojure.test) 4 | ) 5 | 6 | (deftest atest 7 | (is true) 8 | ) 9 | -------------------------------------------------------------------------------- /build-caching-maven-samples/duplicate-finder-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class App { 4 | public static void main( String[] args ) { 5 | System.out.println( "Hello World!" ); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/duplicate-finder-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue( true ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/enforcer-project/README.md: -------------------------------------------------------------------------------- 1 | The `maven-enforcer-plugin` cannot be made cacheable in general since it can be extended with rules and we don't know their inputs. 2 | Most rules are rather fast and not worth to made cacheable. 3 | 4 | In order to find out which rules are slow, you should first separate each rule into its own goal and look at the resulting build scan. 5 | Once that is done, you can group the fast rules into a single goal and look at the code of the slow rules in detail. 6 | 7 | In this example, 4 different enforcer rules have been enabled: 8 | - `Banned Repositories`: a fast rule that does not require caching 9 | - `Ban Distribution Management`: a fast rule that does not require caching 10 | - `Banned Dependencies`: a slower rule that has been made cacheable 11 | - `Enforce Bytecode Version`: a slower rule that has been made cacheable 12 | 13 | The first 2 "fast" rules are combined into a single Enforcer execution. 14 | The other 2 rules are run in separate executions, allowing them to be made independently cacheable. 15 | 16 | Note that each enforcer execution will require it's own cache configuration, in order to correctly define all of the rule inputs. 17 | 18 | ### Compatibility 19 | 20 | This example is compatible with `maven-enforcer-plugin` version `3.2.1+`. 21 | -------------------------------------------------------------------------------- /build-caching-maven-samples/enforcer-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class App { 4 | public static void main( String[] args ) { 5 | System.out.println( "Hello World!" ); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/enforcer-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue( true ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/exec-yarn-project/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/exec-yarn-project/README.md: -------------------------------------------------------------------------------- 1 | The `exec-maven-plugin` can be used to execute arbitrary programs, meaning that the inputs and output of the execution are also arbitrary. 2 | An `exec` goal can be made cacheable by declaring _all_ inputs and outputs for the execution. 3 | 4 | In this example, the `exec-maven-plugin` is used to invoke the [`Yarn Package Manager`](https://yarnpkg.com/). 5 | Both `yarn install` and `yarn run build` are invoked, and the Develocity POM DSL is used to make `yarn run build` outputs cacheable. 6 | The `build` action is defined in `package.json` to simply copy all files from `src` into `target/out`. As such, `src` is an input to the action, and `target/out` is an output. 7 | -------------------------------------------------------------------------------- /build-caching-maven-samples/exec-yarn-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-package", 3 | "license": "MIT", 4 | "scripts": { 5 | "build": "mkdir target && cp -a public/. target/out && cp -a src/. target/out" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/exec-yarn-project/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/exec-yarn-project/src/dummy.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/build-caching-maven-samples/exec-yarn-project/src/dummy.js -------------------------------------------------------------------------------- /build-caching-maven-samples/exec-yarn-project/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | -------------------------------------------------------------------------------- /build-caching-maven-samples/java-project/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | java-project 5 | jar 6 | 7 | 8 | com.example 9 | develocity-maven-caching-sample 10 | 1.0-SNAPSHOT 11 | 12 | 13 | -------------------------------------------------------------------------------- /build-caching-maven-samples/java-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class App { 4 | public static void main( String[] args ) { 5 | System.out.println( "Hello World!" ); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/java-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue( true ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/kotlin-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `compile` and `testCompile` goals of the `kotlin-maven-plugin` cacheable. 2 | -------------------------------------------------------------------------------- /build-caching-maven-samples/kotlin-project/src/main/kotlin/com/example/App.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | fun main() { 4 | println("Hello, World!") 5 | } 6 | -------------------------------------------------------------------------------- /build-caching-maven-samples/kotlin-project/src/test/kotlin/com/example/AppTest.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import org.junit.jupiter.api.Assertions.* 4 | import org.junit.jupiter.api.Test 5 | 6 | class AppTest { 7 | 8 | @Test 9 | fun testApp() { 10 | assertTrue(true) 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /build-caching-maven-samples/pmd-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `pmd` and `cpd` goals of the `maven-pmd-plugin` cacheable. 2 | 3 | Note that there are some limitations in the caching behaviour, where incorrect cache hits or misses 4 | could result in very particular change scenarios. See comments in the `pom.xml` file for more details. 5 | -------------------------------------------------------------------------------- /build-caching-maven-samples/pmd-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class App { 4 | public static void main( String[] args ) { 5 | System.out.println( "Hello World!" ); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/pmd-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue( true ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/protobuf-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `protoc-jar:run` goal of the `protoc-jar-maven-plugin` cacheable. 2 | 3 | Note that example cache configuration does not handle `outputTargets`, and will produce invalid results if this is parameter is set. See comments in the `pom.xml` file for more details. 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/protobuf-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.protbuf.PersonProto.Person; 4 | 5 | public class App { 6 | public static Person getPerson() { 7 | Person.Builder person = Person.newBuilder(); 8 | person.setId(1); 9 | person.setName("Perry"); 10 | return person.build(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /build-caching-maven-samples/protobuf-project/src/main/protobuf/person.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option java_package = "com.example.protbuf"; 4 | option java_outer_classname = "PersonProto"; 5 | 6 | message Person { 7 | required int32 id = 1; 8 | required string name = 2; 9 | optional string email = 3; 10 | } -------------------------------------------------------------------------------- /build-caching-maven-samples/protobuf-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testProtoPerson() { 8 | assertEquals("Perry", App.getPerson().getName()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/spotbugs-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `spotbugs` goal of the `spotbugs-maven-plugin` cacheable. 2 | 3 | Note that there are some limitations in the caching behaviour, where incorrect cache hits or misses 4 | could result in very particular change scenarios. See comments in the `pom.xml` file for more details. 5 | -------------------------------------------------------------------------------- /build-caching-maven-samples/spotbugs-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class App { 4 | public static void main( String[] args ) { 5 | System.out.println( "Hello World!" ); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build-caching-maven-samples/spotbugs-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | 6 | public class AppTest extends TestCase { 7 | public void testApp() { 8 | assertTrue( true ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-caching-maven-samples/spring-cloud-contract-project/README.md: -------------------------------------------------------------------------------- 1 | Depending on the contracts, the `spring-cloud-contracts:generateTests` goal may produce irreproducible test cases, due to randomization when picking values from the contracts. This will cause downstream goals such as test compilation and execution to have different inputs, and break caching for these goals. 2 | 3 | This app demonstrates how the `generateTests` goal can be made cacheable, resulting in more consistent outputs for a fixed set of inputs. 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/spring-cloud-contract-project/src/test/resources/contracts/Sample.groovy: -------------------------------------------------------------------------------- 1 | org.springframework.cloud.contract.spec.Contract.make { 2 | request { 3 | method 'POST' 4 | url('/users') { 5 | 6 | } 7 | headers { 8 | header 'Content-Type': 'application/json' 9 | } 10 | body '''{ "login" : "john", "name": "John The Contract" }''' 11 | } 12 | response { 13 | status OK() 14 | headers { 15 | header 'Location': '/users/john' 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /build-caching-maven-samples/webstart-project/README.md: -------------------------------------------------------------------------------- 1 | Example configuration for making the `jnlp-single` goal of the `webstart-maven-plugin` cacheable. 2 | 3 | This project will only work with Gradle 1.8 (and possibly earlier). As such, it is excluded from the multi-module build by default. 4 | -------------------------------------------------------------------------------- /build-caching-maven-samples/webstart-project/src/main/java/com/example/App.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | /** 4 | * Hello world! 5 | * 6 | */ 7 | public class App 8 | { 9 | public static void main( String[] args ) 10 | { 11 | System.out.println( "Hello World!" ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /build-caching-maven-samples/webstart-project/src/test/java/com/example/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | { 12 | /** 13 | * Rigorous Test :-) 14 | */ 15 | @Test 16 | public void shouldAnswerWithTrue() 17 | { 18 | assertTrue( true ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle: -------------------------------------------------------------------------------- 1 | def develocityApi = project.extensions.findByName('develocity') 2 | if (!develocityApi) { 3 | return 4 | } 5 | 6 | allprojects { 7 | tasks.withType(Test).configureEach { 8 | develocityApi.getBuildScan().value("${identityPath}#maxParallelForks", "$maxParallelForks") 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-max-parallel-forks/gradle-max-parallel-forks.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.gradle.DevelocityConfiguration 2 | 3 | project.extensions.configure() { 4 | buildScan { 5 | allprojects { 6 | tasks.withType().configureEach { 7 | value("${identityPath}#maxParallelForks", "$maxParallelForks") 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-os-processes/gradle-os-processes.gradle: -------------------------------------------------------------------------------- 1 | import java.nio.charset.Charset 2 | import java.util.concurrent.TimeUnit 3 | 4 | /** 5 | * This Gradle script captures the OS processes as reported by the OS 'ps' command, 6 | * and adds these as a custom value. 7 | */ 8 | 9 | def develocityApi = project.extensions.findByName('develocity') 10 | if (!develocityApi) { 11 | return 12 | } 13 | 14 | develocityApi.getBuildScan().background { api -> 15 | Capture.captureOsProcesses(api) 16 | } 17 | 18 | class Capture { 19 | 20 | static void captureOsProcesses(def api) { 21 | def psOutput = execAndGetStdout('ps', '-o pid,ppid,time,command') 22 | api.value 'OS processes', psOutput 23 | } 24 | 25 | static String execAndGetStdout(String... args) { 26 | Process process = args.toList().execute() 27 | try { 28 | def standardText = process.inputStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 29 | def ignore = process.errorStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 30 | 31 | def finished = process.waitFor(10, TimeUnit.SECONDS) 32 | finished && process.exitValue() == 0 ? trimAtEnd(standardText) : null 33 | } finally { 34 | process.destroyForcibly() 35 | } 36 | } 37 | 38 | static String trimAtEnd(String str) { 39 | ('x' + str).trim().substring(1) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-os-processes/gradle-os-processes.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.gradle.DevelocityConfiguration 2 | import com.gradle.develocity.agent.gradle.scan.BuildScanConfiguration 3 | import java.nio.charset.Charset 4 | import java.util.concurrent.TimeUnit 5 | 6 | /** 7 | * This Gradle script captures the OS processes as reported by the OS 'ps' command, 8 | * and adds these as a custom value. 9 | */ 10 | 11 | project.extensions.configure() { 12 | buildScan { 13 | background { 14 | Capture.captureOsProcesses(buildScan) 15 | } 16 | } 17 | } 18 | 19 | class Capture { 20 | companion object { 21 | fun captureOsProcesses(api: BuildScanConfiguration) { 22 | val psOutput = execAndGetStdout("ps", "-o pid,ppid,time,command") 23 | api.value("OS processes", psOutput) 24 | } 25 | 26 | private fun execAndGetStdout(vararg args: String): String { 27 | val process = ProcessBuilder(*args) 28 | .redirectOutput(ProcessBuilder.Redirect.PIPE) 29 | .redirectError(ProcessBuilder.Redirect.PIPE) 30 | .start() 31 | try { 32 | val finished = process.waitFor(10, TimeUnit.SECONDS) 33 | val standardText = process.inputStream.bufferedReader().use { it.readText() } 34 | val ignore = process.errorStream.bufferedReader().use { it.readText() } 35 | 36 | return if (finished && process.exitValue() == 0) trimAtEnd(standardText) else return "" 37 | } finally { 38 | process.destroyForcibly() 39 | } 40 | } 41 | 42 | private fun trimAtEnd(str: String): String { 43 | return ("x" + str).trim().substring(1) 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-processor-arch/gradle-processor-arch.gradle: -------------------------------------------------------------------------------- 1 | import java.nio.charset.Charset 2 | import java.util.concurrent.TimeUnit 3 | 4 | /** 5 | * This Gradle script captures the processor architecture 6 | * and adds these as a custom value. 7 | */ 8 | 9 | def develocityApi = project.extensions.findByName('develocity') 10 | if (!develocityApi) { 11 | return 12 | } 13 | 14 | develocityApi.getBuildScan().background { api -> 15 | Capture.captureProcessorArch(api) 16 | } 17 | 18 | class Capture { 19 | 20 | static void captureProcessorArch(def api) { 21 | def osName = System.getProperty("os.name") 22 | api.value("os.name", osName) 23 | 24 | def osArch = System.getProperty("os.arch") 25 | api.value("os.arch", osArch) 26 | 27 | if (isDarwin(osName)) { 28 | if (isTranslatedByRosetta()) { 29 | api.tag("M1-translated") 30 | } else if (isM1()) { 31 | api.tag("M1") 32 | } 33 | } 34 | } 35 | 36 | static boolean isDarwin(String osName) { 37 | return osName.contains("OS X") || osName.startsWith("Darwin") 38 | } 39 | 40 | static boolean isM1() { 41 | return execAndGetStdout("uname", "-p") == "arm" 42 | } 43 | 44 | // On Apple silicon, a universal binary may run either natively or as a translated binary 45 | // https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment#Determine-Whether-Your-App-Is-Running-as-a-Translated-Binary 46 | static boolean isTranslatedByRosetta() { 47 | return execAndGetStdout("sysctl", "sysctl.proc_translated") == "sysctl.proc_translated: 1" 48 | } 49 | 50 | static String execAndGetStdout(String... args) { 51 | Process process = args.toList().execute() 52 | try { 53 | def standardText = process.inputStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 54 | def ignore = process.errorStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 55 | 56 | def finished = process.waitFor(10, TimeUnit.SECONDS) 57 | finished && process.exitValue() == 0 ? trimAtEnd(standardText) : null 58 | } finally { 59 | process.destroyForcibly() 60 | } 61 | } 62 | 63 | static String trimAtEnd(String str) { 64 | ('x' + str).trim().substring(1) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-processor-arch/gradle-processor-arch.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.gradle.DevelocityConfiguration 2 | import com.gradle.develocity.agent.gradle.scan.BuildScanConfiguration 3 | import java.nio.charset.Charset 4 | import java.util.concurrent.TimeUnit 5 | 6 | /** 7 | * This Gradle script captures the processor architecture 8 | * and adds these as a custom value. 9 | */ 10 | 11 | project.extensions.configure() { 12 | buildScan { 13 | background { 14 | Capture.captureProcessorArch(buildScan) 15 | } 16 | } 17 | } 18 | 19 | class Capture { 20 | companion object { 21 | fun captureProcessorArch(api: BuildScanConfiguration) { 22 | val osName = System.getProperty("os.name") 23 | api.value("os.name", osName) 24 | 25 | val osArch = System.getProperty("os.arch") 26 | api.value("os.arch", osArch) 27 | 28 | if (isDarwin(osName)) { 29 | if (isTranslatedByRosetta()) { 30 | api.tag("M1-translated") 31 | } else if (isM1()) { 32 | api.tag("M1") 33 | } 34 | } 35 | } 36 | 37 | private fun isDarwin(osName: String): Boolean { 38 | return osName.contains("OS X") || osName.startsWith("Darwin") 39 | } 40 | 41 | private fun isM1(): Boolean { 42 | return execAndGetStdout("uname", "-p") == "arm" 43 | } 44 | 45 | // On Apple silicon, a universal binary may run either natively or as a translated binary 46 | // https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment#Determine-Whether-Your-App-Is-Running-as-a-Translated-Binary 47 | private fun isTranslatedByRosetta(): Boolean { 48 | return execAndGetStdout("sysctl", "sysctl.proc_translated") == "sysctl.proc_translated: 1" 49 | } 50 | 51 | private fun execAndGetStdout(vararg args: String): String { 52 | val process = ProcessBuilder(*args) 53 | .redirectOutput(ProcessBuilder.Redirect.PIPE) 54 | .redirectError(ProcessBuilder.Redirect.PIPE) 55 | .start() 56 | try { 57 | val finished = process.waitFor(10, TimeUnit.SECONDS) 58 | val standardText = process.inputStream.bufferedReader().use { it.readText() } 59 | val ignore = process.errorStream.bufferedReader().use { it.readText() } 60 | 61 | return if (finished && process.exitValue() == 0) trimAtEnd(standardText) else return "" 62 | } finally { 63 | process.destroyForcibly() 64 | } 65 | } 66 | 67 | private fun trimAtEnd(str: String): String { 68 | return ("x" + str).trim().substring(1) 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-slow-workunit-executions/gradle-slow-task-executions.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * This Gradle script captures all tasks of a given type taking longer to execute than a certain threshold, 3 | * and adds these as custom values. 4 | */ 5 | 6 | def develocityApi = project.extensions.findByName('develocity') 7 | if (!develocityApi) { 8 | return 9 | } 10 | 11 | def THRESHOLD_MILLIS = 15 * 60 * 1000 // 15 min 12 | 13 | allprojects { 14 | tasks.withType(JavaCompile).configureEach { t -> 15 | long start 16 | doFirst { 17 | start = System.currentTimeMillis() 18 | } 19 | doLast { 20 | long duration = System.currentTimeMillis() - start 21 | if (duration > THRESHOLD_MILLIS) { 22 | Capture.addbuildScanValue(develocityApi.getBuildScan(), 'Slow task', t.identityPath as String) 23 | } 24 | } 25 | } 26 | } 27 | 28 | class Capture { 29 | 30 | static void addbuildScanValue(api, key, value) { 31 | api.value(key, value) 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-slow-workunit-executions/gradle-slow-task-executions.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.gradle.DevelocityConfiguration 2 | import com.gradle.develocity.agent.gradle.scan.BuildScanConfiguration 3 | 4 | /** 5 | * This Gradle script captures all tasks of a given type taking longer to execute than a certain threshold, 6 | * and adds these as custom values. 7 | */ 8 | 9 | project.extensions.configure() { 10 | buildScan { 11 | val THRESHOLD_MILLIS = 15 * 60 * 1000 // 15 min 12 | val api = buildScan 13 | allprojects { 14 | tasks.withType().configureEach { 15 | var start = 0L 16 | doFirst { 17 | start = System.currentTimeMillis() 18 | } 19 | doLast { 20 | val duration = System.currentTimeMillis() - start 21 | if (duration > THRESHOLD_MILLIS) { 22 | Capture.addbuildScanValue(api, "Slow task", identityPath.toString()) 23 | } 24 | } 25 | } 26 | } 27 | } 28 | } 29 | 30 | class Capture { 31 | companion object { 32 | fun addbuildScanValue(api: BuildScanConfiguration, key: String, value: String) { 33 | api.value(key, value) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-test-execution-system-properties/gradle-test-execution-system-properties.gradle: -------------------------------------------------------------------------------- 1 | import java.nio.charset.StandardCharsets 2 | import java.security.MessageDigest 3 | 4 | /** 5 | * This Gradle script captures the system properties available to each Test task, hashes the properties' values, 6 | * and adds these as custom values. 7 | */ 8 | 9 | def develocityApi = project.extensions.findByName('develocity') 10 | if (!develocityApi) { 11 | return 12 | } 13 | 14 | allprojects { 15 | tasks.withType(Test).configureEach { t -> 16 | doFirst { 17 | t.systemProperties.forEach { key, val -> Capture.addBuildScanValue(develocityApi.getBuildScan(), "${t.identityPath}#sysProps-$key", "$val") } 18 | } 19 | } 20 | } 21 | 22 | class Capture { 23 | static MessageDigest MESSAGE_DIGEST = MessageDigest.getInstance('SHA-256') 24 | 25 | static void addBuildScanValue(api, key, value) { 26 | api.value(key, hash(value)) 27 | } 28 | 29 | static String hash(Object value) { 30 | if (value == null) { 31 | null 32 | } else { 33 | String string = String.valueOf(value) 34 | byte[] encodedHash = MESSAGE_DIGEST.digest(string.getBytes(StandardCharsets.UTF_8)) 35 | StringBuilder hexString = new StringBuilder() 36 | for (int i = 0; i < encodedHash.length / 4; i++) { 37 | String hex = Integer.toHexString(0xff & encodedHash[i]) 38 | if (hex.length() == 1) { 39 | hexString.append('0') 40 | } 41 | hexString.append(hex) 42 | } 43 | hexString.append('...') 44 | hexString.toString() 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /build-data-capturing-gradle-samples/capture-test-execution-system-properties/gradle-test-execution-system-properties.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.gradle.DevelocityConfiguration 2 | import com.gradle.develocity.agent.gradle.scan.BuildScanConfiguration 3 | import java.nio.charset.StandardCharsets 4 | import java.security.MessageDigest 5 | 6 | /** 7 | * This Gradle script captures the system properties available to each Test task, hashes the properties' values, 8 | * and adds these as custom values. 9 | */ 10 | 11 | project.extensions.configure() { 12 | buildScan { 13 | val api = buildScan 14 | allprojects { 15 | tasks.withType().configureEach { 16 | doFirst { 17 | systemProperties.forEach { (k, v) -> Capture.addbuildScanValue(api, "${identityPath}#sysProps-${k}", v) } 18 | } 19 | } 20 | } 21 | } 22 | } 23 | 24 | class Capture { 25 | companion object { 26 | val MESSAGE_DIGEST = MessageDigest.getInstance("SHA-256") 27 | 28 | fun addbuildScanValue(api: BuildScanConfiguration, key: String, value: Any?) { 29 | api.value(key, hash(value)) 30 | } 31 | 32 | private fun hash(value: Any?): String? { 33 | if (value == null) { 34 | return null 35 | } else { 36 | val str = java.lang.String.valueOf(value) 37 | val encodedHash = MESSAGE_DIGEST.digest(str.toByteArray()) 38 | val hexString = StringBuilder() 39 | for (i in 0 until (encodedHash.size / 4)) { 40 | val hex = java.lang.Integer.toHexString(0xff and encodedHash[i].toInt()) 41 | if (hex.length == 1) { 42 | hexString.append("0") 43 | } 44 | hexString.append(hex) 45 | } 46 | hexString.append("...") 47 | return hexString.toString() 48 | } 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /build-data-capturing-maven-samples/README.md: -------------------------------------------------------------------------------- 1 | # Build Data Capturing Maven Samples 2 | 3 | ## Usage 4 | 5 | Each sample has been written to be fully compatible with 6 | the [Common Custom User Data Maven extension](https://github.com/gradle/common-custom-user-data-maven-extension). This 7 | means any sample can be downloaded and included in a Maven build that uses the extension. See 8 | the [Capturing additional tags, links, and values in your build scans](https://github.com/gradle/common-custom-user-data-maven-extension#capturing-additional-tags-links-and-values-in-your-build-scans) 9 | section of the extension documentation for more information. 10 | 11 | ## Overview 12 | 13 | This directory contains samples demonstrating various ways to extend and customize a Build Scan with extra data using 14 | tags, links, and custom values. 15 | 16 | To learn more, see the Develocity documentation 17 | on [Extending build scans](https://docs.gradle.com/develocity/maven-extension/current/#extending_build_scans). 18 | 19 | ### Capture OS Processes 20 | 21 | _Demonstrates: Custom values_ 22 | 23 | This sample captures the output of the `ps` command and adds it to the Build Scan as a custom value named 24 | `OS processes`. 25 | 26 | ### Capture Processor Arch 27 | 28 | _Demonstrates: Custom values, Custom tags_ 29 | 30 | This sample adds the operating system name and processor architecture as custom values and adds a tag to the Build Scan 31 | if the build was executed on an M1 processor. 32 | 33 | ### Capture Profiles 34 | 35 | _Demonstrates: Custom tags_ 36 | 37 | This sample captures each active Maven profile and adds it as a tag on the Build Scan. 38 | 39 | ### Capture Quality Check Issues 40 | 41 | _Demonstrates: Custom values_ 42 | 43 | This sample parses the XML reports of several common quality check plugins and includes the findings as custom values on 44 | the corresponding Build Scan. 45 | 46 | ### Capture Thermal Throttling 47 | 48 | _Demonstrates: Custom values, Custom tags_ 49 | 50 | This sample adds a custom value for macOS builds that captures the average amount of thermal throttling that was 51 | applied during the build, a technique where the CPU is throttled in an effort to reduce heat. It then applies a tag to 52 | the Build Scan that maps the percentage to a "level of thermal throttling". 53 | 54 | ### Capture Top Level Project 55 | 56 | _Demonstrates: Custom values_ 57 | 58 | This sample captures the top-level project name and artifact ID and adds these as custom values on the Build Scan. 59 | -------------------------------------------------------------------------------- /build-data-capturing-maven-samples/capture-os-processes/maven-os-processes.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.charset.Charset 2 | import java.util.concurrent.TimeUnit 3 | import com.gradle.develocity.agent.maven.adapters.BuildScanApiAdapter 4 | 5 | /** 6 | * This Groovy script captures the OS processes as reported by the OS 'ps' command, 7 | * and adds these as a custom value. 8 | */ 9 | 10 | buildScan.executeOnce('os-processes') { BuildScanApiAdapter buildScanApi -> 11 | buildScanApi.background { api -> 12 | captureOsProcesses(api) 13 | } 14 | } 15 | 16 | static void captureOsProcesses(def api) { 17 | def psOutput = execAndGetStdout('ps', '-o pid,ppid,time,command') 18 | api.value 'OS processes', psOutput 19 | } 20 | 21 | static String execAndGetStdout(String... args) { 22 | Process process = args.toList().execute() 23 | try { 24 | def standardText = process.inputStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 25 | def ignore = process.errorStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 26 | 27 | def finished = process.waitFor(10, TimeUnit.SECONDS) 28 | finished && process.exitValue() == 0 ? trimAtEnd(standardText) : null 29 | } finally { 30 | process.destroyForcibly() 31 | } 32 | } 33 | 34 | static String trimAtEnd(String str) { 35 | ('x' + str).trim().substring(1) 36 | } 37 | -------------------------------------------------------------------------------- /build-data-capturing-maven-samples/capture-processor-arch/maven-processor-arch.groovy: -------------------------------------------------------------------------------- 1 | import java.nio.charset.Charset 2 | import java.util.concurrent.TimeUnit 3 | import com.gradle.develocity.agent.maven.adapters.BuildScanApiAdapter 4 | 5 | /** 6 | * This Groovy script captures the processor architecture 7 | * and adds these as a custom value. 8 | */ 9 | 10 | buildScan.executeOnce('processor-arch') { BuildScanApiAdapter buildScanApi -> 11 | buildScanApi.background { api -> 12 | captureProcessorArch(api) 13 | } 14 | } 15 | 16 | static void captureProcessorArch(def api) { 17 | def osName = System.getProperty("os.name") 18 | api.value("os.name", osName) 19 | 20 | def osArch = System.getProperty("os.arch") 21 | api.value("os.arch", osArch) 22 | 23 | if (isDarwin(osName)) { 24 | if (isTranslatedByRosetta()) { 25 | api.tag("M1-translated") 26 | } else if (isM1()) { 27 | api.tag("M1") 28 | } 29 | } 30 | } 31 | 32 | static boolean isDarwin(String osName) { 33 | return osName.contains("OS X") || osName.startsWith("Darwin") 34 | } 35 | 36 | static boolean isM1() { 37 | return execAndGetStdout("uname", "-p") == "arm" 38 | } 39 | 40 | // On Apple silicon, a universal binary may run either natively or as a translated binary 41 | // https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment#Determine-Whether-Your-App-Is-Running-as-a-Translated-Binary 42 | static boolean isTranslatedByRosetta() { 43 | return execAndGetStdout("sysctl", "sysctl.proc_translated") == "sysctl.proc_translated: 1" 44 | } 45 | 46 | static String execAndGetStdout(String... args) { 47 | Process process = args.toList().execute() 48 | try { 49 | def standardText = process.inputStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 50 | def ignore = process.errorStream.withStream { s -> s.getText(Charset.defaultCharset().name()) } 51 | 52 | def finished = process.waitFor(10, TimeUnit.SECONDS) 53 | finished && process.exitValue() == 0 ? trimAtEnd(standardText) : null 54 | } finally { 55 | process.destroyForcibly() 56 | } 57 | } 58 | 59 | static String trimAtEnd(String str) { 60 | ('x' + str).trim().substring(1) 61 | } 62 | -------------------------------------------------------------------------------- /build-data-capturing-maven-samples/capture-profiles/maven-profiles.groovy: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.maven.adapters.BuildScanApiAdapter 2 | 3 | /** 4 | * This Groovy script captures the active profiles and add them as tags to the Build Scan. 5 | */ 6 | 7 | buildScan.executeOnce('tag-profiles') { BuildScanApiAdapter buildScanApi -> 8 | project.activeProfiles.each { profile -> buildScanApi.tag profile.id } 9 | } 10 | -------------------------------------------------------------------------------- /build-data-capturing-maven-samples/capture-top-level-project/maven-top-level-project.groovy: -------------------------------------------------------------------------------- 1 | import com.gradle.develocity.agent.maven.adapters.BuildScanApiAdapter 2 | 3 | /** 4 | * This Groovy script captures the top-level project name and artifact id, 5 | * and adds these as custom values. 6 | */ 7 | 8 | buildScan.executeOnce('top-level-project') { BuildScanApiAdapter buildScanApi -> 9 | buildScanApi.value 'executionRoot.name', session.topLevelProject.name 10 | buildScanApi.value 'executionRoot.artifactId', session.topLevelProject.artifactId 11 | } 12 | -------------------------------------------------------------------------------- /common-develocity-bazel-configuration/.bazelrc: -------------------------------------------------------------------------------- 1 | # To publish Build Scans to your Develocity server, add the following to the .bazelrc file in your 2 | # build workspace: 3 | common:develocity --remote_cache=grpcs://<> # adjust to your Develocity server 4 | common:develocity --bes_results_url=https://<>/build/ # adjust to your Develocity server 5 | common:develocity --bes_backend=grpcs://<> # adjust to your Develocity server 6 | common:develocity --build_event_publish_all_actions=true 7 | common:develocity --noslim_profile 8 | 9 | build --config=develocity 10 | query --config=develocity 11 | -------------------------------------------------------------------------------- /common-develocity-bazel-configuration/README.md: -------------------------------------------------------------------------------- 1 | ## Common Develocity Bazel configuration 2 | 3 | This project demonstrates a common setup of Bazel builds that are using Develocity in production. It is intended to serve as a starting point for projects running Develocity in production, with no configuration yet extracted into components that can be reused across projects. See inline comments for things to adjust specifically to your project. 4 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/README.md: -------------------------------------------------------------------------------- 1 | ## Common Develocity Gradle configuration using Groovy DSL 2 | 3 | This project demonstrates a common setup of Gradle builds using Groovy DSL that are using Develocity in production. It is intended to serve as a starting point for projects running Develocity in production, with no configuration yet extracted into components that can be reused across projects. See inline comments for things to adjust specifically to your project. 4 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'base' 3 | } 4 | 5 | group = 'com.example' 6 | version = '1.0-SNAPSHOT' 7 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/gradle.properties: -------------------------------------------------------------------------------- 1 | # enable these performance features unless you have specific reasons not to 2 | org.gradle.vfs.watch=true 3 | org.gradle.daemon=true 4 | org.gradle.caching=true 5 | org.gradle.parallel=true 6 | 7 | # adjust the locale values to your project's needs and the memory settings to the requirements of your build 8 | # due to https://github.com/gradle/gradle/issues/19750 be sure to include both `-Xmx` and `-XX:MaxMetaspaceSize` settings 9 | org.gradle.jvmargs=-Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 -Xmx512m -XX:MaxMetaspaceSize=256m 10 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/common-develocity-gradle-configuration-groovy/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/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 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-groovy/settings.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.gradle.develocity' version '4.0.2' 3 | id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.3' 4 | } 5 | 6 | def isCI = System.getenv('CI') != null // adjust to your CI provider 7 | 8 | develocity { 9 | server = 'https://develocity-samples.gradle.com' // adjust to your Develocity server 10 | allowUntrustedServer = false // ensure a trusted certificate is configured 11 | 12 | buildScan { 13 | uploadInBackground = !isCI 14 | } 15 | } 16 | 17 | buildCache { 18 | local { 19 | enabled = true 20 | } 21 | 22 | remote(develocity.buildCache) { 23 | enabled = true 24 | push = isCI 25 | } 26 | } 27 | 28 | rootProject.name = 'common-develocity-gradle-configuration-groovy' // adjust to your project 29 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-kotlin/README.md: -------------------------------------------------------------------------------- 1 | ## Common Develocity Gradle configuration using Kotlin DSL 2 | 3 | This project demonstrates a common setup of Gradle builds using Kotlin DSL that are using Develocity in production. It is intended to serve as a starting point for projects running Develocity in production, with no configuration yet extracted into components that can be reused across projects. See inline comments for things to adjust specifically to your project. 4 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-kotlin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | base 3 | } 4 | 5 | group = "com.example" 6 | version = "1.0-SNAPSHOT" 7 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-kotlin/gradle.properties: -------------------------------------------------------------------------------- 1 | # enable these performance features unless you have specific reasons not to 2 | org.gradle.vfs.watch=true 3 | org.gradle.daemon=true 4 | org.gradle.caching=true 5 | org.gradle.parallel=true 6 | 7 | # adjust the locale values to your project's needs and the memory settings to the requirements of your build 8 | # due to https://github.com/gradle/gradle/issues/19750 be sure to include both `-Xmx` and `-XX:MaxMetaspaceSize` settings 9 | org.gradle.jvmargs=-Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 -Xmx512m -XX:MaxMetaspaceSize=256m 10 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-kotlin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/common-develocity-gradle-configuration-kotlin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-kotlin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-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 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /common-develocity-gradle-configuration-kotlin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.gradle.develocity") version "4.0.2" 3 | id("com.gradle.common-custom-user-data-gradle-plugin") version "2.3" 4 | } 5 | 6 | val isCI = System.getenv("CI") != null // adjust to your CI provider 7 | 8 | develocity { 9 | server = "https://develocity-samples.gradle.com" // adjust to your Develocity server 10 | allowUntrustedServer = false // ensure a trusted certificate is configured 11 | 12 | buildScan { 13 | uploadInBackground = !isCI 14 | } 15 | } 16 | 17 | buildCache { 18 | local { 19 | isEnabled = true 20 | } 21 | 22 | remote(develocity.buildCache) { 23 | isEnabled = true 24 | isPush = isCI 25 | } 26 | } 27 | 28 | rootProject.name = "common-develocity-gradle-configuration-kotlin" // adjust to your project 29 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .mvn/.develocity 3 | 4 | # Ignore Maven build output directory 5 | target 6 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/.mvn/develocity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | 21 | 22 | https://develocity-samples.gradle.com 23 | false 24 | 25 | 26 | #{isFalse(env['CI'])} 27 | 28 | 29 | 30 | true 31 | 32 | 33 | true 34 | #{isTrue(env['CI'])} 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.gradle 5 | develocity-maven-extension 6 | 2.0.1 7 | 8 | 9 | com.gradle 10 | common-custom-user-data-maven-extension 11 | 2.0.2 12 | 13 | 14 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 -Xmx512M 2 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -T0.5C -------------------------------------------------------------------------------- /common-develocity-maven-configuration/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip 20 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/README.md: -------------------------------------------------------------------------------- 1 | ## Common Develocity Maven configuration 2 | 3 | This project demonstrates a common setup of Maven builds that are using Develocity in production. It is intended to serve as a starting point for projects running Develocity in production, with no configuration yet extracted into components that can be reused across projects. See inline comments for things to adjust specifically to your project. 4 | -------------------------------------------------------------------------------- /common-develocity-maven-configuration/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | com.example 6 | common-develocity-maven-configuration 7 | 1.0-SNAPSHOT 8 | 9 | Common Develocity Maven configuration 10 | https://github.com/gradle/develocity-build-config-samples/tree/main/common-develocity-maven-configuration 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /common-develocity-sbt-configuration/README.md: -------------------------------------------------------------------------------- 1 | # Common Develocity SBT Configuration 2 | 3 | This project demonstrates a common setup of SBT builds that are using Develocity in production. It is intended to serve as a starting point for projects running Develocity in production, with no configuration yet extracted into components that can be reused across projects. See inline comments for things to adjust specifically to your project. -------------------------------------------------------------------------------- /common-develocity-sbt-configuration/build.sbt: -------------------------------------------------------------------------------- 1 | // You can configure the Develocity sbt plugin to publish Build Scans to your Develocity server 2 | // by adding the following configuration to your project's build.sbt file 3 | 4 | ThisBuild / develocityConfiguration := 5 | DevelocityConfiguration( 6 | server = Server( 7 | url = Some(url("https://develocity-samples.gradle.com")), // adjust to your Develocity server 8 | allowUntrusted = false), // ensure a trusted certificate is configured 9 | buildScan = BuildScan( 10 | backgroundUpload = !sys.env.get("CI").exists(_.toBoolean))) 11 | 12 | lazy val `common-develocity-sbt-configuration` = (project in file(".")) // adjust to your project name 13 | -------------------------------------------------------------------------------- /common-develocity-sbt-configuration/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.9.9 2 | -------------------------------------------------------------------------------- /common-develocity-sbt-configuration/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | // You apply the Develocity sbt plugin to your build by adding the following 2 | // configuration block to a new or existing project/plugins.sbt file in your sbt project 3 | 4 | addSbtPlugin("com.gradle" % "sbt-develocity" % "1.0") 5 | addSbtPlugin("com.gradle" % "sbt-develocity-common-custom-user-data" % "1.0") -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .tool-versions -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_3_and_earlier/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | maven { url 'https://plugins.gradle.org/m2/' } 5 | } 6 | dependencies { 7 | classpath 'com.myorg:convention-develocity-gradle-plugin-gradle-2-through-4:1.0' 8 | } 9 | } 10 | 11 | apply plugin: 'com.myorg.convention-develocity-gradle-2-through-4' 12 | apply plugin: 'java' 13 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_3_and_earlier/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/examples/gradle_3_and_earlier/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_3_and_earlier/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_3_and_earlier/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 execute 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 execute 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 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_3_and_earlier/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'example-build' 2 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_4/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | maven { url 'https://plugins.gradle.org/m2/' } 5 | } 6 | dependencies { 7 | classpath 'com.myorg:convention-develocity-gradle-plugin-gradle-2-through-4:1.0' 8 | } 9 | } 10 | 11 | apply plugin: 'com.myorg.convention-develocity-gradle-2-through-4' 12 | apply plugin: 'java' 13 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_4/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/examples/gradle_4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_4/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip 6 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_4/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_4/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'example-build' 2 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_5/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.myorg.convention-develocity-gradle-5-or-newer' version '1.0' 3 | id 'java' 4 | } 5 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_5/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/examples/gradle_5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_5/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_5/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_5/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = 'example-build' 9 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6.9_and_later/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6.9_and_later/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/examples/gradle_6.9_and_later/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6.9_and_later/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6.9_and_later/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id 'com.myorg.convention-develocity-gradle-5-or-newer' version '1.+' 10 | } 11 | 12 | rootProject.name = 'example-build' 13 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/examples/gradle_6/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6/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 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/examples/gradle_6/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id 'com.myorg.convention-develocity-gradle-5-or-newer' version '1.0' 10 | } 11 | 12 | rootProject.name = 'example-build' 13 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-2-through-4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-gradle-plugin' 3 | id 'maven-publish' 4 | } 5 | 6 | // CHANGE ME: change to your organization's group ID 7 | group = 'com.myorg' 8 | version = '1.0' 9 | 10 | repositories { 11 | gradlePluginPortal() 12 | } 13 | 14 | dependencies { 15 | // must not be newer than 1.16 to be compatible with Gradle 2.x - 4.x 16 | implementation "com.gradle:build-scan-plugin:1.16" 17 | implementation 'com.gradle:common-custom-user-data-gradle-plugin:2.3' 18 | } 19 | 20 | java { 21 | toolchain { 22 | languageVersion = JavaLanguageVersion.of(8) 23 | } 24 | } 25 | 26 | gradlePlugin { 27 | plugins { 28 | develocityConventions { 29 | // CHANGE ME: change for your organization 30 | id = 'com.myorg.convention-develocity-gradle-2-through-4' 31 | displayName = 'Develocity Convention Plugin for Gradle 2.0 through Gradle 4.10.3' 32 | description = 'A Gradle plugin to apply and configure the Build Scan Gradle plugin for com.myorg' 33 | implementationClass = 'com.myorg.ConventionDevelocityGradlePlugin' 34 | } 35 | } 36 | } 37 | 38 | tasks.withType(ValidatePlugins).configureEach { 39 | failOnWarning = true 40 | enableStricterValidation = true 41 | } 42 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-2-through-4/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/plugins/gradle-2-through-4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-2-through-4/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-2-through-4/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 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-2-through-4/settings.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' 3 | } 4 | 5 | rootProject.name = 'convention-develocity-gradle-plugin-gradle-2-through-4' 6 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-2-through-4/src/main/java/com/myorg/ConventionDevelocityGradlePlugin.java: -------------------------------------------------------------------------------- 1 | package com.myorg; 2 | 3 | import com.gradle.CommonCustomUserDataGradlePlugin; 4 | import com.gradle.scan.plugin.BuildScanExtension; 5 | import com.gradle.scan.plugin.BuildScanPlugin; 6 | import org.gradle.StartParameter; 7 | import org.gradle.api.Plugin; 8 | import org.gradle.api.Project; 9 | import org.gradle.util.GradleVersion; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | /** 15 | * An example Gradle plugin for enabling and configuring Develocity features (Build Scan only) for 16 | * Gradle versions 2.0 through Gradle v4.10.3. 17 | */ 18 | public class ConventionDevelocityGradlePlugin implements Plugin { 19 | 20 | @Override 21 | public void apply(Project project) { 22 | if (containsPropertiesTask(project.getGradle().getStartParameter())) { 23 | return; 24 | } 25 | 26 | Map args = new HashMap<>(); 27 | args.put("plugin", BuildScanPlugin.class); 28 | project.apply(args); 29 | 30 | if (isGradle4OrNewer()) { 31 | args = new HashMap<>(); 32 | args.put("plugin", CommonCustomUserDataGradlePlugin.class); 33 | project.apply(args); 34 | } 35 | 36 | /* Example of how to configure build scan publishing from the plugin. */ 37 | BuildScanExtension buildScan = project.getExtensions().getByType(BuildScanExtension.class); 38 | buildScan.setServer("https://develocity-samples.gradle.com"); 39 | buildScan.publishAlways(); 40 | } 41 | 42 | private boolean containsPropertiesTask(StartParameter startParameter) { 43 | return startParameter.getTaskNames().contains("properties") 44 | || startParameter.getTaskNames().stream().anyMatch(it -> it.endsWith(":properties")); 45 | } 46 | 47 | private static boolean isGradle4OrNewer() { 48 | return GradleVersion.current().compareTo(GradleVersion.version("4.0")) >= 0; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-5-or-newer/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-gradle-plugin' 3 | id 'maven-publish' 4 | } 5 | 6 | // CHANGE ME: change to your organization's group ID 7 | group = 'com.myorg' 8 | version = '1.0' 9 | 10 | repositories { 11 | gradlePluginPortal() 12 | } 13 | 14 | dependencies { 15 | implementation 'com.gradle:develocity-gradle-plugin:4.0.2' 16 | implementation 'com.gradle:common-custom-user-data-gradle-plugin:2.3' 17 | } 18 | 19 | java { 20 | toolchain { 21 | languageVersion = JavaLanguageVersion.of(8) 22 | } 23 | } 24 | 25 | gradlePlugin { 26 | plugins { 27 | develocityConventions { 28 | // CHANGE ME: change for your organization 29 | id = 'com.myorg.convention-develocity-gradle-5-or-newer' 30 | displayName = 'Develocity Convention Plugin for Gradle 5.0 and higher' 31 | description = 'A Gradle plugin to apply and configure the Develocity Gradle plugin for com.myorg' 32 | implementationClass = 'com.myorg.ConventionDevelocityGradlePlugin' 33 | } 34 | } 35 | } 36 | 37 | tasks.withType(ValidatePlugins).configureEach { 38 | failOnWarning = true 39 | enableStricterValidation = true 40 | } 41 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-5-or-newer/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-gradle-plugin/plugins/gradle-5-or-newer/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-5-or-newer/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /convention-develocity-gradle-plugin/plugins/gradle-5-or-newer/settings.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' 3 | } 4 | 5 | rootProject.name = 'convention-develocity-gradle-plugin-gradle-5-or-newer' 6 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | dependency-reduced-pom.xml 3 | **/.mvn/.develocity/develocity-workspace-id -------------------------------------------------------------------------------- /convention-develocity-maven-extension/examples/maven_3/.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.myorg 5 | convention-develocity-maven-extension 6 | (,2.0) 7 | 8 | 9 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/examples/maven_3/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip 20 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/examples/maven_3/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | com.myorg 7 | maven-sample 8 | 1.0 9 | 10 | Convention Develocity Maven Extension Example 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/extension/.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 -Xmx512M 2 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/extension/.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -T0.5C 2 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/extension/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip 20 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/extension/src/main/java/com/myorg/ConventionDevelocityListener.java: -------------------------------------------------------------------------------- 1 | package com.myorg; 2 | 3 | import com.gradle.develocity.agent.maven.api.DevelocityApi; 4 | import com.gradle.develocity.agent.maven.api.DevelocityListener; 5 | import com.gradle.develocity.agent.maven.api.cache.BuildCacheApi; 6 | import com.gradle.develocity.agent.maven.api.scan.BuildScanApi; 7 | import org.apache.maven.execution.MavenSession; 8 | 9 | /** 10 | * An example Maven extension for enabling and configuring Develocity features. 11 | */ 12 | public final class ConventionDevelocityListener implements DevelocityListener { 13 | 14 | @Override 15 | public void configure(DevelocityApi develocity, MavenSession session) { 16 | configureDevelocity(develocity); 17 | configureBuildCache(develocity.getBuildCache()); 18 | } 19 | 20 | private void configureDevelocity(DevelocityApi develocity) { 21 | // CHANGE ME: Apply your Develocity configuration here 22 | develocity.setServer("https://develocity-samples.gradle.com"); 23 | configureBuildScan(develocity.getBuildScan()); 24 | } 25 | 26 | private void configureBuildScan(BuildScanApi buildScan) { 27 | // CHANGE ME: Apply your Build Scan configuration here 28 | buildScan.setUploadInBackground(!isCi()); 29 | } 30 | 31 | private void configureBuildCache(BuildCacheApi buildCache) { 32 | // CHANGE ME: Apply your Build Cache configuration here 33 | buildCache.getRemote().setEnabled(true); 34 | buildCache.getRemote().setStoreEnabled(isCi()); 35 | 36 | buildCache.getLocal().setEnabled(true); 37 | buildCache.getLocal().setStoreEnabled(true); 38 | } 39 | 40 | private static boolean isCi() { 41 | // CHANGE ME: Apply your environment detection logic here 42 | return System.getenv().containsKey("CI"); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /convention-develocity-maven-extension/extension/src/main/resources/META-INF/plexus/components.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.gradle.develocity.agent.maven.api.DevelocityListener 6 | convention-develocity-listener 7 | com.myorg.ConventionDevelocityListener 8 | Configures the Develocity Maven extension for com.myorg 9 | false 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /convention-develocity-shared/buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | gradlePluginPortal() 7 | } 8 | -------------------------------------------------------------------------------- /convention-develocity-shared/buildSrc/src/main/kotlin/com.myorg.java-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.gradle.jvm.toolchain.JavaLanguageVersion 2 | 3 | plugins { 4 | id("java") 5 | } 6 | 7 | java { 8 | withJavadocJar() 9 | withSourcesJar() 10 | toolchain { 11 | languageVersion = JavaLanguageVersion.of(8) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /convention-develocity-shared/buildSrc/src/main/kotlin/com.myorg.publishing-conventions.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("maven-publish") 3 | } 4 | 5 | publishing { 6 | repositories { 7 | maven { 8 | // CHANGE ME: change to point to your organization's artifact repository 9 | url = uri("https://repo.myorg.com/maven") 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.myorg.java-conventions") 3 | id("com.myorg.publishing-conventions") 4 | id("java-library") 5 | } 6 | 7 | publishing { 8 | publications { 9 | create("maven") { 10 | from(components["java"]) 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/DevelocityConventions.java: -------------------------------------------------------------------------------- 1 | package com.myorg; 2 | 3 | import com.myorg.configurable.BuildCacheConfigurable; 4 | import com.myorg.configurable.BuildScanConfigurable; 5 | import com.myorg.configurable.DevelocityConfigurable; 6 | import com.myorg.configurable.ExecutionContext; 7 | 8 | final class DevelocityConventions { 9 | 10 | private final ExecutionContext context; 11 | 12 | DevelocityConventions(ExecutionContext context) { 13 | this.context = context; 14 | } 15 | 16 | void configureDevelocity(DevelocityConfigurable develocity) { 17 | // CHANGE ME: Apply your Develocity configuration here 18 | develocity.setServer("https://develocity-samples.gradle.com"); 19 | configureBuildScan(develocity.getBuildScan()); 20 | configureBuildCache(develocity.getBuildCache()); 21 | } 22 | 23 | private void configureBuildScan(BuildScanConfigurable buildScan) { 24 | // CHANGE ME: Apply your Build Scan configuration here 25 | buildScan.setUploadInBackground(!isCi()); 26 | } 27 | 28 | private void configureBuildCache(BuildCacheConfigurable buildCache) { 29 | // CHANGE ME: Apply your Build Cache configuration here 30 | buildCache.getLocal().setEnabled(true); 31 | buildCache.getLocal().setStoreEnabled(true); 32 | buildCache.getRemote().setEnabled(true); 33 | buildCache.getRemote().setStoreEnabled(isCi()); 34 | } 35 | 36 | private boolean isCi() { 37 | // CHANGE ME: Apply your environment detection logic here 38 | return context.environmentVariable("CI").isPresent(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/BuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | public interface BuildCacheConfigurable { 4 | 5 | LocalBuildCacheConfigurable getLocal(); 6 | 7 | RemoteBuildCacheConfigurable getRemote(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/BuildResult.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.util.List; 4 | 5 | public final class BuildResult { 6 | 7 | private final List failures; 8 | 9 | BuildResult(List failures) { 10 | this.failures = failures; 11 | } 12 | 13 | public List getFailures() { 14 | return failures; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/BuildScanCaptureConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | public interface BuildScanCaptureConfigurable { 4 | 5 | void setFileFingerprints(boolean capture); 6 | 7 | void setBuildLogging(boolean capture); 8 | 9 | void setTestLogging(boolean capture); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/BuildScanConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.util.function.Consumer; 4 | 5 | public interface BuildScanConfigurable { 6 | 7 | void tag(String tag); 8 | 9 | void value(String name, String value); 10 | 11 | void link(String name, String url); 12 | 13 | void background(Consumer action); 14 | 15 | void buildFinished(Consumer action); 16 | 17 | void buildScanPublished(Consumer action); 18 | 19 | void setUploadInBackground(boolean uploadInBackground); 20 | 21 | BuildScanObfuscationConfigurable getObfuscation(); 22 | 23 | BuildScanCaptureConfigurable getCapture(); 24 | 25 | BuildScanPublishingConfigurable getPublishing(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/BuildScanObfuscationConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.net.InetAddress; 4 | import java.util.List; 5 | import java.util.function.Function; 6 | 7 | public interface BuildScanObfuscationConfigurable { 8 | 9 | void username(Function obfuscator); 10 | 11 | void hostname(Function obfuscator); 12 | 13 | void ipAddresses(Function, List> obfuscator); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/BuildScanPublishingConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public interface BuildScanPublishingConfigurable { 6 | 7 | void onlyIf(Predicate onlyIf); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/DevelocityConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | public interface DevelocityConfigurable { 4 | 5 | void setServer(String server); 6 | 7 | void setProjectId(String projectId); 8 | 9 | void setAllowUntrustedServer(boolean untrustedServer); 10 | 11 | void setAccessKey(String accessKey); 12 | 13 | BuildScanConfigurable getBuildScan(); 14 | 15 | BuildCacheConfigurable getBuildCache(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/ExecutionContext.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.util.Optional; 4 | 5 | public interface ExecutionContext { 6 | 7 | Optional environmentVariable(String name); 8 | 9 | Optional systemProperty(String name); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/LocalBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.io.File; 4 | 5 | public interface LocalBuildCacheConfigurable { 6 | 7 | void setEnabled(boolean enabled); 8 | 9 | void setStoreEnabled(boolean storeEnabled); 10 | 11 | void setDirectory(File directory); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/PublishedBuildScan.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.net.URI; 4 | 5 | public final class PublishedBuildScan { 6 | 7 | private final String buildScanId; 8 | private final URI buildScanUri; 9 | 10 | PublishedBuildScan(String buildScanId, URI buildScanUri) { 11 | this.buildScanId = buildScanId; 12 | this.buildScanUri = buildScanUri; 13 | } 14 | 15 | public String getBuildScanId() { 16 | return buildScanId; 17 | } 18 | 19 | public URI getBuildScanUri() { 20 | return buildScanUri; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/PublishingContext.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | public final class PublishingContext { 4 | 5 | private final BuildResult buildResult; 6 | private final boolean authenticated; 7 | 8 | PublishingContext(BuildResult buildResult, boolean authenticated) { 9 | this.buildResult = buildResult; 10 | this.authenticated = authenticated; 11 | } 12 | 13 | public BuildResult getBuildResult() { 14 | return buildResult; 15 | } 16 | 17 | public boolean isAuthenticated() { 18 | return authenticated; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-common/src/main/java/com/myorg/configurable/RemoteBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | public interface RemoteBuildCacheConfigurable { 4 | 5 | void setEnabled(boolean enabled); 6 | 7 | void setStoreEnabled(boolean storeEnabled); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.myorg.java-conventions") 3 | id("com.myorg.publishing-conventions") 4 | id("java-gradle-plugin") 5 | } 6 | 7 | repositories { 8 | gradlePluginPortal() 9 | } 10 | 11 | dependencies { 12 | implementation("com.gradle:develocity-gradle-plugin:4.0.2") 13 | implementation("com.gradle:common-custom-user-data-gradle-plugin:2.3") 14 | implementation(project(":convention-develocity-common")) 15 | } 16 | 17 | gradlePlugin { 18 | plugins { 19 | create("develocityConventions") { 20 | // CHANGE ME: change for your organization 21 | id = "com.myorg.convention-develocity-gradle-plugin" 22 | displayName = "Convention Develocity Gradle Plugin" 23 | description = "A Gradle plugin to apply and configure the Develocity Gradle plugin for com.myorg" 24 | implementationClass = "com.myorg.ConventionDevelocityGradlePlugin" 25 | } 26 | } 27 | } 28 | 29 | tasks.withType().configureEach { 30 | failOnWarning = true 31 | enableStricterValidation = true 32 | } 33 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.gradle.buildcache.DevelocityBuildCache; 4 | import org.gradle.caching.configuration.BuildCacheConfiguration; 5 | 6 | final class GradleBuildCacheConfigurable implements BuildCacheConfigurable { 7 | 8 | private final LocalBuildCacheConfigurable localBuildCache; 9 | private final RemoteBuildCacheConfigurable remoteBuildCache; 10 | 11 | public GradleBuildCacheConfigurable(Class develocityBuildCache, BuildCacheConfiguration buildCache) { 12 | this.localBuildCache = new GradleLocalBuildCacheConfigurable(buildCache.getLocal()); 13 | this.remoteBuildCache = new GradleRemoteBuildCacheConfigurable(buildCache.remote(develocityBuildCache)); 14 | } 15 | 16 | @Override 17 | public LocalBuildCacheConfigurable getLocal() { 18 | return localBuildCache; 19 | } 20 | 21 | @Override 22 | public RemoteBuildCacheConfigurable getRemote() { 23 | return remoteBuildCache; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleBuildScanCaptureConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.gradle.scan.BuildScanCaptureConfiguration; 4 | 5 | final class GradleBuildScanCaptureConfigurable implements BuildScanCaptureConfigurable { 6 | 7 | private final BuildScanCaptureConfiguration buildScanCapture; 8 | 9 | public GradleBuildScanCaptureConfigurable(BuildScanCaptureConfiguration buildScanCapture) { 10 | this.buildScanCapture = buildScanCapture; 11 | } 12 | 13 | @Override 14 | public void setFileFingerprints(boolean capture) { 15 | buildScanCapture.getFileFingerprints().set(capture); 16 | } 17 | 18 | @Override 19 | public void setBuildLogging(boolean capture) { 20 | buildScanCapture.getBuildLogging().set(capture); 21 | } 22 | 23 | @Override 24 | public void setTestLogging(boolean capture) { 25 | buildScanCapture.getTestLogging().set(capture); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleBuildScanConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.gradle.scan.BuildScanConfiguration; 4 | 5 | import java.util.function.Consumer; 6 | 7 | final class GradleBuildScanConfigurable implements BuildScanConfigurable { 8 | 9 | private final BuildScanConfiguration buildScan; 10 | private final GradleBuildScanObfuscationConfigurable buildScanObfuscation; 11 | private final GradleBuildScanCaptureConfigurable buildScanCapture; 12 | private final GradleBuildScanPublishingConfigurable buildScanPublishing; 13 | 14 | public GradleBuildScanConfigurable(BuildScanConfiguration buildScan) { 15 | this.buildScan = buildScan; 16 | this.buildScanObfuscation = new GradleBuildScanObfuscationConfigurable(buildScan.getObfuscation()); 17 | this.buildScanCapture = new GradleBuildScanCaptureConfigurable(buildScan.getCapture()); 18 | this.buildScanPublishing = new GradleBuildScanPublishingConfigurable(buildScan.getPublishing()); 19 | } 20 | 21 | @Override 22 | public void tag(String tag) { 23 | buildScan.tag(tag); 24 | } 25 | 26 | @Override 27 | public void value(String name, String value) { 28 | buildScan.value(name, value); 29 | } 30 | 31 | @Override 32 | public void link(String name, String url) { 33 | buildScan.link(name, url); 34 | } 35 | 36 | @Override 37 | public void background(Consumer action) { 38 | buildScan.background(__ -> action.accept(this)); 39 | } 40 | 41 | @Override 42 | public void buildFinished(Consumer action) { 43 | buildScan.buildFinished(buildResult -> action.accept(new BuildResult(buildResult.getFailures()))); 44 | } 45 | 46 | @Override 47 | public void buildScanPublished(Consumer action) { 48 | buildScan.buildScanPublished(publishedBuildScan -> 49 | action.accept(new PublishedBuildScan(publishedBuildScan.getBuildScanId(), publishedBuildScan.getBuildScanUri()))); 50 | } 51 | 52 | @Override 53 | public void setUploadInBackground(boolean uploadInBackground) { 54 | buildScan.getUploadInBackground().set(uploadInBackground); 55 | } 56 | 57 | @Override 58 | public BuildScanObfuscationConfigurable getObfuscation() { 59 | return buildScanObfuscation; 60 | } 61 | 62 | @Override 63 | public BuildScanCaptureConfigurable getCapture() { 64 | return buildScanCapture; 65 | } 66 | 67 | @Override 68 | public BuildScanPublishingConfigurable getPublishing() { 69 | return buildScanPublishing; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleBuildScanObfuscationConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.gradle.scan.BuildScanDataObfuscationConfiguration; 4 | 5 | import java.net.InetAddress; 6 | import java.util.List; 7 | import java.util.function.Function; 8 | 9 | final class GradleBuildScanObfuscationConfigurable implements BuildScanObfuscationConfigurable { 10 | 11 | private final BuildScanDataObfuscationConfiguration buildScanObfuscation; 12 | 13 | public GradleBuildScanObfuscationConfigurable(BuildScanDataObfuscationConfiguration buildScanObfuscation) { 14 | this.buildScanObfuscation = buildScanObfuscation; 15 | } 16 | 17 | @Override 18 | public void username(Function obfuscator) { 19 | buildScanObfuscation.username(obfuscator); 20 | } 21 | 22 | @Override 23 | public void hostname(Function obfuscator) { 24 | buildScanObfuscation.hostname(obfuscator); 25 | } 26 | 27 | @Override 28 | public void ipAddresses(Function, List> obfuscator) { 29 | buildScanObfuscation.ipAddresses(obfuscator); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleBuildScanPublishingConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.gradle.scan.BuildScanPublishingConfiguration; 4 | 5 | import java.util.function.Predicate; 6 | 7 | final class GradleBuildScanPublishingConfigurable implements BuildScanPublishingConfigurable { 8 | 9 | private final BuildScanPublishingConfiguration buildScanPublishing; 10 | 11 | public GradleBuildScanPublishingConfigurable(BuildScanPublishingConfiguration buildScanPublishing) { 12 | this.buildScanPublishing = buildScanPublishing; 13 | } 14 | 15 | @Override 16 | public void onlyIf(Predicate onlyIf) { 17 | buildScanPublishing.onlyIf(context -> 18 | onlyIf.test(new PublishingContext(new BuildResult(context.getBuildResult().getFailures()), context.isAuthenticated()))); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleDevelocityConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.gradle.DevelocityConfiguration; 4 | import org.gradle.caching.configuration.BuildCacheConfiguration; 5 | 6 | public final class GradleDevelocityConfigurable implements DevelocityConfigurable { 7 | 8 | private final DevelocityConfiguration develocity; 9 | private final BuildScanConfigurable buildScan; 10 | private final BuildCacheConfigurable buildCache; 11 | 12 | public GradleDevelocityConfigurable(DevelocityConfiguration develocity) { 13 | this.develocity = develocity; 14 | this.buildScan = new GradleBuildScanConfigurable(develocity.getBuildScan()); 15 | this.buildCache = new NoopBuildCacheConfigurable(); 16 | } 17 | 18 | public GradleDevelocityConfigurable(DevelocityConfiguration develocity, BuildCacheConfiguration buildCache) { 19 | this.develocity = develocity; 20 | this.buildScan = new GradleBuildScanConfigurable(develocity.getBuildScan()); 21 | this.buildCache = new GradleBuildCacheConfigurable(develocity.getBuildCache(), buildCache); 22 | } 23 | 24 | @Override 25 | public void setServer(String server) { 26 | develocity.getServer().set(server); 27 | } 28 | 29 | @Override 30 | public void setProjectId(String projectId) { 31 | develocity.getProjectId().set(projectId); 32 | } 33 | 34 | @Override 35 | public void setAllowUntrustedServer(boolean allowUntrustedServer) { 36 | develocity.getAllowUntrustedServer().set(allowUntrustedServer); 37 | } 38 | 39 | @Override 40 | public void setAccessKey(String accessKey) { 41 | develocity.getAccessKey().set(accessKey); 42 | } 43 | 44 | @Override 45 | public BuildScanConfigurable getBuildScan() { 46 | return buildScan; 47 | } 48 | 49 | @Override 50 | public BuildCacheConfigurable getBuildCache() { 51 | return buildCache; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleExecutionContext.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import org.gradle.api.provider.Provider; 4 | import org.gradle.api.provider.ProviderFactory; 5 | import org.gradle.util.GradleVersion; 6 | 7 | import java.util.Optional; 8 | 9 | public final class GradleExecutionContext implements ExecutionContext { 10 | 11 | private final ProviderFactory providers; 12 | 13 | public GradleExecutionContext(ProviderFactory providers) { 14 | this.providers = providers; 15 | } 16 | 17 | // Environment variables must be accessed differently in some Gradle 18 | // versions in order to detect changes when configuration cache is enabled. 19 | @Override 20 | public Optional environmentVariable(String name) { 21 | if (isGradle65OrNewer() && !isGradle74OrNewer()) { 22 | @SuppressWarnings("deprecation") Provider variable = providers.environmentVariable(name).forUseAtConfigurationTime(); 23 | return Optional.ofNullable(variable.getOrNull()); 24 | } 25 | return Optional.ofNullable(System.getenv(name)); 26 | } 27 | 28 | // System properties must be accessed differently in some Gradle 29 | // versions in order to detect changes when configuration cache is enabled. 30 | @Override 31 | public Optional systemProperty(String name) { 32 | if (isGradle65OrNewer() && !isGradle74OrNewer()) { 33 | @SuppressWarnings("deprecation") Provider property = providers.systemProperty(name).forUseAtConfigurationTime(); 34 | return Optional.ofNullable(property.getOrNull()); 35 | } 36 | return Optional.ofNullable(System.getProperty(name)); 37 | } 38 | 39 | private static boolean isGradle65OrNewer() { 40 | return GradleVersion.current().compareTo(GradleVersion.version("6.5")) >= 0; 41 | } 42 | 43 | @SuppressWarnings("BooleanMethodIsAlwaysInverted") 44 | private static boolean isGradle74OrNewer() { 45 | return GradleVersion.current().compareTo(GradleVersion.version("7.4")) >= 0; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleLocalBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import org.gradle.caching.local.DirectoryBuildCache; 4 | 5 | import java.io.File; 6 | 7 | final class GradleLocalBuildCacheConfigurable implements LocalBuildCacheConfigurable { 8 | 9 | private final DirectoryBuildCache localBuildCache; 10 | 11 | public GradleLocalBuildCacheConfigurable(DirectoryBuildCache localBuildCache) { 12 | this.localBuildCache = localBuildCache; 13 | } 14 | 15 | @Override 16 | public void setEnabled(boolean enabled) { 17 | localBuildCache.setEnabled(enabled); 18 | } 19 | 20 | @Override 21 | public void setStoreEnabled(boolean storeEnabled) { 22 | localBuildCache.setPush(storeEnabled); 23 | } 24 | 25 | @Override 26 | public void setDirectory(File directory) { 27 | localBuildCache.setDirectory(directory); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/GradleRemoteBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import org.gradle.caching.configuration.BuildCache; 4 | 5 | final class GradleRemoteBuildCacheConfigurable implements RemoteBuildCacheConfigurable { 6 | 7 | private final BuildCache remoteBuildCache; 8 | 9 | public GradleRemoteBuildCacheConfigurable(BuildCache remoteBuildCache) { 10 | this.remoteBuildCache = remoteBuildCache; 11 | } 12 | 13 | @Override 14 | public void setEnabled(boolean enabled) { 15 | remoteBuildCache.setEnabled(enabled); 16 | } 17 | 18 | @Override 19 | public void setStoreEnabled(boolean storeEnabled) { 20 | remoteBuildCache.setPush(storeEnabled); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/NoopBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | /* 4 | * Build cache cannot be configured via a plugin prior to Gradle 6.0, so build 5 | * cache operations must be a no-op. 6 | */ 7 | final class NoopBuildCacheConfigurable implements BuildCacheConfigurable { 8 | 9 | @Override 10 | public LocalBuildCacheConfigurable getLocal() { 11 | return new NoopLocalBuildCacheConfigurable(); 12 | } 13 | 14 | @Override 15 | public RemoteBuildCacheConfigurable getRemote() { 16 | return new NoopRemoteBuildCacheConfigurable(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/NoopLocalBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.io.File; 4 | 5 | /* 6 | * Build cache cannot be configured via a plugin prior to Gradle 6.0, so build 7 | * cache operations must be a no-op. 8 | */ 9 | final class NoopLocalBuildCacheConfigurable implements LocalBuildCacheConfigurable { 10 | 11 | @Override 12 | public void setEnabled(boolean enabled) { 13 | 14 | } 15 | 16 | @Override 17 | public void setStoreEnabled(boolean storeEnabled) { 18 | 19 | } 20 | 21 | @Override 22 | public void setDirectory(File directory) { 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-gradle-plugin/src/main/java/com/myorg/configurable/NoopRemoteBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | /* 4 | * Build cache cannot be configured via a plugin prior to Gradle 6.0, so build 5 | * cache operations must be a no-op. 6 | */ 7 | final class NoopRemoteBuildCacheConfigurable implements RemoteBuildCacheConfigurable { 8 | 9 | @Override 10 | public void setEnabled(boolean enabled) { 11 | 12 | } 13 | 14 | @Override 15 | public void setStoreEnabled(boolean storeEnabled) { 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.myorg.java-conventions") 3 | id("com.myorg.publishing-conventions") 4 | id("java") 5 | } 6 | 7 | repositories { 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | compileOnly("org.apache.maven:maven-core:3.9.10") 13 | 14 | implementation("com.gradle:develocity-maven-extension:2.0.1") 15 | implementation("com.gradle:common-custom-user-data-maven-extension:2.0.2") 16 | implementation(project(":convention-develocity-common")) 17 | } 18 | 19 | publishing { 20 | publications { 21 | create("maven") { 22 | from(components["java"]) 23 | } 24 | } 25 | } 26 | 27 | tasks.jar { 28 | from(zipTree(configurations.compileClasspath.map { it.files.first { jar -> jar.name.contains("develocity-maven-extension") }})) { 29 | include("META-INF/maven/extension.xml") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/ConventionDevelocityListener.java: -------------------------------------------------------------------------------- 1 | package com.myorg; 2 | 3 | import com.gradle.develocity.agent.maven.api.DevelocityApi; 4 | import com.gradle.develocity.agent.maven.api.DevelocityListener; 5 | import com.myorg.configurable.MavenDevelocityConfigurable; 6 | import com.myorg.configurable.MavenExecutionContext; 7 | import org.apache.maven.execution.MavenSession; 8 | 9 | /** 10 | * An example Maven extension for enabling and configuring Develocity features. 11 | */ 12 | final class ConventionDevelocityListener implements DevelocityListener { 13 | 14 | @Override 15 | public void configure(DevelocityApi develocity, MavenSession session) { 16 | MavenExecutionContext context = new MavenExecutionContext(); 17 | new DevelocityConventions(context).configureDevelocity(new MavenDevelocityConfigurable(develocity)); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.cache.BuildCacheApi; 4 | 5 | final class MavenBuildCacheConfigurable implements BuildCacheConfigurable { 6 | 7 | private final LocalBuildCacheConfigurable localBuildCache; 8 | private final RemoteBuildCacheConfigurable remoteBuildCache; 9 | 10 | public MavenBuildCacheConfigurable(BuildCacheApi buildCache) { 11 | this.localBuildCache = new MavenLocalBuildCacheConfigurable(buildCache.getLocal()); 12 | this.remoteBuildCache = new MavenRemoteBuildCacheConfigurable(buildCache.getRemote()); 13 | } 14 | 15 | @Override 16 | public LocalBuildCacheConfigurable getLocal() { 17 | return localBuildCache; 18 | } 19 | 20 | @Override 21 | public RemoteBuildCacheConfigurable getRemote() { 22 | return remoteBuildCache; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenBuildScanCaptureConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.scan.BuildScanCaptureSettings; 4 | 5 | final class MavenBuildScanCaptureConfigurable implements BuildScanCaptureConfigurable { 6 | 7 | private final BuildScanCaptureSettings buildScanCapture; 8 | 9 | public MavenBuildScanCaptureConfigurable(BuildScanCaptureSettings buildScanCapture) { 10 | this.buildScanCapture = buildScanCapture; 11 | } 12 | 13 | @Override 14 | public void setFileFingerprints(boolean capture) { 15 | buildScanCapture.setFileFingerprints(capture); 16 | } 17 | 18 | @Override 19 | public void setBuildLogging(boolean capture) { 20 | buildScanCapture.setBuildLogging(capture); 21 | } 22 | 23 | @Override 24 | public void setTestLogging(boolean capture) { 25 | buildScanCapture.setTestLogging(capture); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenBuildScanConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.scan.BuildScanApi; 4 | 5 | import java.util.function.Consumer; 6 | 7 | final class MavenBuildScanConfigurable implements BuildScanConfigurable { 8 | 9 | private final BuildScanApi buildScan; 10 | private final MavenBuildScanObfuscationConfigurable buildScanObfuscation; 11 | private final MavenBuildScanCaptureConfigurable buildScanCapture; 12 | private final MavenBuildScanPublishingConfigurable buildScanPublishing; 13 | 14 | public MavenBuildScanConfigurable(BuildScanApi buildScan) { 15 | this.buildScan = buildScan; 16 | this.buildScanObfuscation = new MavenBuildScanObfuscationConfigurable(buildScan.getObfuscation()); 17 | this.buildScanCapture = new MavenBuildScanCaptureConfigurable(buildScan.getCapture()); 18 | this.buildScanPublishing = new MavenBuildScanPublishingConfigurable(buildScan.getPublishing()); 19 | } 20 | 21 | @Override 22 | public void tag(String tag) { 23 | buildScan.tag(tag); 24 | } 25 | 26 | @Override 27 | public void value(String name, String value) { 28 | buildScan.value(name, value); 29 | } 30 | 31 | @Override 32 | public void link(String name, String url) { 33 | buildScan.link(name, url); 34 | } 35 | 36 | @Override 37 | public void background(Consumer action) { 38 | buildScan.background(__ -> action.accept(this)); 39 | } 40 | 41 | @Override 42 | public void buildFinished(Consumer action) { 43 | buildScan.buildFinished(buildResult -> action.accept(new BuildResult(buildResult.getFailures()))); 44 | } 45 | 46 | @Override 47 | public void buildScanPublished(Consumer action) { 48 | buildScan.buildScanPublished(publishedBuildScan -> 49 | action.accept(new PublishedBuildScan(publishedBuildScan.getBuildScanId(), publishedBuildScan.getBuildScanUri()))); 50 | } 51 | 52 | @Override 53 | public void setUploadInBackground(boolean uploadInBackground) { 54 | buildScan.setUploadInBackground(uploadInBackground); 55 | } 56 | 57 | @Override 58 | public BuildScanObfuscationConfigurable getObfuscation() { 59 | return buildScanObfuscation; 60 | } 61 | 62 | @Override 63 | public BuildScanCaptureConfigurable getCapture() { 64 | return buildScanCapture; 65 | } 66 | 67 | @Override 68 | public BuildScanPublishingConfigurable getPublishing() { 69 | return buildScanPublishing; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenBuildScanObfuscationConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.scan.BuildScanDataObfuscation; 4 | 5 | import java.net.InetAddress; 6 | import java.util.List; 7 | import java.util.function.Function; 8 | 9 | final class MavenBuildScanObfuscationConfigurable implements BuildScanObfuscationConfigurable { 10 | 11 | private final BuildScanDataObfuscation buildScanObfuscation; 12 | 13 | public MavenBuildScanObfuscationConfigurable(BuildScanDataObfuscation buildScanObfuscation) { 14 | this.buildScanObfuscation = buildScanObfuscation; 15 | } 16 | 17 | @Override 18 | public void username(Function obfuscator) { 19 | buildScanObfuscation.username(obfuscator); 20 | } 21 | 22 | @Override 23 | public void hostname(Function obfuscator) { 24 | buildScanObfuscation.hostname(obfuscator); 25 | } 26 | 27 | @Override 28 | public void ipAddresses(Function, List> obfuscator) { 29 | buildScanObfuscation.ipAddresses(obfuscator); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenBuildScanPublishingConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.scan.BuildScanPublishing; 4 | 5 | import java.util.function.Predicate; 6 | 7 | final class MavenBuildScanPublishingConfigurable implements BuildScanPublishingConfigurable { 8 | 9 | private final BuildScanPublishing buildScanPublishing; 10 | 11 | public MavenBuildScanPublishingConfigurable(BuildScanPublishing buildScanPublishing) { 12 | this.buildScanPublishing = buildScanPublishing; 13 | } 14 | 15 | @Override 16 | public void onlyIf(Predicate onlyIf) { 17 | buildScanPublishing.onlyIf(context -> 18 | onlyIf.test(new PublishingContext(new BuildResult(context.getBuildResult().getFailures()), context.isAuthenticated()))); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenDevelocityConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.DevelocityApi; 4 | 5 | public final class MavenDevelocityConfigurable implements DevelocityConfigurable { 6 | 7 | private final DevelocityApi develocity; 8 | private final BuildScanConfigurable buildScan; 9 | private final BuildCacheConfigurable buildCache; 10 | 11 | public MavenDevelocityConfigurable(DevelocityApi develocity) { 12 | this.develocity = develocity; 13 | this.buildScan = new MavenBuildScanConfigurable(develocity.getBuildScan()); 14 | this.buildCache = new MavenBuildCacheConfigurable(develocity.getBuildCache()); 15 | } 16 | 17 | @Override 18 | public void setServer(String server) { 19 | develocity.setServer(server); 20 | } 21 | 22 | @Override 23 | public void setProjectId(String projectId) { 24 | develocity.setProjectId(projectId); 25 | } 26 | 27 | @Override 28 | public void setAllowUntrustedServer(boolean allowUntrustedServer) { 29 | develocity.setAllowUntrustedServer(allowUntrustedServer); 30 | } 31 | 32 | @Override 33 | public void setAccessKey(String accessKey) { 34 | develocity.setAccessKey(accessKey); 35 | } 36 | 37 | @Override 38 | public BuildScanConfigurable getBuildScan() { 39 | return buildScan; 40 | } 41 | 42 | @Override 43 | public BuildCacheConfigurable getBuildCache() { 44 | return buildCache; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenExecutionContext.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import java.util.Optional; 4 | 5 | public final class MavenExecutionContext implements ExecutionContext { 6 | 7 | @Override 8 | public Optional environmentVariable(String name) { 9 | return Optional.ofNullable(System.getenv(name)); 10 | } 11 | 12 | @Override 13 | public Optional systemProperty(String name) { 14 | return Optional.ofNullable(System.getProperty(name)); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenLocalBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.cache.LocalBuildCache; 4 | 5 | import java.io.File; 6 | 7 | final class MavenLocalBuildCacheConfigurable implements LocalBuildCacheConfigurable { 8 | 9 | private final LocalBuildCache localBuildCache; 10 | 11 | public MavenLocalBuildCacheConfigurable(LocalBuildCache localBuildCache) { 12 | this.localBuildCache = localBuildCache; 13 | } 14 | 15 | @Override 16 | public void setEnabled(boolean enabled) { 17 | localBuildCache.setEnabled(enabled); 18 | } 19 | 20 | @Override 21 | public void setStoreEnabled(boolean storeEnabled) { 22 | localBuildCache.setStoreEnabled(storeEnabled); 23 | } 24 | 25 | @Override 26 | public void setDirectory(File directory) { 27 | localBuildCache.setDirectory(directory); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/java/com/myorg/configurable/MavenRemoteBuildCacheConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.myorg.configurable; 2 | 3 | import com.gradle.develocity.agent.maven.api.cache.RemoteBuildCache; 4 | 5 | final class MavenRemoteBuildCacheConfigurable implements RemoteBuildCacheConfigurable { 6 | 7 | private final RemoteBuildCache remoteBuildCache; 8 | 9 | public MavenRemoteBuildCacheConfigurable(RemoteBuildCache remoteBuildCache) { 10 | this.remoteBuildCache = remoteBuildCache; 11 | } 12 | 13 | @Override 14 | public void setEnabled(boolean enabled) { 15 | remoteBuildCache.setEnabled(enabled); 16 | } 17 | 18 | @Override 19 | public void setStoreEnabled(boolean storeEnabled) { 20 | remoteBuildCache.setStoreEnabled(storeEnabled); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /convention-develocity-shared/convention-develocity-maven-extension/src/main/resources/META-INF/plexus/components.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.gradle.develocity.agent.maven.api.DevelocityListener 6 | convention-develocity-listener 7 | com.myorg.ConventionDevelocityListener 8 | Configures the Develocity Maven extension for com.myorg 9 | false 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_5/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.myorg.convention-develocity-gradle-plugin") version "1.0" 3 | id("java") 4 | } 5 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_5/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-shared/examples/gradle_5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_5/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_5/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_5/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = "example-build" 9 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6.9_and_later/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("java") 3 | } 4 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6.9_and_later/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-shared/examples/gradle_6.9_and_later/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6.9_and_later/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6.9_and_later/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 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6.9_and_later/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id("com.myorg.convention-develocity-gradle-plugin") version "1.+" 10 | } 11 | 12 | rootProject.name = "example-build" 13 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("java") 3 | } 4 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-shared/examples/gradle_6/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6/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 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/gradle_6/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenLocal() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id("com.myorg.convention-develocity-gradle-plugin") version "1.0" 10 | } 11 | 12 | rootProject.name = "example-build" 13 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/maven_3/.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.myorg 5 | convention-develocity-maven-extension 6 | (,2.0) 7 | 8 | 9 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/maven_3/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip 20 | -------------------------------------------------------------------------------- /convention-develocity-shared/examples/maven_3/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | com.myorg 7 | maven-sample 8 | 1.0 9 | 10 | Convention Develocity Maven Extension Example 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /convention-develocity-shared/gradle.properties: -------------------------------------------------------------------------------- 1 | # CHANGE ME: change to your organization's group ID 2 | group=com.myorg 3 | version=1.0 4 | -------------------------------------------------------------------------------- /convention-develocity-shared/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gradle/develocity-build-config-samples/19f170a7f4fcd0ed36dd6f30c390738c3a99add0/convention-develocity-shared/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /convention-develocity-shared/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /convention-develocity-shared/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 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /convention-develocity-shared/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" 3 | } 4 | 5 | rootProject.name = "convention-develocity-shared" 6 | 7 | include("convention-develocity-common") 8 | include("convention-develocity-gradle-plugin") 9 | include("convention-develocity-maven-extension") 10 | -------------------------------------------------------------------------------- /custom-maven-wrapper/create-custom-maven-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Script that runs the Maven wrapper generation goal, and then modifies the mvnw wrapper shell script such that 5 | # a 'Wrapper' custom tag is added to all build scans. 6 | # 7 | # Having such a 'Wrapper' tag allows to query for all builds that have been invoked via Maven wrapper. 8 | # 9 | # Note: You can invoke the Maven wrapper generation tool in a custom directory by running 10 | # this script and passing the working directory as the first argument, e.g.: 11 | # 12 | # mkdir /tmp/custom-maven-wrapper && ./create-custom-maven-wrapper.sh /tmp/custom-maven-wrapper 13 | # 14 | 15 | current_dir=$PWD 16 | maven_version=3.9.7 17 | 18 | yellow='\033[1;33m' 19 | nc='\033[0m' 20 | 21 | if [ -n "$1" ] 22 | then 23 | cd "$1" || exit 24 | fi 25 | 26 | echo -e "${yellow}Installing Maven wrapper${nc}" 27 | mvn -N io.takari:maven:0.7.7:wrapper -Dmaven=$maven_version 28 | 29 | echo -e "${yellow}Customizing Maven wrapper script by adding a custom 'Wrapper' tag${nc}" 30 | grep -q 'scan.tag.Wrapper' mvnw || sed -i '' $'s/^MAVEN_OPTS/&="-Dscan.tag.Wrapper $&"\\\n&/' mvnw 31 | 32 | cd "$current_dir" || exit 33 | 34 | exit 0 35 | -------------------------------------------------------------------------------- /git-user-count/README.md: -------------------------------------------------------------------------------- 1 | # Develocity Git User Count 2 | 3 | ## Overview 4 | 5 | There are two scripts in this repository. 6 | The first script `unique-git-repos.sh` provides a means to gather a list of unique git repositories publishing scans to a Develocity instance. 7 | The second script `user-count.sh` provides a means to automate the counting of the number of unique active developers in separate git repositories. 8 | 9 | ## Unique Git Repositories 10 | 11 | The Develocity configuration must be configured to publish a custom value with the key `Git repository` to Develocity. This can be done automatically via the Common Custom User Data Gradle plugin or Maven extension. 12 | 13 | ### Usage 14 | 15 | 1. Run the `./unique-git-repos.sh` bash script. The script supports the following ordered command line arguments: 16 | * ``: The URL of the Develocity instance. 17 | * ``: The access token to use when connecting to the Develocity instance. 18 | * ``: Number of days to go back in history (default: 7). 19 | 2. The script will output a list of unique git repositories to `repositories.txt`. 20 | 21 | ## Git User Count 22 | 23 | ### Usage 24 | 25 | 1. Update the `repositories.txt` file with the list of Git repositories that are connected to Develocity. 26 | Make sure each line contains a single Git repository URL. 27 | 2. Run the `./user-count.sh` bash script to count the number of users rollout. The script supports the following command line arguments: 28 | * `-b `: Count the users from the specified branch name (across all repositories). 29 | * `-s `: Number of days to go back in history (default: 30). 30 | * `-c`: When specified does not pass `--shallow-since` flag to cloning options. Use this when encountering cloning issues. 31 | * `-o `: Specify additional git cloning options (default: none). 32 | 3. Remove redundant users or CI emails from the `develocity-unique-users.txt` file. 33 | 4. Run `wc -l develocity-unique-users.txt` to get the number of unique users. 34 | 35 | ### How it works 36 | 37 | The `user-count.sh` script reads the list of Git repositories from the `repositories.txt` file. 38 | The script creates a temporary folder and clones the listed Git repositories to that folder in a minimal state. 39 | It then writes all the unique emails committed to that repository to a file named `develocity-unique-users.txt`. 40 | -------------------------------------------------------------------------------- /git-user-count/repositories.txt: -------------------------------------------------------------------------------- 1 | # List of Git repositories to process, one repository per line 2 | https://github.com/gradle/maven-build-scan-quickstart 3 | https://github.com/gradle/android-cache-fix-gradle-plugin 4 | https://github.com/gradle/develocity-build-config-samples 5 | -------------------------------------------------------------------------------- /git-user-count/unique-git-repos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Command line options for DEVELOCITY_URL and ACCESS_KEY 4 | if [[ $# -lt 2 ]]; then 5 | echo "Usage: $0 [number_of_days]" 6 | exit 1 7 | fi 8 | 9 | DEVELOCITY_URL="$1" 10 | ACCESS_KEY="$2" 11 | NUMBER_OF_DAYS="${3:-7}" # Default to 7 days if not provided 12 | FROM_INSTANT=$(date -d "$NUMBER_OF_DAYS days ago" +%s)000 # Days ago in milliseconds 13 | 14 | # Function to fetch builds 15 | fetch_builds() { 16 | local from_build=$1 17 | local url="$DEVELOCITY_URL/api/builds?models=gradle-attributes&models=maven-attributes&fromInstant=$FROM_INSTANT&maxBuilds=1000" 18 | if [[ -n "$from_build" ]]; then 19 | url="$url&fromBuild=$from_build" 20 | fi 21 | curl -s -H "Authorization: Bearer $ACCESS_KEY" -H "Content-Type: application/json" "$url" 22 | } 23 | 24 | # Main loop to fetch all builds with pagination and extract Git repositories 25 | git_repos=() 26 | from_build="" 27 | while :; do 28 | response=$(fetch_builds "$from_build") 29 | num_builds=$(echo "$response" | jq -r '. | length') 30 | 31 | # Progress message 32 | echo "Fetched $num_builds builds" 33 | 34 | # Extract Git repository values 35 | new_repos=$(echo "$response" | jq -r '.[] | .models.gradleAttributes.model.values[]?, .models.mavenAttributes.model.values[]? | select(.name=="Git repository").value // empty') 36 | git_repos+=("$new_repos") 37 | 38 | if [[ num_builds -eq 0 || num_builds -lt 1000 ]]; then 39 | break # No more builds to fetch or fewer than 1000 builds 40 | fi 41 | 42 | from_build=$(echo "$response" | jq -r '.[-1].id') # Set fromBuild for the next request 43 | done 44 | 45 | # Remove duplicates and count unique Git repositories 46 | IFS=$'\n' read -r -d '' -a unique_git_repos < <(printf "%s\n" "${git_repos[@]}" | sort -u && printf '\0') 47 | num_unique_repos=${#unique_git_repos[@]} 48 | 49 | # Print unique Git repositories and their count 50 | echo "Number of unique Git repositories: $num_unique_repos" 51 | printf "%s\n" "${unique_git_repos[@]}" > repositories.txt 52 | echo "List of unique Git repositories saved to repositories.txt" 53 | -------------------------------------------------------------------------------- /kotlin-scripts-caching-experiment/README.md: -------------------------------------------------------------------------------- 1 | # Kotlin script compilation remote build cache performance experiment 2 | 3 | ## Overview 4 | 5 | This script is used to test the performance of remote caching for Kotlin scripts. 6 | 7 | It will run 3 builds: 8 | 9 | 1. Init/seed build, that writes to remote build cache. The scan for this build will have a tag of `remote-cache-experiment-init`. 10 | 2. Kotlin script caching enabled - pulls from remote cache. The scan for this build will have a tag of `kotlin-script-caching-enabled`. 11 | 3. Kotlin script caching disabled - compiles the Kotlin scripts. The scan for this build will have a tag of `kotlin-script-caching-disabled`. 12 | 13 | You can then use the published build scans to evaluate how caching Kotlin script compilation affects your overall build time. 14 | 15 | If results show that (remote) caching of Kotlin script compilation is not beneficial for your project, you can disable caching for Kotlin script compilation using the flag `-Dorg.gradle.internal.kotlin-script-caching-disabled`, which is also used in this script. 16 | 17 | ## Requirements 18 | 19 | - A Develocity instance to publish scans to 20 | - Access key with remote build cache write permission 21 | - Gradle version 8.9 or higher 22 | - The [Common Custom User Data Gradle plugin](https://github.com/gradle/common-custom-user-data-gradle-plugin) is expected to be applied to the project 23 | 24 | ## Usage 25 | 26 | 1. Ensure you have an access key with remote build cache write permission. 27 | 2. Copy the script into your project directory. 28 | 3. (Optional) If you're using a HTTP cache connector, uncomment line 31 and set the remote cache URL in the script to use a cache shard instead of the default cache. 29 | 4. Having the key set in the environment is expected - note that **remote build cache write is required**. If the key stored in your Gradle user home is missing the remote build cache write permission you can set the key in the environment by running `export DEVELOCITY_ACCESS_KEY==`, either in the script, or in the terminal before running the script. 30 | 5. Run the script with `./remote-cache-experiment-kotlin-scripts.sh`. It will run the Gradle `help` task by default, but you can specify a different task by passing it as an argument to the script. 31 | 6. Inspect and compare build times 32 | 33 | ### Invocation 34 | 35 | To run the script with the `help` task (default), use the following command: 36 | ```bash 37 | ./remote-cache-experiment-kotlin-scripts.sh 38 | ``` 39 | 40 | To run the script with a specific Gradle task(s), use the following command: 41 | ```bash 42 | ./remote-cache-experiment-kotlin-scripts.sh 43 | ``` 44 | 45 | 46 | -------------------------------------------------------------------------------- /kotlin-scripts-caching-experiment/remote-cache-experiment-kotlin-scripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | # REQUIRED: Having the key set in the environment is expected - note that remote build cache write is requiered. It can be set here or exported in the terminal before running the script. 5 | #export DEVELOCITY_ACCESS_KEY=$develocityUrl= 6 | 7 | gradleVersion=$(./gradlew --version | grep "Gradle" | awk '{print $2}') 8 | 9 | major=$(echo "$gradleVersion" | cut -d. -f1) 10 | minor=$(echo "$gradleVersion" | cut -d. -f2) 11 | 12 | # Check if the version is lower than 8.9 13 | if [ "$major" -lt 8 ] || { [ "$major" -eq 8 ] && [ "$minor" -lt 9 ]; }; then 14 | echo "Gradle version $gradleVersion is lower than 8.9" 15 | exit 1 16 | else 17 | echo "Gradle version detected: $gradleVersion" 18 | fi 19 | 20 | homeDir=build/HOME 21 | 22 | # Set 'task' to the first argument or 'help' if no arguments are provided 23 | tasks=${*:-help} 24 | 25 | # Initialize empty Gradle User Home with settings to run build 26 | echo "Initializing Gradle User Home directory at $homeDir" 27 | rm -rf $homeDir 28 | mkdir -p $homeDir 29 | mkdir -p $homeDir/caches/"$gradleVersion"/ 30 | cp ~/.gradle/gradle.properties $homeDir || : 31 | cp -r ~/.gradle/caches/"$gradleVersion"/generated-gradle-jars $homeDir/caches/"$gradleVersion"/ || : 32 | cp -r ~/.gradle/develocity/ $homeDir/develocity/ || : 33 | cp -r ~/.gradle/enterprise/ $homeDir/enterprise/ || : 34 | 35 | # Note: This is expecting that CCUD Gradle plugin is applied 36 | export GRADLE_CACHE_REMOTE_PUSH=true 37 | export GRADLE_CACHE_REMOTE_PATH="cache/$USER-exp-non-task" 38 | #export GRADLE_CACHE_REMOTE_URL="/cache/$USER-exp-non-task" # Needed if the HTTP cache connector is used 39 | 40 | echo "------------------------------------------------------------" 41 | echo "Priming build with task '$tasks' and HOME=$homeDir" 42 | echo "------------------------------------------------------------" 43 | set -x 44 | # shellcheck disable=SC2086 45 | ./gradlew $tasks -g $homeDir -Dscan.tag.remote-cache-experiment-init --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dscan.uploadInBackground=false -Dgradle.cache.local.enabled=false --no-daemon 46 | set +x 47 | 48 | for args in "-Dscan.tag.kotlin-script-caching-enabled" "-Dscan.tag.kotlin-script-caching-disabled -Dorg.gradle.internal.kotlin-script-caching-disabled" 49 | do 50 | echo "------------------------------------------------------------" 51 | echo "Test caches/*/kotlin-dsl removal with $args" 52 | echo "------------------------------------------------------------" 53 | set -x 54 | 55 | echo "Removing locally cached kotlin scripts from $homeDir/caches" 56 | rm -rf $homeDir/caches/*/kotlin-dsl 57 | 58 | # shellcheck disable=SC2086 59 | ./gradlew $tasks -g $homeDir --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dscan.uploadInBackground=false -Dgradle.cache.local.enabled=false --no-daemon $args 60 | 61 | set +x 62 | echo "" 63 | done -------------------------------------------------------------------------------- /quarkus-build-caching-extension/README.md: -------------------------------------------------------------------------------- 1 | # Custom Maven Extension to make Quarkus build goal cacheable 2 | 3 | This has been moved to a dedicated [GitHub repository](https://github.com/gradle/quarkus-build-caching-extension). -------------------------------------------------------------------------------- /rollout-maven-extension/.mvn/develocity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | https://develocity-samples.gradle.com 14 | 15 | 16 | #{isFalse(env['CI'])} 17 | 18 | 19 | 20 | true 21 | 22 | 23 | true 24 | #{isTrue(env['CI'])} 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /rollout-maven-extension/.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | com.gradle 9 | develocity-maven-extension 10 | 2.0.1 11 | 12 | 13 | com.gradle 14 | common-custom-user-data-maven-extension 15 | 2.0.2 16 | 17 | 18 | -------------------------------------------------------------------------------- /rollout-maven-extension/README.md: -------------------------------------------------------------------------------- 1 | ## Develocity Maven Extension rollout script 2 | 3 | ### Overview 4 | 5 | The Develocity Maven Extension rollout script provides a means to automate the application and upgrade of the [Develocity Maven extension](https://docs.gradle.com/develocity/maven-extension/current/) on multiple Maven projects stored in separate Git repositories. 6 | 7 | ### Usage 8 | 9 | 1. Update the `repositories.txt` file with the list of Git repositories you want to apply the extension on. 10 | Make sure each line contains a single Git repository URL. 11 | 1. Update the Maven `.mvn/extensions.xml` and the Develocity `.mvn/develocity.xml` files with your desired Develocity configuration. 12 | 1. Run the `./rollout.sh` bash script to execute the Develocity configuration rollout. The script supports the following command line arguments: 13 | * `-u`: Only update those Git repositories that already contain the `.mvn` folder where the configuration files are stored. 14 | * `-f`: Force-override any pre-existing `extensions.xml` and `develocity.xml` configuration files in the `.mvn` folder. 15 | * `-p`: Push the applied changes to the listed Git repositories. Omit the `-p` flag to do a dry run. 16 | 17 | ### How it works 18 | 19 | The `rollout.sh` script reads the list of Git repositories with Maven projects to instrument from the `repositories.txt` file. 20 | The script creates a temporary folder and clones the listed Git repositories to that folder. 21 | 22 | If the `-u` flag is specified, the script only processes those repositories that already contain a `.mvn` folder. 23 | If the `-u` flag is not specified, the script will process all repositories and create the `.mvn` folder for those repositories that do not already contain it. 24 | 25 | For each processed repository, if the `-f` flag is specified, any pre-existing `extensions.xml` and `develocity.xml` configuration files in the `.mvn` folder are overridden. 26 | If the `-f` flag is not specified, any pre-existing configuration files are not modified. The modifications are committed to the cloned repository. 27 | 28 | For each repository, if the `-p` flag is specified, the committed changes are pushed to the remote Git repository, and the temporary folder is deleted once all repositories have been processed. 29 | If the `-p` flag is not specified, the committed changes are not pushed, and the temporary folder with all the cloned repositories is kept for further inspection. 30 | 31 | ### Changelog 32 | 33 | - 2020-09-01 - Add the `-p`, `-f`, and `-u` flags 34 | - 2020-07-27 - Initial release 35 | -------------------------------------------------------------------------------- /rollout-maven-extension/repositories.txt: -------------------------------------------------------------------------------- 1 | # List of Git repositories to process, one repository per line, end with an empty line 2 | https://github.com/gradle/maven-build-scan-quickstart 3 | --------------------------------------------------------------------------------