├── changelog ├── @unreleased │ └── .gitkeep ├── 1.0.0 │ └── pr-1.v2.yml ├── 1.0.2 │ └── pr-14.v2.yml ├── 2.1.0 │ └── pr-155.v2.yml ├── 3.0.0 │ └── pr-411.v2.yml ├── 2.6.0 │ └── pr-332.v2.yml ├── 3.1.0 │ └── pr-552.v2.yml ├── 2.0.0 │ └── pr-137.v2.yml ├── 2.8.0 │ └── pr-362.v2.yml ├── 1.0.1 │ └── pr-10.v2.yml ├── 1.3.2 │ └── pr-77.v2.yml └── 1.3.1 │ └── pr-74.v2.yml ├── gradle ├── gradle-daemon-jdk-version ├── jdks │ ├── 17 │ │ ├── macos │ │ │ ├── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── windows │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── linux-glibc │ │ │ ├── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ └── linux-musl │ │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ ├── 21 │ │ ├── macos │ │ │ ├── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── windows │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── linux-glibc │ │ │ ├── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ └── linux-musl │ │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ └── 25 │ │ ├── macos │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── windows │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── linux-glibc │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── linux-musl │ │ ├── aarch64 │ │ ├── local-path │ │ └── download-url │ │ └── x86-64 │ │ ├── local-path │ │ └── download-url ├── gradle-test-versions.yml ├── gradle-jdks-setup.jar ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle-jdks-setup.sh └── gradle-jdks-functions.sh ├── .circleci ├── template.sh ├── .gitattributes └── config.yml ├── src ├── main │ ├── resources │ │ └── META-INF │ │ │ └── gradle-plugins │ │ │ └── com.palantir.shadow-jar.properties │ └── java │ │ └── com │ │ └── palantir │ │ └── gradle │ │ └── shadowjar │ │ ├── JarFilesRelocator.java │ │ └── ShadowJarPlugin.java └── test │ └── java │ └── com │ └── palantir │ └── gradle │ └── shadowjar │ └── ShadowJarPluginIntegrationTest.java ├── .changelog.yml ├── settings.gradle ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── stale.yml ├── .bulldozer.yml ├── gradle.properties ├── .excavator.yml ├── .gitignore ├── .baseline ├── copyright │ └── 001_apache-2.0.txt ├── eclipse │ ├── dynamic │ │ └── dotfile.checkstyle │ ├── static │ │ └── dotfile.settings │ │ │ └── org.eclipse.jdt.ui.prefs │ └── org.eclipse.jdt.core.prefs ├── checkstyle │ ├── checkstyle-suppressions.xml │ └── checkstyle.xml └── idea │ └── intellij-java-palantir-style.xml ├── versions.props ├── gradlew.bat ├── README.md ├── versions.lock ├── gradlew └── LICENSE /changelog/@unreleased/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/gradle-daemon-jdk-version: -------------------------------------------------------------------------------- 1 | 21 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/windows/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/windows/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/macos/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.8.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/macos/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.8.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/windows/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.8.1 2 | -------------------------------------------------------------------------------- /gradle/gradle-test-versions.yml: -------------------------------------------------------------------------------- 1 | major-versions: 2 | 8: 8.14.3 3 | 9: 9.2.1 4 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.9.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-glibc/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.9.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-musl/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.9.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-musl/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-25.0.1.9.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-glibc 2 | -------------------------------------------------------------------------------- /.circleci/template.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export CIRCLECI_TEMPLATE=java-library-oss 3 | export JDK=11 4 | -------------------------------------------------------------------------------- /gradle/gradle-jdks-setup.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/gradle-shadow-jar/HEAD/gradle/gradle-jdks-setup.jar -------------------------------------------------------------------------------- /.circleci/.gitattributes: -------------------------------------------------------------------------------- 1 | # Mark .circleci/config.yml as generated for github reviews 2 | config.yml linguist-generated=true 3 | -------------------------------------------------------------------------------- /changelog/1.0.0/pr-1.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Initial release of the project 4 | links: [] 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/gradle-shadow-jar/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/jdks/21/macos/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-macosx-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/macos/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.8.1/amazon-corretto-25.0.1.8.1-macosx-x64.tar.gz 2 | -------------------------------------------------------------------------------- /changelog/1.0.2/pr-14.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Shaded dependencies are now accessible in test source sets. 4 | links: [] 5 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-macosx-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-macosx-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/windows/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-windows-x64-jdk.zip 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-glibc/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/macos/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.8.1/amazon-corretto-25.0.1.8.1-macosx-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/windows/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.8.1/amazon-corretto-25.0.1.8.1-windows-x64-jdk.zip 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-macosx-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/windows/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-windows-x64-jdk.zip 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-glibc/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-musl/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-alpine-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-alpine-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-alpine-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/25/linux-musl/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-alpine-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-alpine-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-alpine-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /changelog/2.1.0/pr-155.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Do not shade safe logger 4 | links: 5 | - https://github.com/palantir/gradle-shadow-jar/pull/155 6 | -------------------------------------------------------------------------------- /changelog/3.0.0/pr-411.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: Support Gradle 8. Drop support for Gradle 7. 4 | links: 5 | - https://github.com/palantir/gradle-shadow-jar/pull/411 6 | -------------------------------------------------------------------------------- /changelog/2.6.0/pr-332.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: No longer shade tracing or metric classes 4 | links: 5 | - https://github.com/palantir/gradle-shadow-jar/pull/332 6 | -------------------------------------------------------------------------------- /changelog/3.1.0/pr-552.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: exclude shaded configuration from checkUnusedConstraints task 4 | links: 5 | - https://github.com/palantir/gradle-shadow-jar/pull/552 6 | -------------------------------------------------------------------------------- /changelog/2.0.0/pr-137.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: Fix Gradle 7 compatibility. Increase minimum required Gradle version 4 | to 7.0. 5 | links: 6 | - https://github.com/palantir/gradle-shadow-jar/pull/137 7 | -------------------------------------------------------------------------------- /changelog/2.8.0/pr-362.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: ServiceLoader service providers within shaded modules work as expected 4 | links: 5 | - https://github.com/palantir/gradle-shadow-jar/pull/362 6 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/gradle-plugins/com.palantir.shadow-jar.properties: -------------------------------------------------------------------------------- 1 | # 2 | # (c) Copyright 2019 Palantir Technologies Inc. All rights reserved. 3 | # 4 | 5 | implementation-class=com.palantir.gradle.shadowjar.ShadowJarPlugin 6 | -------------------------------------------------------------------------------- /.changelog.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template. 2 | 3 | # This file is intentionally empty. The file's existence enables changelog-app and is empty to use the default configuration. 4 | -------------------------------------------------------------------------------- /changelog/1.0.1/pr-10.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix a bug where classes that are excluded from shading still that their 4 | references rewritten to use the shaded versions, which would produce broken jars. 5 | links: [] 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /changelog/1.3.2/pr-77.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Previously, projects that shaded multi-release jars may have had an 4 | empty line in the middle of their manifest, which would prevent the manifest from 5 | being parsed. This has been removed. 6 | links: 7 | - https://github.com/palantir/gradle-shadow-jar/pull/77 8 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | gradlePluginPortal() 5 | } 6 | dependencies { 7 | classpath 'com.palantir.gradle.jdks:gradle-jdks-settings:0.71.0' 8 | } 9 | } 10 | apply plugin: 'com.palantir.jdks.settings' 11 | rootProject.name = 'gradle-shadow-jar' 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## What happened? 2 | 3 | 7 | 8 | ## What did you want to happen? 9 | 10 | 13 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Before this PR 2 | 3 | 4 | ## After this PR 5 | 6 | ==COMMIT_MSG== 7 | ==COMMIT_MSG== 8 | 9 | ## Possible downsides? 10 | 11 | 12 | -------------------------------------------------------------------------------- /changelog/1.3.1/pr-74.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: '`shadowJar` now depends on the `jar` task in order to trigger tasks 4 | like `configureProductDependencies` from `com.palantir.sls-recommended-dependencies` 5 | which modify the `jar` manifest, so that these `manifest` changes are inherited 6 | by default in `shadowJar`.' 7 | links: 8 | - https://github.com/palantir/gradle-shadow-jar/pull/74 9 | -------------------------------------------------------------------------------- /.bulldozer.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template. 2 | 3 | version: 1 4 | merge: 5 | trigger: 6 | labels: ["merge when ready"] 7 | ignore: 8 | labels: ["do not merge"] 9 | method: squash 10 | options: 11 | squash: 12 | body: pull_request_body 13 | message_delimiter: ==COMMIT_MSG== 14 | delete_after_merge: true 15 | update: 16 | trigger: 17 | labels: ["update me"] 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.parallel=true 2 | org.gradle.caching = true 3 | org.gradle.jvmargs = --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 4 | palantir.jdk.setup.enabled=true 5 | palantir.native.formatter=true 6 | -------------------------------------------------------------------------------- /.excavator.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template. 2 | 3 | auto-label: 4 | names: 5 | versions-props/upgrade-all: [ "merge when ready" ] 6 | circleci/manage-circleci: [ "merge when ready" ] 7 | tags: 8 | donotmerge: [ "do not merge" ] 9 | roomba: [ "merge when ready", "🤖 fix nits" ] 10 | automerge: [ "merge when ready", "🤖 fix nits" ] 11 | standards: [ "merge when ready", "🤖 fix nits" ] 12 | autorelease: [ "autorelease" ] 13 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template: 2 | 3 | only: pulls 4 | staleLabel: stale 5 | pulls: 6 | daysUntilStale: 14 7 | daysUntilClose: 7 8 | exemptLabels: [ long-lived ] 9 | markComment: > 10 | This PR has been automatically marked as stale because it has not been touched in the last 14 days. 11 | If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days. 12 | closeComment: false 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ 2 | *.iml 3 | *.ipr 4 | *.iws 5 | .idea/ 6 | 7 | # Eclipse 8 | .classpath 9 | .checkstyle 10 | .factorypath 11 | .project 12 | .settings 13 | *.launch 14 | 15 | # Codegen 16 | .generated 17 | .apt_generated 18 | generated_src/ 19 | **/src/generated/ 20 | 21 | # OS X 22 | .DS_Store 23 | 24 | # Java 25 | *.class 26 | 27 | # Build Systems 28 | .gradle/ 29 | bin/ 30 | build/ 31 | out/ 32 | reports/ 33 | 34 | 35 | # SublimeText + TextMate + Vim 36 | *.sublime-workspace 37 | *.sublime-project 38 | *.tmproj 39 | *.tmproject 40 | *.sw[op] 41 | 42 | # Gradle JDKs setup 43 | !gradle/* 44 | -------------------------------------------------------------------------------- /.baseline/copyright/001_apache-2.0.txt: -------------------------------------------------------------------------------- 1 | (c) Copyright ${today.year} Palantir Technologies Inc. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /versions.props: -------------------------------------------------------------------------------- 1 | com.fasterxml.jackson.*:* = 2.20.1 2 | com.fasterxml.jackson.core:jackson-annotations = 2.20 3 | com.gradleup.shadow:shadow-gradle-plugin = 9.2.2 4 | org.immutables:value = 2.11.7 5 | com.google.guava:guava = 33.5.0-jre 6 | 7 | # Test deps 8 | com.palantir.tracing:tracing = 6.29.0 9 | com.palantir.safe-logging:safe-logging = 3.9.0 10 | com.palantir.tritium:tritium-registry = 0.115.0 11 | commons-io:commons-io = 2.21.0 12 | 13 | # conflict resolution 14 | com.google.code.findbugs:jsr305 = 3.0.2 15 | com.google.errorprone:error_prone_annotations = 2.11.0 16 | org.checkerframework:checker-qual = 3.52.0 17 | org.junit.jupiter:* = 6.0.1 18 | org.junit.platform:* = 6.0.1 19 | org.junit.vintage:* = 6.0.1 20 | 21 | # gradlePluginForTesting 22 | org.unbroken-dome.test-sets:org.unbroken-dome.test-sets.gradle.plugin = 4.1.0 23 | com.palantir.gradle.consistentversions:gradle-consistent-versions = 3.7.0 24 | com.netflix.nebula:nebula-publishing-plugin = 17.2.1 25 | -------------------------------------------------------------------------------- /.baseline/eclipse/dynamic/dotfile.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.baseline/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Autorelease 3 |

4 | 5 | # Gradle shadow jar ![Bintray](https://img.shields.io/bintray/v/palantir/releases/gradle-shadow-jar.svg) [![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](https://opensource.org/licenses/Apache-2.0) 6 | 7 | 8 | This is a Gradle plugin that wraps the existing [`shadow`](https://github.com/GradleUp/shadow) Gradle plugin to 9 | make producing *partially shaded jars* much easier. This means you can shade just one of your dependencies in a library or Gradle plugin to avoid dependency clashes. It is possible to produce fully shaded jars with this plugin, but it is not the aim of this plugin, and perf may be bad for shading a large dependency tree. 10 | 11 | ## Applying the plugin 12 | 13 | To apply this plugin, *build.gradle* should look something like: 14 | 15 | ```diff 16 | buildscript { 17 | repositories { 18 | maven { url 'https://dl.bintray.com/palantir/releases' } 19 | } 20 | 21 | dependencies { 22 | classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:' 23 | + classpath 'com.palantir.gradle.shadow-jar:gradle-shadow-jar:' 24 | } 25 | 26 | apply plugin: 'com.palantir.consistent-versions' 27 | + apply plugin: 'com.palantir.shadow-jar' 28 | } 29 | ``` 30 | 31 | *Requires [`gradle-consistent-versions`](https://github.com/palantir/gradle-consistent-versions) and Gradle 8.11+ to work.* 32 | 33 | ## Producing shaded JARs 34 | 35 | Shading is where you copy the class files of another jar into your jar, and then change the package names 36 | of the classes from the original jar. This removes dependencies from your project's publication and can reduce 37 | dependency conflicts at the expense of increased jar size and build time. 38 | 39 | To use, identify which of your dependencies you want shaded and put them in the `shadeTransitively` configuration like so: 40 | 41 | ```gradle 42 | dependencies { 43 | implementation 'some-unshaded:dependency' 44 | 45 | shadeTransitively 'com.google.guava:guava' 46 | } 47 | ``` 48 | 49 | The dependency you list and all its dependencies will be shaded *unless* one of these dependencies exists in other 50 | standard java configurations. For example, [`com.google.guava:guava:28.2-jre`](https://mvnrepository.com/artifact/com.google.guava/guava/28.2-jre) 51 | depends on [`'com.google.code.findbugs:jsr305:3.0.2'`](https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305/3.0.2). 52 | If you use the following: 53 | 54 | ```gradle 55 | dependencies { 56 | implementation 'com.google.code.findbugs:jsr305' 57 | 58 | shadeTransitively 'com.google.guava:guava' 59 | } 60 | ``` 61 | 62 | will shade `guava` and all its dependencies except for `jsr305` (and its dependencies), which will not be shaded and 63 | appear in the maven POM. 64 | 65 | We explicitly ban logging libraries from shading, as they can cause problems when shaded, and will show up as real 66 | dependencies in your POM, even if they were brought in as transitives through `shadeTransitively`. 67 | 68 | We also ban tracing and metric libraries, as they might rely on static variables (see `com.palantir.tracing.Tracer` 69 | and `com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry`). 70 | -------------------------------------------------------------------------------- /gradle/gradle-jdks-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # (c) Copyright 2024 Palantir Technologies Inc. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # 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, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | ############################################################################## 19 | # 20 | # Gradle jdk set up script for POSIX generated by gradle-jdks. 21 | # 22 | # This script does the following: 23 | # (1) Downloads all the JDK distributions that are present in `gradle/jdks` 24 | # (2) Installs the distributions in a temporary directory 25 | # (3) Calls the java class `GradleJdkInstallationSetup` that will move each distribution to 26 | # `$GRADLE_USER_HOME/${local_path}` based on the local_path=`gradle/jdks/${majorVersion}/${os}/${arch}/local_path` 27 | # and it will set up the certificates based on `gradle/certs` entries for the locally installed distribution 28 | # (4) Sets `org.gradle.java.home` to the JDK distribution that is used by the Gradle Daemon 29 | # 30 | # 31 | # Important for running: 32 | # This script requires all of these POSIX shell features: 33 | # * functions; 34 | # * expansions «$var», «${var}», «${var%suffix}», and «$( cmd )»; 35 | # * compound commands having a testable exit status, especially «case»; 36 | # * various built-in commands including «command» and «set». 37 | # 38 | ############################################################################## 39 | 40 | set -e 41 | # Set pipefail if it works in a subshell, disregard if unsupported 42 | # shellcheck disable=SC3040 43 | if (set -o pipefail 2>/dev/null); then 44 | set -o pipefail 45 | fi 46 | 47 | # Resolve links: $0 may be a link 48 | app_path=$0 49 | 50 | # Need this for daisy-chained symlinks. 51 | while 52 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 53 | [ -h "$app_path" ] 54 | do 55 | ls=$( ls -ld "$app_path" ) 56 | link=${ls#*' -> '} 57 | case $link in #( 58 | /*) app_path=$link ;; #( 59 | *) app_path=$APP_HOME$link ;; 60 | esac 61 | done 62 | 63 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 64 | APP_HOME=${APP_HOME%/gradle} 65 | APP_GRADLE_DIR="$APP_HOME"/gradle 66 | 67 | # Loading gradle jdk functions 68 | . "$APP_GRADLE_DIR"/gradle-jdks-functions.sh 69 | 70 | if ! is_arch_os_supported; then 71 | echo "Skipping Gradle JDKs Setup, Unsupported OS/Arch..." 72 | cleanup 73 | return 74 | fi 75 | 76 | install_and_setup_jdks "$APP_GRADLE_DIR" 77 | 78 | gradle_daemon_jdk_version=$(read_value "$APP_GRADLE_DIR"/gradle-daemon-jdk-version) 79 | gradle_daemon_jdk_distribution_local_path=$(read_value "$APP_GRADLE_DIR"/jdks/"$gradle_daemon_jdk_version"/"$OS"/"$ARCH"/local-path) 80 | "$GRADLE_JDKS_HOME"/"$gradle_daemon_jdk_distribution_local_path"/bin/java -cp "$APP_GRADLE_DIR"/gradle-jdks-setup.jar com.palantir.gradle.jdks.setup.GradleJdkInstallationSetup daemonSetup "$APP_HOME" "$GRADLE_JDKS_HOME/$gradle_daemon_jdk_distribution_local_path" 81 | 82 | # [Used by ./gradlew only] Setting the Gradle Daemon Java Home to the JDK distribution 83 | export GRADLE_DAEMON_JDK="$GRADLE_JDKS_HOME/$gradle_daemon_jdk_distribution_local_path" 84 | set -- "-Dorg.gradle.java.home=$GRADLE_DAEMON_JDK" "$@" 85 | 86 | cleanup 87 | -------------------------------------------------------------------------------- /src/main/java/com/palantir/gradle/shadowjar/JarFilesRelocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.palantir.gradle.shadowjar; 18 | 19 | import com.github.jengelman.gradle.plugins.shadow.relocation.CacheableRelocator; 20 | import com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator; 21 | import com.google.common.base.Preconditions; 22 | import com.google.common.base.Suppliers; 23 | import com.google.common.collect.ImmutableList; 24 | import java.io.IOException; 25 | import java.io.UncheckedIOException; 26 | import java.util.Collections; 27 | import java.util.Set; 28 | import java.util.function.Supplier; 29 | import java.util.jar.JarFile; 30 | import java.util.regex.Matcher; 31 | import java.util.regex.Pattern; 32 | import java.util.stream.Collectors; 33 | import java.util.stream.Stream; 34 | import java.util.zip.ZipEntry; 35 | import org.codehaus.plexus.util.SelectorUtils; 36 | import org.gradle.api.file.FileCollection; 37 | import org.gradle.api.logging.Logger; 38 | import org.gradle.api.logging.Logging; 39 | import org.gradle.api.tasks.Classpath; 40 | 41 | /** 42 | * Custom relocator that uses {@code Set} based lookups instead of {@link SimpleRelocator}'s include/exclude pattern 43 | * matching. 44 | * 45 | *

We don't use {@link SimpleRelocator}'s include list because it uses {@link SelectorUtils#matchPath} for every 46 | * pattern against every file in the jar, which is {@code O(n*m)} where {@code n = number of files} and 47 | * {@code m = number of patterns}. This causes a massive performance penalty (e.g., 8 minutes vs 13 seconds for tests). 48 | * 49 | *

Instead, we compute a set of relocatable paths upfront and use {@code O(1)} set lookups in 50 | * {@link SimpleRelocator#canRelocatePath}. 51 | */ 52 | @CacheableRelocator 53 | class JarFilesRelocator extends SimpleRelocator { 54 | private static final Logger log = Logging.getLogger(JarFilesRelocator.class); 55 | private static final Pattern MULTIRELEASE_JAR_PREFIX = Pattern.compile("^META-INF/versions/\\d+/"); 56 | private static final String SERVICE_PROVIDER_PREFIX = "META-INF/services/"; 57 | private static final String CLASS_SUFFIX = ".class"; 58 | 59 | private final FileCollection jars; 60 | private final Supplier> relocatable; 61 | 62 | JarFilesRelocator(String prefix, FileCollection jars) { 63 | super("", prefix, ImmutableList.of(), ImmutableList.of()); 64 | this.jars = jars; 65 | this.relocatable = Suppliers.memoize(() -> computeRelocatablePaths(scanJarsForPaths(jars))); 66 | } 67 | 68 | @Classpath 69 | public final FileCollection getJars() { 70 | return jars; 71 | } 72 | 73 | @Override 74 | public boolean canRelocatePath(String path) { 75 | return relocatable.get().contains(path + CLASS_SUFFIX) 76 | || relocatable.get().contains(path); 77 | } 78 | 79 | private static Set scanJarsForPaths(FileCollection jars) { 80 | return jars.getFiles().stream() 81 | .flatMap(jar -> { 82 | try (JarFile jarFile = new JarFile(jar)) { 83 | return Collections.list(jarFile.entries()).stream() 84 | .filter(entry -> !entry.isDirectory()) 85 | .map(ZipEntry::getName) 86 | .peek(path -> log.debug("Jar '{}' contains entry '{}'", jar.getName(), path)) 87 | .peek(path -> Preconditions.checkState( 88 | !path.startsWith("/"), "Unexpected absolute path '%s' in jar '%s'", path, jar)); 89 | } catch (IOException e) { 90 | throw new UncheckedIOException("Could not open jar file", e); 91 | } 92 | }) 93 | .collect(Collectors.toSet()); 94 | } 95 | 96 | private static Set computeRelocatablePaths(Set pathsInJars) { 97 | // For multi-release JARs (e.g., META-INF/versions/9/com/foo/Bar.class), we need to add the 98 | // unprefixed path (com/foo/Bar.class) to the relocatable set. This ensures that bytecode references 99 | // to com.foo.Bar are properly relocated, even though the actual file path relocation is handled by 100 | // ShadowCopyAction which temporarily removes the prefix before calling relocatePath. 101 | Set multiReleaseStuff = pathsInJars.stream() 102 | .flatMap(JarFilesRelocator::extractMultiReleasePath) 103 | .collect(Collectors.toSet()); 104 | 105 | return Stream.concat(pathsInJars.stream(), multiReleaseStuff.stream()) 106 | .filter(path -> !path.equals("META-INF/MANIFEST.MF")) // don't relocate this! 107 | .filter(path -> !path.startsWith(SERVICE_PROVIDER_PREFIX)) // service providers remain in the root 108 | .collect(Collectors.toSet()); 109 | } 110 | 111 | /* 112 | Returns the path without the multi-release prefix e.g. 113 | 'com/foo/Bar.class' from 'META-INF/versions/9/com/foo/Bar.class'. 114 | */ 115 | private static Stream extractMultiReleasePath(String input) { 116 | Matcher matcher = MULTIRELEASE_JAR_PREFIX.matcher(input); 117 | if (matcher.find()) { 118 | return Stream.of(input.substring(matcher.end())); 119 | } else { 120 | return Stream.empty(); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # This file was generated by the excavator check 'excavator/manage-circleci' as specified in .circleci/template.sh. 2 | # To request a modification to the general template, file an issue on Excavator. 3 | # To manually manage the CircleCI configuration for this project, remove the .circleci/template.sh file. 4 | 5 | version: 2.1 6 | 7 | aliases: 8 | - &check-no-files-changed 9 | run: 10 | name: Check that no git-tracked files were modified 11 | command: | 12 | FILES_MODIFIED="$(git status --porcelain)" 13 | if [[ -n "$FILES_MODIFIED" ]]; then 14 | echo "The following files were modified or added during the build process:" 15 | echo "$FILES_MODIFIED" 16 | echo "This will likely prevent successful publishing. Please run the build locally and include these changes in your pull request. (If new files are created, consider whether they should be checked in or .gitignored.)" 17 | exit 1 18 | fi 19 | 20 | jobs: 21 | 22 | check: 23 | docker: [{ image: 'cimg/openjdk:11.0.22-node' }] 24 | resource_class: large 25 | environment: 26 | CIRCLE_TEST_REPORTS: /home/circleci/junit 27 | CIRCLE_ARTIFACTS: /home/circleci/artifacts 28 | GRADLE_OPTS: -Dorg.gradle.workers.max=2 -Dorg.gradle.jvmargs='-Xmx2147483648 --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' 29 | _JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts 30 | steps: 31 | - checkout 32 | - run: 33 | name: delete_unrelated_tags 34 | command: | 35 | ALL_TAGS=$(git tag --points-at HEAD) 36 | 37 | if [ -z "$ALL_TAGS" ]; then 38 | echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))" 39 | exit 0 40 | fi 41 | 42 | if [ -z "${CIRCLE_TAG:+x}" ]; then 43 | echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]" 44 | echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done 45 | exit 0 46 | fi 47 | 48 | TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :) 49 | if [ -z "$TAGS_TO_DELETE" ]; then 50 | echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD" 51 | exit 0 52 | fi 53 | 54 | echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]" 55 | echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done 56 | - restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' } 57 | - restore_cache: { key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' } 58 | - run: 59 | name: check-setup 60 | command: | 61 | if [ -x .circleci/check-setup.sh ]; then 62 | echo "Running check-setup" && .circleci/check-setup.sh && echo "check-setup complete" 63 | fi 64 | - run: ./gradlew --parallel --stacktrace --continue --max-workers=2 build -Porg.gradle.java.installations.fromEnv=JAVA_11_HOME,JAVA_17_HOME,JAVA_21_HOME,JAVA_HOME 65 | - *check-no-files-changed 66 | - persist_to_workspace: 67 | root: /home/circleci 68 | paths: [ project ] 69 | - save_cache: 70 | key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' 71 | paths: [ ~/.gradle/wrapper ] 72 | - save_cache: 73 | key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' 74 | paths: [ ~/.gradle/caches ] 75 | - run: 76 | command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \; 77 | when: always 78 | - store_test_results: { path: ~/junit } 79 | - store_artifacts: { path: ~/artifacts } 80 | 81 | publish: 82 | docker: [{ image: 'cimg/openjdk:11.0.22-node' }] 83 | resource_class: medium 84 | environment: 85 | CIRCLE_TEST_REPORTS: /home/circleci/junit 86 | CIRCLE_ARTIFACTS: /home/circleci/artifacts 87 | GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2147483648 --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' 88 | _JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts 89 | steps: 90 | - attach_workspace: { at: /home/circleci } 91 | - restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' } 92 | - restore_cache: { key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' } 93 | - deploy: 94 | command: ./gradlew --parallel --stacktrace --continue --no-configuration-cache publish -Porg.gradle.java.installations.fromEnv=JAVA_11_HOME,JAVA_17_HOME,JAVA_21_HOME,JAVA_HOME 95 | - run: 96 | command: git status --porcelain 97 | when: always 98 | - save_cache: 99 | key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' 100 | paths: [ ~/.gradle/caches ] 101 | - store_test_results: { path: ~/junit } 102 | - store_artifacts: { path: ~/artifacts } 103 | 104 | circle-all: 105 | docker: [{ image: 'busybox:1.36.1@sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74' }] 106 | resource_class: small 107 | steps: 108 | - run: {command: echo "All required jobs finished successfully"} 109 | 110 | workflows: 111 | version: 2 112 | build: 113 | jobs: 114 | - check: 115 | filters: { tags: { only: /.*/ } } 116 | 117 | - circle-all: 118 | requires: [ check ] 119 | filters: { tags: { only: /.*/ } } 120 | 121 | - publish: 122 | requires: [ circle-all ] 123 | filters: { tags: { only: /.*/ }, branches: { only: develop } } 124 | -------------------------------------------------------------------------------- /gradle/gradle-jdks-functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | # Set pipefail if it works in a subshell, disregard if unsupported 5 | # shellcheck disable=SC3040 6 | if (set -o pipefail 2>/dev/null); then 7 | set -o pipefail 8 | fi 9 | # 10 | # (c) Copyright 2024 Palantir Technologies Inc. All rights reserved. 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | # 24 | 25 | TMP_WORK_DIR=$(mktemp -d) 26 | export TMP_WORK_DIR 27 | 28 | # writing to stderr 29 | write() { echo "$*" >&2; } 30 | 31 | cleanup() { 32 | [ -d "$TMP_WORK_DIR" ] && rm -rf "$TMP_WORK_DIR" 33 | } 34 | 35 | die() { 36 | write 37 | write "$*" 38 | write 39 | cleanup 40 | exit 1 41 | } >&2 42 | 43 | read_value() { 44 | if [ ! -f "$1" ]; then 45 | die "ERROR: $1 not found, aborting Gradle JDK setup" 46 | fi 47 | read -r value < "$1" || die "ERROR: Unable to read value from $1. Make sure the file ends with a newline." 48 | echo "$value" 49 | } 50 | 51 | get_os() { 52 | # OS specific support; same as gradle-jdks:com.palantir.gradle.jdks.setup.common.CurrentOs.java 53 | case "$( uname )" in #( 54 | Linux* ) os_name="linux" ;; #( 55 | Darwin* ) os_name="macos" ;; #( 56 | * ) os_name="unsupported";; 57 | esac 58 | 59 | if [ "$os_name" = "linux" ]; then 60 | ldd_output=$(ldd --version 2>&1 || true) 61 | if echo "$ldd_output" | grep -qi glibc; then 62 | os_name="linux-glibc" 63 | elif echo "$ldd_output" | grep -qi "gnu libc"; then 64 | os_name="linux-glibc" 65 | elif echo "$ldd_output" | grep -qi musl; then 66 | os_name="linux-musl" 67 | else 68 | die "Unable to determine glibc or musl based Linux distribution: ldd_output: $ldd_output" 69 | fi 70 | fi 71 | 72 | echo "$os_name" 73 | } 74 | 75 | get_arch() { 76 | # Arch specific support, see: gradle-jdks:com.palantir.gradle.jdks.setup.common.CurrentArch.java 77 | case "$(uname -m)" in #( 78 | x86_64* ) arch_name="x86-64" ;; #( 79 | x64* ) arch_name="x86-64" ;; #( 80 | amd64* ) arch_name="x86-64" ;; #( 81 | arm64* ) arch_name="aarch64" ;; #( 82 | arm* ) arch_name="aarch64" ;; #( 83 | aarch64* ) arch_name="aarch64" ;; #( 84 | x86* ) arch_name="x86" ;; #( 85 | i686* ) arch_name="x86" ;; #( 86 | * ) arch_name="unsupported";; 87 | esac 88 | 89 | echo "$arch_name" 90 | } 91 | 92 | get_gradle_jdks_home() { 93 | gradle_user_home=${GRADLE_USER_HOME:-"$HOME"/.gradle} 94 | gradle_jdks_home="$gradle_user_home"/gradle-jdks 95 | echo "$gradle_jdks_home" 96 | } 97 | 98 | get_java_home() { 99 | java_bin=$(find "$1" -type f -name "java" -path "*/bin/java" ! -type l -print -quit) 100 | echo "${java_bin%/*/*}" 101 | } 102 | 103 | GRADLE_JDKS_HOME=$(get_gradle_jdks_home) 104 | mkdir -p "$GRADLE_JDKS_HOME" 105 | export GRADLE_JDKS_HOME 106 | 107 | OS=$(get_os) 108 | export OS 109 | 110 | ARCH=$(get_arch) 111 | export ARCH 112 | 113 | is_arch_os_supported() { 114 | if [ "$OS" = "unsupported" ] || [ "$ARCH" = "unsupported" ]; then 115 | return 1 # false 116 | fi 117 | return 0 # true 118 | } 119 | 120 | install_and_setup_jdks() { 121 | gradle_dir=$1 122 | scripts_dir=${2:-"$1"} 123 | 124 | for dir in "$gradle_dir"/jdks/*/; do 125 | major_version_dir=${dir%*/} 126 | major_version=${major_version_dir##*/} 127 | if [ "$major_version" = "8" ]; then 128 | write "Skipping JDK 8 installation as it is not supported by Gradle JDKs Setup." 129 | continue 130 | fi 131 | distribution_local_path=$(read_value "$major_version_dir"/"$OS"/"$ARCH"/local-path) 132 | distribution_url=$(read_value "$major_version_dir"/"$OS"/"$ARCH"/download-url) 133 | # Check if distribution exists in $GRADLE_JDKS_HOME 134 | jdk_installation_directory="$GRADLE_JDKS_HOME"/"$distribution_local_path" 135 | if [ ! -d "$jdk_installation_directory" ]; then 136 | write "JDK installation '$jdk_installation_directory' does not exist, installing '$distribution_url' in progress ..." 137 | elif [ ! -f "$jdk_installation_directory/bin/java" ]; then 138 | write "Java executable not found in $jdk_installation_directory/bin/java, re-installing the JDK...." 139 | else 140 | continue 141 | fi 142 | # Download and extract the distribution into a temporary directory 143 | in_progress_dir="$TMP_WORK_DIR/$distribution_local_path.in-progress" 144 | mkdir -p "$in_progress_dir" 145 | cd "$in_progress_dir" || die "failed to change dir to $in_progress_dir" 146 | if command -v curl > /dev/null 2>&1; then 147 | write "Using curl to download $distribution_url" 148 | case "$distribution_url" in 149 | *.zip) 150 | distribution_name=${distribution_url##*/} 151 | curl -L -C - "$distribution_url" -o "$distribution_name" 152 | tar -xzf "$distribution_name" 153 | ;; 154 | *) 155 | curl -L -C - "$distribution_url" | tar -xzf - 156 | ;; 157 | esac 158 | elif command -v wget > /dev/null 2>&1; then 159 | write "Using wget to download $distribution_url" 160 | case "$distribution_url" in 161 | *.zip) 162 | distribution_name=${distribution_url##*/} 163 | wget -c "$distribution_url" -O "$distribution_name" 164 | tar -xzf "$distribution_name" 165 | ;; 166 | *) 167 | wget -qO- -c "$distribution_url" | tar -xzf - 168 | ;; 169 | esac 170 | else 171 | die "ERROR: Neither curl nor wget are installed, Could not set up JAVA_HOME" 172 | fi 173 | cd - > /dev/null || die "failed to change dir to old pwd: $OLDPWD" 174 | 175 | # Finding the java_home 176 | java_home=$(get_java_home "$in_progress_dir") 177 | "$java_home"/bin/java -cp "$scripts_dir"/gradle-jdks-setup.jar com.palantir.gradle.jdks.setup.GradleJdkInstallationSetup jdkSetup "$jdk_installation_directory" || die "Failed to set up JDK $jdk_installation_directory" 178 | write "Successfully installed JDK distribution in $jdk_installation_directory" 179 | done 180 | } 181 | -------------------------------------------------------------------------------- /.baseline/eclipse/static/dotfile.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true 3 | formatter_profile=_Baseline Profile 4 | formatter_settings_version=12 5 | org.eclipse.jdt.ui.exception.name=e 6 | org.eclipse.jdt.ui.gettersetter.use.is=false 7 | org.eclipse.jdt.ui.ignorelowercasenames=true 8 | org.eclipse.jdt.ui.importorder=; 9 | org.eclipse.jdt.ui.javadoc=false 10 | org.eclipse.jdt.ui.keywordthis=false 11 | org.eclipse.jdt.ui.ondemandthreshold=999 12 | org.eclipse.jdt.ui.overrideannotation=true 13 | org.eclipse.jdt.ui.staticondemandthreshold=999 14 | org.eclipse.jdt.ui.text.custom_code_templates=