mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Use JGit instead of GrGit now that jcenter is going away.
Update missed mapped name in MDK.
This commit is contained in:
1 parent
813f3d630d
commit
f4fd1c2f16
5 files changed
+53
-20
No files matched your search
+9
-18
@@ -25,9 +25,8 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
|
||||
plugins {
|
||||
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 'eclipse'
|
||||
id 'eclipse'
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
@@ -47,7 +46,7 @@ ext {
|
||||
MAPPING_VERSION = '1.16.5'
|
||||
MC_VERSION = '1.16.5'
|
||||
MCP_VERSION = '20210115.111550'
|
||||
SPI_VERSION = '3.2.0'
|
||||
SPI_VERSION = '3.2.0'
|
||||
}
|
||||
|
||||
project(':mcp') {
|
||||
@@ -63,8 +62,8 @@ project(':mcp') {
|
||||
|
||||
project(':clean') {
|
||||
evaluationDependsOn(':mcp')
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
@@ -183,7 +182,8 @@ project(':forge') {
|
||||
}
|
||||
|
||||
ext {
|
||||
SPEC_VERSION = '36.0' // This is overwritten by git tag, but here so dev time doesnt explode
|
||||
GIT_INFO = Util.gitInfo(rootProject.file('.'))
|
||||
SPEC_VERSION = GIT_INFO.tag
|
||||
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
|
||||
// ForgeMC is a unique identifier for every MC version we have supported.
|
||||
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
|
||||
@@ -195,16 +195,7 @@ project(':forge') {
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.1.11'
|
||||
}
|
||||
|
||||
def getVersion = {
|
||||
def (tag, offset, hash) = (grgit.describe(longDescr: true, tags:true) ?: '0.0-0-unknown').rsplit('-', 2)
|
||||
SPEC_VERSION = tag
|
||||
def branch = grgit.branch.current().name
|
||||
if (branch in [null, 'master', 'HEAD', MC_VERSION, MC_VERSION + '.0', MC_VERSION.rsplit('.', 1)[0] + '.x'])
|
||||
return "${MC_VERSION}-${tag}.${offset}".toString()
|
||||
return "${MC_VERSION}-${tag}.${offset}-${branch}".toString()
|
||||
}
|
||||
|
||||
version = getVersion()
|
||||
version = Util.getVersion(GIT_INFO, MC_VERSION)
|
||||
println('Forge Version: ' + version)
|
||||
|
||||
patcher {
|
||||
@@ -350,8 +341,8 @@ project(':forge') {
|
||||
MANIFESTS = [
|
||||
'/': [
|
||||
'Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
'GitCommit': grgit.head().abbreviatedId,
|
||||
'Git-Branch': grgit.branch.current().getName()
|
||||
'GitCommit': GIT_INFO.abbreviatedId,
|
||||
'Git-Branch': GIT_INFO.branch
|
||||
] as LinkedHashMap,
|
||||
'net/minecraftforge/versions/forge/': [
|
||||
'Specification-Title': 'Forge',
|
||||
|
||||
@@ -4,4 +4,5 @@ repositories {
|
||||
dependencies {
|
||||
implementation 'org.ow2.asm:asm:9.0'
|
||||
implementation 'org.ow2.asm:asm-tree:9.0'
|
||||
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r'
|
||||
}
|
||||
@@ -7,6 +7,10 @@ import java.security.MessageDigest
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.lib.AbbreviatedObjectId
|
||||
import org.eclipse.jgit.lib.ObjectId
|
||||
|
||||
public class Util {
|
||||
static void init() {
|
||||
File.metaClass.sha1 = { ->
|
||||
@@ -127,4 +131,42 @@ public class Util {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
public static def gitInfo(dir) {
|
||||
init()
|
||||
def git = null
|
||||
try {
|
||||
git = Git.open(dir)
|
||||
} catch (org.eclipse.jgit.errors.RepositoryNotFoundException e) {
|
||||
return [
|
||||
tag: '0.0',
|
||||
offset: '0',
|
||||
hash: '00000000',
|
||||
branch: 'master',
|
||||
commit: '0000000000000000000000',
|
||||
abbreviatedId: '00000000'
|
||||
]
|
||||
}
|
||||
def desc = git.describe().setLong(true).setTags(true).call().rsplit('-', 2)
|
||||
def head = git.repository.resolve('HEAD')
|
||||
|
||||
def ret = [:]
|
||||
ret.tag = desc[0]
|
||||
ret.offset = desc[1]
|
||||
ret.hash = desc[2]
|
||||
ret.branch = git.repository.branch
|
||||
ret.commit = ObjectId.toString(head)
|
||||
ret.abbreviatedId = head.abbreviate(8).name()
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
public static String getVersion(info, mc_version) {
|
||||
def branch = info.branch
|
||||
if (branch != null && branch.startsWith('pulls/'))
|
||||
branch = 'pr' + branch.rsplit('/', 1)[1]
|
||||
if (branch in [null, 'master', 'HEAD', mc_version, mc_version + '.0', mc_version.rsplit('.', 1)[0] + '.x'])
|
||||
return "${mc_version}-${info.tag}.${info.offset}".toString()
|
||||
return "${mc_version}-${info.tag}.${info.offset}-${branch}".toString()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ExampleMod
|
||||
|
||||
private void doClientStuff(final FMLClientSetupEvent event) {
|
||||
// do something that can only be done on the client
|
||||
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
|
||||
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options);
|
||||
}
|
||||
|
||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
||||
|
||||
Reference in new issue
Block a user