Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'trunk' into bugfix/classifier-dropped-from-published-jar
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Feb 19, 2024
2 parents 4f2e7c1 + 15fad87 commit 56ee08f
Show file tree
Hide file tree
Showing 46 changed files with 1,342 additions and 1,197 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: ~/shadow
docker:
- image: cimg/openjdk:17.0
- image: azul/zulu-openjdk:21-latest
environment:
- TERM: "dumb"
- GRADLE_OPTS: "-Xmx1024m"
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
paths:
- ~/.gradle

- run: ./gradlew build --scan
- run: ./gradlew build

- run:
name: Save test results
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Main

on:
pull_request:
branches:
- trunk
push:
branches:
- trunk
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew build

publish:
needs: build
runs-on: ubuntu-latest
if: github.repository == 'Goooler/shadow' && github.ref == 'refs/heads/trunk'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle publish
# Disable CC due to https://github.com/gradle/gradle/issues/22779
run: ./gradlew publish --no-configuration-cache
env:
ORG_GRADLE_PROJECT_gradle.publish.key: ${{ secrets.GRADLE_PUBLISH_KEY }}
ORG_GRADLE_PROJECT_gradle.publish.secret: ${{ secrets.GRADLE_PUBLISH_SECRET }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ Read the [User Guide](https://imperceptiblethoughts.com/shadow/)!

## Current Status

[![Download](https://img.shields.io/gradle-plugin-portal/v/com.github.johnrengelman.shadow)](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow)
[![Circle CI](https://circleci.com/gh/johnrengelman/shadow.png?style=badge)](https://app.circleci.com/pipelines/github/johnrengelman/shadow)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.goooler.shadow/shadow-gradle-plugin)](https://central.sonatype.com/artifact/io.github.goooler.shadow/shadow-gradle-plugin)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/io.github.goooler.shadow/shadow-gradle-plugin?&server=https://s01.oss.sonatype.org/)](https://s01.oss.sonatype.org/content/repositories/snapshots/io/github/goooler/shadow/shadow-gradle-plugin)
[![Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/io.github.goooler.shadow)](https://plugins.gradle.org/plugin/io.github.goooler.shadow)
[![CI](https://github.com/Goooler/shadow/actions/workflows/main.yml/badge.svg?branch=trunk&event=push)](https://github.com/Goooler/shadow/actions/workflows/main.yml?query=branch:trunk+event:push)
[![License](https://img.shields.io/github/license/goooler/shadow.svg)](LICENSE)

## Latest Test Compatibility

Expand Down
29 changes: 10 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
id 'project-report'
id 'idea'
id 'java-gradle-plugin'
id 'signing'
id 'com.gradle.plugin-publish' version '1.1.0'
id 'org.ajoberstar.git-publish' version '4.1.1'
id 'com.github.node-gradle.node' version '3.5.1'
id 'com.gradle.plugin-publish' version '1.2.1'
id 'org.ajoberstar.git-publish' version '4.2.2'
id 'com.github.node-gradle.node' version '7.0.2'
id 'com.vanniktech.maven.publish' version "0.27.0"
}

apply plugin: ShadowPlugin
Expand All @@ -20,11 +20,6 @@ apply from: file('gradle/vuepress.gradle')
apply from: file('gradle/ghPages.gradle')
apply from: file('gradle/dependencies.gradle')

repositories {
gradlePluginPortal()
mavenCentral()
}

tasks.withType(Test).configureEach {
useJUnitPlatform()

Expand All @@ -34,25 +29,21 @@ tasks.withType(Test).configureEach {
maxHeapSize "1g"
}

systemProperty 'java.io.tmpdir', buildDir.absolutePath
systemProperty 'java.io.tmpdir', project.layout.buildDirectory.asFile.get().absolutePath

// Required to test configuration cache in tests when using withDebug()
// https://github.com/gradle/gradle/issues/22765#issuecomment-1339427241
jvmArgs(
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens",
"java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
)
}

// Remove the gradleApi so it isn't merged into the jar file.
// This is required because 'java-gradle-plugin' adds gradleApi() to the 'api' configuration.
// See https://github.com/gradle/gradle/blob/master/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/plugins/JavaGradlePluginPlugin.java#L162
// See https://github.com/gradle/gradle/blob/972c3e5c6ef990dd2190769c1ce31998a9402a79/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/plugins/JavaGradlePluginPlugin.java#L161
configurations.named(JavaPlugin.API_CONFIGURATION_NAME) {
dependencies.remove(project.dependencies.gradleApi())
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ScriptHolder {

//Grab the dependencies closure and resolve it against
//the buildSrc project dependencies
//This effectively applies the same dependenices from build.gradle into buildSrc/build.gradle
//This effectively applies the same dependencies from build.gradle into buildSrc/build.gradle
//This is required so that when buildSrc is compiled it has the dependencies to compile the source code
def closure = holder.dependencies.clone()
closure.delegate = project.dependencies
Expand Down
28 changes: 26 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g
GROUP=io.github.goooler.shadow
POM_ARTIFACT_ID=shadow-gradle-plugin
VERSION_NAME=8.1.4-SNAPSHOT

POM_NAME=Shadow Gradle Plugin
POM_DESCRIPTION=A fork of https://github.com/johnrengelman/shadow
POM_INCEPTION_YEAR=2023
POM_URL=https://github.com/https://github.com/Goooler/shadow

POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENSE_DIST=repo

POM_SCM_URL=https://github.com/https://github.com/Goooler/shadow
POM_SCM_CONNECTION=scm:git:git://github.com/Goooler/shadow.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/Goooler/shadow.git

POM_DEVELOPER_ID=Gooooler
POM_DEVELOPER_NAME=Zongle Wang
POM_DEVELOPER_URL=https://github.com/Goooler

SONATYPE_HOST=S01


org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g -XX:MaxMetaspaceSize=2g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.unsafe.configuration-cache=true
org.gradle.configuration-cache=true
24 changes: 13 additions & 11 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ dependencies {
shadow 'org.codehaus.groovy:groovy-backports-compat23:3.0.8'

implementation 'org.jdom:jdom2:2.0.6.1'
implementation 'org.ow2.asm:asm:9.5'
implementation 'org.ow2.asm:asm-commons:9.5'
implementation 'commons-io:commons-io:2.11.0'
implementation 'org.apache.ant:ant:1.10.13'
implementation 'org.codehaus.plexus:plexus-utils:3.5.1'
implementation "org.apache.logging.log4j:log4j-core:2.20.0"
implementation('org.vafer:jdependency:2.8.0') {
implementation 'org.ow2.asm:asm:9.6'
implementation 'org.ow2.asm:asm-commons:9.6'
implementation 'commons-io:commons-io:2.15.1'
implementation 'org.apache.ant:ant:1.10.14'
implementation 'org.codehaus.plexus:plexus-utils:4.0.0'
implementation 'org.codehaus.plexus:plexus-xml:4.0.3'
implementation "org.apache.logging.log4j:log4j-core:2.22.1"
implementation('org.vafer:jdependency:2.10') {
exclude group: 'org.ow2.asm'
}

Expand All @@ -19,8 +20,9 @@ dependencies {
}
testImplementation 'org.spockframework:spock-junit4:2.3-groovy-3.0'
testImplementation 'xmlunit:xmlunit:1.6'
testImplementation 'org.apache.commons:commons-lang3:3.12.0'
testImplementation 'com.google.guava:guava:31.1-jre'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.9.2'
testImplementation 'org.apache.commons:commons-lang3:3.14.0'
testImplementation 'com.google.guava:guava:33.0.0-jre'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.10.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
48 changes: 8 additions & 40 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,56 +1,24 @@
apply plugin: "com.gradle.plugin-publish"
apply plugin: "com.vanniktech.maven.publish"

group = 'com.github.johnrengelman'

if (System.env.CIRCLE_TAG && System.env.CIRCLE_TAG =~ /^\d\.\d\.\d$/) {
version = System.env.CIRCLE_TAG
} else {
version = file('src/main/resources/shadow-version.txt').text.trim()
if (!version.endsWith("-SNAPSHOT")) {
version = version + "-SNAPSHOT"
}
}
group = providers.gradleProperty("GROUP")
version = providers.gradleProperty("VERSION_NAME")

gradlePlugin {
website = 'https://github.com/johnrengelman/shadow'
vcsUrl = 'https://github.com/johnrengelman/shadow'
website = providers.gradleProperty("POM_URL")
vcsUrl = providers.gradleProperty("POM_URL")

plugins {
shadowPlugin {
id = 'com.github.johnrengelman.shadow'
id = 'io.github.goooler.shadow'
implementationClass = 'com.github.jengelman.gradle.plugins.shadow.ShadowPlugin'
displayName = 'Shadow Plugin'
description = "Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin."
displayName = providers.gradleProperty("POM_NAME").orNull
description = providers.gradleProperty("POM_DESCRIPTION").orNull
tags.set(['onejar', 'shade', 'fatjar', 'uberjar'])
}
}
}

tasks.named('publishPlugins') {
doFirst {
if (version.endsWith("SNAPSHOT")) {
throw new GradleException('Cannot publish SNAPSHOT versions to Plugin Portal!')
}
}
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/21283")
}

signing {
if (System.env.CI == 'true') {
def encodedSigningKey = findProperty("signingKey")
def signingKey = encodedSigningKey ? new String(encodedSigningKey.decodeBase64()) : null
def signingPassword = findProperty("signingPassword") as String
useInMemoryPgpKeys(signingKey, signingPassword)
}
// See https://github.com/johnrengelman/shadow/pull/831#discussion_r1119012328
required = false && gradle.taskGraph.hasTask("artifactoryPublish")
sign(publishing.publications)
}

tasks.withType(Sign).configureEach {
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13470")
}

tasks.register('release') {
dependsOn tasks.named('assemble'), tasks.named('publishPlugins'), tasks.named('gitPublishPush')
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
8 changes: 7 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ pluginManagement {
}

plugins {
id 'com.gradle.enterprise' version '3.12.6'
id 'com.gradle.enterprise' version '3.16.2'
}

dependencyResolutionManagement {
repositories {
mavenCentral()
}
}

gradleEnterprise {
Expand Down
6 changes: 4 additions & 2 deletions src/docs/application-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ configured to contain the `Main-Class` attribute with the value specified in the
// Using Shadow with Application Plugin
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'io.github.goooler.shadow'
mainClassName = 'myapp.Main'
application {
mainClass = 'myapp.Main'
}
```

## Running the Shadow JAR
Expand Down
Loading

0 comments on commit 56ee08f

Please sign in to comment.