├── changelog ├── @unreleased │ └── .gitkeep ├── 7.69.0 │ └── pr-1712.v2.yml ├── 4.13.1 │ └── pr-913.v2.yml ├── 4.16.3 │ └── pr-965.v2.yml ├── 4.11.3 │ └── pr-886.v2.yml ├── 4.20.0 │ └── pr-1015.v2.yml ├── 4.3.1 │ └── pr-647.v2.yml ├── 4.6.0 │ ├── pr-753.v2.yml │ └── pr-749.v2.yml ├── 5.2.0 │ ├── pr-1118.v2.yml │ └── pr-1146.v2.yml ├── 7.74.0 │ └── pr-1772.v2.yml ├── 3.8.1 │ └── pr-543.v2.yml ├── 4.15.1 │ └── pr-921.v2.yml ├── 4.26.0 │ └── pr-1060.v2.yml ├── 4.3.2 │ └── pr-649.v2.yml ├── 5.3.0 │ ├── pr-1151.v2.yml │ └── pr-1150.v2.yml ├── 6.3.0 │ └── pr-1181.v2.yml ├── 7.42.0 │ └── pr-1525.v2.yml ├── 4.18.1 │ └── pr-1013.v2.yml ├── 5.4.0 │ └── pr-1154.v2.yml ├── 5.8.0 │ └── pr-1166.v2.yml ├── 7.5.0 │ └── pr-1201.v2.yml ├── 7.55.0 │ └── pr-1645.v2.yml ├── 7.57.0 │ └── pr-1649.v2.yml ├── 7.68.0 │ └── pr-1709.v2.yml ├── 4.16.2 │ └── pr-945.v2.yml ├── 4.5.0 │ ├── pr-710.v2.yml │ └── pr-715.v2.yml ├── 5.5.0 │ └── pr-1155.v2.yml ├── 5.9.0 │ └── pr-1167.v2.yml ├── 7.25.0 │ └── pr-1414.v2.yml ├── 7.35.0 │ └── pr-1470.v2.yml ├── 7.43.0 │ └── pr-1539.v2.yml ├── 7.52.0 │ └── pr-1641.v2.yml ├── 7.76.0 │ └── pr-1803.v2.yml ├── 4.25.1 │ └── pr-1059.v2.yml ├── 4.28.1 │ └── pr-1084.v2.yml ├── 4.30.0 │ └── pr-1086.v2.yml ├── 5.7.0 │ └── pr-1164.v2.yml ├── 7.15.0 │ └── pr-1272.v2.yml ├── 7.33.0 │ └── pr-1452.v2.yml ├── 7.4.0 │ └── pr-1196.v2.yml ├── 7.45.0 │ └── pr-1585.v2.yml ├── 7.67.0 │ └── pr-1703.v2.yml ├── 4.17.0 │ └── pr-1005.v2.yml ├── 4.28.0 │ ├── pr-1081.v2.yml │ └── pr-1080.v2.yml ├── 4.3.3 │ └── pr-678.v2.yml ├── 6.1.0 │ └── pr-1174.v2.yml ├── 6.2.0 │ └── pr-1176.v2.yml ├── 7.12.0 │ └── pr-1245.v2.yml ├── 7.18.0 │ └── pr-1289.v2.yml ├── 7.19.0 │ └── pr-1292.v2.yml ├── 7.24.0 │ ├── pr-1371.v2.yml │ └── pr-1411.v2.yml ├── 7.36.0 │ ├── pr-1479.v2.yml │ ├── pr-1472.v2.yml │ └── pr-1505.v2.yml ├── 7.56.0 │ └── pr-1646.v2.yml ├── 7.58.0 │ └── pr-1662.v2.yml ├── 7.77.0 │ └── pr-1825.v2.yml ├── 7.9.0 │ └── pr-1221.v2.yml ├── 4.21.0 │ └── pr-1016.v2.yml ├── 4.25.0 │ └── pr-1058.v2.yml ├── 7.0.0 │ └── pr-1183.v2.yml ├── 7.21.0 │ └── pr-1349.v2.yml ├── 7.27.0 │ └── pr-1424.v2.yml ├── 7.41.0 │ └── pr-1520.v2.yml ├── 7.64.0 │ └── pr-1673.v2.yml ├── 4.11.2 │ └── pr-875.v2.yml ├── 4.13.0 │ └── pr-907.v2.yml ├── 4.19.0 │ └── pr-1017.v2.yml ├── 5.0.0 │ └── pr-1093.v2.yml ├── 7.17.0 │ └── pr-1282.v2.yml ├── 7.34.0 │ └── pr-1454.v2.yml ├── 7.40.0 │ └── pr-1519.v2.yml ├── 7.44.0 │ └── pr-1543.v2.yml ├── 7.53.0 │ └── pr-1642.v2.yml ├── 7.72.0 │ └── pr-1762.v2.yml ├── 7.16.0 │ └── pr-1280.v2.yml ├── 7.2.0 │ └── pr-1191.v2.yml ├── 7.38.0 │ └── pr-1516.v2.yml ├── 7.70.0 │ └── pr-1756.v2.yml ├── 4.15.0 │ └── pr-919.v2.yml ├── 7.1.0 │ └── pr-1184.v2.yml ├── 7.39.0 │ └── pr-1517.v2.yml ├── 7.46.0 │ └── pr-1581.v2.yml ├── 7.50.0 │ └── pr-1633.v2.yml ├── 7.7.0 │ └── pr-1215.v2.yml ├── 4.16.4 │ └── go-java-launcher-1.10.0.v2.yml ├── 5.1.0 │ └── pr-1095.v2.yml ├── 7.10.0 │ └── pr-1223.v2.yml ├── 4.5.1 │ └── pr-727.v2.yml ├── 4.7.0 │ └── pr-800.v2.yml ├── 7.37.0 │ └── pr-1510.v2.yml ├── 7.49.0 │ └── pr-1632.v2.yml ├── 4.1.0 │ └── pr-618.v2.yml ├── 4.23.1 │ └── pr-1045.v2.yml ├── 7.48.0 │ └── pr-1629.v2.yml ├── 7.59.0 │ └── pr-1666.v2.yml ├── 4.16.1 │ └── pr-926.v2.yml ├── 7.26.0 │ └── pr-1417.v2.yml ├── 7.75.0 │ └── pr-1787.v2.yml ├── 7.8.0 │ └── pr-1220.v2.yml ├── 4.3.0 │ └── pr-644.v2.yml ├── 4.27.1 │ └── pr-1078.v2.yml ├── 7.51.0 │ └── pr-1636.v2.yml ├── 4.18.0 │ └── pr-1007.v2.yml ├── 5.6.0 │ └── pr-1160.v2.yml ├── 4.2.0 │ └── pr-631.v2.yml ├── 4.29.0 │ └── pr-1085.v2.yml ├── 7.23.0 │ └── pr-1372.v2.yml ├── 7.29.0 │ └── pr-1436.v2.yml ├── 7.30.0 │ └── pr-1441.v2.yml ├── 7.54.0 │ └── pr-1643.v2.yml ├── 4.14.0 │ └── pr-916.v2.yml ├── 7.31.0 │ └── pr-1443.v2.yml ├── 4.4.0 │ ├── pr-696.v2.yml │ └── pr-680.v2.yml ├── 4.0.0 │ └── pr-580.v2.yml ├── 4.22.1 │ └── pr-1012.v2.yml ├── 4.4.1 │ └── pr-711.v2.yml ├── 7.28.0 │ └── pr-1434.v2.yml ├── 4.10.1 │ └── pr-852.v2.yml ├── 4.22.0 │ └── pr-1033.v2.yml ├── 4.8.0 │ └── pr-844.v2.yml ├── 4.11.1 │ └── pr-870.v2.yml ├── 7.61.0 │ └── pr-1668.v2.yml ├── 7.20.0 │ └── pr-1294.v2.yml ├── 7.66.0 │ └── pr-1693.v2.yml ├── 4.27.0 │ └── pr-1074.v2.yml ├── 7.22.0 │ └── pr-1370.v2.yml ├── 7.11.0 │ └── pr-1178.v2.yml ├── 4.12.0 │ └── pr-899.v2.yml ├── 6.0.0 │ └── pr-1149.v2.yml ├── 4.24.1 │ └── pr-1054.v2.yml ├── 4.23.0 │ └── pr-1034.v2.yml └── 7.32.0 │ └── pr-1380.v2.yml ├── gradle ├── wrapper │ ├── .gitignore │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── 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 ├── gradle-jdks-setup.jar └── gradle-jdks-setup.sh ├── .circleci ├── .gitattributes └── template.sh ├── gradle-sls-packaging ├── src │ ├── test │ │ ├── resources │ │ │ ├── a-1.0.jar │ │ │ ├── b-1.0.jar │ │ │ ├── external.jar │ │ │ ├── missing-manifest.jar │ │ │ └── b-duplicate-different-versions-1.0.jar │ │ ├── groovy │ │ │ └── com │ │ │ │ └── palantir │ │ │ │ └── gradle │ │ │ │ └── dist │ │ │ │ ├── Versions.java │ │ │ │ ├── service │ │ │ │ ├── ExampleTouchService.java │ │ │ │ ├── GcProfileIntegrationSpec.groovy │ │ │ │ └── DiagnosticsManifestPluginIntegrationSpec.groovy │ │ │ │ ├── ObjectMappersTest.java │ │ │ │ ├── asset │ │ │ │ └── AssetDistributionExtensionTest.groovy │ │ │ │ ├── GradleIntegrationSpec.groovy │ │ │ │ ├── ProductDependencyTest.groovy │ │ │ │ ├── tasks │ │ │ │ └── CreateManifestTaskTest.groovy │ │ │ │ ├── ProductDependencyMergerTest.groovy │ │ │ │ ├── ProductDependencyIntrospectionPluginTest.groovy │ │ │ │ ├── ProductDependencyLockFileTest.groovy │ │ │ │ └── pdeps │ │ │ │ └── ResolveProductDependenciesTaskSpec.groovy │ │ └── java │ │ │ └── com │ │ │ └── palantir │ │ │ └── gradle │ │ │ └── dist │ │ │ └── GradleTestVersions.java │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── gradle-plugins │ │ │ │ ├── com.palantir.sls-recommended-dependencies.properties │ │ │ │ └── com.palantir.product-dependency-introspection.properties │ │ └── sls-packaging │ │ │ ├── check.sh │ │ │ └── init.sh │ │ └── java │ │ └── com │ │ └── palantir │ │ └── gradle │ │ └── dist │ │ ├── service │ │ ├── MergeDiagnosticsJsonTask.java │ │ ├── tasks │ │ │ ├── CreateInitScriptTask.java │ │ │ ├── CreateCheckScriptTask.java │ │ │ ├── LaunchConfigTask.java │ │ │ ├── CreateInitScript.java │ │ │ └── CreateCheckScript.java │ │ ├── Diagnostics.java │ │ ├── util │ │ │ ├── EmitFiles.java │ │ │ └── MainClassResolver.java │ │ └── MergeDiagnosticsJson.java │ │ ├── artifacts │ │ ├── ArtifactLocator.java │ │ ├── FileExtractParameter.java │ │ ├── FileAndManifestExtractParameter.java │ │ ├── JsonArtifactLocator.java │ │ ├── SelectSingleFile.java │ │ ├── ExtractFileFromJar.java │ │ ├── ExtractSingleFileOrManifest.java │ │ └── PreferProjectCompatibilityRule.java │ │ ├── ProductType.java │ │ ├── pdeps │ │ └── ProductDependencyManifest.java │ │ ├── asset │ │ ├── GcvUtils.java │ │ └── AssetDistributionExtension.java │ │ ├── SlsManifest.java │ │ ├── tasks │ │ ├── WriteSchemaVersionLocksMarkerTask.java │ │ ├── WriteProductDependenciesLocksMarkerTask.java │ │ └── ConfigTarTask.java │ │ ├── SlsBaseDistPlugin.java │ │ ├── ProductId.java │ │ ├── DeploymentDirInclusion.java │ │ ├── ObjectMappers.java │ │ └── ProductDependencyLockFile.java └── build.gradle ├── gradle-recommended-product-dependencies ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ └── com.palantir.recommended-product-dependencies.properties │ │ └── java │ │ │ └── com │ │ │ └── palantir │ │ │ └── gradle │ │ │ └── dist │ │ │ ├── RecommendedProductDependencies.java │ │ │ ├── CompileRecommendedProductDependencies.java │ │ │ ├── RecommendedProductDependenciesExtension.java │ │ │ ├── RecommendedProductDependenciesPlugin.java │ │ │ └── ConfigureProductDependenciesTask.java │ └── test │ │ └── java │ │ └── com │ │ └── palantir │ │ └── gradle │ │ └── dist │ │ └── GradleTestVersions.java └── build.gradle ├── .changelog.yml ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── stale.yml ├── gradle-sls-packaging-api ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── palantir │ └── gradle │ └── dist │ ├── SchemaMigration.java │ └── SchemaVersionLockFile.java ├── gradle.properties ├── settings.gradle ├── .bulldozer.yml ├── .excavator.yml ├── .gitignore ├── .baseline ├── copyright │ └── 001_apache-2.0.txt ├── eclipse │ └── dynamic │ │ └── dotfile.checkstyle └── checkstyle │ └── checkstyle-suppressions.xml ├── versions.props ├── .palantir └── revapi.yml └── gradlew.bat /changelog/@unreleased/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | !*.jar 2 | -------------------------------------------------------------------------------- /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/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/17/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/gradle-jdks-setup.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/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 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/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/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/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-sls-packaging/src/test/resources/a-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/HEAD/gradle-sls-packaging/src/test/resources/a-1.0.jar -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/resources/b-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/HEAD/gradle-sls-packaging/src/test/resources/b-1.0.jar -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /changelog/7.69.0/pr-1712.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: fix publishing 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1712 6 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/resources/external.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/HEAD/gradle-sls-packaging/src/test/resources/external.jar -------------------------------------------------------------------------------- /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/4.13.1/pr-913.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix typo in Java flags 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/913 6 | -------------------------------------------------------------------------------- /changelog/4.16.3/pr-965.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Update YourKit version 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/965 6 | -------------------------------------------------------------------------------- /.circleci/template.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export CIRCLECI_TEMPLATE=java-library-oss 3 | export JDK=17 4 | export PERSIST_WORKSPACE_BETWEEN_CHECK_AND_PUBLISH=false 5 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/resources/missing-manifest.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/HEAD/gradle-sls-packaging/src/test/resources/missing-manifest.jar -------------------------------------------------------------------------------- /changelog/4.11.3/pr-886.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: '`run` works with gradle 6.4 and up' 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/886 6 | -------------------------------------------------------------------------------- /changelog/4.20.0/pr-1015.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add empty GC profile 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1015 6 | -------------------------------------------------------------------------------- /changelog/4.3.1/pr-647.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Correctly configure `run` task lazily 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/647 6 | -------------------------------------------------------------------------------- /changelog/4.6.0/pr-753.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Add support for Linux arm64 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/753 6 | -------------------------------------------------------------------------------- /changelog/5.2.0/pr-1118.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: use mavenCentral in tests 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1118 6 | -------------------------------------------------------------------------------- /changelog/7.74.0/pr-1772.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Add enableAlwaysPreTouch option 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1772 6 | -------------------------------------------------------------------------------- /changelog/3.8.1/pr-543.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Correctly merge discovered product dependencies 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/543 6 | -------------------------------------------------------------------------------- /changelog/4.15.1/pr-921.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Correctly configure start scripts in Gradle 6.4+ 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/921 6 | -------------------------------------------------------------------------------- /changelog/4.26.0/pr-1060.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Expose pdeps as a property 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1060 6 | -------------------------------------------------------------------------------- /changelog/4.3.2/pr-649.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Run task correctly uses the discovered mainClass 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/649 6 | -------------------------------------------------------------------------------- /changelog/5.3.0/pr-1151.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: javaVersion use is documented 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1151 6 | -------------------------------------------------------------------------------- /changelog/6.3.0/pr-1181.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Remove unused pod product type 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1181 6 | -------------------------------------------------------------------------------- /changelog/7.42.0/pr-1525.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Opt out of AVX-512 once again 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1525 6 | -------------------------------------------------------------------------------- /changelog/4.18.1/pr-1013.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Downgrade jackson to 2.11.1 to avoid jackson bugs 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1013 6 | -------------------------------------------------------------------------------- /changelog/5.2.0/pr-1146.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: move product dep calcs into own task 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1146 6 | -------------------------------------------------------------------------------- /changelog/5.4.0/pr-1154.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: removes change to depend directly on configurations 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1154 6 | -------------------------------------------------------------------------------- /changelog/5.8.0/pr-1166.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Handle missing manifest when transforming artifacts 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1166 6 | -------------------------------------------------------------------------------- /changelog/7.5.0/pr-1201.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Declare missing task dependencies of configTar task 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1201 6 | -------------------------------------------------------------------------------- /changelog/7.55.0/pr-1645.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Added the `HELM_CHART_V1` `ProductType`. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1645 6 | -------------------------------------------------------------------------------- /changelog/7.57.0/pr-1649.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: add artifacts manifest extension 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1649 6 | -------------------------------------------------------------------------------- /changelog/7.68.0/pr-1709.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: remove accidental connection between task outputs 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1709 6 | -------------------------------------------------------------------------------- /changelog/4.16.2/pr-945.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Prefer in declared dependency when merging in repo pdeps 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/945 6 | -------------------------------------------------------------------------------- /changelog/4.5.0/pr-710.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Fix typo when specifying `-XX:+UseNUMA` 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/710 6 | -------------------------------------------------------------------------------- /changelog/5.3.0/pr-1150.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: resolve race condition with jar manifest manipulation 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1150 6 | -------------------------------------------------------------------------------- /changelog/5.5.0/pr-1155.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Revert "move product dep calcs into own task (#1146)" 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1155 6 | -------------------------------------------------------------------------------- /changelog/5.9.0/pr-1167.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: logs message only if a declared and a recommended overlap 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1167 6 | -------------------------------------------------------------------------------- /changelog/7.25.0/pr-1414.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Enable 'UseContainerCpuShares' for java distributions 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1414 6 | -------------------------------------------------------------------------------- /changelog/7.35.0/pr-1470.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Create api project for schema lock file 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1470 6 | -------------------------------------------------------------------------------- /changelog/7.43.0/pr-1539.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Allow AVX-512 instructions on JDK-21+ 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1539 6 | -------------------------------------------------------------------------------- /changelog/7.52.0/pr-1641.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Make input/output methods public on CreateManifestTask 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1641 6 | -------------------------------------------------------------------------------- /changelog/7.76.0/pr-1803.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Do not cache any artifact transforms 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1803 6 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/resources/META-INF/gradle-plugins/com.palantir.sls-recommended-dependencies.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.palantir.gradle.dist.RecommendedProductDependenciesPlugin 2 | -------------------------------------------------------------------------------- /changelog/4.25.1/pr-1059.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Expose provider on RecommendedProductDependenciesExtension 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1059 6 | -------------------------------------------------------------------------------- /changelog/4.28.1/pr-1084.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: The new `javaAgent` configuration is no longer non-transitive 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1084 6 | -------------------------------------------------------------------------------- /changelog/4.30.0/pr-1086.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: bump go-java-launcher to 1.11.0 (was 1.10.0) 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1086 6 | -------------------------------------------------------------------------------- /changelog/5.7.0/pr-1164.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Discover product dependencies in a lazy, pluggable way 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1164 6 | -------------------------------------------------------------------------------- /changelog/7.15.0/pr-1272.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Explicitly declare variant for resolving product dependencies 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1272 6 | -------------------------------------------------------------------------------- /changelog/7.33.0/pr-1452.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: This reverts commit 902de8d0c0d68098fc7fb5f5932c9cbc0a3a8e6a. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1452 6 | -------------------------------------------------------------------------------- /changelog/7.4.0/pr-1196.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Use Gradle 7 and increase source compat to 11 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1196 6 | -------------------------------------------------------------------------------- /changelog/7.45.0/pr-1585.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: More specific command in lock file headers 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1585 6 | -------------------------------------------------------------------------------- /changelog/7.67.0/pr-1703.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Added the `FOUNDRY_PRODUCT_V1` `ProductType`. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1703 6 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/resources/META-INF/gradle-plugins/com.palantir.product-dependency-introspection.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.palantir.gradle.dist.ProductDependencyIntrospectionPlugin 2 | -------------------------------------------------------------------------------- /changelog/4.17.0/pr-1005.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Disable string deduplication for the G1 collector 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1005 6 | -------------------------------------------------------------------------------- /changelog/4.28.0/pr-1081.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Update YourKit to 2020.9-b424 from 2020.9-b416 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1081 6 | -------------------------------------------------------------------------------- /changelog/4.3.3/pr-678.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Service Distributions "run" task correctly respects the GC profile 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/678 6 | -------------------------------------------------------------------------------- /changelog/6.1.0/pr-1174.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Enable `-XX:NativeMemoryTracking=summary` for all 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1174 6 | -------------------------------------------------------------------------------- /changelog/6.2.0/pr-1176.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add jvm args to jdk16+ to support safepoint metrics 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1176 6 | -------------------------------------------------------------------------------- /changelog/7.12.0/pr-1245.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Upgrade go-java-launcher to 1.15.0 (was 1.13.0) 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1245 6 | -------------------------------------------------------------------------------- /changelog/7.18.0/pr-1289.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Update go-java-launcher to 1.17.0 (was 1.15.0) 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1289 6 | -------------------------------------------------------------------------------- /changelog/7.19.0/pr-1292.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Update go-java-launcher to 1.18.0 (was 1.17.0) 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1292 6 | -------------------------------------------------------------------------------- /changelog/7.24.0/pr-1371.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Gradle wrapper is updated to latest version `7.5` 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1371 6 | -------------------------------------------------------------------------------- /changelog/7.36.0/pr-1479.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Clarify error message with recommended next steps 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1479 6 | -------------------------------------------------------------------------------- /changelog/7.56.0/pr-1646.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: '`ConfigTarTask` supports custom `configuration.yml` location' 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1646 6 | -------------------------------------------------------------------------------- /changelog/7.58.0/pr-1662.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Allow `ArtifactLocator`s to have inputs derived from task outputs. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1662 6 | -------------------------------------------------------------------------------- /changelog/7.77.0/pr-1825.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Allow extraFiles to be added into a distribution 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1825 6 | -------------------------------------------------------------------------------- /changelog/7.9.0/pr-1221.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Module export discovery handles jars with no manifest gracefully 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1221 6 | -------------------------------------------------------------------------------- /changelog/4.21.0/pr-1016.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Use hybrid as default GC profile for Java 15 and above 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1016 6 | -------------------------------------------------------------------------------- /changelog/4.25.0/pr-1058.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Recommended product dependencies doesn't require Java 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1058 6 | -------------------------------------------------------------------------------- /changelog/7.0.0/pr-1183.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: Copy pdeps config lazily. Increase minimum Gradle version to 6.1. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1183 6 | -------------------------------------------------------------------------------- /changelog/7.21.0/pr-1349.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Make ModuleArgs expand manifest classpath JARs for exports and opens 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1349 6 | -------------------------------------------------------------------------------- /changelog/7.27.0/pr-1424.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Prefer `-XX:UseAVX=2` over `-XX:-UseAESCTRIntrinsics` 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1424 6 | -------------------------------------------------------------------------------- /changelog/7.41.0/pr-1520.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: JDK-21+ response-time gc profile uses generational zgc 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1520 6 | -------------------------------------------------------------------------------- /changelog/7.64.0/pr-1673.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Override the JNA temporary directory to point to var/data/tmp 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1673 6 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/resources/b-duplicate-different-versions-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/sls-packaging/HEAD/gradle-sls-packaging/src/test/resources/b-duplicate-different-versions-1.0.jar -------------------------------------------------------------------------------- /changelog/4.11.2/pr-875.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Ensure `createManifest` is re-run when gradle is invoked with `--write-locks` 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/875 6 | -------------------------------------------------------------------------------- /changelog/4.13.0/pr-907.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Enable Improved NullPointerException messages on modern JDKs 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/907 6 | -------------------------------------------------------------------------------- /changelog/4.19.0/pr-1017.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Upgrade the embedded yourkit libyjpagent.so to 2020.9-b411 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1017 6 | -------------------------------------------------------------------------------- /changelog/5.0.0/pr-1093.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: The yourkit java profiling agent is no longer bundled into distributions. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1093 6 | -------------------------------------------------------------------------------- /changelog/7.17.0/pr-1282.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Increase default JFR stack depth to 256 frames (from 64) 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1282 6 | -------------------------------------------------------------------------------- /changelog/7.34.0/pr-1454.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Create schema-versions.lock file to track supported schema versions 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1454 6 | -------------------------------------------------------------------------------- /changelog/7.40.0/pr-1519.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Unset the JDK-11 CompileCommand override for bundled JDKS 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1519 6 | -------------------------------------------------------------------------------- /changelog/7.44.0/pr-1543.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: sls-packaging no longer sets `-XX:+UseContainerCpuShares` 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1543 6 | -------------------------------------------------------------------------------- /changelog/7.53.0/pr-1642.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Bump the minimum required gradle version to handle mr-jars 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1642 6 | -------------------------------------------------------------------------------- /changelog/7.72.0/pr-1762.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Add getProductDependenciesFile() to CompileRecommendedProductDependencies 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1762 6 | -------------------------------------------------------------------------------- /changelog/7.16.0/pr-1280.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Ignore unknown properties in serialized data to support forward compatibility. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1280 6 | -------------------------------------------------------------------------------- /changelog/7.2.0/pr-1191.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Include `service/bin/launcher-static.yml` in java config tars. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1191 6 | -------------------------------------------------------------------------------- /changelog/7.38.0/pr-1516.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Remove version from JDK path when JDKs are included in dists. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1516 6 | -------------------------------------------------------------------------------- /changelog/7.70.0/pr-1756.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Remove outdated optional transitive recommended pdep restriction 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1756 6 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/main/resources/META-INF/gradle-plugins/com.palantir.recommended-product-dependencies.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.palantir.gradle.dist.RecommendedProductDependenciesPlugin 2 | -------------------------------------------------------------------------------- /changelog/4.15.0/pr-919.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Tolerate multiple product dependencies on the `distribution` extension. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/919 6 | -------------------------------------------------------------------------------- /changelog/7.1.0/pr-1184.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: AtlasDB schema classes are now ignored when resolving the main class. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1184 6 | -------------------------------------------------------------------------------- /changelog/7.39.0/pr-1517.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Allow AVX-512 instructions when jdks are bundled with distributions 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1517 6 | -------------------------------------------------------------------------------- /changelog/7.46.0/pr-1581.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Integrates with gradle-failure-reports. Adds ExceptionWithSuggestion. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1581 6 | -------------------------------------------------------------------------------- /changelog/7.50.0/pr-1633.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Allow plugins to configure/read where the configuration.yml is included 4 | from 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1633 7 | -------------------------------------------------------------------------------- /changelog/7.7.0/pr-1215.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Apply `--add-exports` to Java 16+ services based on manifest entries 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1215 6 | -------------------------------------------------------------------------------- /changelog/4.16.4/go-java-launcher-1.10.0.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: | 4 | Upgrade go-java-launcher to 1.10.0 which is built against Go 1.15 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/992 7 | -------------------------------------------------------------------------------- /changelog/5.1.0/pr-1095.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add workaround for JDK-8253566 by default when target runtime is java 15 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1095 6 | -------------------------------------------------------------------------------- /changelog/7.10.0/pr-1223.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Support `--add-opens` in addition to `--add-exports` based on classpath 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1223 6 | -------------------------------------------------------------------------------- /changelog/4.5.1/pr-727.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Only warn users about unnecessary product dependencies when they are 4 | actually unnecessary 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/727 7 | -------------------------------------------------------------------------------- /changelog/4.7.0/pr-800.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Refactor `com.palantir.recommended-product-dependencies` into separate 4 | JAR 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/800 7 | -------------------------------------------------------------------------------- /changelog/7.37.0/pr-1510.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Add `jdks` property to `distribution` extension to help include JDKs 4 | into dists. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1510 7 | -------------------------------------------------------------------------------- /changelog/7.49.0/pr-1632.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Revert "Allow plugins to configure where the configuration.yml is included 4 | from (#1629)" 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1632 7 | -------------------------------------------------------------------------------- /.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/4.1.0/pr-618.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Use manifest classpath in launcher YAML files and startScript when it is configured. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/580 6 | -------------------------------------------------------------------------------- /changelog/4.23.1/pr-1045.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: The `createStartScripts` task can now be cached, as it no longer has 4 | a lambda attached to it. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1045 7 | -------------------------------------------------------------------------------- /changelog/7.48.0/pr-1629.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Allow plugins to configure/read where the configuration.yml is included 4 | from 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1629 7 | -------------------------------------------------------------------------------- /changelog/7.59.0/pr-1666.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Allow plugins to configure/read where the configuration.yml is included 4 | from **for assets** 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1666 7 | -------------------------------------------------------------------------------- /changelog/4.16.1/pr-926.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Correctly set `-XX:+UnlockExperimentalVMOptions` when using `response-time` 4 | gc profile with JDK 14+ 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/926 7 | -------------------------------------------------------------------------------- /changelog/7.26.0/pr-1417.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Annotate ConfigureProductDependenciesTask inputs to ensure task dependencies 4 | are set as expected 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1417 7 | -------------------------------------------------------------------------------- /changelog/7.75.0/pr-1787.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: The enableAlwaysPreTouch() option will include the `+UseTransparentHugePages` 4 | JVM opt. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1787 7 | -------------------------------------------------------------------------------- /changelog/7.8.0/pr-1220.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: 'Fix the Throughput GC on java 14+: use `-XX:+UseParallelGC` rather 4 | than `-XX:+UseParallelOldGC`' 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1220 7 | -------------------------------------------------------------------------------- /changelog/4.6.0/pr-749.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: sls-packaging now embeds libyjpagent.so from YourKit 2019.8 b137 in 4 | server distributions 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/749 7 | -------------------------------------------------------------------------------- /changelog/4.3.0/pr-644.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Services no longer need to specify the mainClassName, instead it will be inferred from the main source set 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/644 -------------------------------------------------------------------------------- /changelog/4.27.1/pr-1078.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: If a dependency is discovered (non-optional) but declared explicitly as optional, it will be recognized as `optional`. 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1078 6 | -------------------------------------------------------------------------------- /changelog/7.51.0/pr-1636.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Reduce default dns cache ttl to ten seconds (from twenty) to follow 4 | address changes more quickly 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1636 7 | -------------------------------------------------------------------------------- /changelog/4.18.0/pr-1007.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: | 4 | Where systems are running with multiple NUMA nodes, this would enable G1GC to make better decisions. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1007 7 | -------------------------------------------------------------------------------- /changelog/4.28.0/pr-1080.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: JavaServiceDistributionPlugin supports adding java agents using a new `javaAgent` dependency configuration 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1080 6 | -------------------------------------------------------------------------------- /changelog/4.5.0/pr-715.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Upgrade yourkit to 2019.8-b127. Learn about the new features [here](https://www.yourkit.com/changes/yjp_2019_8.jsp) 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/715 6 | -------------------------------------------------------------------------------- /changelog/5.6.0/pr-1160.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Disable biased locking by providing `-XX:-UseBiasedLocking` to jvm 4 | args for java versions prior to jdk15. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1160 7 | -------------------------------------------------------------------------------- /changelog/4.2.0/pr-631.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: go-java-launcher 1.6.2 -> 1.7.0. 4 | Enables fallback to to $JAVA_HOME if configured javaHome is not found 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/631 7 | -------------------------------------------------------------------------------- /changelog/4.29.0/pr-1085.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Always write “$projectVersion” as the minimumVersion in lock files for dependencies that are in the same repository … 4 | links: 5 | - https://github.com/palantir/sls-packaging/pull/1085 6 | -------------------------------------------------------------------------------- /changelog/7.23.0/pr-1372.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: |- 4 | Disable C2 compilation for problematic structure in JDK 11.0.16 5 | 6 | See https://bugs.openjdk.org/browse/JDK-8291665 7 | links: 8 | - https://github.com/palantir/sls-packaging/pull/1372 9 | -------------------------------------------------------------------------------- /changelog/7.29.0/pr-1436.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: '`mergeDiagnosticJson` is no longer build cacheable, as it spends 100x 4 | more time accessing the cache than just running the task' 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1436 7 | -------------------------------------------------------------------------------- /changelog/7.30.0/pr-1441.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Moved the init and check scripts to a resource subdirectory less likely 4 | to collide with other Gradle plugins. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1441 7 | -------------------------------------------------------------------------------- /changelog/7.54.0/pr-1643.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: sls-packaging sets the individual-addressability extension default 4 | value to `true` when not otherwise specified 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1643 7 | -------------------------------------------------------------------------------- /changelog/4.14.0/pr-916.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Expose ListProperty `getAllProductDependencies` for accessing and configuring 4 | a distribution's product dependencies 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/916 7 | -------------------------------------------------------------------------------- /changelog/7.31.0/pr-1443.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: The diagnostic manifest plugin now correctly discovers diagnostic manifest 4 | generates from places other than the resource directory. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1443 7 | -------------------------------------------------------------------------------- /changelog/4.4.0/pr-696.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: For Java 11 and above, the `javaHome` property on the `distribution` 4 | extension will be set to `$JAVA_11_HOME` etc by default. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/696 7 | -------------------------------------------------------------------------------- /changelog/4.0.0/pr-580.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: sls-packaging should now be compatible with Gradle 6.0. sls-packaging 4 | now requires at least Gradle 5.1 and is no longer compatible with 4.X. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/580 7 | -------------------------------------------------------------------------------- /changelog/4.22.1/pr-1012.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: | 4 | If gradle-consistent-versions is detected, lock the assetBundle configuration, to ensure that it always gets the locked dependency versions. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1012 7 | -------------------------------------------------------------------------------- /changelog/4.4.1/pr-711.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Shenandoah GC selection logic will remain the same when using Gradle 4 | 6, and not require a higher level of Java that when running with Gradle 5. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/711 7 | -------------------------------------------------------------------------------- /changelog/7.28.0/pr-1434.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: '`createLaunchConfig`, `mergeDiagnosticsJson`, `createInitScript` and 4 | `createCheckScript` can all now run in parallel within the same project.' 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1434 7 | -------------------------------------------------------------------------------- /changelog/7.36.0/pr-1472.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: When failing to create a `ProductDependency` due to invalid versions, 4 | specify in the error message which depended-on product is involved. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1472 7 | -------------------------------------------------------------------------------- /changelog/4.10.1/pr-852.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix regression that required gradle 6, bringing minimum gradle down 4 | to 5.6, which is checked in the base plugin, and integration tests run against 5 | it. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/852 8 | -------------------------------------------------------------------------------- /changelog/4.22.0/pr-1033.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: sls-packaging will automatically include the `--enable-preview` jvm 4 | arg in launcher-static.yml if `com.palantir.baseline-enable-preview-flag` is applied. 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/1033 7 | -------------------------------------------------------------------------------- /changelog/4.8.0/pr-844.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Correctly handle multiple in repo recommended product dependencies 4 | when the constraint is the project version and the project version is not orderable 5 | links: 6 | - https://github.com/palantir/sls-packaging/pull/844 7 | -------------------------------------------------------------------------------- /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/7.24.0/pr-1411.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: |- 4 | Disable AES-CTR intrinsics due to corruption bug JDK-8292158 5 | 6 | See https://bugs.openjdk.org/browse/JDK-8292158 where AES-CTR streams may be corrupted on AVX-512 CPUs. 7 | links: 8 | - https://github.com/palantir/sls-packaging/pull/1411 9 | -------------------------------------------------------------------------------- /changelog/4.11.1/pr-870.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Inter-project product dependencies are now correctly wired up to point 4 | to the projects themselves, and additionally to recursively collect those transitive 5 | projects' product dependencies. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/870 8 | -------------------------------------------------------------------------------- /changelog/7.61.0/pr-1668.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: assets can also have custom configuration.yml locations and the asset 4 | plugin will fall back to `build/deployment/configuration.yml` if the `deployment/configuration.yml` 5 | does not exist. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/1668 8 | -------------------------------------------------------------------------------- /changelog/7.20.0/pr-1294.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Get go-java-launcher version from versions.props. Note that this requires 4 | adding the go-java-launcher version in "versions.props", e.g. "com.palantir.launching:* 5 | = 1.18.0". 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/1294 8 | -------------------------------------------------------------------------------- /changelog/7.66.0/pr-1693.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Do not use the remote build cache for `mergeDiagnosticJson`; it takes 4 | far longer than just doing the operation locally. Avoids spamming output with 5 | "Requesting from remote build cache" too. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/1693 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## What happened? 2 | 3 | 7 | 8 | ## What did you want to happen? 9 | 10 | 13 | -------------------------------------------------------------------------------- /changelog/4.27.0/pr-1074.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: |- 4 | Support `optional` field in the `ProductDependency` class. 5 | It also allows discovered dependencies to be set optional through the `optionalProductDependency` declaration in the manifest. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/1074 8 | -------------------------------------------------------------------------------- /changelog/7.22.0/pr-1370.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: |- 4 | Disable C2 compiler for Java 11 5 | 6 | Disable the C2 compiler using the -XX:TieredStopAtLevel=1 flag. This prevents a potential memory leak issue https://bugs.openjdk.org/browse/JDK-8291665 7 | links: 8 | - https://github.com/palantir/sls-packaging/pull/1370 9 | -------------------------------------------------------------------------------- /gradle-sls-packaging-api/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.palantir.external-publish-jar' 2 | 3 | dependencies { 4 | implementation 'com.fasterxml.jackson.core:jackson-databind' 5 | implementation 'com.palantir.safe-logging:preconditions' 6 | 7 | compileOnly 'org.immutables:value::annotations' 8 | annotationProcessor 'org.immutables:value' 9 | } 10 | -------------------------------------------------------------------------------- /changelog/7.11.0/pr-1178.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add a new `writeProductDependenciesLocks` task that allows writing 4 | out the `product-dependencies.lock` files without running `--write-locks` and 5 | possibly triggering undesirable code paths from other gradle plugins. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/1178 8 | -------------------------------------------------------------------------------- /changelog/7.36.0/pr-1505.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: |- 4 | Increase G1 default pause target from 200ms to 500ms 5 | 6 | The G1 pause target can be modified thusly: 7 | ```groovy 8 | gc 'hybrid', { 9 | maxGCPauseMillis 250 10 | } 11 | ``` 12 | links: 13 | - https://github.com/palantir/sls-packaging/pull/1505 14 | -------------------------------------------------------------------------------- /.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/4.12.0/pr-899.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: For users of the `response-time` GC Profile, the CMS garbage will still 4 | be enabled on Java 13, as the GC is just _deprecated_ but not fully removed. From 5 | Java 14 onwards, CMS does not exist anymore so we auto-switch to Shenandoah. 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/899 8 | -------------------------------------------------------------------------------- /changelog/6.0.0/pr-1149.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: 'Java services running in Rubix will ignore any conf.heap-size or -Xmx/-Xms 4 | settings and automatically set their heap size based on the container memory limit. 5 | PCloud behavior is unchanged: conf.heap-size is still the supported configuration.' 6 | links: 7 | - https://github.com/palantir/sls-packaging/pull/1149 8 | -------------------------------------------------------------------------------- /changelog/4.24.1/pr-1054.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: When parsing the `sls-manifest/diagnostics.json` file out of jars, 4 | sls-packaging no longer performs strict validation on its structure (as this can 5 | prevent the rollout of jars which include extra fields). Instead it just passes 6 | everything on as long as it's a JSON object. 7 | links: 8 | - https://github.com/palantir/sls-packaging/pull/1054 9 | -------------------------------------------------------------------------------- /changelog/4.23.0/pr-1034.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: 'For java services, a new `diagnostics` extension of the sls manifest 4 | will be populated based on the `sls-manifest/diagnostics.json` file found locally 5 | or in any jar in runtimeClasspath. Contents should look like `{["type": "foo.v1", "docs": "..."]}`, 6 | as defined in the sls-spec.' 7 | links: 8 | - https://github.com/palantir/sls-packaging/pull/1034 9 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.parallel=true 2 | 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 3 | palantir.jdk.setup.enabled=true 4 | palantir.native.formatter=true 5 | -------------------------------------------------------------------------------- /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 = 'sls-packaging' 12 | include 'gradle-sls-packaging' 13 | include 'gradle-sls-packaging-api' 14 | include 'gradle-recommended-product-dependencies' 15 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /changelog/4.4.0/pr-680.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Add `javaVersion` property to JavaServiceDistributionExtension which 4 | specifies the version of Java the service intends to run with. `javaVersion` defaults 5 | to the source compatibility of the project. When `javaVersion` is greater than Java 13 6 | "response-time" GC profile will use Shenandoah instead of CMS 7 | links: 8 | - https://github.com/palantir/sls-packaging/pull/680 9 | -------------------------------------------------------------------------------- /.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 | *.class 2 | .project 3 | .gradle 4 | .classpath 5 | .checkstyle 6 | .settings 7 | .factorypath 8 | .node 9 | build 10 | bin 11 | !*/service/bin 12 | 13 | # Mobile Tools for Java (J2ME) 14 | .mtj.tmp/ 15 | 16 | # Package Files # 17 | *.war 18 | *.ear 19 | 20 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 21 | hs_err_pid* 22 | 23 | # Windows git artifact 24 | fileeditor 25 | 26 | # Mac specific files 27 | .DS_Store 28 | 29 | # IntelliJ 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | out/ 35 | 36 | **/generated_src/ 37 | 38 | # Gradle JDKs setup 39 | !gradle/* 40 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /changelog/7.32.0/pr-1380.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: |- 4 | Enable String Deduplication on JDK 17+ 5 | 6 | G1 and Shenandoah GC support string deduplication as of JDK 17 7 | * https://openjdk.java.net/jeps/192 8 | * https://bugs.openjdk.org/browse/JDK-8264718 9 | 10 | Only enable on JDK 17+ due to fix 11 | https://bugs.openjdk.org/browse/JDK-8277981 12 | 13 | JDK 18+ enable string deduplication for SerialGC, ParallalGC, and ZGC. 14 | https://malloc.se/blog/zgc-jdk18 15 | links: 16 | - https://github.com/palantir/sls-packaging/pull/1380 17 | - https://openjdk.java.net/jeps/192 18 | - https://bugs.openjdk.org/browse/JDK-8264718 19 | - https://malloc.se/blog/zgc-jdk18 20 | -------------------------------------------------------------------------------- /versions.props: -------------------------------------------------------------------------------- 1 | com.fasterxml.jackson.*:* = 2.20.1 2 | com.fasterxml.jackson.core:jackson-annotations = 2.20 3 | com.google.guava:guava = 33.5.0-jre 4 | com.palantir.gradle.auto-parallelizable:* = 1.4.0 5 | com.palantir.gradle.consistentversions:gradle-consistent-versions = 3.7.0 6 | com.palantir.safe-logging:* = 3.9.0 7 | com.palantir.sls.versions:sls-versions = 1.8.0 8 | org.apache.commons:commons-lang3 = 3.20.0 9 | org.immutables:value = 2.12.0 10 | org.junit.jupiter:* = 6.0.1 11 | org.junit.platform:* = 6.0.1 12 | org.junit.vintage:* = 6.0.1 13 | org.rauschig:jarchivelib = 1.2.0 14 | com.palantir.gradle.failure-reports:* = 1.2.0 15 | 16 | com.netflix.nebula:nebula-test = 10.6.2 17 | junit:junit = 4.13.2 18 | org.awaitility:awaitility = 4.3.0 19 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | apply plugin: 'java-gradle-plugin' 3 | apply plugin: 'org.revapi.revapi-gradle-plugin' 4 | 5 | apply plugin: 'com.palantir.external-publish-jar' 6 | apply plugin: 'com.palantir.gradle-plugin-testing' 7 | 8 | dependencies { 9 | api gradleApi() 10 | api 'com.google.guava:guava' 11 | api 'com.fasterxml.jackson.core:jackson-databind' 12 | api 'com.palantir.sls.versions:sls-versions' 13 | api 'com.palantir.safe-logging:preconditions' 14 | 15 | testImplementation gradleTestKit() 16 | testImplementation 'com.netflix.nebula:nebula-test' 17 | 18 | compileOnly 'org.immutables:value::annotations' 19 | annotationProcessor 'org.immutables:value' 20 | } 21 | 22 | gradleTestUtils { 23 | gradleVersions = ['8.14.3'] 24 | configurationCacheEnabled = true 25 | } 26 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/MergeDiagnosticsJsonTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist.service; 18 | 19 | public abstract class MergeDiagnosticsJsonTask extends MergeDiagnosticsJsonTaskImpl {} 20 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/Versions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist; 18 | 19 | public final class Versions { 20 | 21 | public static final String GRADLE_CONSISTENT_VERSIONS = "3.3.0"; 22 | 23 | private Versions() {} 24 | } 25 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/test/java/com/palantir/gradle/dist/GradleTestVersions.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.dist; 18 | 19 | import java.util.List; 20 | 21 | public final class GradleTestVersions { 22 | private GradleTestVersions() {} 23 | 24 | public static final List GRADLE_VERSIONS = List.of("7.6.4", "8.14.3", "9.1.0"); 25 | } 26 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/resources/sls-packaging/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2016 Palantir Technologies 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 | # 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 | # Everything in this script is relative to the base directory of an SLSv2 distribution 19 | pushd "`dirname \"$0\"`/../../.." > /dev/null 20 | 21 | # Prefer java 8 when available to deal with poor environment management 22 | if [ -n "$JAVA_8_HOME" ]; then 23 | export JAVA_HOME=$JAVA_8_HOME 24 | fi 25 | 26 | service/bin/init.sh check 27 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/ArtifactLocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2024 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.dist.artifacts; 18 | 19 | import org.gradle.api.provider.Property; 20 | import org.gradle.api.tasks.Input; 21 | 22 | public interface ArtifactLocator { 23 | @Input 24 | Property getType(); 25 | 26 | @Input 27 | Property getUri(); 28 | } 29 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/CreateInitScriptTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.service.tasks; 18 | 19 | public abstract class CreateInitScriptTask extends CreateInitScriptTaskImpl { 20 | public CreateInitScriptTask() { 21 | getOutputFile().set(getProject().getLayout().getBuildDirectory().file("scripts/init.sh")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/CreateCheckScriptTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.service.tasks; 18 | 19 | public abstract class CreateCheckScriptTask extends CreateCheckScriptTaskImpl { 20 | public CreateCheckScriptTask() { 21 | getOutputFile().set(getProject().getLayout().getBuildDirectory().file("monitoring/check.sh")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/java/com/palantir/gradle/dist/GradleTestVersions.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.dist; 18 | 19 | import java.util.List; 20 | 21 | public final class GradleTestVersions { 22 | private GradleTestVersions() {} 23 | 24 | public static final List GRADLE_VERSIONS = 25 | List.of(SlsBaseDistPlugin.MINIMUM_GRADLE.getVersion(), "8.14.3", "9.1.0"); 26 | } 27 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/FileExtractParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.artifacts; 18 | 19 | import org.gradle.api.artifacts.transform.TransformParameters; 20 | import org.gradle.api.provider.Property; 21 | import org.gradle.api.tasks.Input; 22 | 23 | public interface FileExtractParameter extends TransformParameters { 24 | @Input 25 | Property getPathToExtract(); 26 | } 27 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/LaunchConfigTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.service.tasks; 18 | 19 | public abstract class LaunchConfigTask extends LaunchConfigTaskImpl { 20 | public LaunchConfigTask() { 21 | getStaticLauncher().set(getProject().getLayout().getBuildDirectory().file("scripts/launcher-static.yml")); 22 | getCheckLauncher().set(getProject().getLayout().getBuildDirectory().file("scripts/launcher-check.yml")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/FileAndManifestExtractParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.artifacts; 18 | 19 | import org.gradle.api.artifacts.transform.TransformParameters; 20 | import org.gradle.api.provider.Property; 21 | import org.gradle.api.tasks.Input; 22 | 23 | public interface FileAndManifestExtractParameter extends TransformParameters { 24 | @Input 25 | Property getPathToExtract(); 26 | 27 | @Input 28 | Property getKeyToExtract(); 29 | } 30 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/ExampleTouchService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist.service; 18 | 19 | import java.io.IOException; 20 | import java.nio.file.Files; 21 | import java.nio.file.Paths; 22 | 23 | public final class ExampleTouchService { 24 | 25 | /** A tiny service which we run as part of integration tests */ 26 | public static void main(String[] args) throws IOException { 27 | Files.createFile(Paths.get(args[0])); 28 | } 29 | 30 | private ExampleTouchService() {} 31 | } 32 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ProductType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | 21 | public enum ProductType { 22 | @JsonProperty("service.v1") 23 | SERVICE_V1, 24 | 25 | @JsonProperty("daemon.v1") 26 | DAEMON_V1, 27 | 28 | @JsonProperty("asset.v1") 29 | ASSET_V1, 30 | 31 | @JsonProperty("helm-chart.v1") 32 | HELM_CHART_V1, 33 | 34 | @JsonProperty("foundry-product.v1") 35 | FOUNDRY_PRODUCT_V1, 36 | 37 | @JsonProperty("module.v1") 38 | MODULE_V1, 39 | } 40 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/ObjectMappersTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2022 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.dist; 18 | 19 | import java.io.IOException; 20 | import java.nio.file.Files; 21 | import java.nio.file.Path; 22 | import org.junit.jupiter.api.Test; 23 | 24 | class ObjectMappersTest { 25 | @Test 26 | void ensure_we_can_deserialise_with_unknown_properties() throws IOException { 27 | Path path = Files.createTempFile("prefix", ".json"); 28 | Files.writeString(path, "{\"recommended-product-dependencies\":[],\"something-else\":3}"); 29 | ObjectMappers.readRecommendedProductDependencies(path.toFile()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/pdeps/ProductDependencyManifest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.pdeps; 18 | 19 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 20 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 21 | import com.palantir.gradle.dist.ProductDependency; 22 | import java.util.List; 23 | import org.immutables.value.Value.Immutable; 24 | 25 | @Immutable 26 | @JsonDeserialize(as = ImmutableProductDependencyManifest.class) 27 | @JsonSerialize(as = ImmutableProductDependencyManifest.class) 28 | public interface ProductDependencyManifest { 29 | List productDependencies(); 30 | 31 | static ProductDependencyManifest of(List productDependencies) { 32 | return ImmutableProductDependencyManifest.builder() 33 | .addAllProductDependencies(productDependencies) 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/asset/GcvUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist.asset; 18 | 19 | import com.palantir.gradle.versions.VersionsLockExtension; 20 | import org.gradle.api.Project; 21 | 22 | /** 23 | * Things that access GCV classes are done here in a separate class, so it doesn't prevent groovy from loading and 24 | * decorating the plugin class. 25 | */ 26 | final class GcvUtils { 27 | /** 28 | * If GCV is applied, we want to lock the asset configuration. 29 | * This is to work around a bug where during --write-locks, the locks from locked configurations don't get 30 | * exposed to consumers (as constraints) and so non-locked configurations get different versions than when 31 | * running without {@code --write-locks}. 32 | */ 33 | public static void lockConfigurationInGcv(Project project) { 34 | project.getExtensions().configure(VersionsLockExtension.class, lockExt -> { 35 | lockExt.production(prod -> prod.from(AssetDistributionPlugin.ASSET_CONFIGURATION)); 36 | }); 37 | } 38 | 39 | private GcvUtils() {} 40 | } 41 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SlsManifest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 21 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 22 | import java.util.Map; 23 | import org.immutables.value.Value; 24 | 25 | @Value.Immutable 26 | @JsonSerialize(as = ImmutableSlsManifest.class) 27 | @JsonDeserialize(as = ImmutableSlsManifest.class) 28 | public interface SlsManifest { 29 | @JsonProperty("manifest-version") 30 | String manifestVersion(); 31 | 32 | @JsonProperty("product-type") 33 | ProductType productType(); 34 | 35 | @JsonProperty("product-group") 36 | String productGroup(); 37 | 38 | @JsonProperty("product-name") 39 | String productName(); 40 | 41 | @JsonProperty("product-version") 42 | String productVersion(); 43 | 44 | @JsonProperty("extensions") 45 | Map extensions(); 46 | 47 | static Builder builder() { 48 | return new Builder(); 49 | } 50 | 51 | final class Builder extends ImmutableSlsManifest.Builder {} 52 | } 53 | -------------------------------------------------------------------------------- /gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaMigration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2023 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.dist; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 21 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 22 | import java.util.Comparator; 23 | import org.immutables.value.Value; 24 | 25 | @Value.Immutable 26 | @JsonDeserialize(as = ImmutableSchemaMigration.class) 27 | @JsonSerialize(as = ImmutableSchemaMigration.class) 28 | public interface SchemaMigration extends Comparable { 29 | 30 | Comparator COMPARATOR = Comparator.comparing(SchemaMigration::fromVersion, Integer::compareTo) 31 | .thenComparing(SchemaMigration::type, String::compareTo); 32 | 33 | String type(); 34 | 35 | @JsonProperty("from") 36 | int fromVersion(); 37 | 38 | @Override 39 | default int compareTo(SchemaMigration other) { 40 | return COMPARATOR.compare(this, other); 41 | } 42 | 43 | static SchemaMigration of(String type, int fromVersion) { 44 | return ImmutableSchemaMigration.builder() 45 | .type(type) 46 | .fromVersion(fromVersion) 47 | .build(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/asset/AssetDistributionExtensionTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.asset 18 | 19 | import nebula.test.ProjectSpec 20 | 21 | class AssetDistributionExtensionTest extends ProjectSpec { 22 | def 'collection modifiers are cumulative'() { 23 | given: 24 | def ext = new AssetDistributionExtension(project) 25 | 26 | when: 27 | ext.with { 28 | assets "path/to/foo" 29 | assets "path/to/src", "relocated/dest" 30 | assets "path/to/src2", "relocated/dest2" 31 | } 32 | 33 | then: 34 | ext.getAssets().get() == [ 35 | "path/to/src" : "relocated/dest", 36 | "path/to/src2": "relocated/dest2", 37 | "path/to/foo" : "path/to/foo" 38 | ] 39 | } 40 | 41 | def 'collection setters replace existing data'() { 42 | given: 43 | def ext = new AssetDistributionExtension(project) 44 | 45 | when: 46 | ext.with { 47 | assets "path/to/src", "relocated/dest" 48 | setAssets(["path/to/src2": "relocated/dest2"]) 49 | } 50 | 51 | then: 52 | ext.getAssets().get() == ["path/to/src2": "relocated/dest2"] 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/Diagnostics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist.service; 18 | 19 | import com.fasterxml.jackson.core.type.TypeReference; 20 | import com.fasterxml.jackson.databind.node.ObjectNode; 21 | import com.palantir.gradle.dist.ObjectMappers; 22 | import java.io.File; 23 | import java.io.IOException; 24 | import java.nio.file.Files; 25 | import java.util.List; 26 | import org.gradle.api.GradleException; 27 | 28 | public final class Diagnostics { 29 | private static final String EXAMPLE = 30 | "[{\"type\":\"foo.v1\", \"docs\":\"...\"}, \"{\"type\":\"bar.v1\", " + "\"docs\":\"...\"}]"; 31 | 32 | public static List parse(File file) { 33 | String string = null; 34 | try { 35 | string = Files.readString(file.toPath()).trim(); 36 | return ObjectMappers.jsonMapper.readValue(string, new TypeReference<>() {}); 37 | } catch (IOException e) { 38 | throw new GradleException( 39 | String.format( 40 | "Failed to deserialize '%s', expecting something like '%s' but was '%s'", 41 | file.getAbsolutePath(), EXAMPLE, string), 42 | e); 43 | } 44 | } 45 | 46 | private Diagnostics() {} 47 | } 48 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/CreateInitScript.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.service.tasks; 18 | 19 | import com.google.common.collect.ImmutableMap; 20 | import com.palantir.gradle.autoparallelizable.AutoParallelizable; 21 | import com.palantir.gradle.dist.service.JavaServiceDistributionPlugin; 22 | import com.palantir.gradle.dist.service.util.EmitFiles; 23 | import org.gradle.api.file.RegularFileProperty; 24 | import org.gradle.api.provider.Property; 25 | import org.gradle.api.tasks.Input; 26 | import org.gradle.api.tasks.OutputFile; 27 | 28 | @AutoParallelizable 29 | public final class CreateInitScript { 30 | interface Params { 31 | @Input 32 | Property getServiceName(); 33 | 34 | @OutputFile 35 | RegularFileProperty getOutputFile(); 36 | } 37 | 38 | static void action(Params params) { 39 | EmitFiles.replaceVars( 40 | JavaServiceDistributionPlugin.class.getResourceAsStream("/sls-packaging/init.sh"), 41 | params.getOutputFile().get().getAsFile().toPath(), 42 | ImmutableMap.of("@serviceName@", params.getServiceName().get())) 43 | .toFile() 44 | .setExecutable(true); 45 | } 46 | 47 | private CreateInitScript() {} 48 | } 49 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/GradleIntegrationSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist 18 | 19 | import com.google.common.collect.ImmutableList 20 | import nebula.test.IntegrationTestKitSpec 21 | import nebula.test.multiproject.MultiProjectIntegrationHelper 22 | import org.gradle.testkit.runner.GradleRunner 23 | 24 | class GradleIntegrationSpec extends IntegrationTestKitSpec { 25 | protected MultiProjectIntegrationHelper helper 26 | 27 | def setup() { 28 | keepFiles = true 29 | settingsFile.createNewFile() 30 | helper = new MultiProjectIntegrationHelper(getProjectDir(), settingsFile) 31 | // Run with minimum supported version 32 | gradleVersion = SlsBaseDistPlugin.MINIMUM_GRADLE.version 33 | } 34 | 35 | protected boolean fileExists(String path) { 36 | new File(projectDir, path).exists() 37 | } 38 | 39 | /** Just here to ensure we display the gradle warnings, if any. */ 40 | @Override 41 | GradleRunner createRunner(String... tasks) { 42 | def runner = super.createRunner(tasks) 43 | def newArguments = ImmutableList. builder() 44 | .add("--warning-mode=all") 45 | .addAll(runner.getArguments()) 46 | .build() 47 | return runner.withArguments(newArguments) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/asset/AssetDistributionExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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 | package com.palantir.gradle.dist.asset; 17 | 18 | import com.palantir.gradle.dist.BaseDistributionExtension; 19 | import com.palantir.gradle.dist.ProductType; 20 | import java.util.Map; 21 | import javax.inject.Inject; 22 | import org.gradle.api.Project; 23 | import org.gradle.api.provider.MapProperty; 24 | import org.gradle.api.provider.Provider; 25 | 26 | public class AssetDistributionExtension extends BaseDistributionExtension { 27 | private final MapProperty assets; 28 | 29 | @Inject 30 | public AssetDistributionExtension(Project project) { 31 | super(project); 32 | assets = project.getObjects().mapProperty(String.class, String.class).empty(); 33 | setProductType(ProductType.ASSET_V1); 34 | } 35 | 36 | public final Provider> getAssets() { 37 | return assets; 38 | } 39 | 40 | public final void assets(String relativeSourcePath) { 41 | this.assets.put(relativeSourcePath, relativeSourcePath); 42 | } 43 | 44 | public final void assets(String relativeSourcePath, String relativeDestinationPath) { 45 | this.assets.put(relativeSourcePath, relativeDestinationPath); 46 | } 47 | 48 | public final void setAssets(Map assets) { 49 | this.assets.set(assets); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/util/EmitFiles.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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 | package com.palantir.gradle.dist.service.util; 17 | 18 | import com.google.common.io.CharStreams; 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.io.InputStreamReader; 22 | import java.io.Reader; 23 | import java.io.UncheckedIOException; 24 | import java.nio.charset.StandardCharsets; 25 | import java.nio.file.Files; 26 | import java.nio.file.Path; 27 | import java.util.Map; 28 | 29 | public final class EmitFiles { 30 | public static Path replaceVars(InputStream src, Path dest, Map vars) { 31 | String text; 32 | try (Reader reader = new InputStreamReader(src, StandardCharsets.UTF_8)) { 33 | text = CharStreams.toString(reader); 34 | } catch (IOException e) { 35 | throw new UncheckedIOException("Failed to read template", e); 36 | } 37 | 38 | for (Map.Entry entry : vars.entrySet()) { 39 | text = text.replaceAll(entry.getKey(), entry.getValue()); 40 | } 41 | 42 | // ensure output directory exists 43 | dest.getParent().toFile().mkdirs(); 44 | 45 | // write content 46 | try { 47 | return Files.write(dest, text.getBytes(StandardCharsets.UTF_8)); 48 | } catch (IOException e) { 49 | throw new UncheckedIOException("Failed to write templated file", e); 50 | } 51 | } 52 | 53 | private EmitFiles() {} 54 | } 55 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/tasks/WriteSchemaVersionLocksMarkerTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.tasks; 18 | 19 | import org.gradle.api.DefaultTask; 20 | import org.gradle.api.GradleException; 21 | import org.gradle.api.tasks.TaskAction; 22 | 23 | public abstract class WriteSchemaVersionLocksMarkerTask extends DefaultTask { 24 | 25 | public static final String NAME = "writeSchemaVersionLocks"; 26 | 27 | @SuppressWarnings("for-rollout:IllegalMethodCalledDuringTaskExecution") 28 | @TaskAction 29 | public final void checkWriteLocksShouldBeRunning() { 30 | // Check that our task name matcher for writeSchemaVersionLocks is actually matching up the Gradle one; 31 | // if this task is running but we didn't actually write locks, error out. 32 | if (!CreateManifestTask.shouldWriteLocks(getProject(), NAME)) { 33 | throw new GradleException("This `writeSchemaVersionLocks` marker task has been run, but the " 34 | + "schema-versions.lock files did not actually get written out at configuration time. Either " 35 | + "there is another task dependency on this task, which is not supported " 36 | + "(`writeSchemaVersionLocks` must be run as a gradle task from the command line - not as a " 37 | + "dependent task), or this is a bug and should be reported to the owners of the " 38 | + "gradle-sls-packaging plugin."); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/tasks/WriteProductDependenciesLocksMarkerTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.tasks; 18 | 19 | import org.gradle.api.DefaultTask; 20 | import org.gradle.api.GradleException; 21 | import org.gradle.api.tasks.TaskAction; 22 | 23 | public abstract class WriteProductDependenciesLocksMarkerTask extends DefaultTask { 24 | 25 | public static final String NAME = "writeProductDependenciesLocks"; 26 | 27 | @SuppressWarnings("for-rollout:IllegalMethodCalledDuringTaskExecution") 28 | @TaskAction 29 | public final void checkWriteLocksShouldBeRunning() { 30 | // Check that our task name matcher for writeProductDependenciesLocks is actually matching up the Gradle one; 31 | // if this task is running but we didn't actually write locks, error out. 32 | if (!CreateManifestTask.shouldWriteLocks(getProject(), NAME)) { 33 | throw new GradleException("This `writeProductDependenciesLocks` marker task has been run, but the " 34 | + "product-dependencies.lock files did not actually get written out at configuration time. Either " 35 | + "there is another task dependency on this task, which is not supported " 36 | + "(`writeProductDependenciesLocks` must be run as a gradle task from the command line - not as a " 37 | + "dependent task), or this is a bug and should be reported to the owners of the " 38 | + "gradle-sls-packaging plugin."); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/main/java/com/palantir/gradle/dist/RecommendedProductDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist; 18 | 19 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 22 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 23 | import java.util.List; 24 | import java.util.Set; 25 | import org.immutables.value.Value; 26 | 27 | // Automatically suppressed to unblock enforcement in new code 28 | @SuppressWarnings("ImmutablesStyle") 29 | @Value.Immutable 30 | @Value.Style(jdkOnly = true) 31 | @JsonSerialize(as = ImmutableRecommendedProductDependencies.class) 32 | @JsonDeserialize(as = ImmutableRecommendedProductDependencies.class) 33 | @JsonIgnoreProperties(ignoreUnknown = true) 34 | public interface RecommendedProductDependencies { 35 | String SLS_RECOMMENDED_PRODUCT_DEPS_KEY = "Sls-Recommended-Product-Dependencies"; 36 | 37 | @JsonProperty("recommended-product-dependencies") 38 | Set recommendedProductDependencies(); 39 | 40 | final class Builder extends ImmutableRecommendedProductDependencies.Builder {} 41 | 42 | static Builder builder() { 43 | return new Builder(); 44 | } 45 | 46 | static RecommendedProductDependencies of(List productDependencies) { 47 | return builder() 48 | .addAllRecommendedProductDependencies(productDependencies) 49 | .build(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /.palantir/revapi.yml: -------------------------------------------------------------------------------- 1 | acceptedBreaks: 2 | "4.25.1": 3 | com.palantir.sls-packaging:gradle-recommended-product-dependencies: 4 | - code: "java.method.returnTypeChangedCovariantly" 5 | old: "method org.gradle.api.provider.Provider>\ 6 | \ com.palantir.gradle.dist.RecommendedProductDependenciesExtension::getRecommendedProductDependenciesProvider()" 7 | new: "method org.gradle.api.provider.SetProperty\ 8 | \ com.palantir.gradle.dist.RecommendedProductDependenciesExtension::getRecommendedProductDependenciesProvider()" 9 | justification: "not really a break" 10 | "4.26.0": 11 | com.palantir.sls-packaging:gradle-recommended-product-dependencies: 12 | - code: "java.class.defaultSerializationChanged" 13 | old: "class com.palantir.gradle.dist.ProductDependency" 14 | new: "class com.palantir.gradle.dist.ProductDependency" 15 | justification: "Old class is semantically equivalent to optional=false" 16 | "5.3.0": 17 | com.palantir.sls-packaging:gradle-recommended-product-dependencies: 18 | - code: "java.field.removed" 19 | old: "field com.palantir.gradle.dist.RecommendedProductDependencies.SLS_RECOMMENDED_PRODUCT_DEPS_ATTRIBUTE" 20 | justification: "Reverting change" 21 | "7.72.0": 22 | com.palantir.sls-packaging:gradle-recommended-product-dependencies: 23 | - code: "java.method.removed" 24 | old: "method java.io.File com.palantir.gradle.dist.CompileRecommendedProductDependencies::getProductDependenciesFile()" 25 | justification: "Changing a new API" 26 | "7.82.0": 27 | com.palantir.sls-packaging:gradle-recommended-product-dependencies: 28 | - code: "java.class.nowAbstract" 29 | old: "class com.palantir.gradle.dist.ConfigureProductDependenciesTask" 30 | new: "class com.palantir.gradle.dist.ConfigureProductDependenciesTask" 31 | justification: "gradle-guide made this ABI break to improve your Gradle code" 32 | - code: "java.missing.oldSuperType" 33 | old: "class com.palantir.gradle.dist.ConfigureProductDependenciesTask" 34 | new: "class com.palantir.gradle.dist.ConfigureProductDependenciesTask" 35 | justification: "gradle-guide made this ABI break to improve your Gradle code" 36 | -------------------------------------------------------------------------------- /gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2023 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.dist; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 21 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 22 | import com.palantir.logsafe.Preconditions; 23 | import java.util.List; 24 | import java.util.stream.Collectors; 25 | import org.immutables.value.Value; 26 | 27 | @Value.Immutable 28 | @JsonDeserialize(as = ImmutableSchemaVersionLockFile.class) 29 | @JsonSerialize(as = ImmutableSchemaVersionLockFile.class) 30 | public interface SchemaVersionLockFile { 31 | 32 | String COMMENT = "Run ./gradlew writeSchemaVersionLocks to regenerate this file"; 33 | String LOCK_FILE = "schema-versions.lock"; 34 | int VERSION = 1; 35 | 36 | @Value.Default 37 | default String getComment() { 38 | return COMMENT; 39 | } 40 | 41 | @JsonProperty("schemaMigrations") 42 | List getSchemaMigrations(); 43 | 44 | @Value.Default 45 | default int getVersion() { 46 | return VERSION; 47 | } 48 | 49 | static SchemaVersionLockFile of(List schemaMigrations) { 50 | Preconditions.checkArgument(!schemaMigrations.isEmpty(), "Migrations must not be empty"); 51 | List sortedMigrations = 52 | schemaMigrations.stream().sorted().collect(Collectors.toList()); 53 | 54 | return ImmutableSchemaVersionLockFile.builder() 55 | .schemaMigrations(sortedMigrations) 56 | .build(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SlsBaseDistPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist; 18 | 19 | import com.palantir.logsafe.Preconditions; 20 | import com.palantir.logsafe.SafeArg; 21 | import org.gradle.api.Plugin; 22 | import org.gradle.api.Project; 23 | import org.gradle.api.artifacts.Configuration; 24 | import org.gradle.api.attributes.Usage; 25 | import org.gradle.util.GradleVersion; 26 | 27 | public class SlsBaseDistPlugin implements Plugin { 28 | 29 | /** The name of the outgoing configuration. This will include the SLS artifact being published. */ 30 | public static final String SLS_CONFIGURATION_NAME = "sls"; 31 | 32 | public static final String SLS_DIST_USAGE = "sls-dist"; 33 | 34 | public static final GradleVersion MINIMUM_GRADLE = GradleVersion.version("7.6.4"); 35 | 36 | @Override 37 | public final void apply(Project project) { 38 | Preconditions.checkState( 39 | GradleVersion.current().compareTo(MINIMUM_GRADLE) >= 0, 40 | "This gradle version is too old", 41 | SafeArg.of("currentVersion", GradleVersion.current()), 42 | SafeArg.of("minimumVersion", MINIMUM_GRADLE)); 43 | 44 | @SuppressWarnings("for-rollout:ConfigurationAvoidanceRegistration") 45 | Configuration slsConf = project.getConfigurations().create(SLS_CONFIGURATION_NAME); 46 | slsConf.setCanBeResolved(false); 47 | // Make it export a custom usage, to allow resolving it via variant-aware resolution. 48 | slsConf.getAttributes() 49 | .attribute(Usage.USAGE_ATTRIBUTE, project.getObjects().named(Usage.class, SLS_DIST_USAGE)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/ProductDependencyTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2018 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.dist 18 | 19 | import spock.lang.Specification 20 | 21 | class ProductDependencyTest extends Specification { 22 | def 'max version may be matcher'() { 23 | when: 24 | new ProductDependency("", "", "1.2.3", "1.2.x", "1.2.3").isValid() 25 | 26 | then: 27 | true 28 | } 29 | 30 | def 'min version must not be matcher'() { 31 | when: 32 | new ProductDependency("", "", "1.2.x", "1.2.x", "1.2.3").isValid() 33 | 34 | then: 35 | thrown(IllegalArgumentException) 36 | } 37 | 38 | def 'recommended version must not be matcher'() { 39 | when: 40 | new ProductDependency("", "", "1.2.3", "1.2.x", "1.2.x").isValid() 41 | 42 | then: 43 | thrown(IllegalArgumentException) 44 | } 45 | 46 | def 'non-default maximumVersion'() { 47 | when: 48 | def dep = new ProductDependency("", "", "1.2.3", "2.x.x", "1.2.4") 49 | 50 | then: 51 | dep.maximumVersion == "2.x.x" 52 | } 53 | 54 | def 'minimumVersion and maximumVersion must not be equal' () { 55 | when: 56 | new ProductDependency("", "", "1.2.3", "1.2.3", null).isValid() 57 | 58 | then: 59 | thrown(IllegalArgumentException) 60 | } 61 | 62 | def 'reasonable toString for logging' () { 63 | when: 64 | def string = new ProductDependency("com.palantir.foo", "my-service", "1.2.3", "2.x.x", "1.2.4").toString() 65 | 66 | then: 67 | string == "com.palantir.foo:my-service(min: 1.2.3, recommended: 1.2.4, max: 2.x.x)" 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/main/java/com/palantir/gradle/dist/CompileRecommendedProductDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist; 18 | 19 | import com.fasterxml.jackson.databind.ObjectMapper; 20 | import java.io.IOException; 21 | import org.gradle.api.DefaultTask; 22 | import org.gradle.api.file.DirectoryProperty; 23 | import org.gradle.api.file.RegularFile; 24 | import org.gradle.api.provider.Provider; 25 | import org.gradle.api.provider.SetProperty; 26 | import org.gradle.api.tasks.Input; 27 | import org.gradle.api.tasks.OutputDirectory; 28 | import org.gradle.api.tasks.OutputFile; 29 | import org.gradle.api.tasks.TaskAction; 30 | 31 | public abstract class CompileRecommendedProductDependencies extends DefaultTask { 32 | 33 | static final ObjectMapper MAPPER = new ObjectMapper(); 34 | 35 | @Input 36 | abstract SetProperty getRecommendedProductDependencies(); 37 | 38 | /** 39 | * Ensure that the sourcesJar task in {@link RecommendedProductDependenciesPlugin} includes {@code getProductDependenciesFile()}. 40 | */ 41 | @OutputDirectory 42 | abstract DirectoryProperty getOutputDir(); 43 | 44 | @OutputFile 45 | public final Provider getOutputFile() { 46 | return getOutputDir().file(RecommendedProductDependenciesPlugin.RESOURCE_PATH); 47 | } 48 | 49 | @TaskAction 50 | final void action() throws IOException { 51 | MAPPER.writeValue( 52 | getOutputFile().get().getAsFile(), 53 | RecommendedProductDependencies.builder() 54 | .addAllRecommendedProductDependencies( 55 | getRecommendedProductDependencies().get()) 56 | .build()); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/CreateCheckScript.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.service.tasks; 18 | 19 | import com.google.common.base.Joiner; 20 | import com.google.common.collect.ImmutableMap; 21 | import com.palantir.gradle.autoparallelizable.AutoParallelizable; 22 | import com.palantir.gradle.dist.service.JavaServiceDistributionPlugin; 23 | import com.palantir.gradle.dist.service.util.EmitFiles; 24 | import org.gradle.api.file.RegularFileProperty; 25 | import org.gradle.api.provider.ListProperty; 26 | import org.gradle.api.provider.Property; 27 | import org.gradle.api.tasks.Input; 28 | import org.gradle.api.tasks.OutputFile; 29 | 30 | @AutoParallelizable 31 | public final class CreateCheckScript { 32 | interface Params { 33 | @Input 34 | Property getServiceName(); 35 | 36 | @Input 37 | ListProperty getCheckArgs(); 38 | 39 | @OutputFile 40 | RegularFileProperty getOutputFile(); 41 | } 42 | 43 | static void action(Params params) { 44 | if (!params.getCheckArgs().get().isEmpty()) { 45 | EmitFiles.replaceVars( 46 | JavaServiceDistributionPlugin.class.getResourceAsStream("/sls-packaging/check.sh"), 47 | params.getOutputFile().get().getAsFile().toPath(), 48 | ImmutableMap.of( 49 | "@serviceName@", params.getServiceName().get(), 50 | "@checkArgs@", 51 | Joiner.on(" ") 52 | .join(params.getCheckArgs().get()))) 53 | .toFile() 54 | .setExecutable(true); 55 | } 56 | } 57 | 58 | private CreateCheckScript() {} 59 | } 60 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/MergeDiagnosticsJson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist.service; 18 | 19 | import com.fasterxml.jackson.databind.node.ObjectNode; 20 | import com.palantir.gradle.autoparallelizable.AutoParallelizable; 21 | import com.palantir.gradle.dist.ObjectMappers; 22 | import java.io.File; 23 | import java.io.IOException; 24 | import java.util.Comparator; 25 | import java.util.List; 26 | import java.util.stream.Collectors; 27 | import org.gradle.api.GradleException; 28 | import org.gradle.api.file.ConfigurableFileCollection; 29 | import org.gradle.api.file.RegularFileProperty; 30 | import org.gradle.api.tasks.InputFiles; 31 | import org.gradle.api.tasks.OutputFile; 32 | import org.gradle.api.tasks.PathSensitive; 33 | import org.gradle.api.tasks.PathSensitivity; 34 | 35 | @AutoParallelizable 36 | final class MergeDiagnosticsJson { 37 | interface Params { 38 | @InputFiles 39 | @PathSensitive(PathSensitivity.NONE) 40 | ConfigurableFileCollection getClasspath(); 41 | 42 | @OutputFile 43 | RegularFileProperty getOutputJsonFile(); 44 | } 45 | 46 | static void action(Params params) { 47 | List aggregated = params.getClasspath().getFiles().stream() 48 | .flatMap(file -> Diagnostics.parse(file).stream()) 49 | .distinct() 50 | .sorted(Comparator.comparing(node -> node.get("type").asText())) 51 | .collect(Collectors.toList()); 52 | 53 | File out = params.getOutputJsonFile().getAsFile().get(); 54 | try { 55 | ObjectMappers.jsonMapper.writeValue(out, aggregated); 56 | } catch (IOException e) { 57 | throw new GradleException("Failed to write " + out, e); 58 | } 59 | } 60 | 61 | private MergeDiagnosticsJson() {} 62 | } 63 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/tasks/CreateManifestTaskTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2018 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.dist.tasks 18 | 19 | 20 | import nebula.test.ProjectSpec 21 | import org.gradle.api.Project 22 | import org.gradle.testfixtures.ProjectBuilder 23 | 24 | class CreateManifestTaskTest extends ProjectSpec { 25 | def 'Can create CreateManifestTask when product.version is valid SLS version'() { 26 | when: 27 | Project project = ProjectBuilder.builder().build() 28 | project.version = "1.0.0" 29 | CreateManifestTask task = project.tasks.create("m", CreateManifestTask) 30 | 31 | then: 32 | task.getProjectVersion() == "1.0.0" 33 | } 34 | 35 | def 'Cannot create CreateManifestTask when product.version is invalid SLS version'() { 36 | given: 37 | Project project = ProjectBuilder.builder().build() 38 | project.version = "1.0.0foo" 39 | CreateManifestTask task = project.tasks.create("m", CreateManifestTask) 40 | 41 | when: 42 | task.createManifest() 43 | 44 | then: 45 | Exception exception = thrown() 46 | exception.message.contains("Project version must be a valid SLS version: 1.0.0foo. " + 47 | "Please ensure there's at least one git tag on the repo (e.g. 0.0.0)") 48 | } 49 | 50 | def 'Cannot create CreateManifestTask when product.version is a commit hash'() { 51 | given: 52 | Project project = ProjectBuilder.builder().build() 53 | project.version = "7895812" 54 | CreateManifestTask task = project.tasks.create("m", CreateManifestTask) 55 | 56 | when: 57 | task.createManifest() 58 | 59 | then: 60 | Exception exception = thrown() 61 | exception.message.contains("Project version must be a valid SLS version: 7895812. " + 62 | "Please ensure there's at least one git tag on the repo (e.g. 0.0.0)") 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/JsonArtifactLocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2024 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.dist.artifacts; 18 | 19 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 20 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 21 | import java.net.URI; 22 | import java.net.URISyntaxException; 23 | import org.immutables.value.Value; 24 | 25 | @Value.Immutable 26 | @JsonDeserialize(as = ImmutableJsonArtifactLocator.class) 27 | @JsonSerialize(as = ImmutableJsonArtifactLocator.class) 28 | public interface JsonArtifactLocator { 29 | 30 | String URI_IS_NOT_VALID_PREAMBLE = "uri is not valid: "; 31 | 32 | String type(); 33 | 34 | String uri(); 35 | 36 | @Value.Check 37 | default void isValid() { 38 | try { 39 | // Throws IllegalArgumentException if URI does not conform to RFC 2396 40 | URI.create(uri()); 41 | } catch (IllegalArgumentException e) { 42 | if (!(e.getCause() instanceof URISyntaxException)) { 43 | throw new IllegalArgumentException("uri is invalid for some other reason", e); 44 | } 45 | 46 | URISyntaxException cause = (URISyntaxException) e.getCause(); 47 | int problemIndex = cause.getIndex(); 48 | String highlight = 49 | String.format(" %s^%s", "-".repeat(problemIndex), "-".repeat(uri().length() - (problemIndex + 1))); 50 | throw new IllegalArgumentException( 51 | String.format("%s\n'%s'\n%s", URI_IS_NOT_VALID_PREAMBLE, uri(), highlight), e); 52 | } 53 | } 54 | 55 | static JsonArtifactLocator from(ArtifactLocator artifactLocator) { 56 | return from(artifactLocator.getType().get(), artifactLocator.getUri().get()); 57 | } 58 | 59 | static JsonArtifactLocator from(String type, String uri) { 60 | return ImmutableJsonArtifactLocator.builder().type(type).uri(uri).build(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/main/java/com/palantir/gradle/dist/RecommendedProductDependenciesExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist; 18 | 19 | import groovy.lang.Closure; 20 | import groovy.lang.DelegatesTo; 21 | import java.util.Set; 22 | import javax.inject.Inject; 23 | import org.gradle.api.Project; 24 | import org.gradle.api.provider.ProviderFactory; 25 | import org.gradle.api.provider.SetProperty; 26 | 27 | public class RecommendedProductDependenciesExtension { 28 | private final Project project; 29 | private final SetProperty recommendedProductDependencies; 30 | private final ProviderFactory providerFactory; 31 | 32 | @Inject 33 | public RecommendedProductDependenciesExtension(Project project) { 34 | this.project = project; 35 | this.recommendedProductDependencies = 36 | project.getObjects().setProperty(ProductDependency.class).empty(); 37 | this.providerFactory = project.getProviders(); 38 | } 39 | 40 | /** Lazily configures and adds a {@link ProductDependency}. */ 41 | public final void productDependency(@DelegatesTo(ProductDependency.class) Closure closure) { 42 | recommendedProductDependencies.add(providerFactory.provider(() -> { 43 | ProductDependency dep = new ProductDependency(); 44 | project.configure(dep, closure); 45 | dep.isValid(); 46 | return dep; 47 | })); 48 | } 49 | 50 | public final SetProperty getRecommendedProductDependenciesProvider() { 51 | return recommendedProductDependencies; 52 | } 53 | 54 | /** 55 | * The product dependencies of this project. 56 | * 57 | * @deprecated Use {@link #getRecommendedProductDependenciesProvider()} instead. 58 | */ 59 | @Deprecated 60 | public final Set getRecommendedProductDependencies() { 61 | return recommendedProductDependencies.get(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/SelectSingleFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.artifacts; 18 | 19 | import java.io.File; 20 | import java.io.IOException; 21 | import java.io.UncheckedIOException; 22 | import java.nio.file.Files; 23 | import java.nio.file.Path; 24 | import org.gradle.api.artifacts.transform.InputArtifact; 25 | import org.gradle.api.artifacts.transform.TransformAction; 26 | import org.gradle.api.artifacts.transform.TransformOutputs; 27 | import org.gradle.api.file.FileSystemLocation; 28 | import org.gradle.api.provider.Provider; 29 | import org.gradle.api.tasks.PathSensitive; 30 | import org.gradle.api.tasks.PathSensitivity; 31 | import org.gradle.work.DisableCachingByDefault; 32 | import org.slf4j.Logger; 33 | import org.slf4j.LoggerFactory; 34 | 35 | @DisableCachingByDefault( 36 | because = "Extracting a single file from a zip is much faster than making network requests to the build cache") 37 | public abstract class SelectSingleFile implements TransformAction { 38 | private static final Logger log = LoggerFactory.getLogger(SelectSingleFile.class); 39 | 40 | @PathSensitive(PathSensitivity.NAME_ONLY) 41 | @InputArtifact 42 | public abstract Provider getInputArtifact(); 43 | 44 | @Override 45 | public final void transform(TransformOutputs outputs) { 46 | File rootDir = getInputArtifact().get().getAsFile(); 47 | Path pathToExtract = 48 | rootDir.toPath().resolve(getParameters().getPathToExtract().get()); 49 | 50 | if (!Files.exists(pathToExtract)) { 51 | log.debug("Could not find '{}' in {}", pathToExtract, rootDir); 52 | return; 53 | } 54 | 55 | Path outputFile = outputs.file("SelectSingleFile-output").toPath(); 56 | try { 57 | Files.copy(pathToExtract, outputFile); 58 | } catch (IOException e) { 59 | throw new UncheckedIOException(String.format("Failed to copy '%s'", pathToExtract), e); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/ProductDependencyMergerTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2018 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.dist 18 | 19 | 20 | import spock.lang.Specification 21 | 22 | class ProductDependencyMergerTest extends Specification { 23 | def "picks larger minimum version and smaller maximum version"() { 24 | given: 25 | def dep1 = newRecommendation("2.0.0", "2.6.x", "2.2.0") 26 | def dep2 = newRecommendation("2.1.0", "2.x.x", "2.2.0") 27 | 28 | when: 29 | def merged = ProductDependencyMerger.merge(dep1, dep2) 30 | 31 | then: 32 | merged.minimumVersion == "2.1.0" 33 | merged.maximumVersion == "2.6.x" 34 | merged.recommendedVersion == "2.2.0" 35 | } 36 | 37 | def "fails if new min is greater than new max"() { 38 | given: 39 | def dep1 = newRecommendation("2.0.0", "2.6.x", "2.2.0") 40 | def dep2 = newRecommendation("2.7.0", "2.x.x", "2.8.0") 41 | 42 | when: 43 | def merged = ProductDependencyMerger.merge(dep1, dep2) 44 | 45 | then: 46 | def e = thrown(IllegalArgumentException) 47 | e.message.contains("Could not merge recommended product dependencies as their version ranges do not overlap") 48 | } 49 | 50 | def "fails if min == max"() { 51 | given: 52 | def dep1 = newRecommendation("2.5.0", "2.x.x") 53 | def dep2 = newRecommendation("2.1.0", "2.5.0") 54 | 55 | when: 56 | def merged = ProductDependencyMerger.merge(dep1, dep2) 57 | 58 | then: 59 | def e = thrown(IllegalArgumentException) 60 | e.message.contains("minimumVersion and maximumVersion must be different") 61 | } 62 | 63 | def "merges optional and non-optional"() { 64 | given: 65 | def dep1 = newRecommendation("2.0.0", "2.x.x") 66 | def dep2 = new ProductDependency("group", "name", "2.0.0", "2.x.x", null, true) 67 | 68 | when: 69 | def merged = ProductDependencyMerger.merge(dep1, dep2) 70 | def merged2 = ProductDependencyMerger.merge(dep2, dep2) 71 | 72 | then: 73 | !merged.optional 74 | merged2.optional 75 | } 76 | 77 | private ProductDependency newRecommendation(String min, String max, String recommended = null) { 78 | return new ProductDependency("group", "name", min, max, recommended) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/ProductDependencyIntrospectionPluginTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist 18 | 19 | 20 | import nebula.test.ProjectSpec 21 | import org.gradle.api.GradleException 22 | 23 | class ProductDependencyIntrospectionPluginTest extends ProjectSpec { 24 | def setup() { 25 | project.pluginManager.apply(ProductDependencyIntrospectionPlugin) 26 | } 27 | 28 | def "get version from lock file"() { 29 | project.file("product-dependencies.lock").text = '''\ 30 | # Run ./gradlew writeProductDependenciesLocks to regenerate this file 31 | com.palantir.product:test (1.0.0, 1.x.x) 32 | '''.stripIndent(true) 33 | 34 | when: 35 | def result = project.ext.getMinimumProductVersion("com.palantir.product:test") 36 | 37 | then: 38 | result == "1.0.0" 39 | } 40 | 41 | def "resolves project versions into concrete version"() { 42 | project.version = "1.1.0" 43 | project.file("product-dependencies.lock").text = '''\ 44 | # Run ./gradlew writeProductDependenciesLocks to regenerate this file 45 | com.palantir.product:test ($projectVersion, 1.x.x) 46 | '''.stripIndent(true) 47 | 48 | when: 49 | def result = project.ext.getMinimumProductVersion("com.palantir.product:test") 50 | 51 | then: 52 | result == project.version 53 | } 54 | 55 | def "fails if lock file does not exist"() { 56 | when: 57 | project.ext.getMinimumProductVersion("com.palantir.product:test") 58 | 59 | then: 60 | IllegalStateException exception = thrown() 61 | exception.message.contains("product-dependencies.lock does not exist. Run ./gradlew --write-locks to generate it.") 62 | } 63 | 64 | def "fails if dependency does not exist in lock file"() { 65 | project.file("product-dependencies.lock").text = '''\ 66 | # Run ./gradlew writeProductDependenciesLocks to regenerate this file 67 | com.palantir.product:test (1.0.0, 1.x.x) 68 | '''.stripIndent(true) 69 | 70 | when: 71 | project.ext.getMinimumProductVersion("com.palantir.other:test") 72 | 73 | then: 74 | GradleException exception = thrown() 75 | exception.message.contains("Unable to find product dependency for 'com.palantir.other:test'") 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/ExtractFileFromJar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.artifacts; 18 | 19 | import java.io.File; 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | import java.io.UncheckedIOException; 23 | import java.nio.file.Files; 24 | import java.util.zip.ZipEntry; 25 | import java.util.zip.ZipFile; 26 | import org.gradle.api.artifacts.transform.InputArtifact; 27 | import org.gradle.api.artifacts.transform.TransformAction; 28 | import org.gradle.api.artifacts.transform.TransformOutputs; 29 | import org.gradle.api.file.FileSystemLocation; 30 | import org.gradle.api.provider.Provider; 31 | import org.gradle.api.tasks.PathSensitive; 32 | import org.gradle.api.tasks.PathSensitivity; 33 | import org.gradle.work.DisableCachingByDefault; 34 | import org.slf4j.Logger; 35 | import org.slf4j.LoggerFactory; 36 | 37 | @DisableCachingByDefault( 38 | because = "Extracting a single file from a zip is much faster than making network requests to the build cache") 39 | public abstract class ExtractFileFromJar implements TransformAction { 40 | private static final Logger log = LoggerFactory.getLogger(ExtractFileFromJar.class); 41 | 42 | @PathSensitive(PathSensitivity.NAME_ONLY) 43 | @InputArtifact 44 | public abstract Provider getInputArtifact(); 45 | 46 | @Override 47 | public final void transform(TransformOutputs outputs) { 48 | File jarFile = getInputArtifact().get().getAsFile(); 49 | String pathToExtract = getParameters().getPathToExtract().get(); 50 | 51 | try (ZipFile zipFile = new ZipFile(jarFile)) { 52 | ZipEntry zipEntry = zipFile.getEntry(pathToExtract); 53 | if (zipEntry == null) { 54 | log.debug("Unable to find '{}' in JAR: {}", pathToExtract, jarFile); 55 | return; 56 | } 57 | 58 | try (InputStream is = zipFile.getInputStream(zipEntry)) { 59 | String newFileName = com.google.common.io.Files.getNameWithoutExtension(jarFile.getName()) + "-" 60 | + pathToExtract.replaceAll("/", "-"); 61 | File outputFile = outputs.file(newFileName); 62 | Files.copy(is, outputFile.toPath()); 63 | } 64 | } catch (IOException e) { 65 | throw new UncheckedIOException("Failed to extract '" + pathToExtract + "' from jar: " + jarFile, e); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/ProductDependencyLockFileTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist 18 | 19 | 20 | import spock.lang.Specification 21 | 22 | class ProductDependencyLockFileTest extends Specification { 23 | 24 | def 'serialize'() { 25 | when: 26 | List sample = [ 27 | new ProductDependency("com.palantir.product", "foo", "1.20.0", "1.x.x", null), 28 | new ProductDependency("com.palantir.other", "bar", "0.2.0", "0.x.x", null, true) 29 | ] 30 | 31 | then: 32 | ProductDependencyLockFile.asString(sample, [] as Set) == """\ 33 | # Run ./gradlew writeProductDependenciesLocks to regenerate this file 34 | com.palantir.other:bar (0.2.0, 0.x.x) optional 35 | com.palantir.product:foo (1.20.0, 1.x.x) 36 | """.stripIndent(true) 37 | } 38 | 39 | def 'serialize project version'() { 40 | when: 41 | def result = ProductDependencyLockFile.asString( 42 | [new ProductDependency("com.palantir.product", "foo", "1.0.0", "1.x.x", null),], 43 | [new ProductId("com.palantir.product", "foo")] as Set 44 | ) 45 | then: 46 | result == '''\ 47 | # Run ./gradlew writeProductDependenciesLocks to regenerate this file 48 | com.palantir.product:foo ($projectVersion, 1.x.x) 49 | '''.stripIndent(true) 50 | } 51 | 52 | def 'deserialize'() { 53 | when: 54 | List result = ProductDependencyLockFile.fromString("""\ 55 | # Run ./gradlew writeProductDependenciesLocks to regenerate this file 56 | com.palantir.other:bar (0.2.0, 0.x.x) 57 | com.palantir.product:foo (1.20.0, 1.x.x) optional 58 | """.stripIndent(true), "0.0.0") 59 | 60 | then: 61 | result.size() == 2 62 | result[0] == new ProductDependency("com.palantir.other", "bar", "0.2.0", "0.x.x", null) 63 | result[1] == new ProductDependency("com.palantir.product", "foo", "1.20.0", "1.x.x", null, true) 64 | } 65 | 66 | def 'round-trips without recommended version'() { 67 | when: 68 | List input = [ 69 | new ProductDependency("com.palantir.other", "bar", "0.2.0", "0.x.x", null), 70 | new ProductDependency("com.palantir.product", "foo", "1.20.0", "1.x.x", null), 71 | ] 72 | 73 | then: 74 | input == ProductDependencyLockFile.fromString(ProductDependencyLockFile.asString(input, [] as Set), "0.0.0") 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ProductId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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 | package com.palantir.gradle.dist; 17 | 18 | import com.google.common.base.Preconditions; 19 | import com.google.common.base.Splitter; 20 | import java.io.Serializable; 21 | import java.util.List; 22 | import java.util.Objects; 23 | 24 | public final class ProductId implements Serializable { 25 | private static final Splitter SPLITTER = Splitter.on(':'); 26 | 27 | private static final long serialVersionUID = 1L; 28 | private String productGroup; 29 | private String productName; 30 | 31 | public static ProductId of(ProductDependency dependency) { 32 | return new ProductId(dependency.getProductGroup(), dependency.getProductName()); 33 | } 34 | 35 | public ProductId() {} 36 | 37 | public ProductId(String productId) { 38 | List split = SPLITTER.splitToList(productId); 39 | if (split.size() != 2) { 40 | throw new IllegalArgumentException("Invalid product ID: " + split); 41 | } 42 | 43 | this.productGroup = split.get(0); 44 | this.productName = split.get(1); 45 | } 46 | 47 | public ProductId(String productGroup, String productName) { 48 | this.productGroup = productGroup; 49 | this.productName = productName; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return productGroup + ":" + productName; 55 | } 56 | 57 | public void isValid() { 58 | Preconditions.checkNotNull(productGroup, "productGroup must be specified"); 59 | Preconditions.checkNotNull(productName, "productName must be specified"); 60 | } 61 | 62 | public String getProductGroup() { 63 | return productGroup; 64 | } 65 | 66 | public void setProductGroup(String productGroup) { 67 | this.productGroup = productGroup; 68 | } 69 | 70 | public String getProductName() { 71 | return productName; 72 | } 73 | 74 | public void setProductName(String productName) { 75 | this.productName = productName; 76 | } 77 | 78 | @Override 79 | public boolean equals(Object other) { 80 | if (this == other) { 81 | return true; 82 | } 83 | if (other == null || getClass() != other.getClass()) { 84 | return false; 85 | } 86 | ProductId productId = (ProductId) other; 87 | return Objects.equals(productGroup, productId.productGroup) 88 | && Objects.equals(productName, productId.productName); 89 | } 90 | 91 | @Override 92 | public int hashCode() { 93 | return Objects.hash(productGroup, productName); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/ExtractSingleFileOrManifest.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.dist.artifacts; 18 | 19 | import java.io.File; 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | import java.io.UncheckedIOException; 23 | import java.nio.charset.StandardCharsets; 24 | import java.nio.file.Files; 25 | import java.util.Optional; 26 | import java.util.jar.JarFile; 27 | import java.util.zip.ZipEntry; 28 | import org.gradle.api.artifacts.transform.InputArtifact; 29 | import org.gradle.api.artifacts.transform.TransformAction; 30 | import org.gradle.api.artifacts.transform.TransformOutputs; 31 | import org.gradle.api.file.FileSystemLocation; 32 | import org.gradle.api.provider.Provider; 33 | import org.gradle.api.tasks.PathSensitive; 34 | import org.gradle.api.tasks.PathSensitivity; 35 | import org.gradle.work.DisableCachingByDefault; 36 | 37 | @DisableCachingByDefault( 38 | because = "Extracting a single file from a zip is much faster than making network requests to the build cache") 39 | public abstract class ExtractSingleFileOrManifest implements TransformAction { 40 | @PathSensitive(PathSensitivity.NAME_ONLY) 41 | @InputArtifact 42 | public abstract Provider getInputArtifact(); 43 | 44 | @Override 45 | public final void transform(TransformOutputs outputs) { 46 | File jarFile = getInputArtifact().get().getAsFile(); 47 | String pathToExtract = getParameters().getPathToExtract().get(); 48 | String key = getParameters().getKeyToExtract().get(); 49 | 50 | try (JarFile jar = new JarFile(jarFile)) { 51 | ZipEntry fileEntry = jar.getEntry(pathToExtract); 52 | if (fileEntry != null) { 53 | try (InputStream is = jar.getInputStream(fileEntry)) { 54 | String newFileName = com.google.common.io.Files.getNameWithoutExtension(jarFile.getName()) + "-" 55 | + pathToExtract.replaceAll("/", "-"); 56 | File outputFile = outputs.file(newFileName); 57 | Files.copy(is, outputFile.toPath()); 58 | } 59 | return; 60 | } 61 | 62 | Optional value = Optional.ofNullable(jar.getManifest()) 63 | .map(manifest -> manifest.getMainAttributes().getValue(key)); 64 | if (value.isPresent()) { 65 | File outputFile = outputs.file("manifest.json"); 66 | Files.write(outputFile.toPath(), value.get().getBytes(StandardCharsets.UTF_8)); 67 | } 68 | } catch (IOException e) { 69 | throw new UncheckedIOException("Failed to extract '" + pathToExtract + "' from jar: " + jarFile, e); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/PreferProjectCompatibilityRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.artifacts; 18 | 19 | import javax.inject.Inject; 20 | import org.gradle.api.Project; 21 | import org.gradle.api.attributes.AttributeCompatibilityRule; 22 | import org.gradle.api.attributes.AttributeMatchingStrategy; 23 | import org.gradle.api.attributes.Category; 24 | import org.gradle.api.attributes.CompatibilityCheckDetails; 25 | 26 | /** 27 | * PreferProjectCompatibilityRule works alongside artifactTransformers in {@link DependencyDiscovery} to ensure that 28 | * we apply the right transformation to project dependencies to avoid compilation. 29 | * 30 | * Since the consuming {@link org.gradle.api.artifacts.ArtifactView} specifies that it requires 31 | * {@link Category#CATEGORY_ATTRIBUTE} of {@link PreferProjectCompatibilityRule#PROJECT} Gradle will select outgoing 32 | * variants that have the attribute applied and ignore variants with other values. This rule will make it so that 33 | * we will fall back to accepting a variant with {@link Category#CATEGORY_ATTRIBUTE} of 34 | * {@link PreferProjectCompatibilityRule#EXTERNAL} if there is no other variants. 35 | */ 36 | public final class PreferProjectCompatibilityRule implements AttributeCompatibilityRule { 37 | 38 | public static final String PROJECT = "project"; 39 | public static final String EXTERNAL = "external"; 40 | 41 | public static void configureRule(Project project) { 42 | AttributeMatchingStrategy categorySchema = 43 | project.getDependencies().getAttributesSchema().attribute(Category.CATEGORY_ATTRIBUTE); 44 | categorySchema 45 | .getCompatibilityRules() 46 | .add( 47 | PreferProjectCompatibilityRule.class, 48 | actionConfiguration -> actionConfiguration.params( 49 | project.getObjects().named(Category.class, PROJECT), 50 | project.getObjects().named(Category.class, EXTERNAL))); 51 | } 52 | 53 | private final Category project; 54 | private final Category external; 55 | 56 | @Inject 57 | PreferProjectCompatibilityRule(Category project, Category external) { 58 | this.project = project; 59 | this.external = external; 60 | } 61 | 62 | @Override 63 | public void execute(CompatibilityCheckDetails details) { 64 | Category consumerValue = details.getConsumerValue(); 65 | Category producerValue = details.getProducerValue(); 66 | if (consumerValue == null) { 67 | details.compatible(); 68 | } else if (project.equals(consumerValue) && external.equals(producerValue)) { 69 | details.compatible(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/resources/sls-packaging/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2016 Palantir Technologies 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 | # 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 | # Everything in this script is relative to the base directory of an SLSv2 distribution 19 | pushd "`dirname \"$0\"`/../.." > /dev/null 20 | 21 | # Select launcher binary for this OS 22 | case "`uname -sm`" in 23 | "Linux x86_64") 24 | NATIVE_ARCH="linux-amd64" 25 | ;; 26 | "Linux aarch64") 27 | NATIVE_ARCH="linux-arm64" 28 | ;; 29 | Darwin*) 30 | NATIVE_ARCH="darwin-amd64" 31 | ;; 32 | *) 33 | echo "Unsupported operating system: $(uname)"; exit 1 34 | esac 35 | 36 | LAUNCHER_CMD="service/bin/${NATIVE_ARCH}/go-java-launcher" 37 | GO_INIT_CMD="service/bin/${NATIVE_ARCH}/go-init" 38 | 39 | ACTION=$1 40 | SCRIPT_DIR="service/bin" 41 | SERVICE="@serviceName@" 42 | PIDFILE="var/run/$SERVICE.pid" 43 | STATIC_LAUNCHER_CONFIG="service/bin/launcher-static.yml" 44 | CUSTOM_LAUNCHER_CONFIG="var/conf/launcher-custom.yml" 45 | STATIC_LAUNCHER_CHECK_CONFIG="service/bin/launcher-check.yml" 46 | 47 | DEPRECATION_MESSAGE="Command is deprecated: the next major release of sls-packaging will only support start/status/stop" 48 | 49 | function print_help() { 50 | echo "$0 forwards commands to go-init with the following usage." 51 | echo "" 52 | } 53 | 54 | if [[ "$ACTION" =~ ^(-h|--help)$ && "$2" =~ ^(|start|stop|status)$ ]]; then 55 | print_help 56 | exec $GO_INIT_CMD --help "$2" 57 | fi 58 | 59 | case $ACTION in 60 | start|status|stop) 61 | if [[ "$2" =~ ^(-h|--help)$ ]]; then 62 | print_help 63 | exec $GO_INIT_CMD "$ACTION" $2 64 | fi 65 | exec $GO_INIT_CMD "$ACTION" 66 | ;; 67 | console) 68 | echo $DEPRECATION_MESSAGE 69 | if service/bin/init.sh status &> /dev/null; then 70 | echo "Process is already running" 71 | exit 1 72 | fi 73 | trap "service/bin/init.sh stop &> /dev/null" SIGTERM EXIT 74 | mkdir -p "$(dirname $PIDFILE)" 75 | 76 | $LAUNCHER_CMD $STATIC_LAUNCHER_CONFIG $CUSTOM_LAUNCHER_CONFIG & 77 | echo $! > $PIDFILE 78 | wait 79 | ;; 80 | restart) 81 | echo $DEPRECATION_MESSAGE 82 | service/bin/init.sh stop 83 | service/bin/init.sh start 84 | ;; 85 | check) 86 | echo $DEPRECATION_MESSAGE 87 | printf "%-50s" "Checking health of '$SERVICE'..." 88 | $LAUNCHER_CMD $STATIC_LAUNCHER_CHECK_CONFIG > var/log/$SERVICE-check.log 2>&1 89 | RESULT=$? 90 | if [ $RESULT -eq 0 ]; then 91 | printf "%s\n" "Healthy" 92 | exit 0 93 | else 94 | printf "%s\n" "Unhealthy" 95 | exit $RESULT 96 | fi 97 | ;; 98 | *) 99 | # Support arbitrary additional actions; e.g. init-reload.sh will add a "reload" action 100 | if [[ -f "$SCRIPT_DIR/init-$ACTION.sh" ]]; then 101 | echo $DEPRECATION_MESSAGE 102 | export LAUNCHER_CMD 103 | shift 104 | /bin/bash "$SCRIPT_DIR/init-$ACTION.sh" "$@" 105 | exit $? 106 | else 107 | print_help 108 | exec $GO_INIT_CMD 109 | fi 110 | esac 111 | -------------------------------------------------------------------------------- /gradle-sls-packaging/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.gradle.plugin-publish' 2 | // java-gradle-plugin MUST be applied before publish-jar.gradle 3 | apply plugin: 'java-gradle-plugin' 4 | apply plugin: 'com.palantir.external-publish-jar' 5 | apply plugin: 'com.palantir.gradle-plugin-testing' 6 | apply plugin: 'groovy' 7 | apply plugin: 'de.undercouch.download' 8 | 9 | dependencies { 10 | compileOnly 'com.palantir.gradle.consistentversions:gradle-consistent-versions' 11 | testRuntimeOnly 'com.palantir.gradle.consistentversions:gradle-consistent-versions' 12 | 13 | api gradleApi() 14 | api project(':gradle-recommended-product-dependencies') 15 | api project(':gradle-sls-packaging-api') 16 | api 'com.google.guava:guava' 17 | api 'com.fasterxml.jackson.core:jackson-databind' 18 | api 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' 19 | api "com.fasterxml.jackson.datatype:jackson-datatype-guava" 20 | api 'com.palantir.safe-logging:preconditions' 21 | implementation 'org.apache.commons:commons-lang3' 22 | implementation 'com.fasterxml.jackson.datatype:jackson-datatype-guava' 23 | implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8' 24 | implementation 'com.palantir.gradle.failure-reports:gradle-failure-reports-exceptions' 25 | 26 | compileOnly 'org.immutables:value::annotations' 27 | annotationProcessor 'org.immutables:value' 28 | compileOnly 'com.palantir.gradle.auto-parallelizable:auto-parallelizable-annotations' 29 | annotationProcessor 'com.palantir.gradle.auto-parallelizable:auto-parallelizable' 30 | 31 | testImplementation gradleTestKit() 32 | testImplementation 'com.netflix.nebula:nebula-test' 33 | testImplementation 'org.awaitility:awaitility' 34 | testImplementation 'org.junit.jupiter:junit-jupiter' 35 | testImplementation 'org.rauschig:jarchivelib' 36 | testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' 37 | } 38 | 39 | gradlePlugin { 40 | website = 'https://github.com/palantir/sls-packaging' 41 | vcsUrl = 'https://github.com/palantir/sls-packaging' 42 | 43 | plugins { 44 | javaServiceDistributionPlugin { 45 | id = 'com.palantir.sls-java-service-distribution' 46 | displayName = 'Creates SLS Java services distributions' 47 | tags.set(['distribution', 'application']) 48 | implementationClass = 'com.palantir.gradle.dist.service.JavaServiceDistributionPlugin' 49 | description = 'Creates a distributable package containing libraries and scripts necessary to easily deploy and run a Java project.' 50 | } 51 | assetDistributionPlugin { 52 | id = 'com.palantir.sls-asset-distribution' 53 | displayName = 'Creates SLS asset distributions' 54 | tags.set(['distribution', 'application']) 55 | implementationClass= 'com.palantir.gradle.dist.asset.AssetDistributionPlugin' 56 | description = 'Creates a distributable package containing an SLS asset.' 57 | } 58 | } 59 | } 60 | 61 | publishPlugins.onlyIf { 62 | project.version ==~ /[0-9]+(\.[0-9]+)+(-rc[0-9]+)?(-alpha[0-9]+)?/ 63 | } 64 | 65 | test { 66 | maxHeapSize = '1g' 67 | // required so nebula tests don't fail on stuff to be removed in gradle 9 68 | // of course, we are going to have to deal with those things sooner or later 69 | systemProperty('ignoreDeprecations', true) 70 | } 71 | 72 | // Configure the publishPlugins task 73 | tasks.publish.dependsOn publishPlugins 74 | project.ext.'gradle.publish.key' = System.env["GRADLE_KEY"] 75 | project.ext.'gradle.publish.secret' = System.env["GRADLE_SECRET"] 76 | 77 | gradleTestUtils { 78 | gradleVersions = ['8.14.3'] 79 | configurationCacheEnabled = true 80 | } 81 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/DeploymentDirInclusion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2024 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.dist; 18 | 19 | import org.gradle.api.Action; 20 | import org.gradle.api.file.CopySpec; 21 | import org.gradle.api.file.ProjectLayout; 22 | 23 | public final class DeploymentDirInclusion { 24 | 25 | public static void includeFromDeploymentDirs( 26 | ProjectLayout projectLayout, 27 | BaseDistributionExtension distributionExtension, 28 | CopySpec root, 29 | Action extraConfig) { 30 | 31 | root.into("deployment", t -> { 32 | // We exclude configuration.yml from the general "deployment" importer, as it is special cased and 33 | // handled separately below. 34 | t.exclude("configuration.yml"); 35 | t.from("deployment"); 36 | t.from(projectLayout.getBuildDirectory().dir("deployment")); 37 | extraConfig.execute(t); 38 | }); 39 | 40 | root.into("deployment", t -> { 41 | // Import configuration.yml from the where it is declared in the extension, allowing tasks to 42 | // generate it and have dependent tasks (like this distTar) get the correct task deps. 43 | t.from(distributionExtension.getConfigurationYml().map(file -> { 44 | // We enforce the file is called configuration.yml. Unfortunately, there is an internal 45 | // piece of code that deduplicates files in gradle-sls-docker. This deduplication is done 46 | // using this copyspec. Were we to just call `.rename()` on this copyspec arm (to allow plugin 47 | // devs to output their generated configuration.ymls to some file not called configuration.yml) this 48 | // rename happens after the renames in the file deduplication code. Unfortunately, it was very hard 49 | // to disentangle the file deduplication from using this copyspec and maintain build performance 50 | // - instead we choose to simply check that the `configuration.yml` is called the right thing 51 | // so it doesn't need to be renamed here. 52 | if (file.getAsFile().getName().equals("configuration.yml")) { 53 | return file; 54 | } 55 | 56 | throw new IllegalStateException("The file set to be the value of getConfigurationYml() " 57 | + "must be called configuration.yml. Instead, it was called " + file.getAsFile()); 58 | })); 59 | 60 | // This is a bit of hack to "fall back" to a `build/deployment/configuration.yml` if the 61 | // `deployment/configuration.yml` does not exist. This can happen when there's a templating setup 62 | // that pre-exists the being able to configuration.yml on the extension and it outputs to 63 | // `build/deployment/configuration.yml`. 64 | t.from(projectLayout.getBuildDirectory().file("deployment/configuration.yml")); 65 | }); 66 | } 67 | 68 | private DeploymentDirInclusion() {} 69 | } 70 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ObjectMappers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist; 18 | 19 | import com.fasterxml.jackson.annotation.JsonInclude; 20 | import com.fasterxml.jackson.databind.DeserializationFeature; 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | import com.fasterxml.jackson.databind.PropertyNamingStrategies; 23 | import com.fasterxml.jackson.databind.SerializationFeature; 24 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; 25 | import com.fasterxml.jackson.datatype.guava.GuavaModule; 26 | import com.palantir.gradle.dist.pdeps.ProductDependencyManifest; 27 | import java.io.File; 28 | import java.io.IOException; 29 | import java.nio.file.Files; 30 | import org.gradle.api.GradleException; 31 | 32 | public final class ObjectMappers { 33 | @SuppressWarnings("for-rollout:deprecation") 34 | public static final ObjectMapper jsonMapper = new ObjectMapper() 35 | .setSerializationInclusion(JsonInclude.Include.NON_NULL) 36 | .setPropertyNamingStrategy(PropertyNamingStrategies.KEBAB_CASE) 37 | .enable(SerializationFeature.INDENT_OUTPUT) 38 | .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) 39 | .registerModule(new GuavaModule()); 40 | 41 | private static final ObjectMapper ymlMapper = new ObjectMapper(new YAMLFactory()).registerModule(new GuavaModule()); 42 | 43 | public static void writeProductDependencyManifest(ProductDependencyManifest pdm, File outputFile) { 44 | try { 45 | Files.createDirectories(outputFile.toPath().getParent()); 46 | jsonMapper.writeValue(outputFile, pdm); 47 | } catch (IOException e) { 48 | throw new GradleException("Unable to write ProductDependencyManifest file", e); 49 | } 50 | } 51 | 52 | public static ProductDependencyManifest readProductDependencyManifest(File file) { 53 | try { 54 | return jsonMapper.readValue(file, ProductDependencyManifest.class); 55 | } catch (IOException e) { 56 | throw new GradleException("Unable to read ProductDependencyManifest: " + file, e); 57 | } 58 | } 59 | 60 | public static RecommendedProductDependencies readRecommendedProductDependencies(File file) { 61 | try { 62 | return jsonMapper.readValue(file, RecommendedProductDependencies.class); 63 | } catch (IOException e) { 64 | throw new GradleException("Unable to read RecommendedProductDependencies: " + file, e); 65 | } 66 | } 67 | 68 | public static String writeSchemaVersionsAsString(SchemaVersionLockFile lockFile) { 69 | try { 70 | return ymlMapper.writeValueAsString(lockFile); 71 | } catch (IOException e) { 72 | throw new GradleException("Unable to write SchemaVersionLockFile", e); 73 | } 74 | } 75 | 76 | public static SchemaVersionLockFile readSchemaVersionsFromString(String input) { 77 | try { 78 | return ymlMapper.readValue(input, SchemaVersionLockFile.class); 79 | } catch (IOException e) { 80 | throw new GradleException("Unable to read SchemaVersionLockFile", e); 81 | } 82 | } 83 | 84 | private ObjectMappers() {} 85 | } 86 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/main/java/com/palantir/gradle/dist/RecommendedProductDependenciesPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist; 18 | 19 | import org.gradle.api.Plugin; 20 | import org.gradle.api.Project; 21 | import org.gradle.api.plugins.JavaPlugin; 22 | import org.gradle.api.tasks.SourceSetContainer; 23 | import org.gradle.api.tasks.TaskProvider; 24 | import org.gradle.jvm.tasks.Jar; 25 | 26 | public class RecommendedProductDependenciesPlugin implements Plugin { 27 | 28 | public static final String RESOURCE_PATH = 29 | RecommendedProductDependencies.SLS_RECOMMENDED_PRODUCT_DEPS_KEY + "/product-dependencies.json"; 30 | 31 | @Override 32 | public final void apply(Project project) { 33 | @SuppressWarnings({"for-rollout:GradleTypesAsFields", "for-rollout:NonAbstractGradleType"}) 34 | RecommendedProductDependenciesExtension ext = project.getExtensions() 35 | .create("recommendedProductDependencies", RecommendedProductDependenciesExtension.class, project); 36 | 37 | project.getPluginManager().withPlugin("java", _plugin -> { 38 | embedResource(project, ext); 39 | configureManifest(project, ext); 40 | }); 41 | } 42 | 43 | @SuppressWarnings("for-rollout:TaskDependsOn") 44 | private void configureManifest(Project project, RecommendedProductDependenciesExtension ext) { 45 | TaskProvider configureProductDependenciesTask = project.getTasks() 46 | .register("configureProductDependencies", ConfigureProductDependenciesTask.class, cmt -> { 47 | cmt.setProductDependencies(ext.getRecommendedProductDependenciesProvider()); 48 | }); 49 | 50 | // Ensure that the jar task depends on this wiring task 51 | project.getTasks().withType(Jar.class).named(JavaPlugin.JAR_TASK_NAME).configure(jar -> { 52 | jar.dependsOn(configureProductDependenciesTask); 53 | }); 54 | } 55 | 56 | private void embedResource(Project project, RecommendedProductDependenciesExtension ext) { 57 | TaskProvider compilePdeps = project.getTasks() 58 | .register( 59 | "compileRecommendedProductDependencies", CompileRecommendedProductDependencies.class, task -> { 60 | task.getRecommendedProductDependencies() 61 | .set(ext.getRecommendedProductDependenciesProvider()); 62 | task.getOutputDir() 63 | .set(project.getLayout().getBuildDirectory().dir("product-dependencies")); 64 | }); 65 | 66 | project.getTasks() 67 | .named( 68 | JavaPlugin.PROCESS_RESOURCES_TASK_NAME, 69 | processResources -> processResources.dependsOn(compilePdeps)); 70 | 71 | SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); 72 | sourceSets.named("main").configure(sourceSet -> { 73 | sourceSet.getResources().srcDir(compilePdeps.map(CompileRecommendedProductDependencies::getOutputDir)); 74 | }); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/util/MainClassResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2015 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.dist.service.util; 18 | 19 | import com.google.common.collect.Iterables; 20 | import java.io.File; 21 | import java.io.IOException; 22 | import java.io.UncheckedIOException; 23 | import java.nio.charset.StandardCharsets; 24 | import java.nio.file.Files; 25 | import java.nio.file.Path; 26 | import java.util.Set; 27 | import java.util.stream.Collectors; 28 | import java.util.stream.Stream; 29 | import org.gradle.api.Project; 30 | import org.gradle.api.tasks.SourceSet; 31 | 32 | // TODO(fwindheuser): Replace 'JavaPluginConvention' with 'JavaPluginExtension' before migrating to Gradle 8. 33 | @SuppressWarnings("deprecation") 34 | public final class MainClassResolver { 35 | public static String resolveMainClass(Project project) { 36 | SourceSet main = project.getExtensions() 37 | .getByType(org.gradle.api.plugins.JavaPluginExtension.class) 38 | .getSourceSets() 39 | .getByName("main"); 40 | Set javaFilesWithMainMethods = main.getAllSource().getSrcDirs().stream() 41 | .filter(File::exists) 42 | .map(File::toPath) 43 | .flatMap(sourceDir -> allJavaFilesIn(sourceDir) 44 | .filter(javaFile -> anyLinesInFileContain(javaFile, "public static void main(")) 45 | .filter(javaFile -> 46 | !anyLinesInFileContain(javaFile, "com.palantir.atlasdb.table.description.Schema")) 47 | .map(sourceDir::relativize)) 48 | .collect(Collectors.toSet()); 49 | 50 | if (javaFilesWithMainMethods.size() != 1) { 51 | throw new RuntimeException(String.format( 52 | "Expecting to find exactly one main method, however we found %s of them in:\n%s\n", 53 | javaFilesWithMainMethods.size(), 54 | javaFilesWithMainMethods.stream() 55 | .map(Object::toString) 56 | .sorted() 57 | .collect(Collectors.joining("\n")))); 58 | } 59 | 60 | return Iterables.getOnlyElement(javaFilesWithMainMethods) 61 | .toString() 62 | .replace(".java", "") 63 | .replace(File.separatorChar, '.'); 64 | } 65 | 66 | private static boolean anyLinesInFileContain(Path path, String text) { 67 | try (Stream lines = Files.lines(path, StandardCharsets.UTF_8)) { 68 | return lines.anyMatch(line -> line.contains(text)); 69 | } catch (IOException e) { 70 | throw new UncheckedIOException(e); 71 | } 72 | } 73 | 74 | private static Stream allJavaFilesIn(Path rootPath) { 75 | try (Stream paths = Files.walk(rootPath, Integer.MAX_VALUE)) { 76 | return paths 77 | .filter(Files::isRegularFile) 78 | .filter(path -> path.toString().endsWith(".java")) 79 | .collect(Collectors.toSet()) 80 | .stream(); 81 | } catch (IOException e) { 82 | throw new UncheckedIOException(e); 83 | } 84 | } 85 | 86 | private MainClassResolver() {} 87 | } 88 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/GcProfileIntegrationSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2018 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.dist.service 18 | 19 | import com.palantir.gradle.dist.GradleIntegrationSpec 20 | import com.palantir.gradle.dist.GradleTestVersions 21 | import com.palantir.gradle.dist.service.gc.GcProfile 22 | import java.nio.file.Files 23 | import java.nio.file.Path 24 | import java.nio.file.Paths 25 | import org.awaitility.Awaitility 26 | import spock.lang.Unroll 27 | 28 | class GcProfileIntegrationSpec extends GradleIntegrationSpec { 29 | 30 | static Path touchService = Paths.get("src/test/groovy/com/palantir/gradle/dist/service/ExampleTouchService.java") 31 | File signalFile 32 | 33 | def setup() { 34 | signalFile = new File(getProjectDir(), "example-touch-service-started") 35 | buildFile << """ 36 | plugins { 37 | id 'com.palantir.sls-java-service-distribution' 38 | } 39 | 40 | repositories { 41 | mavenCentral() 42 | } 43 | 44 | project.version = '1.0.0' 45 | 46 | distribution { 47 | serviceName 'touch-service' 48 | serviceGroup 'com.palantir.test' 49 | mainClass 'com.palantir.gradle.dist.service.ExampleTouchService' 50 | args '${signalFile.getAbsolutePath()}' 51 | } 52 | 53 | task extractDistTarForTest(type: Copy, dependsOn: distTar) { 54 | from { tarTree(distTar.outputs.files.singleFile) } 55 | into projectDir 56 | } 57 | """.stripIndent(true) 58 | Path path = projectDir.toPath().resolve( 59 | "src/main/java/com/palantir/gradle/dist/service/ExampleTouchService.java") 60 | Files.createDirectories(path.getParent()) 61 | Files.copy(touchService, path) 62 | assert signalFile.exists() == false 63 | } 64 | 65 | @Unroll 66 | def '#gradleVersionNumber: successfully create a distribution using gc: #gc'() { 67 | setup: 68 | gradleVersion = gradleVersionNumber 69 | 70 | buildFile << """ 71 | distribution { 72 | gc '${gc}' 73 | } 74 | """.stripIndent(true) 75 | 76 | when: 77 | runTasks(':extractDistTarForTest') 78 | 79 | then: 80 | execWithExitCode('touch-service-1.0.0/service/bin/init.sh', 'start') == 0 81 | Awaitility.await("file created using ${gc}").until({ 82 | signalFile.exists() 83 | }) 84 | 85 | cleanup: 86 | println file("touch-service-1.0.0/var/log/startup.log").text 87 | 88 | where: 89 | [gc, gradleVersionNumber] << [ 90 | GcProfile.PROFILE_NAMES.keySet().toArray(), 91 | GradleTestVersions.GRADLE_VERSIONS 92 | ].combinations() 93 | } 94 | 95 | int execWithExitCode(String... tasks) { 96 | ProcessBuilder pb = new ProcessBuilder().command(tasks).directory(projectDir).inheritIO() 97 | pb.environment().put("JAVA_HOME", System.getProperty("java.home")) 98 | Process proc = pb.start() 99 | int result = proc.waitFor() 100 | return result 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ProductDependencyLockFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist; 18 | 19 | import static java.util.stream.Collectors.toList; 20 | 21 | import com.google.common.base.Splitter; 22 | import java.util.List; 23 | import java.util.Set; 24 | import java.util.regex.Matcher; 25 | import java.util.regex.Pattern; 26 | import java.util.stream.Collectors; 27 | import java.util.stream.Stream; 28 | 29 | public final class ProductDependencyLockFile { 30 | 31 | private static final String HEADER = "# Run ./gradlew writeProductDependenciesLocks to regenerate this file\n"; 32 | public static final String PROJECT_VERSION = "$projectVersion"; 33 | private static final Pattern LOCK_PATTERN = Pattern.compile( 34 | "^(?[^:]+):(?[^ ]+) \\((?[^,]+), (?[^\\)]+)\\)(? optional)?$"); 35 | public static final String LOCK_FILE = "product-dependencies.lock"; 36 | 37 | public static List fromString(String contents, String projectVersion) { 38 | return Splitter.on("\n").splitToList(contents).stream() 39 | .flatMap(line -> { 40 | Matcher matcher = LOCK_PATTERN.matcher(line); 41 | if (matcher.matches()) { 42 | return Stream.of(new ProductDependency( 43 | matcher.group("group"), 44 | matcher.group("name"), 45 | matcher.group("min").equals(PROJECT_VERSION) ? projectVersion : matcher.group("min"), 46 | matcher.group("max"), 47 | null, 48 | matcher.group("optional") != null)); 49 | } 50 | return Stream.empty(); 51 | }) 52 | .collect(toList()); 53 | } 54 | 55 | public static String asString(List deps, Set servicesDeclaredInProject) { 56 | return deps.stream() 57 | .map(dep -> String.format( 58 | "%s:%s (%s, %s)%s", 59 | dep.getProductGroup(), 60 | dep.getProductName(), 61 | renderDepMinimumVersion(servicesDeclaredInProject, dep), 62 | dep.getMaximumVersion(), 63 | dep.getOptional() ? " optional" : "")) 64 | .sorted() 65 | .collect(Collectors.joining("\n", HEADER, "\n")); 66 | } 67 | 68 | /** 69 | * If a product ends up taking a product dependency on another product that's published in the same repo then the 70 | * lock file would have to be regenerated every commit, such that all PRs will end up conflicting with each other. 71 | * And sometimes it is not even possible to know what the proper minimum version is in time to write the lock file. 72 | * To avoid this, we replace the minimum version of such dependencies with a placeholder, {@code $projectVersion}. 73 | */ 74 | private static String renderDepMinimumVersion(Set servicesDeclaredInProject, ProductDependency dep) { 75 | ProductId productId = ProductId.of(dep); 76 | if (servicesDeclaredInProject.contains(productId)) { 77 | return PROJECT_VERSION; 78 | } else { 79 | return dep.getMinimumVersion(); 80 | } 81 | } 82 | 83 | private ProductDependencyLockFile() {} 84 | } 85 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/DiagnosticsManifestPluginIntegrationSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2020 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.dist.service 18 | 19 | import com.palantir.gradle.dist.GradleTestVersions 20 | import nebula.test.IntegrationSpec 21 | 22 | class DiagnosticsManifestPluginIntegrationSpec extends IntegrationSpec { 23 | 24 | def '#gradleVersionNumber: detects stuff defined in current project'() { 25 | given: 26 | gradleVersion = gradleVersionNumber 27 | buildFile << """ 28 | apply plugin: 'java-library' 29 | ${applyPlugin(DiagnosticsManifestPlugin.class)} 30 | 31 | repositories { 32 | mavenCentral() 33 | } 34 | """.stripIndent(true) 35 | addResource("src/main/resources/sls-manifest", "diagnostics.json", 36 | '[{"type": "foo.v1", "docs" : "This does something", "safe" : false}]') 37 | 38 | when: 39 | runTasksSuccessfully("mergeDiagnosticsJson", '-is') 40 | 41 | then: 42 | def outFile = file("build/mergeDiagnosticsJson.json") 43 | outFile.text == """\ 44 | [ { 45 | "type" : "foo.v1", 46 | "docs" : "This does something", 47 | "safe" : false 48 | } ]""".stripIndent(true) 49 | 50 | when: 51 | def result2 = runTasksSuccessfully("mergeDiagnosticsJson", '-is') 52 | 53 | then: 54 | result2.wasUpToDate(":mergeDiagnosticsJson") 55 | 56 | where: 57 | gradleVersionNumber << GradleTestVersions.GRADLE_VERSIONS 58 | } 59 | 60 | def '#gradleVersionNumber: detects stuff defined in sibling projects'() { 61 | given: 62 | gradleVersion = gradleVersionNumber 63 | buildFile << ''' 64 | subprojects { 65 | apply plugin: 'java-library' 66 | repositories { 67 | mavenCentral() 68 | } 69 | } 70 | ''' 71 | 72 | addSubproject('my-server', ''' 73 | apply plugin: com.palantir.gradle.dist.service.DiagnosticsManifestPlugin 74 | dependencies { 75 | implementation project(':my-project1') 76 | implementation project(':my-project2') 77 | } 78 | ''') 79 | addResource("my-server/src/main/resources/sls-manifest", "diagnostics.json", 80 | '[{"type": "foo.v1", "docs" : "This does something"}]') 81 | 82 | addSubproject('my-project1') 83 | addResource("my-project1/src/main/resources/sls-manifest", "diagnostics.json", 84 | '[{"type": "myproject1.v1", "docs" : "Who knows what this does"}]') 85 | 86 | addSubproject('my-project2') 87 | addResource("my-project2/src/main/resources/sls-manifest", "diagnostics.json", 88 | '[{"type": "myproject2.v1", "docs" : "Click me if you dare!"}]') 89 | 90 | when: 91 | def output = runTasksSuccessfully("my-server:mergeDiagnosticsJson", '-is') 92 | 93 | then: 94 | println output.standardOutput 95 | println output.standardError 96 | file("my-server/build/mergeDiagnosticsJson.json").text == """\ 97 | [ { 98 | "type" : "foo.v1", 99 | "docs" : "This does something" 100 | }, { 101 | "type" : "myproject1.v1", 102 | "docs" : "Who knows what this does" 103 | }, { 104 | "type" : "myproject2.v1", 105 | "docs" : "Click me if you dare!" 106 | } ]""".stripIndent(true) 107 | 108 | where: 109 | gradleVersionNumber << GradleTestVersions.GRADLE_VERSIONS 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/tasks/ConfigTarTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2016 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.dist.tasks; 18 | 19 | import com.palantir.gradle.dist.BaseDistributionExtension; 20 | import com.palantir.gradle.dist.DeploymentDirInclusion; 21 | import com.palantir.gradle.dist.ObjectMappers; 22 | import com.palantir.gradle.dist.service.JavaServiceDistributionPlugin; 23 | import java.io.IOException; 24 | import java.io.UncheckedIOException; 25 | import org.gradle.api.Action; 26 | import org.gradle.api.Project; 27 | import org.gradle.api.file.CopySpec; 28 | import org.gradle.api.tasks.AbstractCopyTask; 29 | import org.gradle.api.tasks.TaskProvider; 30 | import org.gradle.api.tasks.bundling.Compression; 31 | import org.gradle.api.tasks.bundling.Tar; 32 | 33 | public abstract class ConfigTarTask extends Tar { 34 | @Override 35 | public final AbstractCopyTask from(Object... sourcePaths) { 36 | return this.from(sourcePaths, _ignored -> {}); 37 | } 38 | 39 | @Override 40 | public final AbstractCopyTask from(Object sourcePath, Action configureAction) { 41 | return super.from(sourcePath, copySpec -> { 42 | // These from methods are overriden so we can set a default `into` on each from copyspec. Originally, the 43 | // task level `into` was set to `deployment`, which forced all files into the `deployment` directory. 44 | // However, with launcher-static.yml, we want to keep it at the same path as the dist, in service/bin/, 45 | // for consistency. However, other plugins (like hyperion) add their own custom `from`s, so to maintain 46 | // backcompat we override all the froms and set the default per from into to be `deployment`. 47 | copySpec.into("deployment"); 48 | configureAction.execute(copySpec); 49 | }); 50 | } 51 | 52 | public static TaskProvider createConfigTarTask(Project project, BaseDistributionExtension ext) { 53 | TaskProvider configTar = project.getTasks().register("configTar", ConfigTarTask.class, task -> { 54 | task.setGroup(JavaServiceDistributionPlugin.GROUP_NAME); 55 | task.setDescription( 56 | "Creates a compressed, gzipped tar file that contains the sls configuration files for the product"); 57 | task.setCompression(Compression.GZIP); 58 | 59 | DeploymentDirInclusion.includeFromDeploymentDirs(project.getLayout(), ext, task, _ignored -> {}); 60 | 61 | task.getDestinationDirectory() 62 | .set(project.getLayout().getBuildDirectory().dir("distributions")); 63 | task.getArchiveBaseName().set(ext.getDistributionServiceName()); 64 | task.getArchiveVersion() 65 | .set(project.provider(() -> project.getVersion().toString())); 66 | task.getArchiveExtension().set(ext.getProductType().map(productType -> { 67 | try { 68 | String productTypeString = ObjectMappers.jsonMapper.writeValueAsString(productType); 69 | return productTypeString 70 | .substring(1, productTypeString.lastIndexOf('.')) 71 | .concat(".config.tgz"); 72 | } catch (IOException e) { 73 | throw new UncheckedIOException(e); 74 | } 75 | })); 76 | }); 77 | 78 | // TODO(forozco): make this lazy since into does not support providers, but does support callable 79 | project.afterEvaluate(_p -> configTar.configure(task -> { 80 | task.into(String.format("%s-%s", ext.getDistributionServiceName().get(), project.getVersion())); 81 | })); 82 | 83 | return configTar; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/pdeps/ResolveProductDependenciesTaskSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2021 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.dist.pdeps 18 | 19 | import com.google.common.collect.ImmutableSetMultimap 20 | import com.palantir.gradle.dist.ProductDependency 21 | import com.palantir.gradle.dist.ProductId 22 | import nebula.test.ProjectSpec 23 | 24 | class ResolveProductDependenciesTaskSpec extends ProjectSpec { 25 | private static final ProductDependency PDEP = new ProductDependency( 26 | "group", "name", "1.0.0", "1.x.x", "1.0.0"); 27 | private static final ProductDependency PDEP_2 = new ProductDependency( 28 | "group", "name", "1.2.0", "1.x.x", "1.2.0"); 29 | 30 | private static final ProductId PRODUCT_ID = ProductId.of(PDEP); 31 | 32 | private ResolveProductDependenciesTask task; 33 | 34 | void setup() { 35 | project.version = "1.0.0" 36 | task = project.tasks.create("m", ResolveProductDependenciesTask) 37 | 38 | task.serviceGroup.set("com.palantir.test") 39 | task.serviceName.set("test") 40 | } 41 | 42 | def 'merges declared product dependencies'() { 43 | when: 44 | def result = task.computeDependencies(List.of(PDEP, PDEP_2), ImmutableSetMultimap.of()) 45 | 46 | then: 47 | result.get(PRODUCT_ID).minimumVersion == PDEP_2.minimumVersion 48 | } 49 | 50 | def 'merges declared productDependencies with discovered dependencies'() { 51 | when: 52 | def result = task.computeDependencies(List.of(PDEP_2), ImmutableSetMultimap.of(PRODUCT_ID, PDEP)) 53 | 54 | then: 55 | result.get(PRODUCT_ID).minimumVersion == PDEP_2.minimumVersion 56 | } 57 | 58 | def 'throws if declared dependency is also ignored'() { 59 | when: 60 | task.ignoredProductIds.add(PRODUCT_ID) 61 | def result = task.computeDependencies(List.of(PDEP), ImmutableSetMultimap.of()) 62 | 63 | then: 64 | def e = thrown IllegalArgumentException 65 | e.message.contains("Encountered product dependency declaration that was also ignored") 66 | } 67 | 68 | def "throws on declared self-dependency"() { 69 | when: 70 | task.serviceGroup.set("group") 71 | task.serviceName.set("name") 72 | task.computeDependencies(List.of(PDEP), ImmutableSetMultimap.of()) 73 | 74 | then: 75 | def e = thrown IllegalArgumentException 76 | e.message.contains("Invalid for product to declare an explicit dependency on itself") 77 | } 78 | 79 | def "Ignores discovered self-dependency"() { 80 | when: 81 | task.serviceGroup.set("group") 82 | task.serviceName.set("name") 83 | def result = task.computeDependencies(List.of(), ImmutableSetMultimap.of(PRODUCT_ID, PDEP)) 84 | 85 | then: 86 | result.isEmpty() 87 | } 88 | 89 | def 'ignores discovered product dependency'() { 90 | when: 91 | task.ignoredProductIds.add(PRODUCT_ID) 92 | def result = task.computeDependencies(List.of(), ImmutableSetMultimap.of(PRODUCT_ID, PDEP)) 93 | 94 | then: 95 | result.isEmpty() 96 | } 97 | 98 | def 'mark as optional product dependencies'() { 99 | when: 100 | task.optionalProductIds.add(PRODUCT_ID) 101 | def result = task.computeDependencies(List.of(), ImmutableSetMultimap.of(PRODUCT_ID, PDEP)) 102 | 103 | then: 104 | result.get(PRODUCT_ID).optional 105 | } 106 | 107 | def "Merges discovered dependencies"() { 108 | when: 109 | def result = task.computeDependencies(List.of(), ImmutableSetMultimap.of(PRODUCT_ID, PDEP, PRODUCT_ID, PDEP_2)) 110 | 111 | then: 112 | result.get(PRODUCT_ID).minimumVersion == PDEP_2.minimumVersion 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /gradle-recommended-product-dependencies/src/main/java/com/palantir/gradle/dist/ConfigureProductDependenciesTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 2019 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.dist; 18 | 19 | import com.fasterxml.jackson.core.JsonProcessingException; 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import com.google.common.collect.ImmutableMap; 22 | import com.palantir.logsafe.Preconditions; 23 | import java.io.UncheckedIOException; 24 | import java.util.Set; 25 | import org.gradle.api.DefaultTask; 26 | import org.gradle.api.Project; 27 | import org.gradle.api.java.archives.Manifest; 28 | import org.gradle.api.plugins.JavaPlugin; 29 | import org.gradle.api.provider.Provider; 30 | import org.gradle.api.provider.SetProperty; 31 | import org.gradle.api.tasks.Input; 32 | import org.gradle.api.tasks.TaskAction; 33 | import org.gradle.api.tasks.bundling.Jar; 34 | 35 | /** 36 | * This task is only necessary because {@link Jar#getManifest()} cannot be configured lazily at configuration-time, so 37 | * we have to configure it at execution-time instead. 38 | */ 39 | public abstract class ConfigureProductDependenciesTask extends DefaultTask { 40 | 41 | @SuppressWarnings("for-rollout:GradleTypesAsFields") 42 | private final SetProperty productDependencies = 43 | getProject().getObjects().setProperty(ProductDependency.class); 44 | 45 | public ConfigureProductDependenciesTask() { 46 | setDescription("Configures the 'jar' task to write the input product dependencies into its manifest"); 47 | } 48 | 49 | @SuppressWarnings("for-rollout:IllegalMethodCalledDuringTaskExecution") 50 | @TaskAction 51 | final void action() { 52 | getProject() 53 | .getTasks() 54 | .withType(Jar.class) 55 | .named(JavaPlugin.JAR_TASK_NAME) 56 | .configure(jar -> { 57 | Preconditions.checkState( 58 | !jar.getState().getExecuted(), "Attempted to configure jar task after it was executed"); 59 | jar.getManifest() 60 | .from(createManifest( 61 | getProject(), getProductDependencies().get())); 62 | }); 63 | } 64 | 65 | public final void setProductDependencies(Provider> productDependencies) { 66 | getProductDependencies().set(productDependencies); 67 | } 68 | 69 | @Input 70 | final SetProperty getProductDependencies() { 71 | return productDependencies; 72 | } 73 | 74 | /** Eagerly creates a manifest containing only the recommended product dependencies. */ 75 | // TODO(fwindheuser): Replace 'JavaPluginConvention' with 'JavaPluginExtension' before migrating to Gradle 8. 76 | @SuppressWarnings("deprecation") 77 | private static Manifest createManifest(Project project, Set recommendedProductDependencies) { 78 | org.gradle.api.plugins.JavaPluginExtension javaConvention = 79 | project.getExtensions().getByType(org.gradle.api.plugins.JavaPluginExtension.class); 80 | return javaConvention.manifest(manifest -> { 81 | String recommendedProductDeps; 82 | try { 83 | recommendedProductDeps = new ObjectMapper() 84 | .writeValueAsString(RecommendedProductDependencies.builder() 85 | .recommendedProductDependencies(recommendedProductDependencies) 86 | .build()); 87 | } catch (JsonProcessingException e) { 88 | throw new UncheckedIOException("Couldn't serialize recommended product dependencies as string", e); 89 | } 90 | manifest.attributes(ImmutableMap.of( 91 | RecommendedProductDependencies.SLS_RECOMMENDED_PRODUCT_DEPS_KEY, recommendedProductDeps)); 92 | }); 93 | } 94 | } 95 | --------------------------------------------------------------------------------