-
Notifications
You must be signed in to change notification settings - Fork 172
feat: add otel.shadow-conventions plugin to centralize dist packaging and license handling #2518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
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
|
|
||
| plugins { | ||
| id("com.gradleup.shadow") | ||
| id("org.cyclonedx.bom") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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.