From a30d13458c1269ca9ebf90690250476283a4324d Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Thu, 13 Feb 2020 16:57:33 +0100 Subject: [PATCH] Turn project into multiple project structure (separate test and base) --- build.gradle | 154 +++++++----------- foml-mod/build.gradle | 73 +++++++++ .../src}/main/java/nerdhub/foml/FOML.java | 0 .../java/nerdhub/foml/obj/ItemOBJLoader.java | 0 .../java/nerdhub/foml/obj/OBJBuilder.java | 0 .../main/java/nerdhub/foml/obj/OBJLoader.java | 0 .../nerdhub/foml/obj/baked/OBJBakedModel.java | 0 .../foml/obj/baked/OBJUnbakedModel.java | 0 .../src}/main/resources/assets/foml/icon.png | Bin .../src}/main/resources/fabric.mod.json | 0 foml-test/build.gradle | 5 + .../main}/java/nerdhub/fomltest/FOMLTest.java | 0 .../assets/fomltest/blockstates/test.json | 0 .../assets/fomltest/models/block/brick.mtl | 0 .../assets/fomltest/models/block/brick.obj | 0 .../fomltest/textures/blocks/anvil_base.png | Bin .../assets/fomltest/textures/blocks/brick.png | Bin .../assets/fomltest/textures/blocks/test.png | Bin .../src/main}/resources/fabric.mod.json | 0 settings.gradle | 4 + 20 files changed, 142 insertions(+), 94 deletions(-) create mode 100644 foml-mod/build.gradle rename {src => foml-mod/src}/main/java/nerdhub/foml/FOML.java (100%) rename {src => foml-mod/src}/main/java/nerdhub/foml/obj/ItemOBJLoader.java (100%) rename {src => foml-mod/src}/main/java/nerdhub/foml/obj/OBJBuilder.java (100%) rename {src => foml-mod/src}/main/java/nerdhub/foml/obj/OBJLoader.java (100%) rename {src => foml-mod/src}/main/java/nerdhub/foml/obj/baked/OBJBakedModel.java (100%) rename {src => foml-mod/src}/main/java/nerdhub/foml/obj/baked/OBJUnbakedModel.java (100%) rename {src => foml-mod/src}/main/resources/assets/foml/icon.png (100%) rename {src => foml-mod/src}/main/resources/fabric.mod.json (100%) create mode 100644 foml-test/build.gradle rename {src/test => foml-test/src/main}/java/nerdhub/fomltest/FOMLTest.java (100%) rename {src/test => foml-test/src/main}/resources/assets/fomltest/blockstates/test.json (100%) rename {src/test => foml-test/src/main}/resources/assets/fomltest/models/block/brick.mtl (100%) rename {src/test => foml-test/src/main}/resources/assets/fomltest/models/block/brick.obj (100%) rename {src/test => foml-test/src/main}/resources/assets/fomltest/textures/blocks/anvil_base.png (100%) rename {src/test => foml-test/src/main}/resources/assets/fomltest/textures/blocks/brick.png (100%) rename {src/test => foml-test/src/main}/resources/assets/fomltest/textures/blocks/test.png (100%) rename {src/test => foml-test/src/main}/resources/fabric.mod.json (100%) diff --git a/build.gradle b/build.gradle index b81fa1a..84c4f3a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,96 +1,62 @@ plugins { - id 'fabric-loom' version '0.2.6-SNAPSHOT' - id 'maven-publish' + id 'fabric-loom' version '0.2.6-SNAPSHOT' apply false +} + +allprojects { + apply plugin: 'fabric-loom' + + // Java + java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } + + // Project + group = project.mod_group + archivesBaseName = project.mod_name + version = project.mod_version + + // Dependencies + dependencies { + minecraft "com.mojang:minecraft:${mc_version}" + mappings "net.fabricmc:yarn:${yarn_mappings}" + modCompile "net.fabricmc:fabric-loader:${loader_version}" + modCompile "net.fabricmc.fabric-api:fabric-api:${fabric_version}" + } +} + +subprojects { + afterEvaluate { + jar { + from "LICENSE.md" + manifest { + attributes([ + "Implementation-Title": project.name, + "Implementation-Version": project.version, + "Maven-Artifact": "${project.group}:${project.archivesBaseName}:${project.version}".toLowerCase(Locale.ROOT), + "Built-On-Minecraft": "${mc_version}", + "Built-On-Java": "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})" + ]) + } + } + + // Resource processing + processResources { + inputs.property 'archivesBaseName', project.archivesBaseName + inputs.property 'version', project.version + + from(sourceSets.main.resources.srcDirs) { + include 'fabric.mod.json' + expand 'modid': project.archivesBaseName, + 'version': project.version + } + + from(sourceSets.main.resources.srcDirs) { + exclude 'fabric.mod.json' + } + } + } } - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -group = project.mod_group -archivesBaseName = project.mod_name -version = project.mod_version -minecraft { -} - -repositories { - jcenter() - maven { url = "https://oss.sonatype.org/content/repositories/releases/" } -} - -dependencies { - minecraft "com.mojang:minecraft:${mc_version}" - mappings "net.fabricmc:yarn:${yarn_mappings}" - modCompile "net.fabricmc:fabric-loader:${loader_version}" - modCompile "net.fabricmc.fabric-api:fabric-api:${fabric_version}" - modCompile "de.javagl:obj:${javagl_version}" - include "de.javagl:obj:${javagl_version}" -} - -jar { - from "LICENSE.md" - manifest.mainAttributes( - "Implementation-Title": project.name, - "Implementation-Version": project.version, - "Maven-Artifact": "${project.group}:${project.archivesBaseName}:${project.version}".toLowerCase(Locale.ROOT), - "Built-On-Minecraft": "${mc_version}", - "Built-On-Java": "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})" - ) -} - -task sourcesJar(type: Jar, dependsOn: classes) { - from sourceSets.main.allSource - classifier = 'sources' -} - -artifacts { - archives sourcesJar -} - -publishing { - publications { - mavenJava(MavenPublication) { - afterEvaluate { - artifact(remapJar) { - builtBy remapJar - } - } - artifact sourcesJar - pom { - name = "FOML" - url = "https://github.com/NerdHubMC/FOML" - licenses { - license { - name = "MIT License" - url = "https://github.com/NerdHubMC/FOML/blob/master/LICENSE.md" - } - } - scm { - url = "https://github.com/NerdHubMC/FOML" - connection = "scm:git:git://github.com/NerdHubMC/FOML.git" - developerConnection = "scm:git:git@github.com:NerdHubMC/FOML.git" - } - issueManagement { - system = "github" - url = "https://github.com/NerdHubMC/FOML/issues" - } - } - } - } - - repositories { - if (project.hasProperty("maven_user") && project.hasProperty("maven_pass")) { - maven { - name = "Abused's Maven" - url = findProperty("maven_url") - credentials { - username = findProperty("maven_user") - password = findProperty("maven_pass") - } - authentication { - basic(BasicAuthentication) - } - } - } - } -} -tasks.publish.dependsOn build diff --git a/foml-mod/build.gradle b/foml-mod/build.gradle new file mode 100644 index 0000000..5af2bc5 --- /dev/null +++ b/foml-mod/build.gradle @@ -0,0 +1,73 @@ +plugins { + id 'maven-publish' +} + +repositories { + jcenter() + maven { url = "https://oss.sonatype.org/content/repositories/releases/" } +} + +dependencies { + modCompile "de.javagl:obj:${javagl_version}" + include "de.javagl:obj:${javagl_version}" +} + +task sourcesJar(type: Jar, dependsOn: classes) { + from sourceSets.main.allSource + classifier = 'sources' +} + +artifacts { + archives sourcesJar +} + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'FOML' + + afterEvaluate { + artifact(remapJar) { + builtBy remapJar + } + } + artifact sourcesJar + pom { + name = "FOML" + url = "https://github.com/NerdHubMC/FOML" + licenses { + license { + name = "MIT License" + url = "https://github.com/NerdHubMC/FOML/blob/master/LICENSE.md" + } + } + scm { + url = "https://github.com/NerdHubMC/FOML" + connection = "scm:git:git://github.com/NerdHubMC/FOML.git" + developerConnection = "scm:git:git@github.com:NerdHubMC/FOML.git" + } + issueManagement { + system = "github" + url = "https://github.com/NerdHubMC/FOML/issues" + } + } + } + } + + repositories { + if (project.hasProperty("maven_user") && project.hasProperty("maven_pass")) { + maven { + name = "Abused's Maven" + url = findProperty("maven_url") + credentials { + username = findProperty("maven_user") + password = findProperty("maven_pass") + } + authentication { + basic(BasicAuthentication) + } + } + } + } +} +tasks.publish.dependsOn build diff --git a/src/main/java/nerdhub/foml/FOML.java b/foml-mod/src/main/java/nerdhub/foml/FOML.java similarity index 100% rename from src/main/java/nerdhub/foml/FOML.java rename to foml-mod/src/main/java/nerdhub/foml/FOML.java diff --git a/src/main/java/nerdhub/foml/obj/ItemOBJLoader.java b/foml-mod/src/main/java/nerdhub/foml/obj/ItemOBJLoader.java similarity index 100% rename from src/main/java/nerdhub/foml/obj/ItemOBJLoader.java rename to foml-mod/src/main/java/nerdhub/foml/obj/ItemOBJLoader.java diff --git a/src/main/java/nerdhub/foml/obj/OBJBuilder.java b/foml-mod/src/main/java/nerdhub/foml/obj/OBJBuilder.java similarity index 100% rename from src/main/java/nerdhub/foml/obj/OBJBuilder.java rename to foml-mod/src/main/java/nerdhub/foml/obj/OBJBuilder.java diff --git a/src/main/java/nerdhub/foml/obj/OBJLoader.java b/foml-mod/src/main/java/nerdhub/foml/obj/OBJLoader.java similarity index 100% rename from src/main/java/nerdhub/foml/obj/OBJLoader.java rename to foml-mod/src/main/java/nerdhub/foml/obj/OBJLoader.java diff --git a/src/main/java/nerdhub/foml/obj/baked/OBJBakedModel.java b/foml-mod/src/main/java/nerdhub/foml/obj/baked/OBJBakedModel.java similarity index 100% rename from src/main/java/nerdhub/foml/obj/baked/OBJBakedModel.java rename to foml-mod/src/main/java/nerdhub/foml/obj/baked/OBJBakedModel.java diff --git a/src/main/java/nerdhub/foml/obj/baked/OBJUnbakedModel.java b/foml-mod/src/main/java/nerdhub/foml/obj/baked/OBJUnbakedModel.java similarity index 100% rename from src/main/java/nerdhub/foml/obj/baked/OBJUnbakedModel.java rename to foml-mod/src/main/java/nerdhub/foml/obj/baked/OBJUnbakedModel.java diff --git a/src/main/resources/assets/foml/icon.png b/foml-mod/src/main/resources/assets/foml/icon.png similarity index 100% rename from src/main/resources/assets/foml/icon.png rename to foml-mod/src/main/resources/assets/foml/icon.png diff --git a/src/main/resources/fabric.mod.json b/foml-mod/src/main/resources/fabric.mod.json similarity index 100% rename from src/main/resources/fabric.mod.json rename to foml-mod/src/main/resources/fabric.mod.json diff --git a/foml-test/build.gradle b/foml-test/build.gradle new file mode 100644 index 0000000..ce79b89 --- /dev/null +++ b/foml-test/build.gradle @@ -0,0 +1,5 @@ +archivesBaseName = project.mod_name + '-test' + +dependencies { + compile project(':foml-mod') +} diff --git a/src/test/java/nerdhub/fomltest/FOMLTest.java b/foml-test/src/main/java/nerdhub/fomltest/FOMLTest.java similarity index 100% rename from src/test/java/nerdhub/fomltest/FOMLTest.java rename to foml-test/src/main/java/nerdhub/fomltest/FOMLTest.java diff --git a/src/test/resources/assets/fomltest/blockstates/test.json b/foml-test/src/main/resources/assets/fomltest/blockstates/test.json similarity index 100% rename from src/test/resources/assets/fomltest/blockstates/test.json rename to foml-test/src/main/resources/assets/fomltest/blockstates/test.json diff --git a/src/test/resources/assets/fomltest/models/block/brick.mtl b/foml-test/src/main/resources/assets/fomltest/models/block/brick.mtl similarity index 100% rename from src/test/resources/assets/fomltest/models/block/brick.mtl rename to foml-test/src/main/resources/assets/fomltest/models/block/brick.mtl diff --git a/src/test/resources/assets/fomltest/models/block/brick.obj b/foml-test/src/main/resources/assets/fomltest/models/block/brick.obj similarity index 100% rename from src/test/resources/assets/fomltest/models/block/brick.obj rename to foml-test/src/main/resources/assets/fomltest/models/block/brick.obj diff --git a/src/test/resources/assets/fomltest/textures/blocks/anvil_base.png b/foml-test/src/main/resources/assets/fomltest/textures/blocks/anvil_base.png similarity index 100% rename from src/test/resources/assets/fomltest/textures/blocks/anvil_base.png rename to foml-test/src/main/resources/assets/fomltest/textures/blocks/anvil_base.png diff --git a/src/test/resources/assets/fomltest/textures/blocks/brick.png b/foml-test/src/main/resources/assets/fomltest/textures/blocks/brick.png similarity index 100% rename from src/test/resources/assets/fomltest/textures/blocks/brick.png rename to foml-test/src/main/resources/assets/fomltest/textures/blocks/brick.png diff --git a/src/test/resources/assets/fomltest/textures/blocks/test.png b/foml-test/src/main/resources/assets/fomltest/textures/blocks/test.png similarity index 100% rename from src/test/resources/assets/fomltest/textures/blocks/test.png rename to foml-test/src/main/resources/assets/fomltest/textures/blocks/test.png diff --git a/src/test/resources/fabric.mod.json b/foml-test/src/main/resources/fabric.mod.json similarity index 100% rename from src/test/resources/fabric.mod.json rename to foml-test/src/main/resources/fabric.mod.json diff --git a/settings.gradle b/settings.gradle index 5b60df3..408ccc6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,3 +8,7 @@ pluginManagement { gradlePluginPortal() } } + +rootProject.name = 'foml-root' + +include 'foml-mod', 'foml-test'