Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: Publish

on:
push:
branches: [ "master" ]
branches: [ 'master' ]
paths-ignore:
- '.github/workflows/**'
- 'README.md'
- 'settings.gradle'

permissions:
contents: read
Expand All @@ -16,9 +15,14 @@ jobs:
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@v0
with:
java: 17
gradle_tasks: "check publishPlugins"
gradle_tasks: "check publish publishPlugins"
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
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 }}
GRADLE_CACHE_KEY: ${{ secrets.GRADLE_CACHE_KEY }}
3 changes: 3 additions & 0 deletions LICENSE-header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Copyright (c) 2015, Minecrell <https://github.com/Minecrell>
Forked by Forge Development LLC and contributors
SPDX-License-Identifier: MIT
124 changes: 84 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.attributes.plugin.GradlePluginApiVersion
import org.gradle.api.plugins.jvm.JvmTestSuite

plugins {
Expand All @@ -8,32 +8,73 @@ plugins {
id 'idea'
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.licenser' version '1.1.1'
id 'net.minecraftforge.gradleutils' version '2.5.1'
id 'com.gradle.plugin-publish' version '1.3.1'
id 'com.gradleup.shadow' version '8.3.6'
alias libs.plugins.gradleutils
alias libs.plugins.gitversion
alias libs.plugins.changelog
alias libs.plugins.licenser
alias libs.plugins.plugin.publish
}

final projectDisplayName = 'Forge Licenser'
final projectArtifactId = base.archivesName = 'licenser'
description = 'A simple license header manager for Gradle - Fork of org.cadixdev.licenser'
group = 'net.minecraftforge'
version = gitversion.tagOffset

println "Version: $version"

java.toolchain.languageVersion = JavaLanguageVersion.of(8)
java {
toolchain.languageVersion = JavaLanguageVersion.of(8)
withSourcesJar()

repositories {
gradlePluginPortal()
// TODO [Licenser][2.0] Re-enable with Licenser 2.0 when migrating public API from Groovy to Java
// Gradle's Groovydoc task does not fork the JVM and uses the daemon JVM to run the Groovydoc ant task
// This project is built with a version of Groovy so old that its Groovydoc runtime cannot handle Java 17, Gradle 9's minimum
//withJavadocJar()
}

configurations {
// Applies the "Gradle Plugin API Version" attribute to configuration
// This was added in Gradle 7, gives consumers useful errors if they are on an old version
def applyGradleVersionAttribute = { Configuration configuration ->
configuration.attributes {
attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, objects.named(GradlePluginApiVersion, libs.versions.gradle.get()))
}
}

named('runtimeElements', applyGradleVersionAttribute)
}

dependencies {
// Static Analysis
compileOnly libs.nulls

// Gradle API
compileOnly libs.gradle
}

license {
include '**/*.java'
include '**/*.groovy'
header = rootProject.file('LICENSE-header.txt')
newLine = false
exclude '**/*.properties'
}

tasks.named('jar', Jar) {
archiveClassifier = 'thin'
}

tasks.withType(GroovyCompile).configureEach {
groovyOptions.optimizationOptions.indy = true
}

/*
tasks.named('javadoc', Javadoc) {
enabled = false
}

javadoc.enabled = false
groovydoc.use = true
tasks.named('groovydoc', Groovydoc) {
use = true
}

// javadocJar is created after evaluation, so we need to configure it here
afterEvaluate {
Expand All @@ -42,32 +83,44 @@ afterEvaluate {
from groovydoc.destinationDir
}
}
*/

testing {
suites.configureEach { JvmTestSuite suite ->
def suiteSpec = { JvmTestSuite suite ->
suite.dependencies {
implementation.add project()
implementation.add gradleTestKit()
libs.bundles.spock.get().forEach { dependency ->
implementation.add dependency
}
implementation.add testLibs.gradle
compileOnly.add libs.nulls
implementation.bundle testLibs.bundles.spock
}

suite.useJUnitJupiter(libs.junit.get().version)
suite.useJUnitJupiter(testLibs.versions.junit)

suite.targets.configureEach {
testTask.configure {
shouldRunAfter test
shouldRunAfter tasks.named('test')
}
}

// Remove's Gradle's local test kit since we are supplying our own
afterEvaluate { project ->
project.configurations.named(suite.sources.implementationConfigurationName) {
dependencies.remove(project.dependencies.gradleTestKit())
}
}
}

suites.named('test', JvmTestSuite)
suites.register('functionalTest', JvmTestSuite)
suites.named('test', JvmTestSuite, suiteSpec)
suites.register('functionalTest', JvmTestSuite, suiteSpec)
}

changelog {
from '1.0'
publishAll = false
}

gradlePlugin {
testSourceSets sourceSets.functionalTest
testSourceSet sourceSets.functionalTest

website = gitversion.url
vcsUrl = gitversion.url + '.git'
Expand All @@ -81,36 +134,27 @@ gradlePlugin {
}
}

tasks.named('jar', Jar) {
archiveClassifier = 'thin'
}

tasks.named('shadowJar', ShadowJar) {
enableRelocation = true
archiveClassifier = null
relocationPrefix = 'net.minecraftforge.licenser.shadow'
}

publishing {
publications.register('pluginMaven', MavenPublication) {
artifactId = projectArtifactId
changelog.publish it

pom { pom ->
artifactId = project.name
name = projectDisplayName
description = project.description

gradleutils.pom.gitHubDetails = pom
gradleutils.pom.addRemoteDetails(pom)

license gradleutils.pom.licenses.MIT
licenses {
license gradleutils.pom.licenses.MIT
}
}
}

repositories {
// TODO [Licenser] Use publishing Forge maven?
maven {
name = 'localFolder'
url = 'file://' + file('build/repo').absolutePath
}
maven gradleutils.publishingForgeMaven
}
}

idea.module { downloadSources = downloadJavadoc = true }
eclipse.classpath { downloadSources = downloadJavadoc = true }
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ org.gradle.parallel=true
org.gradle.configureondemand=true

# Configuration Cache
# TODO [Licenser][Gradle9] Re-enable in Gradle 9 (if updated)
# https://docs.gradle.org/current/userguide/configuration_cache.html
#org.gradle.configuration-cache=true
org.gradle.configuration-cache=true

# Parallel configuration caching
# TODO [Licenser][Gradle9] Re-enable in Gradle 9 (if updated)
# https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:parallel
#org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache.parallel=true

# Ignoring problems with configuration cache
# Fixes issues with core plugins (publish, idea, eclipse, etc.) that are not compatible with the configuration cache
# TODO [Licenser][Gradle9] Re-enable in Gradle 9 (if updated)
# https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:ignore_problems
#org.gradle.configuration-cache.problems=warn
org.gradle.configuration-cache.problems=warn

# Suppresses adding Gradle's own API dependency with the 'java-gradle-plugin' plugin
systemProp.org.gradle.unsafe.suppress-gradle-api=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
8 changes: 5 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# 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
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -203,7 +205,7 @@ fi
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,
# * DEFAULT_JVM_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.
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Loading