173 lines
5.0 KiB
Groovy
173 lines
5.0 KiB
Groovy
plugins {
|
|
id 'java'
|
|
//id 'com.matyrobbrt.mc.registrationutils' version '1.20.1-1.0.0'
|
|
id 'maven-publish'
|
|
id 'net.minecraftforge.gradle' version '[6.0,6.2)' apply false
|
|
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply false
|
|
id 'com.github.johnrengelman.shadow' version '7.0.0' apply false
|
|
}
|
|
|
|
/*registrationUtils {
|
|
group 'com.hypherionmc.craterlib.core.systems.reg'
|
|
projects {
|
|
Common { type 'common'; project ':Common' }
|
|
Fabric { type 'fabric'; project ':Fabric' }
|
|
Forge { type 'forge'; project ':Forge' }
|
|
}
|
|
}*/
|
|
|
|
ext {
|
|
release = project.properties['release'] ?: false
|
|
}
|
|
|
|
def version_base = "${project.version_major}.${project.version_minor}"
|
|
def final_ver = "${version_base}.${project.version_patch}"
|
|
|
|
// Jenkins
|
|
if (System.getenv('BUILD_NUMBER') != null && project.release == false) {
|
|
final_ver = version_base + "." + System.getenv('BUILD_NUMBER') + "d"
|
|
}
|
|
|
|
version = "${final_ver}"
|
|
|
|
subprojects {
|
|
version = "${final_ver}"
|
|
group = project.group
|
|
|
|
apply plugin: 'java'
|
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
//java.withSourcesJar()
|
|
//java.withJavadocJar()
|
|
|
|
jar {
|
|
archiveClassifier = 'slim'
|
|
|
|
manifest {
|
|
attributes([
|
|
'Specification-Title' : mod_name,
|
|
'Specification-Vendor' : mod_author,
|
|
'Specification-Version' : project.jar.archiveVersion,
|
|
'Implementation-Title' : project.name,
|
|
'Implementation-Version' : project.jar.archiveVersion,
|
|
'Implementation-Vendor' : mod_author,
|
|
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
'Timestamp' : System.currentTimeMillis(),
|
|
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
|
|
'Build-On-Minecraft' : minecraft_version
|
|
])
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = 'First Dark Maven'
|
|
url = 'https://maven.firstdark.dev/releases/'
|
|
}
|
|
maven {
|
|
name = 'First Dark Mirror'
|
|
url = 'https://mcentral.firstdark.dev/releases/'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation "me.hypherionmc.moon-config:core:${moon_config}"
|
|
implementation "me.hypherionmc.moon-config:toml:${moon_config}"
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.encoding = 'UTF-8'
|
|
it.options.release = 17
|
|
}
|
|
|
|
// Disables Gradle's custom module metadata from being published to maven. The
|
|
// metadata includes mapped dependencies which are not reasonably consumable by
|
|
// other mod developers.
|
|
tasks.withType(GenerateModuleMetadata) {
|
|
enabled = false
|
|
}
|
|
|
|
clean {
|
|
delete "$rootDir/artifacts"
|
|
}
|
|
|
|
if (project.name !== 'Common') {
|
|
task delDevJar {
|
|
doLast {
|
|
def tree = fileTree('build/libs')
|
|
tree.include '**/*-dev.jar'
|
|
tree.include '**/*-dev-shadow.jar'
|
|
tree.include '**/*-all.jar'
|
|
tree.include '**/*-slim.jar'
|
|
tree.each { it.delete() }
|
|
}
|
|
}
|
|
build.finalizedBy delDevJar
|
|
|
|
task copyAllArtifacts(type: Copy) {
|
|
from "$buildDir/libs"
|
|
into "$rootDir/artifacts"
|
|
include("*.jar")
|
|
}
|
|
|
|
build.finalizedBy(copyAllArtifacts)
|
|
}
|
|
}
|
|
|
|
// Standalone or Module JARS
|
|
task rpcJar(type: Jar) {
|
|
dependsOn(compileJava)
|
|
includeEmptyDirs = false
|
|
archivesBaseName = "${mod_name}-modules"
|
|
version = final_ver;
|
|
setArchiveClassifier("rpc")
|
|
|
|
from project(":Common").sourceSets.main.output
|
|
}
|
|
|
|
task configJar(type: Jar) {
|
|
dependsOn(compileJava)
|
|
includeEmptyDirs = false
|
|
archivesBaseName = "${mod_name}-modules"
|
|
version = final_ver;
|
|
setArchiveClassifier("config")
|
|
|
|
from project(":Common").sourceSets.main.output
|
|
include("**\\core\\config\\**\\*", "**\\**\\CraterConstants.*")
|
|
}
|
|
|
|
task eventsJar(type: Jar) {
|
|
dependsOn(compileJava)
|
|
includeEmptyDirs = false
|
|
archivesBaseName = "${mod_name}-modules"
|
|
version = final_ver;
|
|
setArchiveClassifier("events")
|
|
|
|
from project(":Common").sourceSets.main.output
|
|
include("**\\core\\event\\**\\*", "**\\**\\CraterConstants.*")
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
groupId project.group
|
|
artifactId "${mod_name}-modules"
|
|
version project.version
|
|
|
|
artifact rpcJar
|
|
artifact eventsJar
|
|
artifact configJar
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url "https://maven.firstdark.dev/" + (project.release ? "releases" : "snapshots")
|
|
credentials {
|
|
username System.getenv("MAVEN_USER")
|
|
password System.getenv("MAVEN_PASS")
|
|
}
|
|
}
|
|
}
|
|
} |