Skip to content

Commit 918c1a3

Browse files
committed
Merge remote-tracking branch 'origin/main' into g/20250311/kotlin-new-app-block
// Conflicts: // src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/KmpPluginTest.kt
2 parents 271ccdb + 377a9bc commit 918c1a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+985
-14522
lines changed

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
* text=auto eol=lf
22

3-
gradlew binary
4-
gradlew.bat binary
3+
*.bat text eol=crlf
4+
*.jar binary
5+
*.svg binary

.github/CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing to Shadow Gradle Plugin
2+
3+
Thank you for considering contributing

.github/actions/deploy-site/action.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ description: 'Deploy site to GitHub Pages'
44
runs:
55
using: 'composite'
66
steps:
7-
- name: Deploy Site
7+
- uses: gradle/actions/setup-gradle@v4
8+
with:
9+
cache-read-only: true
10+
- name: Prepare API documentation
11+
shell: bash
12+
run: ./gradlew dokkaHtml --no-configuration-cache
13+
- name: Build Site
814
shell: bash
915
run: |
10-
git config --global user.name 'github-actions[bot]'
11-
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
1216
# Don't cache it to track updates.
1317
pip install mkdocs-material
14-
# Incremental pushes, make sure gh-pages branch is fetched by checkout.
15-
mkdocs gh-deploy
18+
mkdocs build
19+
- uses: actions/upload-pages-artifact@v3
20+
with:
21+
path: site
22+
- uses: actions/deploy-pages@v4

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
publish-snapshot:
2828
needs: build
2929
runs-on: ubuntu-latest
30-
if: github.repository == 'GradleUp/shadow' && github.ref == 'refs/heads/main'
30+
if: github.event.repository.fork == false && github.ref == 'refs/heads/main'
3131
steps:
3232
- uses: actions/checkout@v4
3333
- uses: actions/setup-java@v4

.github/workflows/deploy.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ on:
66
jobs:
77
deploy:
88
runs-on: ubuntu-latest
9-
if: github.repository == 'GradleUp/shadow'
9+
if: github.event.repository.fork == false
10+
environment:
11+
name: github-pages
1012
permissions:
1113
contents: write
14+
id-token: write
15+
pages: write
1216
steps:
1317
- uses: actions/checkout@v4
14-
with:
15-
# Fetch all tags and branches, so that MkDocs could push incremental updates.
16-
fetch-depth: 0
1718
- uses: ./.github/actions/deploy-site

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ on:
88
jobs:
99
release:
1010
runs-on: ubuntu-latest
11-
if: github.repository == 'GradleUp/shadow'
11+
if: github.event.repository.fork == false
12+
environment:
13+
name: github-pages
1214
permissions:
1315
contents: write
16+
id-token: write
17+
pages: write
1418
steps:
1519
- uses: actions/checkout@v4
16-
with:
17-
# Fetch all tags and branches, so that MkDocs could push incremental updates.
18-
fetch-depth: 0
1920
- uses: actions/setup-java@v4
2021
with:
2122
distribution: 'zulu'
@@ -24,7 +25,7 @@ jobs:
2425
with:
2526
cache-read-only: true
2627
# Disable CC due to https://github.com/gradle/gradle/issues/22779
27-
- run: ./gradlew publish publishPlugins dokkaHtml --no-configuration-cache
28+
- run: ./gradlew publish publishPlugins --no-configuration-cache
2829
env:
2930
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_KEY }}
3031
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_SECRET }}

.idea/icon.svg

Lines changed: 1 addition & 3835 deletions
Loading

NOTICE

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/README.md

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,59 @@
11
<div style="text-align: center;">
2-
<img src="images/logo.svg" alt="Shadow Gradle Plugin" style="max-width: 300px; height: auto;">
2+
<img src="images/logo.svg" alt="Shadow Gradle Plugin" width="300"/>
33
<h1><strong>Shadow Gradle Plugin</strong></h1>
4-
<p><em>The library author's dependency toolkit</em></p>
54
</div>
65

7-
---
6+
# Introduction
87

9-
Previously this plugin was developed by [@johnrengelman](https://github.com/johnrengelman) and published under the ID [
10-
`com.github.johnrengelman.shadow`](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow)
11-
before maintenance was transferred to the [GradleUp organization](https://github.com/GradleUp) to ensure future
12-
development, see [#908](https://github.com/GradleUp/shadow/issues/908).
8+
Shadow is a Gradle plugin for combining a project's dependency classes and resources into a single
9+
output Jar.
10+
The combined Jar is often referred to a _fat-jar_ or _uber-jar_.
11+
Shadow utilizes [`JarInputStream`](https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarInputStream.html) and [`JarOutputStream`](https://docs.oracle.com/javase/8/docs/api/java/util/jar/JarOutputStream.html) to efficiently process dependent libraries
12+
into the output jar without incurring the I/O overhead of expanding the jars to disk.
1313

14-
If you are still using the old plugin ID in your build script, we recommend to switch to the new plugin ID [
15-
`com.gradleup.shadow`](https://plugins.gradle.org/plugin/com.gradleup.shadow)
16-
and update to the latest version to receive all the latest bug fixes and improvements.
14+
!!! warning "Plugin ID Change"
15+
16+
Previously this plugin was developed by [@johnrengelman](https://github.com/johnrengelman) and published under the ID [
17+
`com.github.johnrengelman.shadow`](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow)
18+
before maintenance was transferred to the [GradleUp organization](https://github.com/GradleUp) to ensure future
19+
development, see [#908](https://github.com/GradleUp/shadow/issues/908).
20+
21+
If you are still using the old plugin ID in your build script, we recommend to switch to the new plugin ID [
22+
`com.gradleup.shadow`](https://plugins.gradle.org/plugin/com.gradleup.shadow)
23+
and update to the latest version to receive all the latest bug fixes and improvements.
24+
25+
## Benefits of Shadow
26+
27+
Shadowing a project output has 2 major use cases:
28+
29+
1. Creating an _executable_ JAR distribution
30+
2. Bundling and relocating common dependencies in libraries to avoid classpath conflicts
31+
32+
### Executable Distributions
33+
34+
Executable distribution is the main use case for deploying an _application_ that can be executed/run in the runtime
35+
environment.
36+
In the case of Shadow, this is a single _uber_ or _fat_ JAR.
37+
The JAR file contains all the application code and dependent libraries to execute (not including the standard JVM
38+
libraries).
39+
The shadow JAR does **not** include the JRE itself.
40+
It must be available on the target system.
41+
42+
Executable JARs contain a JAR MANIFEST that specifies the application Main Class.
43+
This allows the application to be started with a single command:
44+
45+
```shell
46+
java -jar application-shadow.jar
47+
```
48+
49+
### Library Bundling
50+
51+
Dependency bundling and relocation is the main use case for _library_ authors.
52+
The goal of a bundled library is to create a pre-packaged dependency for other libraries or applications to utilize.
53+
Often in these scenarios, a library may contain a dependency that a downstream library or application also uses.
54+
In _some_ cases, different versions of this common dependency can cause an issue in either the upstream library or
55+
the downstream application.
56+
These issues often manifest themselves as binary incompatibilities in either the library or application code.
57+
58+
By utilizing Shadow's ability to _relocate_ the package names for dependencies, a library author can ensure that the
59+
library's dependencies will not conflict with the same dependency being declared by the downstream application.

docs/about/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# About This Project
22

3-
I started this project in December 2012. We were working on converting from a monolithic application into the
3+
I (John Engelman) started this project in December 2012. We were working on converting from a monolithic application into the
44
new hot jazz of "microservices" using Dropwizard.
55
I had also just started learning about Gradle and I knew that the incremental build system it provided would benefit
66
our development team greatly.
77
Unfortunately, the closest thing that Gradle had to Maven's Shade plugin was its ability to create application TARs and
88
ZIPs.
99

10-
So, Charlie Knudsen and I (John Engelman) set out to port the existing Shade code into a Gradle plugin.
10+
So, Charlie Knudsen and I set out to port the existing Shade code into a Gradle plugin.
1111
This port is what existed up until the `0.9` milestone releases for Shadow.
1212
It functioned, but it wasn't idiomatic Gradle by any means.
1313

@@ -19,6 +19,7 @@ so Shadow was published there.
1919
## Maintainers
2020

2121
* [John Engelman](https://github.com/johnrengelman)
22+
* [Goooler](https://github.com/Goooler)
2223

2324
## Contributors
2425

0 commit comments

Comments
 (0)