Skip to content
Merged
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
25 changes: 0 additions & 25 deletions .github/workflows/pr-check.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish

on:
push:
branches: [ "FG_3.0" ]

permissions:
contents: read

jobs:
build:
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
with:
java: 17
gradle_tasks: "publish"
artifact_group: "net.minecraftforge.gradle"
artifact_name: "ForgeGradle"
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 }}
87 changes: 0 additions & 87 deletions Jenkinsfile

This file was deleted.

File renamed without changes.
198 changes: 112 additions & 86 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,59 +1,88 @@
plugins {
id 'java-gradle-plugin'
id 'dev.gradleplugins.java-gradle-plugin'
id 'idea'
id 'eclipse'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.5.0'
id 'org.ajoberstar.grgit' version '4.1.0'
id 'com.github.ben-manes.versions' version '0.36.0'
//id 'com.github.johnrengelman.shadow' version '2.0.4'
alias libs.plugins.licenser
alias libs.plugins.gradleutils
}

version = (grgit.describe(longDescr: true, tags: true) ?: 'unknown-unknown-unknown').split('-').with { "${it[0]}.${it[1]}" }
println('Version: ' + version + ' Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
final projectDisplayName = 'ForgeGradle'
final projectArtifactId = base.archivesName = project.name // cannot change this
group = 'net.minecraftforge.gradle'
version = gitversion.tagOffset

sourceSets {
common
mcp
patcher
userdev
}
println "Version: $version"

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

sourceSets {
register('common')
register('mcp')
register('patcher')
register('userdev')
}

configurations {
all {
configureEach {
exclude group: 'org.ow2.asm'
}
mcpImplementation.extendsFrom commonImplementation
patcherImplementation.extendsFrom commonImplementation
userdevImplementation.extendsFrom mcpImplementation
implementation.extendsFrom mcpImplementation, patcherImplementation, userdevImplementation

def extend = { String to, String... from ->
final SourceSet toSet = sourceSets.getByName(to)

for (var s in from) {
final SourceSet fromSet = sourceSets.getByName(s)

named(toSet.implementationConfigurationName) { extendsFrom getByName(fromSet.implementationConfigurationName) }
named(toSet.compileOnlyConfigurationName) { extendsFrom getByName(fromSet.compileOnlyConfigurationName) }
}
}

extend('mcp', 'common')
extend('patcher', 'common')
extend('userdev', 'mcp')
extend('main', 'mcp', 'patcher', 'userdev')
}

jar {
from sourceSets.common.output
from sourceSets.mcp.output
from sourceSets.patcher.output
from sourceSets.userdev.output
// See settings.gradle for why this is here
repositories {
mavenCentral()
maven gradleutils.forgeMaven
}

task sourcesJar(type: Jar) {
from sourceSets.common.allJava
from sourceSets.mcp.allJava
from sourceSets.patcher.allJava
from sourceSets.userdev.allJava
archiveClassifier = 'sources'
dependencies {
commonCompileOnly gradleApi(libs.versions.gradle.get())
commonCompileOnly libs.bundles.groovy

commonImplementation libs.commons.io
commonImplementation libs.lzma
commonImplementation libs.javaxdelta
commonImplementation libs.gson
commonImplementation libs.guava
commonImplementation libs.fastcsv
commonImplementation libs.artifactural
commonImplementation libs.maven.artifact
commonImplementation libs.httpclient
commonImplementation libs.srgutils
commonImplementation variantOf(libs.diffpatch) { classifier 'all' }

mcpImplementation sourceSets.common.output
patcherImplementation sourceSets.mcp.output
patcherImplementation sourceSets.common.output
userdevImplementation sourceSets.mcp.output
userdevImplementation sourceSets.common.output
}

repositories {
mavenLocal()
jcenter()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.gradle.org/gradle/libs-releases-local/' }
tasks.named('jar', Jar) {
from sourceSets.common.output
from sourceSets.mcp.output
from sourceSets.patcher.output
from sourceSets.userdev.output
}

license {
header = file('HEADER')
header = rootProject.file('LICENSE-header.txt')
ext {
name = 'ForgeGradle'
year = 2018
Expand All @@ -64,67 +93,64 @@ license {
exclude 'net/minecraftforge/gradle/common/util/JavaVersionParser.java'
}

wrapper {
gradleVersion = '6.8'
distributionType = Wrapper.DistributionType.ALL
}
gradlePlugin {
website.set gitversion.url
vcsUrl.set gitversion.url + '.git'

dependencies {
commonImplementation gradleApi()
commonImplementation 'commons-io:commons-io:2.8.0'
commonImplementation 'com.github.jponge:lzma-java:1.3' // replaces the LZMA binary
commonImplementation 'com.nothome:javaxdelta:2.0.1' // GDIFF implementation for BinPatches
commonImplementation 'com.google.code.gson:gson:2.8.6'
commonImplementation 'com.google.guava:guava:30.1-jre'
commonImplementation 'de.siegmar:fastcsv:2.0.0'
commonImplementation 'net.minecraftforge:artifactural:2.0.3'
commonImplementation 'org.apache.maven:maven-artifact:3.6.3'
commonImplementation 'org.apache.httpcomponents:httpclient:4.5.13'
commonImplementation 'net.minecraftforge:srgutils:0.4.1'
commonImplementation 'net.minecraftforge:DiffPatch:2.0.5:all'
compatibility {
minimumGradleVersion = libs.versions.gradle.get()
}

mcpImplementation sourceSets.common.output
patcherImplementation sourceSets.mcp.output
patcherImplementation sourceSets.common.output
userdevImplementation sourceSets.mcp.output
userdevImplementation sourceSets.common.output
}
java {
withSourcesJar()
}

//Gradle doesn't add it's own source when doing the API. So lets hack it in!
import org.gradle.plugins.ide.eclipse.model.*
import org.gradle.plugins.ide.eclipse.model.internal.*
project.extensions.eclipse.classpath.file.whenMerged { Classpath cp ->
def gradleSrc = gradle.gradleHomeDir.absolutePath.replace(File.separator, '/') + '/src/'
cp.entries.each { entry ->
if ((entry in AbstractLibrary) && entry.library.file.name.startsWith('gradle-')) {
def type = (entry.library.file.name =~ "^gradle(-(.*))?-(${gradle.gradleVersion})")[0][2]
if (type == 'api') type = 'core-api' //Gradle name is different for cores
if (type == '') type = 'core'
entry.sourcePath = new FileReferenceFactory().fromPath(gradleSrc + type)
plugins {
// UserDev
register('userdev') {
id = 'net.minecraftforge.gradle'
implementationClass = 'net.minecraftforge.gradle.userdev.UserDevPlugin'
}

// MCP
def mcp = { String name ->
register(name) {
it.id = "net.minecraftforge.gradle.${name.replace('-', '.')}"
it.implementationClass = 'net.minecraftforge.gradle.mcp.MCPPlugin'
}
}
mcp('mcp')
mcp('forgedev-mcp')

// Patcher
def patcher = { String name ->
register(name) {
it.id = "net.minecraftforge.gradle.${name.replace('-', '.')}"
it.implementationClass = 'net.minecraftforge.gradle.patcher.PatcherPlugin'
}
}
patcher('patcher')
patcher('forgedev')
patcher('forgedev-patcher')
}
}

publishing {
publications {
pluginMaven(MavenPublication) {
artifact sourcesJar
publications.register('pluginMaven', MavenPublication) {
artifactId = projectArtifactId

pom { pom ->
name = projectDisplayName

gradleutils.pom.setGitHubDetails pom

licenses {
license gradleutils.pom.licenses.LGPLv2_1
}
}
}

repositories {
maven {
if (System.env.MAVEN_USER) {
url 'https://maven.minecraftforge.net/'
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.env.MAVEN_USER ?: 'not'
password = System.env.MAVEN_PASSWORD ?: 'set'
}
} else {
url 'file://' + rootProject.file('repo').getAbsolutePath()
}
}
maven gradleutils.publishingForgeMaven
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading