From 4f7c462e828bfce6875cc55626c5f8733b7f2436 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 30 Nov 2023 18:14:01 -0800 Subject: [PATCH] Publish to plugin portal Update/Shade JGit --- .github/workflows/publish.yml | 4 +++- build.gradle | 20 ++++++++++++++++++- gradle.properties | 3 ++- .../gradleutils/GradleUtils.groovy | 12 +++++------ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 06b5222..1fac24d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main with: java: 8 - gradle_tasks: "publish" + gradle_tasks: "publish publishPlugins" artifact_name: "gradleutils" secrets: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} @@ -21,3 +21,5 @@ jobs: PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }} MAVEN_USER: ${{ secrets.MAVEN_USER }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} + GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} diff --git a/build.gradle b/build.gradle index d8c588d..ed71e47 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,9 @@ plugins { id 'groovy' id 'maven-publish' id 'org.cadixdev.licenser' version '0.6.1' + id 'com.gradle.plugin-publish' version '1.2.1' id 'net.minecraftforge.gradleutils' + id 'com.github.johnrengelman.shadow' version '8.1.1' } group 'net.minecraftforge' @@ -15,7 +17,7 @@ repositories { } dependencies { - implementation 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r' + implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r' } java { @@ -36,18 +38,34 @@ license { } gradlePlugin { + website = 'https://github.com/MinecraftForge/GradleUtils' + vcsUrl = 'https://github.com/MinecraftForge/GradleUtils.git' plugins { gradleutils { id = 'net.minecraftforge.gradleutils' implementationClass = 'net.minecraftforge.gradleutils.GradleUtilsPlugin' + displayName = 'Forge Gradle Utilities' + description = 'Small collection of utilities for standerdizing our gradle scripts' } changelog { id = 'net.minecraftforge.changelog' implementationClass = 'net.minecraftforge.gradleutils.changelog.ChangelogPlugin' + displayName = 'Git Changelog' + description = 'Creates a changelog text file based on git history' } } } +jar { + archiveClassifier = 'thin' +} + +tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { + enableRelocation true + archiveClassifier = null + relocationPrefix = 'net.minecraftforge.gradleutils.shadow' +} + changelog { fromBase() publishAll = false diff --git a/gradle.properties b/gradle.properties index 915b9f3..e2a0fd7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ -org.gradle.configureondemand=true org.gradle.caching=true org.gradle.parallel=true +org.gradle.configureondemand=true +#org.gradle.configuration-cache=true diff --git a/src/main/groovy/net/minecraftforge/gradleutils/GradleUtils.groovy b/src/main/groovy/net/minecraftforge/gradleutils/GradleUtils.groovy index cc40daa..5bc1985 100644 --- a/src/main/groovy/net/minecraftforge/gradleutils/GradleUtils.groovy +++ b/src/main/groovy/net/minecraftforge/gradleutils/GradleUtils.groovy @@ -50,12 +50,12 @@ class GradleUtils { git = Git.open(dir) } catch (RepositoryNotFoundException e) { return [ - tag: '0.0', - offset: '0', - hash: '00000000', - branch: 'master', - commit: '0000000000000000000000', - abbreviatedId: '00000000' + tag: '0.0', + offset: '0', + hash: '00000000', + branch: 'master', + commit: '0000000000000000000000', + abbreviatedId: '00000000' ] } String tag = git.describe().setLong(true).setTags(true).setMatch(globFilters ?: new String[0]).call()