Skip to content

Commit

Permalink
Merge pull request #6 from ArisuOngaku/test-mod-separation
Browse files Browse the repository at this point in the history
Turn project into multiple project structure (separate test and base)
  • Loading branch information
ashpieboop authored Feb 15, 2020
2 parents 53bd1d5 + a30d134 commit c0e1b3f
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 94 deletions.
154 changes: 60 additions & 94 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions foml-mod/build.gradle
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes
File renamed without changes.
5 changes: 5 additions & 0 deletions foml-test/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
archivesBaseName = project.mod_name + '-test'

dependencies {
compile project(':foml-mod')
}
File renamed without changes.
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ pluginManagement {
gradlePluginPortal()
}
}

rootProject.name = 'foml-root'

include 'foml-mod', 'foml-test'

0 comments on commit c0e1b3f

Please sign in to comment.