Skip to content

Commit

Permalink
fix: beta 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed Oct 26, 2023
1 parent aa1ef3d commit 40026b8
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 16 deletions.
20 changes: 8 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "com.github.breadmoirai.github-release" version "2.4.1"
id "maven-publish"
}

if (System.getenv("GITHUB_TOKEN") != null) {
Expand Down Expand Up @@ -73,17 +74,12 @@ allprojects {
java {
withSourcesJar()
}
}

processResources {
filesMatching(["pack.mcmeta", "fabric.mod.json", "mods.toml", "*.mixins.json", "quilt.mod.json"]) {
expand project.properties
}
}

tasks.publish {
dependsOn("githubRelease")
dependsOn("fabric:publishUnified")
dependsOn("quilt:publishUnified")
dependsOn("forge:publishUnified")
}
tasks.publish {
dependsOn(":githubRelease")
dependsOn(":publishAllPublicationsToMavenRepository")
dependsOn("fabric:publishUnified")
dependsOn("quilt:publishUnified")
dependsOn("forge:publishUnified")
}
21 changes: 21 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,24 @@ dependencies {
annotationProcessor libs.mixin.extras.common
api libs.jankson
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archivesBaseName
from components.java
}
}

repositories {
if (System.getenv("MAVEN_USERNAME") != null && System.getenv("MAVEN_PASSWORD") != null) {
maven {
url = "https://maven.jamalam.tech/releases"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public ConfigManager(String modId, String configName, Class<T> configClass) {
this.modId = modId;
this.configClass = configClass;

this.validateConfigClass();

if (!Files.exists(this.configPath)) {
this.config = this.createDefaultConfig();
this.save();
Expand Down Expand Up @@ -136,6 +138,20 @@ public void reloadFromDisk() {
}
}

private void validateConfigClass() {
T defaultConfig = this.createDefaultConfig();

try {
for (Field field : this.configClass.getFields()) {
if (field.get(defaultConfig) == null) {
throw new IllegalArgumentException("Config field " + field.getName() + " is null by default. Config fields cannot be null by default.");
}
}
} catch (Exception e) {
JamLib.LOGGER.error("Failed to validate config class " + this.configClass.getName(), e);
}
}

private T createDefaultConfig() {
try {
return this.configClass.getConstructor().newInstance();
Expand Down
29 changes: 29 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,35 @@ if (System.getenv("CURSEFORGE_API_KEY") != null && System.getenv("MODRINTH_API_K
// }
}

publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archivesBaseName + "-fabric"
from components.java
}
}

repositories {
if (System.getenv("MAVEN_USERNAME") != null && System.getenv("MAVEN_PASSWORD") != null) {
maven {
url = "https://maven.jamalam.tech/releases"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}

processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version
}

inputs.property "version", project.version
}

shadowJar {
exclude "architectury.common.json"

Expand Down
21 changes: 21 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ if (System.getenv("CURSEFORGE_API_KEY") != null && System.getenv("MODRINTH_API_K
// }
}

publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archivesBaseName + "-forge"
from components.java
}
}

repositories {
if (System.getenv("MAVEN_USERNAME") != null && System.getenv("MAVEN_PASSWORD") != null) {
maven {
url = "https://maven.jamalam.tech/releases"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
Expand Down
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.parallel=true
version=1.0.0
version=1.0.0-beta.2
minecraft_version=1.20.2
branch=1.20.2
group=io.github.jamalam360.jamlib
group=io.github.jamalam360
mod_name=JamLib
mod_id=jamlib
# architectury boilerplate
enabled_platforms=fabric,forge,quilt
2 changes: 1 addition & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mixin-extras = "0.2.0"
architectury = "10.0.8"

# https://files.minecraftforge.net/net/minecraftforge/forge/
forge = "1.20.2-48.0.31"
forge = "1.20.2-48.0.33"

# https://fabricmc.net/develop
fabric-loader = "0.14.23"
Expand Down
29 changes: 29 additions & 0 deletions quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,35 @@ if (System.getenv("CURSEFORGE_API_KEY") != null && System.getenv("MODRINTH_API_K
// }
}

publishing {
publications {
mavenQuilt(MavenPublication) {
artifactId = rootProject.archivesBaseName + "-quilt"
from components.java
}
}

repositories {
if (System.getenv("MAVEN_USERNAME") != null && System.getenv("MAVEN_PASSWORD") != null) {
maven {
url = "https://maven.jamalam.tech/releases"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}

processResources {
filesMatching("quilt.mod.json") {
expand "version": project.version
}

inputs.property "version", project.version
}

shadowJar {
exclude "architectury.common.json"

Expand Down

0 comments on commit 40026b8

Please sign in to comment.