Skip to content

Commit

Permalink
Merge pull request #831 from Goooler/more
Browse files Browse the repository at this point in the history
Polish outdated configs
  • Loading branch information
johnrengelman authored Mar 20, 2023
2 parents 49584a7 + 65595ff commit 7f7a26a
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 101 deletions.
34 changes: 3 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id 'groovy'
id 'project-report'
id 'idea'
id 'java-gradle-plugin'
// id 'signing'
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'
}

// Remove the gradleApi so it isn't merged into the jar file.
configurations.named(JavaPlugin.API_CONFIGURATION_NAME) {
dependencies.remove(project.dependencies.gradleApi())
}

apply plugin: ShadowPlugin

apply from: file('gradle/docs.gradle')
Expand All @@ -41,18 +37,10 @@ test {
systemProperty 'java.io.tmpdir', buildDir.absolutePath
}

// jar {
// from rootProject.file('LICENSE')
// from rootProject.file('NOTICE')
// }

// jar.enabled = false

shadowJar {
tasks.named('shadowJar', ShadowJar) {
from rootProject.file('LICENSE')
from rootProject.file('NOTICE')
enableRelocation true
// archiveClassifier = ''
}

idea {
Expand All @@ -72,19 +60,3 @@ tasks.register('downloadDependencies', Exec) {
dependsOn configurations.testRuntimeClasspath
commandLine 'echo', 'Downloaded all dependencies'
}

// tasks.named('build') { dependsOn tasks.named('shadowJar') }

// tasks.withType(JavaCompile).configureEach {
// // This will be the default in Gradle 5.0
// if (!options.compilerArgs.contains("-processor")) {
// options.compilerArgs << '-proc:none'
// }
// }

// tasks.withType(GroovyCompile).configureEach {
// // This will be the default in Gradle 5.0
// if (!options.compilerArgs.contains("-processor")) {
// options.compilerArgs << '-proc:none'
// }
// }
18 changes: 3 additions & 15 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import org.codehaus.groovy.control.CompilerConfiguration

apply plugin: 'groovy'
plugins {
id 'groovy'
}

repositories {
gradlePluginPortal()
Expand Down Expand Up @@ -52,17 +54,3 @@ sourceSets {
resources.srcDirs = ['../src/main/resources']
}
}

tasks.withType(JavaCompile).configureEach {
// This will be the default in Gradle 5.0
if (!options.compilerArgs.contains("-processor")) {
options.compilerArgs << '-proc:none'
}
}

tasks.withType(GroovyCompile).configureEach {
// This will be the default in Gradle 5.0
if (!options.compilerArgs.contains("-processor")) {
options.compilerArgs << '-proc:none'
}
}
5 changes: 2 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
dependencies {

shadow localGroovy()
shadow gradleApi()
compileOnly localGroovy()
compileOnly gradleApi()
shadow 'org.codehaus.groovy:groovy-backports-compat23:3.0.8'

implementation 'org.jdom:jdom2:2.0.6.1'
Expand Down
12 changes: 3 additions & 9 deletions gradle/docs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ tasks.withType(Javadoc).configureEach {
}
}

tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier.set('javadoc')
from 'build/docs/javadoc'
}

tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
java {
withJavadocJar()
withSourcesJar()
}

tasks.named('groovydoc') {
Expand Down
6 changes: 3 additions & 3 deletions gradle/ghPages.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'org.ajoberstar.git-publish'

if (project.hasProperty('githubToken')) {
System.setProperty('org.ajoberstar.grgit.auth.username', project.githubToken)
System.setProperty('org.ajoberstar.grgit.auth.username', project.property('githubToken') as String)
}

gitPublish {
Expand All @@ -23,5 +23,5 @@ gitPublish {
}
}

tasks.named('gitPublishCopy') { dependsOn yarn_build }
tasks.named('gitPublishCopy') { dependsOn groovydoc }
tasks.named('gitPublishCopy') { dependsOn tasks.named('yarn_build') }
tasks.named('gitPublishCopy') { dependsOn tasks.named('groovydoc') }
37 changes: 16 additions & 21 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ if (System.env.CIRCLE_TAG && System.env.CIRCLE_TAG =~ /^\d\.\d\.\d$/) {
}
}

// tasks.configureEach {
// if (name == "publishPluginJar" || name == "generateMetadataFileForPluginMavenPublication") {
// dependsOn(tasks.named("shadowJar"))
// }
// }

gradlePlugin {
website = 'https://github.com/johnrengelman/shadow'
vcsUrl = 'https://github.com/johnrengelman/shadow'
Expand All @@ -41,21 +35,22 @@ tasks.named('publishPlugins') {
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")
// useInMemoryPgpKeys(signingKey, signingPassword)
// }
// required = gradle.taskGraph.hasTask("artifactoryPublish")
// sign(publishing.publications)
// }

// tasks.withType(Sign).configureEach {
// notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13470")
// }
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 'assemble', 'publishPlugins', 'gitPublishPush'
dependsOn tasks.named('assemble'), tasks.named('publishPlugins'), tasks.named('gitPublishPush')
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.gradle.api.artifacts.SelfResolvingDependency
import org.gradle.api.file.CopySpec
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.util.GradleVersion

class ShadowExtension {

Expand All @@ -19,12 +18,7 @@ class ShadowExtension {
}

void component(MavenPublication publication) {

if (GradleVersion.current() >= GradleVersion.version("6.6")) {
publication.artifact(project.tasks.named("shadowJar"))
} else {
publication.artifact(project.tasks.shadowJar)
}
publication.artifact(project.tasks.named("shadowJar"))

publication.pom { MavenPom pom ->
pom.withXml { xml ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.gradle.api.attributes.LibraryElements
import org.gradle.api.attributes.Usage
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.configuration.project.ProjectConfigurationActionContainer
import org.gradle.util.GradleVersion

import javax.inject.Inject

Expand Down Expand Up @@ -59,15 +58,7 @@ class ShadowJavaPlugin implements Plugin<Project> {
project.tasks.register(SHADOW_JAR_TASK_NAME, ShadowJar) { shadow ->
shadow.group = SHADOW_GROUP
shadow.description = 'Create a combined JAR of project and runtime dependencies'
if (GradleVersion.current() >= GradleVersion.version("5.1")) {
shadow.archiveClassifier.set("all")
} else {
shadow.conventionMapping.with {
map('classifier') {
'all'
}
}
}
shadow.archiveClassifier.set("all")
shadow.manifest.inheritFrom(project, project.tasks.jar.manifest)
def libsProvider = project.provider { -> [project.tasks.jar.manifest.attributes.get('Class-Path')] }
def files = project.objects.fileCollection().from { ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import org.gradle.api.internal.file.copy.CopySpecInternal
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.bundling.ZipEntryCompression
import org.gradle.api.tasks.util.PatternSet
import org.gradle.util.GradleVersion

class GradleVersionUtil {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.github.jengelman.gradle.plugins.shadow.tasks

import com.github.jengelman.gradle.plugins.shadow.ShadowStats
import com.github.jengelman.gradle.plugins.shadow.impl.RelocatorRemapper
import com.github.jengelman.gradle.plugins.shadow.internal.GradleVersionUtil
import com.github.jengelman.gradle.plugins.shadow.internal.UnusedTracker
import com.github.jengelman.gradle.plugins.shadow.internal.ZipCompressor
import com.github.jengelman.gradle.plugins.shadow.relocation.Relocator
Expand Down

0 comments on commit 7f7a26a

Please sign in to comment.