Start of Fabric Setup

This commit is contained in:
Sebastian Hartte
2020-06-27 15:23:15 +02:00
parent d5eb16a6b0
commit 82af7e6dde
7 changed files with 141 additions and 149 deletions
+2
View File
@@ -0,0 +1,2 @@
archivesBaseName = artifact_basename + '-api'
+89 -119
View File
@@ -16,146 +16,116 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
plugins { plugins {
id "maven-publish"
id "com.diffplug.gradle.spotless" version "4.3.0" id 'java'
id "org.sonarqube" version "2.8" id 'fabric-loom' apply false
id "jacoco" id 'maven-publish'
id "org.jetbrains.kotlin.jvm" apply false
} }
apply plugin: 'net.minecraftforge.gradle' allprojects {
apply plugin: "eclipse" // Maven group and artifact name
group = artifact_group
repositories { // Create version number
mavenLocal() ext.pr = System.getenv('PR_NUMBER') ?: ""
jcenter() if (ext.pr) {
mavenCentral() version = version + "+pr." + ext.pr
}
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'
}
} }
test {
compileClasspath += sourceSets.api.output ext.branch = System.getenv('BRANCH') ?: ""
runtimeClasspath += sourceSets.api.output if (ext.branch) {
java { version = version + "+branch." + ext.branch
exclude '**/*' }
}
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 { subprojects {
apiCompile.extendsFrom(compile)
}
apply from: 'gradle/scripts/dependencies.gradle' apply plugin: 'fabric-loom'
apply from: 'gradle/scripts/spotless.gradle' apply plugin: 'kotlin-platform-jvm'
minecraft { sourceCompatibility = JavaVersion.VERSION_1_8
mappings channel: "snapshot", version: project.mcp_mappings targetCompatibility = JavaVersion.VERSION_1_8
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') minecraft {
}
runs { dependencies {
client { minecraft "com.mojang:minecraft:1.16.1"
property 'forge.logging.console.level', 'debug' mappings "net.fabricmc:yarn:1.16.1+build.9:v2"
workingDirectory project.file('run') modImplementation "net.fabricmc:fabric-loader:0.8.8+build.202"
mods {
appliedenergistics2 { //Fabric api
source sourceSets.main modImplementation "net.fabricmc.fabric-api:fabric-api:0.14.0+build.371-1.16"
source sourceSets.api
} 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' from(sourceSets.main.resources.srcDirs) {
workingDirectory project.file('run') exclude "fabric.mod.json"
mods {
appliedenergistics2 {
source sourceSets.main
source sourceSets.api
}
}
} }
data { }
property 'forge.logging.console.level', 'debug'
workingDirectory project.file('run') // ensure that the encoding is set to UTF-8, no matter what the system default is
args '--mod', 'appliedenergistics2', '--all', '--output', file('src/generated/resources/') // this fixes some edge cases with special characters not displaying correctly
mods { // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
appliedenergistics2 { tasks.withType(JavaCompile) {
source sourceSets.main options.encoding = "UTF-8"
source sourceSets.api }
// 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 { publishing {
publications { // select the repositories you want to publish to
maven(MavenPublication) {
groupId = project.group
artifactId = project.archivesBaseName
version = project.version
from components.java
artifact sourcesJar
artifact javadocJar
artifact apiJar
}
}
repositories { repositories {
maven { maven {
credentials { credentials {
+6
View File
@@ -0,0 +1,6 @@
archivesBaseName = artifact_basename
dependencies {
project(":api")
}
+22 -28
View File
@@ -1,34 +1,28 @@
version_major=0 version=0.0.0
version_minor=0
version_patch=0
artifact_group=appeng artifact_group=appeng
artifact_basename=appliedenergistics2 artifact_basename=appliedenergistics2-fabric
######################################################### kotlin.code.style=official
# Minecraft Versions # org.gradle.jvmargs=-Xmx1G
#########################################################
minecraft_release=1.15
minecraft_version=1.15.2
mcp_mappings=20200613-1.15.1
forge_version=31.2.20
######################################################### # Fabric Properties
# Provided APIs # # Check these on https://modmuss50.me/fabric.html
#########################################################
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
######################################################### minecraft_version=1.16.1
# Deployment # yarn_mappings=1.16.1+build.9
######################################################### loader_version=0.8.8+build.202
website_version=1.15.2
curse_versions=1.15.2
######################################################### #Fabric api
# Gradle # fabric_version=0.14.0+build.371-1.16
#########################################################
# Various tasks like runData will fail when run as daemon loom_version=0.4-SNAPSHOT
org.gradle.daemon=false
# 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
Binary file not shown.
+3 -2
View File
@@ -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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
+19
View File
@@ -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"