-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa823ba
commit e33337c
Showing
3 changed files
with
161 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,82 @@ | ||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
val versionMain: String = System.getenv("VERSION") ?: "9.9.9" | ||
|
||
plugins { | ||
id("java-library") | ||
id("maven-publish") | ||
alias(neoforged.plugins.moddev) | ||
} | ||
|
||
sourceSets { | ||
named("test") { | ||
resources { | ||
//The test module has no resources | ||
setSrcDirs(emptyList<String>()) | ||
} | ||
} | ||
} | ||
|
||
base { | ||
group = "dev.compactmods.compactmachines" | ||
version = versionMain | ||
} | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) | ||
withJavadocJar() | ||
} | ||
|
||
neoForge { | ||
version = neoforged.versions.neoforge | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
options.compilerArgs.add("-proc:none") | ||
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "9000")) | ||
} | ||
|
||
tasks.withType<Jar> { | ||
val gitVersion = providers.exec { | ||
commandLine("git", "rev-parse", "HEAD") | ||
}.standardOutput.asText.get() | ||
|
||
manifest { | ||
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) | ||
attributes( | ||
mapOf( | ||
"Specification-Title" to "Compact Machines - Core API", | ||
"Specification-Version" to "1", // We are version 1 of ourselves | ||
"Implementation-Title" to "Compact Machines - Core API", | ||
"Implementation-Timestamp" to now, | ||
"FMLModType" to "GAMELIBRARY", | ||
"Minecraft-Version" to mojang.versions.minecraft.get(), | ||
"NeoForge-Version" to neoforged.versions.neoforge.get(), | ||
"Main-Commit" to gitVersion | ||
) | ||
) | ||
} | ||
} | ||
|
||
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines" | ||
publishing { | ||
publications.register<MavenPublication>("api") { | ||
artifactId = "core-api" | ||
from(components.getByName("java")) | ||
} | ||
|
||
repositories { | ||
// GitHub Packages | ||
maven(PACKAGES_URL) { | ||
name = "GitHubPackages" | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
val versionMain: String = System.getenv("VERSION") ?: "9.9.9" | ||
|
||
plugins { | ||
id("java-library") | ||
id("maven-publish") | ||
alias(neoforged.plugins.moddev) | ||
} | ||
|
||
sourceSets { | ||
named("test") { | ||
resources { | ||
//The test module has no resources | ||
setSrcDirs(emptyList<String>()) | ||
} | ||
} | ||
} | ||
|
||
base { | ||
group = "dev.compactmods.compactmachines" | ||
version = versionMain | ||
} | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) | ||
withJavadocJar() | ||
} | ||
|
||
minecraft {} | ||
|
||
dependencies { | ||
api(neoforged.neoforge) | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
options.compilerArgs.add("-proc:none") | ||
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "9000")) | ||
} | ||
|
||
tasks.withType<Jar> { | ||
val gitVersion = providers.exec { | ||
commandLine("git", "rev-parse", "HEAD") | ||
}.standardOutput.asText.get() | ||
|
||
manifest { | ||
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) | ||
attributes( | ||
mapOf( | ||
"Specification-Title" to "Compact Machines - Core API", | ||
"Specification-Version" to "1", // We are version 1 of ourselves | ||
"Implementation-Title" to "Compact Machines - Core API", | ||
"Implementation-Timestamp" to now, | ||
"FMLModType" to "GAMELIBRARY", | ||
"Minecraft-Version" to mojang.versions.minecraft.get(), | ||
"NeoForge-Version" to neoforged.versions.neoforge.get(), | ||
"Main-Commit" to gitVersion | ||
) | ||
) | ||
} | ||
} | ||
|
||
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines" | ||
publishing { | ||
publications.register<MavenPublication>("api") { | ||
artifactId = "core-api" | ||
from(components.getByName("java")) | ||
} | ||
|
||
repositories { | ||
// GitHub Packages | ||
maven(PACKAGES_URL) { | ||
name = "GitHubPackages" | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters