From 0228787568fda2bb5b5dd9e89d84e1453320bea0 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Mon, 27 Feb 2023 00:13:09 +0100 Subject: [PATCH 1/3] Add Pagination project Signed-off-by: Quentin Legot --- Database/build.gradle | 7 ------- Pagination/build.gradle | 0 Pagination/src/main/java/fr/altarik/toolbox/Main.java | 7 +++++++ Tasks/build.gradle | 8 -------- build.gradle | 7 +++++++ settings.gradle | 3 ++- 6 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 Pagination/build.gradle create mode 100644 Pagination/src/main/java/fr/altarik/toolbox/Main.java diff --git a/Database/build.gradle b/Database/build.gradle index 27285c6..87ae4db 100644 --- a/Database/build.gradle +++ b/Database/build.gradle @@ -1,11 +1,4 @@ dependencies { implementation 'org.postgresql:postgresql:42.5.0' testImplementation 'com.google.code.gson:gson:2.10' - testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}" } - -test { - useJUnitPlatform() -} - diff --git a/Pagination/build.gradle b/Pagination/build.gradle new file mode 100644 index 0000000..e69de29 diff --git a/Pagination/src/main/java/fr/altarik/toolbox/Main.java b/Pagination/src/main/java/fr/altarik/toolbox/Main.java new file mode 100644 index 0000000..88dbeed --- /dev/null +++ b/Pagination/src/main/java/fr/altarik/toolbox/Main.java @@ -0,0 +1,7 @@ +package fr.altarik.toolbox; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/Tasks/build.gradle b/Tasks/build.gradle index 590944e..1bb2636 100644 --- a/Tasks/build.gradle +++ b/Tasks/build.gradle @@ -9,9 +9,6 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - - testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}" } processResources { @@ -37,8 +34,3 @@ tasks.withType(JavaCompile).configureEach { it.options.release = targetVersion } } - - -test { - useJUnitPlatform() -} diff --git a/build.gradle b/build.gradle index f860cd0..873f6f6 100644 --- a/build.gradle +++ b/build.gradle @@ -27,12 +27,19 @@ subprojects { } } + dependencies { + testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}" + } java { withSourcesJar() withJavadocJar() } + test { + useJUnitPlatform() + } repositories { maven { diff --git a/settings.gradle b/settings.gradle index ea6151c..14dcabe 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,4 +10,5 @@ pluginManagement { } rootProject.name = 'Toolbox' -include(':Tasks', ':Database') +include(':Tasks', ':Database', ':Pagination') + From 5bb9df3c49dcbd70e5f9e16d3f240d5e470ff699 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Thu, 2 Mar 2023 14:07:48 +0100 Subject: [PATCH 2/3] Add artifact with all subprojects inside --- .gitignore | 3 +- build.gradle | 57 +++++++++++++++++++++--------- gradle.properties | 4 +-- src/main/resources/fabric.mod.json | 29 +++++++++++++++ 4 files changed, 74 insertions(+), 19 deletions(-) create mode 100644 src/main/resources/fabric.mod.json diff --git a/.gitignore b/.gitignore index 5f60383..d037336 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,8 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ -Tasks/run +*/run +*/logs ### IntelliJ IDEA ### .idea diff --git a/build.gradle b/build.gradle index 873f6f6..836efbb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,40 @@ -allprojects { - group = project.maven_group - version = project.maven_version +plugins { + id 'java' + id 'fabric-loom' version '1.1-SNAPSHOT' apply false } -subprojects { +allprojects { apply plugin: 'java' apply plugin: 'maven-publish' + + group = project.maven_group + version = project.maven_version + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 + repositories { + maven { + name 'altarik-snapshots' + url 'https://repo.altarik.fr/snapshots/' + } + maven { + name 'altarik-releases' + url 'https://repo.altarik.fr/releases/' + } + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + } + publishing { publications { mavenJava(MavenPublication) { - from components.java + from components.java } - } + } repositories { maven { name 'altarik' @@ -26,6 +46,9 @@ subprojects { } } } +} + +subprojects { dependencies { testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}" @@ -41,16 +64,18 @@ subprojects { useJUnitPlatform() } - repositories { - maven { - name 'altarik-snapshots' - url 'https://repo.altarik.fr/snapshots/' - } - maven { - name 'altarik-releases' - url 'https://repo.altarik.fr/releases/' - } +} - mavenCentral() +dependencies { + implementation project(':Pagination') +} + + +jar { + dependsOn subprojects.jar + subprojects.each { project -> + from(project.jar) { + into("META-INF/jars/") + } } } diff --git a/gradle.properties b/gradle.properties index b918202..f3d33f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx5G +org.gradle.jvmargs=-Xmx4G junit_version=5.9.0 @@ -10,4 +10,4 @@ fabric_version=0.70.0+1.19.3 maven_group=fr.altarik.toolbox maven_version=4.0.0-SNAPSHOT repo_username=Altarik -repo_password=password \ No newline at end of file +repo_password=password diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..3d55a7b --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,29 @@ +{ + "schemaVersion": 1, + "id": "toolbox", + "version": "${version}", + "name": "Altarik Toolbox", + "description": "Altarik Toolbox, for developers", + "authors": [ + "Altarik" + ], + "contributors": [ + "Legot Quentin" + ], + "contact": { + "homepage": "https://altarik.fr" + }, + "license": "Altarik @ All-Rights-Reserved ", + "icon": "assets/quests/icon.png", + "environment": "*", + "mixins": [ + "Task.mixins.json" + ], + "depends": { + "fabricloader": "^0.14.12", + "fabric-api": "*", + "minecraft": "1.19.3", + "java": ">=17" + } + } + From 16dff9556d97dc05068feb5596097939294fd82d Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Thu, 2 Mar 2023 14:51:17 +0100 Subject: [PATCH 3/3] Fix task build.gradle Signed-off-by: Quentin Legot --- Pagination/build.gradle | 35 +++++++++++++++++++ .../main/java/fr/altarik/toolbox/Main.java | 7 ---- Tasks/build.gradle | 2 +- build.gradle | 5 --- 4 files changed, 36 insertions(+), 13 deletions(-) delete mode 100644 Pagination/src/main/java/fr/altarik/toolbox/Main.java diff --git a/Pagination/build.gradle b/Pagination/build.gradle index e69de29..75f7707 100644 --- a/Pagination/build.gradle +++ b/Pagination/build.gradle @@ -0,0 +1,35 @@ +plugins { + id 'fabric-loom' +} + +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}" +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + // 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 + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too + // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. + // We'll use that if it's available, but otherwise we'll use the older option. + def targetVersion = 17 + if (JavaVersion.current().isJava9Compatible()) { + it.options.release = targetVersion + } +} \ No newline at end of file diff --git a/Pagination/src/main/java/fr/altarik/toolbox/Main.java b/Pagination/src/main/java/fr/altarik/toolbox/Main.java deleted file mode 100644 index 88dbeed..0000000 --- a/Pagination/src/main/java/fr/altarik/toolbox/Main.java +++ /dev/null @@ -1,7 +0,0 @@ -package fr.altarik.toolbox; - -public class Main { - public static void main(String[] args) { - System.out.println("Hello world!"); - } -} \ No newline at end of file diff --git a/Tasks/build.gradle b/Tasks/build.gradle index 1bb2636..77c4a5a 100644 --- a/Tasks/build.gradle +++ b/Tasks/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.1-SNAPSHOT' + id 'fabric-loom' } diff --git a/build.gradle b/build.gradle index 836efbb..7ab39e6 100644 --- a/build.gradle +++ b/build.gradle @@ -66,11 +66,6 @@ subprojects { } -dependencies { - implementation project(':Pagination') -} - - jar { dependsOn subprojects.jar subprojects.each { project ->