2021-07-30 07:09:18 +00:00
|
|
|
import java.security.MessageDigest
|
2020-08-20 08:57:08 +00:00
|
|
|
|
2021-07-27 16:08:18 +00:00
|
|
|
plugins {
|
2021-07-30 07:09:18 +00:00
|
|
|
id 'com.github.johnrengelman.shadow' version '7.0.0' apply false
|
2021-07-27 16:08:18 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 08:57:08 +00:00
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'idea'
|
2020-10-21 07:01:09 +00:00
|
|
|
apply plugin: 'maven-publish'
|
2021-07-30 07:09:18 +00:00
|
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
2020-08-20 08:57:08 +00:00
|
|
|
|
2021-06-21 03:54:14 +00:00
|
|
|
archivesBaseName = archivesBaseName + '-' + minecraftVersion
|
|
|
|
|
2021-05-12 15:15:02 +00:00
|
|
|
sourceSets {
|
|
|
|
applaunch {
|
|
|
|
java {
|
|
|
|
compileClasspath += main.output
|
|
|
|
runtimeClasspath += main.output
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-03 05:27:06 +00:00
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
2021-07-27 16:08:18 +00:00
|
|
|
|
2020-08-20 08:57:08 +00:00
|
|
|
configurations {
|
2021-07-30 07:09:18 +00:00
|
|
|
installer
|
2020-08-20 08:57:08 +00:00
|
|
|
embed
|
2021-10-24 07:42:08 +00:00
|
|
|
gson
|
|
|
|
implementation.extendsFrom(embed, gson)
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = 'sponge-repo'
|
|
|
|
url = 'https://repo.spongepowered.org/maven'
|
|
|
|
}
|
|
|
|
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
|
|
|
maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
|
|
|
|
maven { url = 'https://files.minecraftforge.net/maven/' }
|
2020-08-22 12:26:14 +00:00
|
|
|
maven { url = 'https://jitpack.io/' }
|
2021-02-08 16:03:59 +00:00
|
|
|
maven { url = 'https://maven.izzel.io/releases' }
|
2022-08-01 09:08:20 +00:00
|
|
|
mavenCentral()
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
|
|
|
|
2022-10-06 01:44:29 +00:00
|
|
|
def embedLibs = [/*"org.spongepowered:mixin:$mixinVersion", */ 'org.yaml:snakeyaml:1.33',
|
2022-08-01 09:08:20 +00:00
|
|
|
'org.xerial:sqlite-jdbc:3.36.0.3', 'mysql:mysql-connector-java:8.0.29',
|
2021-07-27 16:08:18 +00:00
|
|
|
/*'commons-lang:commons-lang:2.6',*/ 'com.googlecode.json-simple:json-simple:1.1.1',
|
2022-08-01 09:08:20 +00:00
|
|
|
'org.apache.logging.log4j:log4j-jul:2.17.2', 'net.md-5:SpecialSource:1.11.0',
|
2020-09-22 05:25:09 +00:00
|
|
|
'org.jline:jline-terminal-jansi:3.12.1', 'org.fusesource.jansi:jansi:1.18',
|
2021-10-24 07:42:08 +00:00
|
|
|
/*'org.jline:jline-terminal:3.12.1', 'org.jline:jline-reader:3.12.1',*/
|
2021-05-16 15:36:33 +00:00
|
|
|
'jline:jline:2.12.1', 'org.apache.maven:maven-resolver-provider:3.8.1',
|
|
|
|
'org.apache.maven.resolver:maven-resolver-connector-basic:1.6.2', 'org.apache.maven.resolver:maven-resolver-transport-http:1.6.2',
|
|
|
|
'org.apache.maven:maven-model:3.8.1', 'org.codehaus.plexus:plexus-utils:3.2.1',
|
|
|
|
'org.apache.maven:maven-model-builder:3.8.1', 'org.codehaus.plexus:plexus-interpolation:1.25',
|
|
|
|
'org.eclipse.sisu:org.eclipse.sisu.inject:0.3.4', 'org.apache.maven:maven-builder-support:3.8.1',
|
|
|
|
'org.apache.maven:maven-repository-metadata:3.8.1', 'org.apache.maven.resolver:maven-resolver-api:1.6.2',
|
|
|
|
'org.apache.maven.resolver:maven-resolver-spi:1.6.2', 'org.apache.maven.resolver:maven-resolver-util:1.6.2',
|
|
|
|
'org.apache.maven.resolver:maven-resolver-impl:1.6.2', 'org.apache.httpcomponents:httpclient:4.5.12',
|
2021-12-03 08:52:33 +00:00
|
|
|
'org.apache.httpcomponents:httpcore:4.4.13', 'commons-codec:commons-codec:1.15',
|
2021-10-24 07:42:08 +00:00
|
|
|
'org.slf4j:jcl-over-slf4j:1.7.30', /*'org.apache.logging.log4j:log4j-slf4j18-impl:2.14.1',*/
|
2021-07-30 07:09:18 +00:00
|
|
|
'org.spongepowered:configurate-hocon:3.6.1', 'org.spongepowered:configurate-core:3.6.1',
|
|
|
|
'com.typesafe:config:1.3.1']
|
2020-08-20 08:57:08 +00:00
|
|
|
|
|
|
|
dependencies {
|
2022-08-01 09:08:20 +00:00
|
|
|
implementation 'com.google.guava:guava:31.1-jre'
|
|
|
|
implementation 'org.ow2.asm:asm:9.3'
|
|
|
|
implementation 'org.ow2.asm:asm-tree:9.3'
|
|
|
|
implementation 'cpw.mods:modlauncher:9.0.24'
|
|
|
|
implementation 'cpw.mods:securejarhandler:2.1.4'
|
|
|
|
implementation 'net.minecraftforge:forgespi:6.0.0'
|
|
|
|
gson 'com.google.code.gson:gson:2.9.0'
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.17.2'
|
|
|
|
implementation 'org.jetbrains:annotations:23.0.0'
|
2021-07-30 07:09:18 +00:00
|
|
|
implementation 'org.spongepowered:mixin:0.8.3'
|
2022-08-01 09:08:20 +00:00
|
|
|
implementation 'org.apache.logging.log4j:log4j-jul:2.17.2'
|
2020-08-20 08:57:08 +00:00
|
|
|
for (def lib : embedLibs) {
|
2021-07-30 07:09:18 +00:00
|
|
|
installer lib
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
2021-07-27 16:08:18 +00:00
|
|
|
embed 'io.izzel.arclight:mixin-tools:1.0.1'
|
2021-06-13 14:06:33 +00:00
|
|
|
embed "io.izzel:tools:$toolsVersion"
|
|
|
|
embed "io.izzel.arclight:arclight-api:$apiVersion"
|
2021-07-27 16:08:18 +00:00
|
|
|
embed 'commons-lang:commons-lang:2.6@jar'
|
2021-07-30 07:09:18 +00:00
|
|
|
embed(project(':i18n-config')) {
|
|
|
|
transitive = false
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
2021-10-24 07:42:08 +00:00
|
|
|
embed(project(':forge-installer')) {
|
|
|
|
transitive = false
|
|
|
|
}
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
2021-05-12 15:15:02 +00:00
|
|
|
manifest.attributes 'Main-Class': 'io.izzel.arclight.server.Launcher'
|
2020-08-20 08:57:08 +00:00
|
|
|
manifest.attributes 'Implementation-Title': 'Arclight'
|
2021-07-30 07:09:18 +00:00
|
|
|
manifest.attributes 'Implementation-Version': "arclight-$minecraftVersion-${project.version}-$gitHash"
|
2020-08-20 08:57:08 +00:00
|
|
|
manifest.attributes 'Implementation-Vendor': 'Arclight Team'
|
|
|
|
manifest.attributes 'Implementation-Timestamp': new Date().format("yyyy-MM-dd HH:mm:ss")
|
2021-07-27 16:08:18 +00:00
|
|
|
manifest.attributes 'Automatic-Module-Name': 'arclight.boot'
|
2020-08-20 08:57:08 +00:00
|
|
|
from(configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }) {
|
|
|
|
exclude "META-INF/MANIFEST.MF"
|
|
|
|
exclude "META-INF/*.SF"
|
|
|
|
exclude "META-INF/*.DSA"
|
|
|
|
exclude "META-INF/*.RSA"
|
|
|
|
exclude "LICENSE.txt"
|
2021-07-27 16:08:18 +00:00
|
|
|
exclude "META-INF/services/**"
|
|
|
|
exclude "org/apache/commons/lang/enum/**"
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
2021-07-30 07:09:18 +00:00
|
|
|
into('/') {
|
|
|
|
it.from(project(':arclight-common').tasks.jar.outputs.files.collect())
|
|
|
|
it.rename { name -> 'common.jar' }
|
|
|
|
}
|
2021-10-24 07:42:08 +00:00
|
|
|
into('/') {
|
|
|
|
it.from(configurations.gson.collect())
|
|
|
|
it.rename { name -> 'gson.jar' }
|
|
|
|
}
|
2021-05-12 15:15:02 +00:00
|
|
|
from sourceSets.applaunch.output.classesDirs
|
2021-07-26 12:20:33 +00:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2021-07-30 07:09:18 +00:00
|
|
|
dependsOn(project(':arclight-common').tasks.jar)
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
|
|
|
|
2021-07-30 07:09:18 +00:00
|
|
|
task generateInstallerInfo {
|
2021-08-26 09:08:18 +00:00
|
|
|
inputs.property('forgeVersion', forgeVersion)
|
2021-07-30 07:09:18 +00:00
|
|
|
def installer = file("${project.buildDir}/arclight_installer/META-INF/installer.json")
|
|
|
|
outputs.file(installer)
|
|
|
|
doLast {
|
|
|
|
def libs = project.configurations.installer.dependencies.collect { Dependency dep ->
|
|
|
|
def classifier = null
|
|
|
|
if (dep.artifacts) {
|
|
|
|
dep.artifacts.each { DependencyArtifact artifact ->
|
|
|
|
if (artifact.classifier) {
|
|
|
|
classifier = artifact.classifier
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (classifier) {
|
|
|
|
return "${dep.group}:${dep.name}:${dep.version}:$classifier"
|
|
|
|
} else {
|
|
|
|
return "${dep.group}:${dep.name}:${dep.version}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
def sha1 = { file ->
|
|
|
|
MessageDigest md = MessageDigest.getInstance('SHA-1')
|
|
|
|
file.eachByte 4096, { bytes, size ->
|
|
|
|
md.update(bytes, 0 as byte, size)
|
|
|
|
}
|
|
|
|
return md.digest().collect { String.format "%02x", it }.join()
|
|
|
|
}
|
|
|
|
def artifacts = { List<String> arts ->
|
|
|
|
def ret = new HashMap<String, String>()
|
|
|
|
def cfg = project.configurations.create("art_rev_" + System.currentTimeMillis())
|
|
|
|
cfg.transitive = false
|
|
|
|
arts.each {
|
|
|
|
def dep = project.dependencies.create(it)
|
|
|
|
cfg.dependencies.add(dep)
|
|
|
|
}
|
|
|
|
cfg.resolve()
|
|
|
|
cfg.resolvedConfiguration.resolvedArtifacts.each { rev ->
|
|
|
|
def art = [
|
|
|
|
group : rev.moduleVersion.id.group,
|
|
|
|
name : rev.moduleVersion.id.name,
|
|
|
|
version : rev.moduleVersion.id.version,
|
|
|
|
classifier: rev.classifier,
|
|
|
|
extension : rev.extension,
|
|
|
|
file : rev.file
|
|
|
|
]
|
|
|
|
def desc = "${art.group}:${art.name}:${art.version}"
|
|
|
|
if (art.classifier != null)
|
|
|
|
desc += ":${art.classifier}"
|
|
|
|
if (art.extension != 'jar')
|
|
|
|
desc += "@${art.extension}"
|
|
|
|
ret.put(desc.toString(), sha1(art.file))
|
|
|
|
}
|
|
|
|
return arts.collectEntries { [(it.toString()): ret.get(it.toString())] }
|
|
|
|
}
|
|
|
|
def output = [
|
|
|
|
installer: [
|
|
|
|
minecraft: minecraftVersion,
|
|
|
|
forge : forgeVersion,
|
|
|
|
hash : sha1(project(':arclight-common').file("${project(':arclight-common').buildDir}/arclight_cache/forge-$minecraftVersion-$forgeVersion-installer.jar"))
|
|
|
|
],
|
|
|
|
libraries: artifacts(libs)
|
|
|
|
]
|
|
|
|
installer.text = groovy.json.JsonOutput.toJson(output)
|
|
|
|
}
|
|
|
|
dependsOn(project(':arclight-common').tasks.downloadInstaller)
|
2020-08-20 08:57:08 +00:00
|
|
|
}
|
2021-06-12 09:58:16 +00:00
|
|
|
|
2021-07-30 07:09:18 +00:00
|
|
|
project.sourceSets.main.output.dir file("${project.buildDir}/arclight_installer"), builtBy: tasks.generateInstallerInfo
|
2020-08-20 08:57:08 +00:00
|
|
|
|
|
|
|
compileJava {
|
2021-07-27 16:08:18 +00:00
|
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16
|
2020-08-20 08:57:08 +00:00
|
|
|
options.compilerArgs << '-XDignore.symbol.file' << '-XDenableSunApiLintControl'
|
|
|
|
options.encoding = 'UTF-8'
|
2020-10-21 07:01:09 +00:00
|
|
|
}
|
|
|
|
|
2021-05-12 15:15:02 +00:00
|
|
|
compileApplaunchJava {
|
2021-07-26 12:20:33 +00:00
|
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_7
|
2021-05-12 15:15:02 +00:00
|
|
|
}
|
|
|
|
|
2022-08-01 09:08:20 +00:00
|
|
|
task runProdServer(type: JavaExec) {
|
|
|
|
classpath = files(tasks.jar)
|
|
|
|
systemProperties 'terminal.ansi': 'true'
|
|
|
|
systemProperties 'mixin.debug.export': 'true'
|
|
|
|
systemProperties 'arclight.alwaysExtract': 'true'
|
|
|
|
systemProperties 'arclight.remapper.dump': './.mixin.out/plugin_classes'
|
|
|
|
workingDir System.env.ARCLIGHT_PROD_DIR ?: file('run_prod')
|
|
|
|
maxHeapSize '4G'
|
|
|
|
args 'nogui'
|
|
|
|
standardInput System.in
|
|
|
|
javaLauncher.convention(javaToolchains.launcherFor {
|
|
|
|
languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
})
|
|
|
|
dependsOn project(':arclight-common').tasks.build, project.tasks.build
|
|
|
|
}
|
|
|
|
|
2020-10-21 07:01:09 +00:00
|
|
|
publishing {
|
|
|
|
repositories {
|
|
|
|
maven {
|
2021-01-28 11:51:42 +00:00
|
|
|
name = "IzzelAliz"
|
2020-10-21 07:01:09 +00:00
|
|
|
url = uri('https://maven.izzel.io/' + (project.version.toString().endsWith('SNAPSHOT') ? 'snapshots' : 'releases'))
|
|
|
|
credentials {
|
|
|
|
username = project.findProperty("mavenUser") ?: System.getenv("ARCLIGHT_USER")
|
|
|
|
password = project.findProperty("mavenToken") ?: System.getenv("ARCLIGHT_TOKEN")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
2021-12-03 05:27:06 +00:00
|
|
|
artifactId = 'arclight-forge-1.18'
|
2021-10-27 13:45:37 +00:00
|
|
|
artifact project(':arclight-common').tasks.srgJar
|
|
|
|
artifact project(':arclight-common').tasks.spigotJar
|
2021-07-30 07:09:18 +00:00
|
|
|
//artifact sourceJar
|
2020-10-21 07:01:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ('true'.equalsIgnoreCase(System.getenv('APPVEYOR_REPO_TAG'))) {
|
|
|
|
tasks.build.dependsOn(tasks.publish)
|
|
|
|
}
|