209 lines
5.9 KiB
Groovy
209 lines
5.9 KiB
Groovy
plugins {
|
|
id "idea"
|
|
id "maven-publish"
|
|
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
|
id "com.matthewprenger.cursegradle" version "1.4.0"
|
|
id 'org.spongepowered.mixin' version '0.7.+'
|
|
}
|
|
|
|
apply plugin: 'org.spongepowered.mixin'
|
|
apply from: "minecraft.gradle"
|
|
|
|
allprojects {
|
|
gradle.projectsEvaluated {
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs << "-Xmaxerrs" << "1000"
|
|
}
|
|
}
|
|
}
|
|
|
|
def getGitRef() {
|
|
try {
|
|
final def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine "git", "rev-parse", "--short", "HEAD"
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
} catch (final Throwable ignored) {
|
|
return "unknown"
|
|
}
|
|
}
|
|
|
|
version = "${semver}+${getGitRef()}"
|
|
group = "com.therealm18studios.librecomponents"
|
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = "utf-8"
|
|
}
|
|
|
|
final def hasGithubPackageCredentials =
|
|
(project.hasProperty("gpr.user") && project.hasProperty("gpr.key")) ||
|
|
(System.getenv("GITHUB_ACTOR") && System.getenv("GITHUB_TOKEN"))
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url "https://cursemaven.com"
|
|
}
|
|
maven {
|
|
// location of the maven that hosts JEI files since January 2023
|
|
name = "Jared's maven"
|
|
url = "https://maven.blamejared.com/"
|
|
}
|
|
maven { url = "https://proxy-maven.covers1624.net/" }
|
|
if (hasGithubPackageCredentials) {
|
|
final def GithubPackages = [
|
|
["fnuecke/ceres", "li.cil.ceres"],
|
|
["fnuecke/sedna", "li.cil.sedna"],
|
|
["fnuecke/buildroot", "li.cil.sedna"]
|
|
]
|
|
GithubPackages.each { final repo, final group ->
|
|
maven {
|
|
url = uri("https://maven.pkg.github.com/${repo}")
|
|
credentials {
|
|
username = project.findProperty("gpr.user") ?: System.getenv("GPR_USER")
|
|
password = project.findProperty("gpr.key") ?: System.getenv("GPR_KEY")
|
|
}
|
|
content { includeGroup group }
|
|
}
|
|
}
|
|
}
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
|
|
|
|
|
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
|
|
|
runtimeOnly fileTree(dir: 'libs', include: '*.jar')
|
|
runtimeOnly fg.deobf("curse.maven:architectury-api-419699:5137942")
|
|
runtimeOnly fg.deobf("curse.maven:jei-238222:5846858")
|
|
runtimeOnly fg.deobf("curse.maven:tiny-redstone-453746:5318126")
|
|
|
|
implementation fg.deobf("curse.maven:markdownmanual-502485:4306669")
|
|
implementation fg.deobf("curse.maven:libre-computers-1163239:6136998")
|
|
|
|
}
|
|
|
|
System.setProperty("line.separator", "\n")
|
|
|
|
minecraft {
|
|
mappings channel: "official", version: minecraft_version
|
|
|
|
runs {
|
|
all {
|
|
property "forge.logging.markers", "REGISTRIES"
|
|
property "forge.logging.console.level", "debug"
|
|
|
|
mods {
|
|
librecomponents {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
client {
|
|
workingDirectory project.file("runclient")
|
|
property "forge.enabledGameTestNamespaces", "librecomponents"
|
|
}
|
|
|
|
server {
|
|
workingDirectory project.file("run")
|
|
property "forge.enabledGameTestNamespaces", "librecomponents"
|
|
arg "--nogui"
|
|
}
|
|
|
|
gameTestServer {
|
|
workingDirectory project.file('run')
|
|
property "forge.enabledGameTestNamespaces", "librecomponents"
|
|
}
|
|
|
|
data {
|
|
workingDirectory project.file("run")
|
|
args "--mod", "librecomponents", "--all", "--output", file("src/generated/resources/"), "--existing", file("src/main/resources")
|
|
}
|
|
}
|
|
}
|
|
|
|
task copyGeneratedResources(type: Copy) {
|
|
from "src/generated"
|
|
into "src/main"
|
|
exclude "resources/.cache"
|
|
}
|
|
|
|
jar {
|
|
finalizedBy "reobfJar"
|
|
|
|
manifest {
|
|
attributes([
|
|
"FMLAT" : "accesstransformer.cfg",
|
|
"Specification-Title" : "librecomponents",
|
|
"Specification-Vendor" : "The Realm 18 Studios",
|
|
"Specification-Version" : "1",
|
|
"Implementation-Title" : project.name,
|
|
"Implementation-Version" : "${semver}",
|
|
"Implementation-Vendor" : "The Realm 18 Studios",
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
"MixinConfigs" : "mixins.librecomponents.json",
|
|
"ContainedDeps" : "commons-collections4-4.4.jar"
|
|
])
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
groupId = project.group
|
|
artifactId = project.name
|
|
version = semver
|
|
artifact jar
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = "GitHubPackages"
|
|
url = System.getenv("GITHUB_MAVEN_URL") ?: ""
|
|
credentials {
|
|
username = System.getenv("GITHUB_ACTOR")
|
|
password = System.getenv("GITHUB_TOKEN")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//
|
|
//curseforge {
|
|
// apiKey = System.getenv("CURSEFORGE_API_KEY") ?: ""
|
|
// project {
|
|
// id = curse_project_id
|
|
// releaseType = System.getenv('CURSEFORGE_RELEASE_TYPE') ?: "alpha"
|
|
// changelogType = 'markdown'
|
|
// changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
|
|
// addGameVersion "Forge"
|
|
// addGameVersion minecraft_version
|
|
// addGameVersion "Java 17"
|
|
// relations {
|
|
// requiredDependency "markdownmanual"
|
|
// requiredDependency "sedna"
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
idea {
|
|
module {
|
|
for (final String exclude in ["assets", "run", "out", "logs", "src/generated"]) {
|
|
excludeDirs += file(exclude)
|
|
}
|
|
}
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|