Files
CraterLib/build.gradle

195 lines
5.6 KiB
Groovy

plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.0.0' apply false
id "xyz.wagyourtail.unimined" version "1.1.0-SNAPSHOT" apply false
id "me.hypherionmc.modutils.modpublisher" version "1.0.+"
id 'maven-publish'
//id 'com.matyrobbrt.mc.registrationutils' version '1.20.1-1.0.0'
}
// TODO Reg Utils
/*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
}
var base_version = "${version_major}.${version_minor}"
var final_version = "${base_version}.${version_patch}"
// CI Support
if (!release && System.getenv('BUILD_NUMBER') != null) {
final_version = "${base_version}.${System.getenv('BUILD_NUMBER')}d"
}
group = project_group
version = "${final_version}"
subprojects {
apply plugin: "xyz.wagyourtail.unimined"
apply plugin: "java"
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'me.hypherionmc.modutils.modpublisher'
group = rootProject.group
version = rootProject.version
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
maven {
name = 'First Dark Maven'
url = 'https://maven.firstdark.dev/releases/'
}
maven {
name = 'First Dark Mirror'
url = 'https://mcentral.firstdark.dev/releases/'
}
}
configurations {
shade
modCompileOnly
implementation.extendsFrom shade
compileOnly.extendsFrom modCompileOnly
}
dependencies {
implementation "me.hypherionmc.moon-config:core:${moon_config}"
implementation "me.hypherionmc.moon-config:toml:${moon_config}"
}
jar {
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
])
}
}
/**
* ===============================================================================
* = DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING =
* ===============================================================================
*/
unimined.minecraft(sourceSets.main, true) {
version minecraft_version
mappings {
mojmap()
devNamespace "mojmap"
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = 17
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
clean {
delete "$rootDir/artifacts"
}
if (project.name !== 'Common') {
tasks.register('delDevJar') {
doLast {
def tree = fileTree('build/libs')
tree.include '**/*-dev-shadow.jar'
tree.include '**/*-dev.jar'
tree.include '**/*-all.jar'
tree.include '**/*-slim.jar'
tree.each { it.delete() }
}
}
build.finalizedBy delDevJar
tasks.register('copyAllArtifacts', Copy) {
from "$buildDir/libs"
into "$rootDir/artifacts"
include("*.jar")
}
build.finalizedBy(copyAllArtifacts)
}
}
// Standalone or Module JARS
tasks.register('rpcJar', Jar) {
dependsOn(compileJava)
includeEmptyDirs = false
archivesBaseName = "${mod_name}-modules-${minecraft_version}"
version = final_version
setArchiveClassifier("rpc")
from project(":Common").sourceSets.main.output
}
tasks.register('configJar', Jar) {
dependsOn(compileJava)
includeEmptyDirs = false
archivesBaseName = "${mod_name}-modules-${minecraft_version}"
version = final_version
setArchiveClassifier("config")
from project(":Common").sourceSets.main.output
include("**\\core\\config\\**\\*", "**\\**\\CraterConstants.*")
}
tasks.register('eventsJar', Jar) {
dependsOn(compileJava)
includeEmptyDirs = false
archivesBaseName = "${mod_name}-modules-${minecraft_version}"
version = final_version
setArchiveClassifier("events")
from project(":Common").sourceSets.main.output
include("**\\core\\event\\**\\*", "**\\**\\CraterConstants.*")
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId "${mod_name}-modules-${minecraft_version}"
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")
}
}
}
}