diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 000000000..18b811c78 --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,2 @@ + +archivesBaseName = artifact_basename + '-api' diff --git a/build.gradle b/build.gradle index 2a83f8868..4060ee6eb 100644 --- a/build.gradle +++ b/build.gradle @@ -16,146 +16,116 @@ * along with Applied Energistics 2. If not, see . */ -buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true - } -} - plugins { - id "maven-publish" - id "com.diffplug.gradle.spotless" version "4.3.0" - id "org.sonarqube" version "2.8" - id "jacoco" + + id 'java' + id 'fabric-loom' apply false + id 'maven-publish' + id "org.jetbrains.kotlin.jvm" apply false } -apply plugin: 'net.minecraftforge.gradle' -apply plugin: "eclipse" +allprojects { + // Maven group and artifact name + group = artifact_group -repositories { - mavenLocal() - jcenter() - mavenCentral() -} - -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 -compileJava { - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 -} - -// ensure everything uses UTF-8 and not some random codepage chosen by gradle -compileJava.options.encoding = 'UTF-8' -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -// Create version number -version = version_major + "." + version_minor + "." + version_patch - -ext.pr = System.getenv('PR_NUMBER') ?: "" -if (ext.pr) { - version = version + "+pr." + ext.pr -} - -ext.branch = System.getenv('BRANCH') ?: "" -if (ext.branch) { - version = version + "+branch." + ext.branch -} - -ext.release = System.getenv('RELEASE') ?: "" -if (ext.release) { - version = ext.release.substring(1) -} - - -// Maven group and artifact name -group = artifact_group -archivesBaseName = artifact_basename - -sourceSets { - api - main { - compileClasspath += sourceSets.api.output - runtimeClasspath += sourceSets.api.output - resources { - srcDir 'src/generated/resources' - } + // Create version number + ext.pr = System.getenv('PR_NUMBER') ?: "" + if (ext.pr) { + version = version + "+pr." + ext.pr } - test { - compileClasspath += sourceSets.api.output - runtimeClasspath += sourceSets.api.output - java { - exclude '**/*' - } + + ext.branch = System.getenv('BRANCH') ?: "" + if (ext.branch) { + version = version + "+branch." + ext.branch + } + + ext.release = System.getenv('RELEASE') ?: "" + if (ext.release) { + version = ext.release.substring(1) + } + + // Avoid build-directories for each subproject + setBuildDir(rootProject.getBuildDir()) + + repositories { + maven { url = "http://maven.fabricmc.net/" } } } -configurations { - apiCompile.extendsFrom(compile) -} +subprojects { -apply from: 'gradle/scripts/dependencies.gradle' -apply from: 'gradle/scripts/spotless.gradle' + apply plugin: 'fabric-loom' + apply plugin: 'kotlin-platform-jvm' -minecraft { - mappings channel: "snapshot", version: project.mcp_mappings + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + minecraft { + } - runs { - client { - property 'forge.logging.console.level', 'debug' - workingDirectory project.file('run') - mods { - appliedenergistics2 { - source sourceSets.main - source sourceSets.api - } - } + dependencies { + minecraft "com.mojang:minecraft:1.16.1" + mappings "net.fabricmc:yarn:1.16.1+build.9:v2" + modImplementation "net.fabricmc:fabric-loader:0.8.8+build.202" + + //Fabric api + modImplementation "net.fabricmc.fabric-api:fabric-api:0.14.0+build.371-1.16" + + modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}" + } + + processResources { + inputs.property "version", project.version + + from(sourceSets.main.resources.srcDirs) { + include "fabric.mod.json" + expand "version": project.version } - server { - property 'forge.logging.console.level', 'debug' - workingDirectory project.file('run') - mods { - appliedenergistics2 { - source sourceSets.main - source sourceSets.api - } - } + + from(sourceSets.main.resources.srcDirs) { + exclude "fabric.mod.json" } - data { - property 'forge.logging.console.level', 'debug' - workingDirectory project.file('run') - args '--mod', 'appliedenergistics2', '--all', '--output', file('src/generated/resources/') - mods { - appliedenergistics2 { - source sourceSets.main - source sourceSets.api + } + + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + tasks.withType(JavaCompile) { + options.encoding = "UTF-8" + } + + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this task, sources will not be generated. + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = "sources" + from sourceSets.main.allSource + } + + jar { + from "LICENSE" + } + + compileKotlin.kotlinOptions.jvmTarget = "1.8" + + publishing { + publications { + mavenJava(MavenPublication) { + // add all the jars that should be included when publishing to maven + artifact(remapJar) { + builtBy remapJar + } + artifact(sourcesJar) { + builtBy remapSourcesJar } } } } } -apply from: 'gradle/scripts/artifacts.gradle' - +// configure the maven publication publishing { - publications { - maven(MavenPublication) { - groupId = project.group - artifactId = project.archivesBaseName - version = project.version - from components.java - artifact sourcesJar - artifact javadocJar - artifact apiJar - } - } + // select the repositories you want to publish to repositories { maven { credentials { diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 000000000..03cb6fb63 --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,6 @@ + +archivesBaseName = artifact_basename + +dependencies { + project(":api") +} diff --git a/gradle.properties b/gradle.properties index aee000602..33cdc4fc7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,34 +1,28 @@ -version_major=0 -version_minor=0 -version_patch=0 +version=0.0.0 artifact_group=appeng -artifact_basename=appliedenergistics2 +artifact_basename=appliedenergistics2-fabric -######################################################### -# Minecraft Versions # -######################################################### -minecraft_release=1.15 -minecraft_version=1.15.2 -mcp_mappings=20200613-1.15.1 -forge_version=31.2.20 +kotlin.code.style=official +org.gradle.jvmargs=-Xmx1G -######################################################### -# Provided APIs # -######################################################### -jei_version=6.0.0.4 -top_version=2.0.4-5 -hwyla_version=1.10.8-B72_1.15.2 -ctm_version=MC1.15.2-1.1.0.9 +# Fabric Properties +# Check these on https://modmuss50.me/fabric.html -######################################################### -# Deployment # -######################################################### -website_version=1.15.2 -curse_versions=1.15.2 +minecraft_version=1.16.1 +yarn_mappings=1.16.1+build.9 +loader_version=0.8.8+build.202 -######################################################### -# Gradle # -######################################################### -# Various tasks like runData will fail when run as daemon -org.gradle.daemon=false +#Fabric api +fabric_version=0.14.0+build.371-1.16 + +loom_version=0.4-SNAPSHOT + +# Mod Properties +mod_version = 1.0.0 +maven_group = net.fabricmc +archives_base_name = fabric-example-mod + +# Kotlin +kotlin_version=1.3.61 +fabric_kotlin_version=1.3.61+build.1 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1948b9074..deedc7fa5 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a95009c3b..b24234d47 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sat Jul 27 10:29:07 IDT 2019 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..3176f2316 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,19 @@ +pluginManagement { + repositories { + jcenter() + maven { + name = "Fabric" + url = "https://maven.fabricmc.net/" + } + gradlePluginPortal() + } + + plugins { + id "fabric-loom" version loom_version + id "org.jetbrains.kotlin.jvm" version kotlin_version + } + +} + +include "api" +include "core"