Skip to content

Commit

Permalink
Publish to GPP
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jun 23, 2024
1 parent ef8d008 commit 27e7c5b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
release:
uses: neoforged/actions/.github/workflows/gradle-publish.yml@main
with:
java: 8
java: 17
pre_gradle_tasks: test
gradle_tasks: publish # TODO - publish to central (closeAndReleaseSonatypeStagingRepository) and GPP
gradle_tasks: publish publishPlugins closeAndReleaseSonatypeStagingRepository
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
Expand All @@ -27,3 +27,5 @@ jobs:
GPG_SUBKEY_PASSWORD: ${{ secrets.GPG_SUBKEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPP_KEY: ${{ secrets.GPP_KEY }}
GPP_SECRET: ${{ secrets.GPP_SECRET }}
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,29 @@ This means that there may be changes between the base JAR and concrete JAR which
```groovy
repositories {
maven {
url = 'https://maven.minecraftforge.net/'
url = 'https://maven.neoforged.net/releases'
}
}
dependencies {
implementation 'net.minecraftforge:JarCompatibilityChecker:0.1.+'
implementation 'net.neoforged:jarcompatibilitychecker:0.1.+'
}
```

For command-line usage, the `all` classifier JAR can be downloaded and used.
For usage from inside other libraries, the no-classifier JAR can be referenced through gradle.
The main entrypoint for other libraries is the `net.minecraftforge.jarcompatibilitychecker.JarCompatibilityChecker` class.
The main entrypoint for other libraries is the `net.neoforged.jarcompatibilitychecker.JarCompatibilityChecker` class.

## Note on Terminology
JarCompatibilityChecker and the Java Language Specification have different meanings for binary compatibility.
For JarCompatibilityChecker, binary compatibility means that all members, both public and private, are compatible between the base JAR and concrete JAR.
Compatible means that a member still exists in the concrete JAR, its type or parameters has not been changed, and its visibility has not been lowered.
For the Java Language Specification, binary compatibility means a new version of a JAR does not break other binaries depending on previous versions of that JAR.
Binaries can normally only reference public and protected members of another JAR,
so this definition of binary compatibility is more in line with JarCompatibilityChecker's definition of API compatibility.
so this definition of binary compatibility is more in line with JarCompatibilityChecker's definition of API compatibility.

## Gradle Plugin
A Gradle plugin with the ID `net.neoforged.jarcompatibilitychecker` is also provided.
This Gradle plugin registers a `checkJarCompatibility` task that outputs the api/binary (configurable) changes since the last release
(determined through the base commit of the PR in a GitHub action run, otherwise the latest version, and a list of known repositories to pull the artifact from).
The plugin is intended to be used alongside the [Jar Compatibility action](https://github.com/neoforged/action-jar-compatibility).
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(8)

gradleutils {
setupSigning()
setupCentralPublishing()
}

ext {
Expand Down
20 changes: 18 additions & 2 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ plugins {
version rootProject.version
group 'net.neoforged.jarcompatibilitychecker'

if (System.getenv('GPP_KEY')) {
project.ext {
set('gradle.publish.key', System.getenv('GPP_KEY'))
set('gradle.publish.secret', System.getenv('GPP_SECRET'))
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
Expand All @@ -21,12 +28,12 @@ repositories {

dependencies {
implementation(project(':'))
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.code.gson:gson:2.11.0'
}

gradlePlugin {
website = 'https://github.com/neoforged/JarCompatibilityChecker'
vcsUrl = 'https://github.com/neoforged/JarCompatibilityChecker.git'
vcsUrl = 'https://github.com/neoforged/JarCompatibilityChecker.git'

plugins {
jcc {
Expand All @@ -44,3 +51,12 @@ publishing {
maven gradleutils.publishingMaven
}
}

gradle.taskGraph.whenReady {
tasks.withType(PublishToMavenRepository) { PublishToMavenRepository t ->
if (t.repository.name == "sonatype") {
logger.lifecycle("Disabling task `{}` because it publishes to Sonatype", t.path)
t.enabled = false
}
}
}
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ pluginManagement {
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

rootProject.name = 'JarCompatibilityChecker'
include(':tests:base')
include(':tests:top')
Expand Down
3 changes: 3 additions & 0 deletions tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id 'base'
}

0 comments on commit 27e7c5b

Please sign in to comment.