Browse Source

Use a simpler gradle setup

master
Martmists 10 months ago
parent
commit
fd8c8fd17a
14 changed files with 87 additions and 190 deletions
  1. +73
    -6
      build.gradle
  2. +0
    -47
      compat/1.16/build.gradle
  3. +0
    -5
      compat/1.16/gradle.properties
  4. +0
    -10
      compat/1.16/src/main/java/spinnery/common/BaseContainer.java
  5. +0
    -12
      compat/1.16/src/main/java/spinnery/common/BaseContainerScreen.java
  6. +8
    -1
      gradle.properties
  7. +0
    -4
      settings.gradle
  8. +5
    -2
      src/main/resources/data/ynet/recipes/cable.json
  9. +1
    -1
      src/main/resources/data/ynet/recipes/connector.json
  10. +0
    -1
      versions/1.15.2/build.gradle
  11. +0
    -6
      versions/1.15.2/gradle.properties
  12. +0
    -1
      versions/1.16/build.gradle
  13. +0
    -6
      versions/1.16/gradle.properties
  14. +0
    -88
      versions/common.gradle

+ 73
- 6
build.gradle View File

@@ -11,16 +11,83 @@ buildscript {
}
}

apply plugin: "idea"
apply plugin: 'fabric-loom'
apply plugin: 'java'
apply plugin: 'idea'

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "${project.mod_name}-${project.mod_version}-${project.minecraft_version}"
String root = "."

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompileOnly "TechReborn:${project.tr_slug}"
modImplementation "com.github.vini2003:spinnery:${project.spinnery_version}"
include "com.github.vini2003:spinnery:${project.spinnery_version}"
}

repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
name = "TechReborn"
url = "https://maven.fabricmc.net/"
}
maven {
name = "Spinnery"
url "https://dl.bintray.com/spinnery/Spinnery"
}
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

sourceSets {
main {
java {
srcDirs = ["${root}/src/main/java"]
exclude "**/compat/**/*.java"
}
resources {
srcDirs = ["${root}/src/main/resources"]
}
}
}

jar {
from "LICENSE"
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}

task apiJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("api")
from sourceSets.main.allSource.filter { it.path.contains("/api/") }
}

task deleteDev(type: Delete) {
delete "${root}/build/libs/${archivesBaseName}-dev.jar"
delete "${root}/build/libs/${archivesBaseName}-sources-dev.jar"
}

jar.dependsOn apiJar
jar.dependsOn sourcesJar
deleteDev.dependsOn remapJar
deleteDev.dependsOn remapSourcesJar
build.dependsOn jar
build.dependsOn deleteDev

+ 0
- 47
compat/1.16/build.gradle View File

@@ -1,47 +0,0 @@
buildscript {
dependencies {
classpath "net.fabricmc:fabric-loom:0.2.7-SNAPSHOT"
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
}
}

apply plugin: 'fabric-loom'
apply plugin: "idea"

sourceSets {
main {
java {
srcDirs = ["src/main/java"]
}
}
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "com.github.vini2003:spinnery:${project.spinnery_version}"
include "com.github.vini2003:spinnery:${project.spinnery_version}"
}

repositories {
maven {
name = "Spinnery"
url "https://dl.bintray.com/spinnery/Spinnery"
}
mavenCentral()
maven {
url 'https://jitpack.io'
}
}

setBuildDir("../../build")
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "internal-compat-${project.name}"

+ 0
- 5
compat/1.16/gradle.properties View File

@@ -1,5 +0,0 @@
minecraft_version=20w11a
yarn_mappings=20w11a+build.6
loader_version=0.7.8+build.187
fabric_version=0.5.3+build.308-1.16
spinnery_version=2.0.19+fabric-20w11a

+ 0
- 10
compat/1.16/src/main/java/spinnery/common/BaseContainer.java View File

@@ -1,10 +0,0 @@
package spinnery.common;

import net.minecraft.entity.player.PlayerInventory;
import spinnery.common.BaseScreenHandler;

public class BaseContainer extends BaseScreenHandler {
public BaseContainer(int synchronizationID, PlayerInventory linkedPlayerInventory) {
super(synchronizationID, linkedPlayerInventory);
}
}

+ 0
- 12
compat/1.16/src/main/java/spinnery/common/BaseContainerScreen.java View File

@@ -1,12 +0,0 @@
package spinnery.common;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;
import spinnery.common.BaseContainer;
import spinnery.common.BaseHandledScreen;

public class BaseContainerScreen<T extends BaseContainer> extends BaseHandledScreen<T> {
public BaseContainerScreen(Text name, T linkedContainer, PlayerEntity player) {
super(name, linkedContainer, player);
}
}

+ 8
- 1
gradle.properties View File

@@ -1,4 +1,11 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
mod_version=0.1.2
mod_name=ynet
mod_name=ynet

minecraft_version=1.15.2
yarn_mappings=1.15.2+build.14
loader_version=0.7.8+build.184
fabric_version=0.4.32+build.292-1.15
tr_slug=TechReborn-1.15:3.3.4+build.193
spinnery_version=2.0.19+fabric-1.15.2

+ 0
- 4
settings.gradle View File

@@ -1,5 +1 @@
include ":versions:1.15.2"
include ":versions:1.16"
include ":compat:1.16"

rootProject.name = 'ynet'

+ 5
- 2
src/main/resources/data/ynet/recipes/cable.json View File

@@ -2,7 +2,7 @@
"type": "crafting_shaped",
"pattern": [
"SSS",
"SRS",
"IRI",
"SSS"
],
"key": {
@@ -11,10 +11,13 @@
},
"R": {
"item": "minecraft:redstone_block"
},
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "ynet:cable",
"count": 64
"count": 12
}
}

+ 1
- 1
src/main/resources/data/ynet/recipes/connector.json View File

@@ -18,6 +18,6 @@
},
"result": {
"item": "ynet:connector",
"count": 8
"count": 1
}
}

+ 0
- 1
versions/1.15.2/build.gradle View File

@@ -1 +0,0 @@
apply from: '../common.gradle'

+ 0
- 6
versions/1.15.2/gradle.properties View File

@@ -1,6 +0,0 @@
minecraft_version=1.15.2
yarn_mappings=1.15.2+build.14
loader_version=0.7.8+build.184
fabric_version=0.4.32+build.292-1.15
tr_slug=TechReborn-1.15:3.3.4+build.193
spinnery_version=2.0.19+fabric-1.15.2

+ 0
- 1
versions/1.16/build.gradle View File

@@ -1 +0,0 @@
apply from: '../common.gradle'

+ 0
- 6
versions/1.16/gradle.properties View File

@@ -1,6 +0,0 @@
minecraft_version=20w11a
yarn_mappings=20w11a+build.6
loader_version=0.7.8+build.187
fabric_version=0.5.3+build.308-1.16
tr_slug=TechReborn-1.16:3.3.3+build.3
spinnery_version=2.0.19+fabric-20w11a

+ 0
- 88
versions/common.gradle View File

@@ -1,88 +0,0 @@
apply plugin: 'fabric-loom'
apply plugin: 'java'
apply plugin: 'idea'

sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "${project.mod_name}-${project.mod_version}-${project.minecraft_version}"
String root = rootDir.absolutePath

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompileOnly "TechReborn:${project.tr_slug}"

if (project.name == "1.16") {
implementation project(":compat:${project.name}")
include project(":compat:${project.name}")
}

modImplementation "com.github.vini2003:spinnery:${project.spinnery_version}"
include "com.github.vini2003:spinnery:${project.spinnery_version}"
}

repositories {
maven {
name = "TechReborn"
url = "https://maven.fabricmc.net/"
}
maven {
name = "Spinnery"
url "https://dl.bintray.com/spinnery/Spinnery"
}
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

setBuildDir("../../build")

sourceSets {
main {
java {
srcDirs = ["${root}/src/main/java"]
exclude "**/compat/**/*.java"
}
resources {
srcDirs = ["${root}/src/main/resources"]
}
}
}

jar {
from "LICENSE"
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}

task apiJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("api")
from sourceSets.main.allSource.filter { it.path.contains("/api/") }
}

task deleteDev(type: Delete) {
delete "${root}/build/libs/${archivesBaseName}-dev.jar"
delete "${root}/build/libs/${archivesBaseName}-sources-dev.jar"
}

jar.dependsOn apiJar
jar.dependsOn sourcesJar
deleteDev.dependsOn remapJar
deleteDev.dependsOn remapSourcesJar
build.dependsOn jar
build.dependsOn deleteDev

Loading…
Cancel
Save