-
Notifications
You must be signed in to change notification settings - Fork 459
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
Try to migrate to com.vanniktech.maven.publish #2236
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,26 @@ org.gradle.parallel=true | |
org.gradle.caching=true | ||
org.gradle.configuration-cache=true | ||
|
||
name=spotless | ||
description=Spotless - keep your code spotless with Gradle | ||
org=diffplug | ||
GROUP=com.diffplug.spotless | ||
|
||
group=com.diffplug.spotless | ||
SONATYPE_AUTOMATIC_RELEASE=true | ||
SONATYPE_HOST=DEFAULT | ||
RELEASE_SIGNING_ENABLED=true | ||
|
||
artifactIdLib=spotless-lib | ||
artifactIdLibExtra=spotless-lib-extra | ||
artifactIdTestLib=spotless-testlib | ||
POM_URL=https://github.com/diffplug/spotless | ||
|
||
# naming convention '-maven-plugin' allows mvn 'spotless:check' instead of 'spotless-plugin-maven:check' | ||
artifactIdMaven=spotless-maven-plugin | ||
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/diffplug/spotless | ||
POM_SCM_CONNECTION=scm:git:git://github.com/diffplug/spotless.git | ||
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/diffplug/spotless.git | ||
|
||
POM_DEVELOPER_ID=diffplug | ||
POM_DEVELOPER_NAME=DiffPlug developers | ||
POM_DEVELOPER_URL=https://github.com/diffplug | ||
|
||
artifactIdGradle=spotless-plugin-gradle | ||
|
||
# Build requirements | ||
VER_JAVA=11 | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,5 @@ | ||
import java.nio.charset.StandardCharsets | ||
|
||
def decode64(String varName) { | ||
String envValue = System.env[varName] | ||
if (envValue == null) { | ||
return "" | ||
} else { | ||
return new String(envValue.decodeBase64(), "UTF-8") | ||
} | ||
} | ||
|
||
if (project.parent == null) { | ||
group = 'com.diffplug.spotless' | ||
def pass = System.env['ORG_GRADLE_PROJECT_nexus_pass64'] | ||
if (pass != null) { | ||
pass = pass.decodeBase64() | ||
} | ||
// it's the root project | ||
apply plugin: 'io.github.gradle-nexus.publish-plugin' | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
username = System.env['ORG_GRADLE_PROJECT_nexus_user'] | ||
password = decode64('ORG_GRADLE_PROJECT_nexus_pass64') | ||
} | ||
} | ||
} | ||
def initTask = tasks.named('initializeSonatypeStagingRepository') | ||
allprojects { | ||
initTask.configure { | ||
shouldRunAfter(tasks.withType(Sign)) | ||
} | ||
} | ||
return | ||
} | ||
apply plugin: 'com.vanniktech.maven.publish' | ||
apply plugin: 'java' | ||
|
||
/////////// | ||
// MAVEN // | ||
|
@@ -48,9 +13,6 @@ tasks.named('sourcesJar') { | |
dependsOn 'jar' | ||
} | ||
|
||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
// Where it's possible to name parameters and methods clearly enough | ||
// that javadoc is not necessary, why make the code bigger? | ||
// | ||
|
@@ -66,7 +28,7 @@ tasks.named('check') { | |
|
||
// use markdown in javadoc | ||
def makeLink = { url, text -> "<a href=\"${url}\" style=\"text-transform: none;\">${text}</a>" } | ||
def javadocInfo = '<h2>' + makeLink("https://github.com/${org}/${name}", "${group}:${project.ext.artifactId}:${version}") + | ||
def javadocInfo = '<h2>' + makeLink("https://github.com/diffplug/spotless", "${group}:${project.ext.artifactId}:${version}") + | ||
' by ' + makeLink('https://www.diffplug.com', 'DiffPlug') + '</h2>' | ||
|
||
String dotdotGradle = project.name.startsWith('eclipse-') ? '../../gradle' : '../gradle' | ||
|
@@ -88,117 +50,6 @@ javadoc { | |
options.linksOffline("https://javadoc.io/static/com.diffplug.spotless/spotless-lib-extra/${rootProject.spotlessChangelog.versionLast}", "${dotdotGradle}/javadoc/spotless-lib-extra") | ||
} | ||
|
||
//////////////// | ||
// PUBLISHING // | ||
//////////////// | ||
final MAVEN_PLUGIN_ARTIFACT_NAME = 'spotless-maven-plugin' | ||
boolean isExt = project.name.startsWith('eclipse-') | ||
boolean isPluginMaven = project.ext.artifactId == 'spotless-maven-plugin' | ||
|
||
model { | ||
publishing { | ||
publications { | ||
pluginMaven(MavenPublication) { | ||
if (project.ext.artifactId != 'spotless-plugin-gradle') { | ||
from components.java | ||
} | ||
|
||
groupId project.group | ||
artifactId project.ext.artifactId | ||
version project.version | ||
|
||
pom.withXml { | ||
// add MavenCentral requirements to the POM | ||
asNode().children().last() + { | ||
resolveStrategy = Closure.DELEGATE_FIRST | ||
name project.ext.artifactId | ||
description project.description | ||
url "https://github.com/${project.org}/${rootProject.name}" | ||
scm { | ||
url "https://github.com/${project.org}/${rootProject.name}" | ||
connection "scm:git:https://github.com/${project.org}/${rootProject.name}.git" | ||
developerConnection "scm:git:ssh:[email protected]/${project.org}/${rootProject.name}.git" | ||
} | ||
licenses { | ||
if (isExt) { | ||
license { | ||
name 'Eclipse Public License - v 1.0' | ||
url 'https://www.eclipse.org/legal/epl-v10.html' | ||
distribution 'repo' | ||
} | ||
} else { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
} | ||
if (isPluginMaven) { | ||
// Maven plugin required Maven 3.1.0+ to run | ||
prerequisites { maven '3.1.0' } | ||
} | ||
developers { | ||
if (isExt) { | ||
project.ext.developers.each { extId, extValues -> | ||
developer { | ||
id extId | ||
name extValues['name'] | ||
email extValues['email'] | ||
} | ||
} | ||
} else { | ||
if (isPluginMaven) { | ||
developer { | ||
id 'lutovich' | ||
name 'Konstantin Lutovich' | ||
email '[email protected]' | ||
} | ||
} | ||
developer { | ||
id 'nedtwigg' | ||
name 'Ned Twigg' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (System.env['JITPACK'] == 'true' || version.endsWith('-SNAPSHOT')) { | ||
signing { | ||
setRequired(false) | ||
} | ||
} else { | ||
signing { | ||
String gpg_key = decode64('ORG_GRADLE_PROJECT_gpg_key64') | ||
useInMemoryPgpKeys(gpg_key, System.env['ORG_GRADLE_PROJECT_gpg_passphrase']) | ||
sign(publishing.publications) | ||
} | ||
|
||
// find the project with the changelog (this project for plugins, root project for libs) | ||
def changelogTasks = (tasks.names.contains('changelogBump') ? project : rootProject).tasks | ||
|
||
// ensures that nothing will be built if changelogPush will end up failing | ||
tasks.named('jar').configure { | ||
dependsOn changelogTasks.named('changelogCheck') | ||
} | ||
// ensures that changelog bump and push only happens if the publish was successful | ||
def thisProj = project | ||
changelogTasks.named('changelogBump').configure { | ||
dependsOn ":${thisProj.path}:publishPluginMavenPublicationToSonatypeRepository" | ||
dependsOn ":closeAndReleaseSonatypeStagingRepository" | ||
// if we have a Gradle plugin, we need to push it up to the plugin portal too | ||
if (thisProj.tasks.names.contains('publishPlugins')) { | ||
dependsOn thisProj.tasks.named('publishPlugins') | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(AbstractArchiveTask).configureEach { | ||
preserveFileTimestamps = false | ||
reproducibleFileOrder = true | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
POM_ARTIFACT_ID=spotless-lib-extra | ||
POM_NAME=Spotless Lib Extra | ||
POM_DESCRIPTION=Spotless shared lib extra for Gradle plugin and Maven plugin. | ||
VERSION_NAME=3.0.0.BETA3-SNAPSHOT |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
POM_ARTIFACT_ID=spotless-lib | ||
POM_NAME=Spotless Lib | ||
POM_DESCRIPTION=Spotless shared lib for Gradle plugin and Maven plugin. | ||
VERSION_NAME=3.0.0.BETA3-SNAPSHOT |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
POM_ARTIFACT_ID=spotless-plugin-gradle | ||
POM_NAME=Spotless Gradle Plugin | ||
POM_DESCRIPTION=Spotless - keep your code spotless with Gradle. | ||
VERSION_NAME=7.0.0.BETA3-SNAPSHOT |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
POM_ARTIFACT_ID=spotless-maven-plugin | ||
POM_DEVELOPER_ID=lutovich | ||
POM_DEVELOPER_NAME=Konstantin Lutovich | ||
POM_NAME=Spotless Maven Plugin | ||
POM_DESCRIPTION=Spotless - keep your code spotless with Maven. | ||
VERSION_NAME=2.44.0.BETA3-SNAPSHOT |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Not sure what the possible values are, but I think we are on the
s01
host, not the default.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.
You are right, forgot updating.