feat: add otel.shadow-conventions plugin to centralize dist packaging and license handling #2518
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull requests and discussion's involved:
opentelemetry-java-contrib/gcp-auth-extension/build.gradle.kts
Line 70 in b7a3272
Summary
A new in-repo convention plugin
otel.shadow-conventionswas added to centralize creation ofruntime distribution jars and legal/SBOM handling. The plugin applies and configures Shadow
(fat-jar), CycloneDX (SBOM), and the dependency-license-report plugin, and wires generated outputs
into the distribution packaging in a lazy, incremental-friendly way.
Inspired by https://cwiki.apache.org/confluence/display/FLINK/Licensing# .
What changed
A new convention file was added under
buildSrc/src/main/kotlin/otel.shadow-conventions.gradle.ktswhich:com.gradleup.shadow,org.cyclonedx.bom, andcom.github.jk1.dependency-license-reportplugins;licenseReportconfiguration and points it at the repoconfig/dependency-license/*policy files;for packaging;
copyLegalDocstask that copies generatedTHIRD-PARTY-NOTICES.txtand the CycloneDX BOM intobuild/generated/legal-docsandrenames the BOM to
SBOM.json;shadowJarto set classifierdist, exclude dependency-providedLICENSE/NOTICEfiles, depend on the license and SBOM generator tasks, and include only thecurated legal artifacts and project
LICENSEintoMETA-INFin the distribution jar.buildSrc/build.gradle.ktswas updated to include implementation dependencies for the Shadow,dependency-license-report, and CycloneDX Gradle plugins so the new convention plugin compiles.
The
cel-samplermodule now appliesotel.shadow-conventionsand its README was updated torecommend depending on the runtime distribution artifact (artifact with
-distclassifier) forextension usage.
Two configuration files were added under
config/dependency-license/:allowed-licenses.json— an allowlist of acceptable licenses used by the license report checklicense-normalizer-bundle.json— rules to normalize license names across inputsRationale
Centralizing dist packaging and license handling in a convention plugin provides a consistent
workflow across modules: the normal library JAR remains clean for library consumers, while the
self-contained distribution jar (classifier
dist) bundles dependencies, SBOM, and curated legalmaterials for runtime use. The plugin uses Gradle Providers and
dependsOnwiring so generatedoutputs are included without eager file resolution, supporting up-to-date checks and
configuration-cache friendliness.
Dependency-provided
LICENSE/NOTICEfiles are excluded from the fat jar to avoid duplicates andconflicts; the plugin includes only the authorized/generated artifacts.