feat: add otel.shadow-conventions plugin to centralize dist packaging and license handling#2518
Open
dol wants to merge 2 commits intoopen-telemetry:mainfrom
Open
feat: add otel.shadow-conventions plugin to centralize dist packaging and license handling#2518dol wants to merge 2 commits intoopen-telemetry:mainfrom
dol wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
Contributor
Author
|
No longer applies as the problem is only in the |
f366a27 to
d371e6d
Compare
bc355d6 to
a582f0f
Compare
… and license handling # Summary A new in-repo convention plugin `otel.shadow-conventions` was added to centralize creation of runtime 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. # What changed A new convention file was added under `buildSrc/src/main/kotlin/otel.shadow-conventions.gradle.kts` which: - applies the `com.gradleup.shadow`, `org.cyclonedx.bom`, and `com.github.jk1.dependency-license-report` plugins; - centralizes `licenseReport` configuration and points it at the repo `config/dependency-license/*` policy files; - configures CycloneDX to emit JSON-only SBOM and registers the BOM as a lazy input for packaging; - adds a provider-based `copyLegalDocs` task that copies generated `THIRD-PARTY-NOTICES.txt` and the CycloneDX BOM into `build/generated/legal-docs` and renames the BOM to `SBOM.json`; - configures `shadowJar` to set classifier `dist`, exclude dependency-provided `LICENSE`/`NOTICE` files, depend on the license and SBOM generator tasks, and include only the curated legal artifacts and project `LICENSE` into `META-INF` in the distribution jar. `buildSrc/build.gradle.kts` was updated to include implementation dependencies for the Shadow, dependency-license-report, and CycloneDX Gradle plugins so the new convention plugin compiles. The `cel-sampler` module now applies `otel.shadow-conventions` and its README was updated to recommend depending on the runtime distribution artifact (artifact with `-dist` classifier) for extension usage. Two configuration files were added under `config/dependency-license/`: - `allowed-licenses.json` — an allowlist of acceptable licenses used by the license report check - `license-normalizer-bundle.json` — rules to normalize license names across inputs # Rationale 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 legal materials for runtime use. The plugin uses Gradle Providers and `dependsOn` wiring so generated outputs are included without eager file resolution, supporting up-to-date checks and configuration-cache friendliness. Dependency-provided `LICENSE`/`NOTICE` files are excluded from the fat jar to avoid duplicates and conflicts; the plugin includes only the authorized/generated artifacts.
0f34ea5 to
f4d35ed
Compare
f4d35ed to
6353a11
Compare
breedx-splk
reviewed
Jan 6, 2026
|
|
||
| plugins { | ||
| id("com.gradleup.shadow") | ||
| id("org.cyclonedx.bom") |
Contributor
There was a problem hiding this comment.
Hmmm, I'm fairly sure we don't use this org.cyclonedx.bom plugin in other java projects. It would be nice if we could remain consistent....have you tried looking at how the other repos are doing bom conventions?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.