-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
67b442a
commit a54195f
Showing
18 changed files
with
150 additions
and
409 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
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,74 +1,9 @@ | ||
//file:noinspection GroovyAssignabilityCheck | ||
import groovy.json.JsonSlurper | ||
import groovy.json.JsonOutput | ||
import groovy.util.Node | ||
import groovy.util.NodeList | ||
import java.time.Instant | ||
import java.time.format.DateTimeFormatter | ||
import java.util.* | ||
|
||
val mod_group: String by project | ||
val mc_version: String by project | ||
val mod_version: String by project | ||
val mod_id: String by project | ||
val forge_version: String by project | ||
val jei_version: String by project | ||
val java_version: String by project | ||
val mappings_channel: String by project | ||
val mappings_version: String by project | ||
val vendor: String by project | ||
val github: String by project | ||
val mod_name: String by project | ||
val mod_url: String by project | ||
|
||
|
||
fun Project.fileTree(dir: String, include: String) = fileTree("dir" to dir, "include" to include) | ||
|
||
plugins { | ||
`maven-publish` | ||
eclipse | ||
idea | ||
java | ||
id("net.minecraftforge.gradle") | ||
id("org.parchmentmc.librarian.forgegradle") | ||
} | ||
|
||
//-------------- | ||
|
||
group = mod_group | ||
version = "${mc_version}-${mod_version}" | ||
base { | ||
archivesName.set(mod_id) | ||
} | ||
|
||
if (System.getenv("RELEASE_TYPE") != null) { | ||
status = System.getenv("RELEASE_TYPE").lowercase() | ||
if (status == "snapshot") status = (status as String).uppercase() | ||
} else { | ||
status = "SNAPSHOT" | ||
} | ||
|
||
if (status != "release") { | ||
version = "${version}-${status}" | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
|
||
toolchain.languageVersion.set(JavaLanguageVersion.of(java_version)) | ||
} | ||
|
||
sourceSets { | ||
main { | ||
resources { | ||
srcDir("src/main/generated") | ||
} | ||
} | ||
id ("com.github.minecraftschurlimods.helperplugin") | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { | ||
name = "blamejared Maven" | ||
url = uri("https://maven.blamejared.com") | ||
|
@@ -79,203 +14,46 @@ repositories { | |
} | ||
} | ||
|
||
configurations.testImplementation.configure { extendsFrom(configurations.minecraft.get()) } | ||
|
||
dependencies { | ||
minecraft("net.minecraftforge:forge:${mc_version}-${forge_version}") | ||
compileOnly(fg.deobf("mezz.jei:jei-1.20-common-api:${jei_version}")) | ||
runtimeOnly(fg.deobf("mezz.jei:jei-1.20-forge:${jei_version}")) | ||
implementation(helper.neoforge()) | ||
compileOnly("mezz.jei:jei-1.20.4-common-api:${project.properties["jei_version"]}") | ||
runtimeOnly("mezz.jei:jei-1.20.4-neoforge:${project.properties["jei_version"]}") | ||
implementation("org.jetbrains:annotations:23.0.0") | ||
testImplementation(sourceSets.main.map { it.output }) | ||
} | ||
|
||
minecraft { | ||
mappings(mappings_channel, mappings_version) | ||
copyIdeResources.set(true) | ||
runs { | ||
create("client") { | ||
workingDirectory(file("run")) | ||
property("forge.logging.console.level", "debug") | ||
mods.register(mod_id) { | ||
source(sourceSets.main.get()) | ||
} | ||
} | ||
create("server") { | ||
workingDirectory(file("run")) | ||
property("forge.logging.console.level", "debug") | ||
mods.register(mod_id) { | ||
source(sourceSets.main.get()) | ||
} | ||
} | ||
create("data") { | ||
workingDirectory(file("run")) | ||
property("forge.logging.console.level", "debug") | ||
args("--mod", mod_id, "--all", "--output", file("src/main/generated/"), "--existing", file("src/main/resources/")) | ||
mods.register(mod_id) { | ||
source(sourceSets.main.get()) | ||
} | ||
} | ||
create("gameTestServer") { | ||
workingDirectory(file("run")) | ||
singleInstance(true) | ||
jvmArg("-ea") // Enable assertions | ||
property("forge.logging.markers", "REGISTRIES") | ||
property("forge.enabledGameTestNamespaces", mod_id) | ||
mods.register(mod_id) { | ||
source(sourceSets.main.get()) | ||
source(sourceSets.test.get()) | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
withType<JavaCompile>().configureEach { | ||
options.encoding = "UTF-8" | ||
} | ||
processResources { | ||
val buildProps = project.properties.toMutableMap() | ||
buildProps.values.removeIf { it !is CharSequence && it !is Number && it !is Boolean } | ||
inputs.properties(buildProps) | ||
|
||
filesMatching("META-INF/mods.toml") { | ||
expand(buildProps) | ||
} | ||
// minify json files | ||
doLast { | ||
fileTree(dir = outputs.files.asPath, include = "**/*.json").forEach { | ||
it.writeText(JsonOutput.toJson(JsonSlurper().parse(it))) | ||
} | ||
} | ||
} | ||
named<Jar>("jar") { | ||
from(sourceSets.main.map { it.output }) | ||
finalizedBy("reobfJar") | ||
} | ||
named<Jar>("sourcesJar") { | ||
duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
from(sourceSets.main.map { it.allSource }) | ||
} | ||
withType<Jar>().configureEach { | ||
var extension = "" | ||
if (archiveClassifier.isPresent) { | ||
extension = archiveClassifier.get() | ||
if (extension != "") { | ||
extension = "-$extension" | ||
} | ||
} | ||
manifest { | ||
attributes(mapOf( | ||
"Maven-Artifact" to "${mod_group}:${base.archivesName}:${project.version}", | ||
"Specification-Title" to base.archivesName, | ||
"Specification-Vendor" to vendor, | ||
"Specification-Version" to "1", | ||
"Implementation-Title" to "${base.archivesName}${extension}", | ||
"Implementation-Version" to mod_version, | ||
"Implementation-Vendor" to vendor, | ||
"Built-On-Java" to "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})", | ||
"Built-On" to "${mc_version}-${forge_version}", | ||
"Timestamp" to DateTimeFormatter.ISO_INSTANT.format(Instant.now()), | ||
"FMLModType" to "MOD" | ||
)) | ||
} | ||
} | ||
register("reobf") { | ||
dependsOn(named("reobfJar")) | ||
} | ||
register("setupGithubActions") { | ||
doLast { | ||
println("##[set-output name=modid;]${mod_id}") | ||
println("##[set-output name=version;]${project.version}") | ||
} | ||
} | ||
withType<GenerateModuleMetadata>().configureEach { | ||
enabled = false | ||
} | ||
} | ||
|
||
artifacts { | ||
archives(tasks.named("jar")) | ||
archives(tasks.named("sourcesJar")) | ||
} | ||
|
||
reobf { | ||
create("jar") { | ||
classpath.from(sourceSets.main.map { it.compileClasspath }) | ||
} | ||
} | ||
|
||
idea.module.excludeDirs.addAll(arrayOf("run", "out", "libs").map(::file)) | ||
|
||
publishing { | ||
publications.create<MavenPublication>("${base.archivesName.get()}ToMaven") { | ||
groupId = project.group as String | ||
artifactId = base.archivesName.get() | ||
version = project.version as String | ||
from(components["java"]) | ||
pom { | ||
name.set(mod_name) | ||
url.set(mod_url) | ||
packaging = "jar" | ||
scm { | ||
connection.set("scm:git:git://github.com/${github}.git") | ||
developerConnection.set("scm:git:[email protected]:${github}.git") | ||
url.set("https://github.com/${github}") | ||
} | ||
issueManagement { | ||
system.set("github") | ||
url.set("https://github.com/${github}/issues") | ||
} | ||
organization { | ||
name.set("Minecraftschurli Mods") | ||
url.set("https://github.com/MinecraftschurliMods") | ||
} | ||
developers { | ||
developer { | ||
id.set("minecraftschurli") | ||
name.set("Minecraftschurli") | ||
url.set("https://github.com/Minecraftschurli") | ||
email.set("[email protected]") | ||
organization.set("Minecraftschurli Mods") | ||
organizationUrl.set("https://github.com/MinecraftschurliMods") | ||
timezone.set("Europe/Vienna") | ||
} | ||
developer { | ||
id.set("ichhabehunger54") | ||
name.set("IchHabeHunger54") | ||
url.set("https://github.com/IchHabeHunger54") | ||
organization.set("Minecraftschurli Mods") | ||
organizationUrl.set("https://github.com/MinecraftschurliMods") | ||
timezone.set("Europe/Vienna") | ||
} | ||
} | ||
withXml { | ||
val rootNode = asNode() | ||
val dependencies: NodeList = (rootNode.get("dependencies") as NodeList) | ||
val dependencyList = dependencies.getAt("dependency") | ||
for (dependency in dependencyList) { | ||
val dependencyNode = dependency as Node | ||
val version = ((((dependencyNode.get("version") as NodeList).last() as Node).value() as NodeList).last() as String) | ||
if (version.contains("_mapped_")) { | ||
assert(dependencyNode.parent().remove(dependencyNode)) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
if ((System.getenv("MAVEN_USER") != null) | ||
&& (System.getenv("MAVEN_PASSWORD") != null) | ||
&& (System.getenv("MAVEN_URL") != null)) { | ||
url = uri(System.getenv("MAVEN_URL")) | ||
credentials { | ||
username = System.getenv("MAVEN_USER") | ||
password = System.getenv("MAVEN_PASSWORD") | ||
} | ||
} else { | ||
url = uri("$buildDir/repo") | ||
} | ||
helper.withTestSourceSet() | ||
helper.withCommonRuns() | ||
helper.withGameTestRuns() | ||
helper.modproperties.put( | ||
"catalogueItemIcon", helper.projectId.map { "$it:potion_bundle{Potion:\"minecraft:water\"}" } | ||
) | ||
helper.dependency( | ||
"jei", | ||
project.properties["jei_version_range"] as String, | ||
"optional" | ||
) | ||
|
||
helper.publication.pom { | ||
organization { | ||
name = "Minecraftschurli Mods" | ||
url = "https://github.com/MinecraftschurliMods" | ||
} | ||
developers { | ||
developer { | ||
id = "minecraftschurli" | ||
name = "Minecraftschurli" | ||
email = "[email protected]" | ||
organization = "Minecraftschurli Mods" | ||
organizationUrl = "https://github.com/Minecraftschurli" | ||
timezone = "Europe/Vienna" | ||
} | ||
developer { | ||
id = "ichhabehunger54" | ||
name = "IchHabeHunger54" | ||
url = "https://github.com/IchHabeHunger54" | ||
organization = "Minecraftschurli Mods" | ||
organizationUrl = "https://github.com/MinecraftschurliMods" | ||
timezone = "Europe/Vienna" | ||
} | ||
} | ||
} |
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,34 +1,38 @@ | ||
org.gradle.jvmargs=-Xmx3G | ||
org.gradle.jvmargs=-Xmx4G | ||
org.gradle.daemon=false | ||
org.gradle.caching=true | ||
|
||
mod_group=com.github.minecraftschurlimods | ||
mod_id=potionbundles | ||
mod_name=Potion Bundles | ||
mod_version=1.8 | ||
mod_url=https://www.curseforge.com/minecraft/mc-mods/potion-bundles | ||
mod_name=Potion Bundles | ||
mod_authors=IchHabeHunger54, Minecraftschurli | ||
mod_description=Potions can now be bound into bundles, to save inventory space. | ||
|
||
url=https://www.curseforge.com/minecraft/mc-mods/potion-bundles | ||
github=MinecraftschurliMods/PotionBundles | ||
|
||
vendor=MinecraftschurliMods | ||
java_version=17 | ||
forgegradle_version=[6.0,6.2) | ||
librarian_version=1.+ | ||
url=https://www.curseforge.com/minecraft/mc-mods/potion-bundles | ||
|
||
github.owner=MinecraftschurliMods | ||
github.repo=PotionBundles | ||
|
||
license.name=GPLv3 | ||
license.url=https://www.gnu.org/licenses/gpl-3.0.en.html | ||
license.file=LICENSE | ||
|
||
loader_version_range=[46,) | ||
neogradle.subsystems.parchment.minecraftVersion=1.20.3 | ||
neogradle.subsystems.parchment.mappingsVersion=2023.12.31 | ||
|
||
mc_version=1.20 | ||
mc_version_range=[1.20,1.20.2) | ||
mc_version=1.20.4 | ||
mc_version_range=[1.20.4,1.20.5) | ||
|
||
forge_version=46.0.1 | ||
forge_version_range=[46.0.1,) | ||
neo_version=20.4.80-beta | ||
neo_version_range=[20.4.80-beta,20.5) | ||
|
||
mappings_version=1.20 | ||
mappings_channel=official | ||
mc-publish.curseforge=382836 | ||
mc-publish.modrinth=ZZLWU8jS | ||
|
||
jei_version=14.0.0.4 | ||
loader.version=[1,) | ||
|
||
curse_project_id=382836 | ||
modrinth_project_id=ZZLWU8jS | ||
jei_version=17.3.0.49 | ||
jei_version_range=[17.3,18) |
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,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.