|
1 | 1 | import dex.plugins.outlet.v2.util.ReleaseType
|
2 | 2 |
|
3 | 3 | plugins {
|
4 |
| - id 'fabric-loom' version '1.8-SNAPSHOT' |
5 |
| - id 'io.github.dexman545.outlet' version '1.6.1' |
6 |
| - id 'com.modrinth.minotaur' version '2.+' |
| 4 | + id 'fabric-loom' version '1.9-SNAPSHOT' apply false |
| 5 | + id 'io.github.dexman545.outlet' version '1.6.1' apply false |
| 6 | + id 'com.modrinth.minotaur' version '2.+' apply false |
7 | 7 | id 'maven-publish'
|
8 | 8 | }
|
9 | 9 |
|
10 |
| -sourceCompatibility = JavaVersion.VERSION_17 |
11 |
| -targetCompatibility = JavaVersion.VERSION_17 |
12 |
| - |
13 |
| -archivesBaseName = "mesh-lib" |
14 |
| -version = "${project.mod_version}+${project.minecraft_version}" |
15 |
| -group = "top.offsetmonkey538.meshlib" |
16 |
| - |
17 |
| -outlet { |
18 |
| - maintainPropertiesFile = System.getenv("DISABLE_PROPERTIES_UPDATE") == null |
19 |
| - mcVersionRange = project.supported_minecraft_versions |
20 |
| - allowedReleaseTypes = Set.of(ReleaseType.RELEASE) |
21 |
| - propertiesData = [ |
22 |
| - 'yarn_version': outlet.yarnVersion(project.minecraft_version), |
23 |
| - 'loader_version': outlet.loaderVersion() |
24 |
| - ] |
| 10 | +ext { |
| 11 | + debugVersion = System.currentTimeMillis() |
25 | 12 | }
|
26 | 13 |
|
27 |
| - |
28 |
| -loom { |
29 |
| - runs { |
30 |
| - client { |
31 |
| - runDir "run/client" |
32 |
| - } |
33 |
| - server { |
34 |
| - runDir "run/server" |
35 |
| - } |
36 |
| - } |
37 |
| -} |
38 |
| - |
39 |
| -// https://gist.github.com/maityyy/3dbcd558d58a6412c3a2a38c72706e8e |
40 |
| -afterEvaluate { |
41 |
| - loom.runs.configureEach { |
42 |
| - vmArg "-javaagent:${configurations.compileClasspath.find{ it.name.contains("sponge-mixin") }}" |
43 |
| - if (System.getenv("DISABLE_PROPERTIES_UPDATE") == null) vmArg "-Ddevauth.enabled=true" |
44 |
| - } |
| 14 | +allprojects { |
| 15 | + group = "top.offsetmonkey538.meshlib" |
45 | 16 | }
|
46 | 17 |
|
47 |
| -configurations { |
48 |
| - includeModImplementation |
49 |
| - |
50 |
| - include.extendsFrom includeModImplementation |
51 |
| - modImplementation.extendsFrom includeModImplementation |
52 |
| - |
53 |
| - |
54 |
| - includeImplementation |
| 18 | +subprojects { |
| 19 | + apply plugin: "maven-publish" |
| 20 | + apply plugin: "java" |
| 21 | + apply plugin: "java-library" |
55 | 22 |
|
56 |
| - include.extendsFrom includeImplementation |
57 |
| - implementation.extendsFrom includeImplementation |
| 23 | + archivesBaseName = "mesh-lib-${project.nameSuffix}" |
| 24 | + version = "${rootProject.mod_version}+${rootProject.minecraft_version}" |
58 | 25 |
|
| 26 | + tasks.named("javadoc", Javadoc) { |
| 27 | + options.addFileOption('-add-stylesheet', rootProject.file("javadoc-stylesheet.css")) |
| 28 | + } |
59 | 29 |
|
60 |
| - includeApi |
61 |
| - |
62 |
| - include.extendsFrom includeApi |
63 |
| - api.extendsFrom includeApi |
64 |
| -} |
| 30 | + java { |
| 31 | + withSourcesJar() |
| 32 | + withJavadocJar() |
| 33 | + } |
65 | 34 |
|
66 |
| -repositories { |
67 |
| - mavenCentral() |
68 |
| - mavenLocal() |
69 |
| - maven { |
70 |
| - name = "DevAuth" |
71 |
| - url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" |
72 |
| - content { |
73 |
| - includeGroup "me.djtheredstoner" |
| 35 | + jar { |
| 36 | + from("${rootProject.projectDir}/LICENSE") { |
| 37 | + rename { "${it}" } |
74 | 38 | }
|
75 | 39 | }
|
76 |
| -} |
77 |
| - |
78 |
| -dependencies { |
79 |
| - minecraft "com.mojang:minecraft:${project.minecraft_version}" |
80 |
| - mappings "net.fabricmc:yarn:${project.yarn_version}:v2" |
81 |
| - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
82 |
| - |
83 |
| - // DevAuth |
84 |
| - modLocalRuntime "me.djtheredstoner:DevAuth-fabric:${devauth_version}" |
85 |
| - |
86 |
| - // Netty |
87 |
| - includeApi "io.netty:netty-codec-http:${project.netty_version}" |
88 |
| - |
89 |
| - // Uncomment for including a module of fabric api |
90 |
| - // includeModImplementation fabricApi.module("fabric-api-base", project.fapi_version) |
91 |
| -} |
92 | 40 |
|
93 |
| -processResources { |
94 |
| - final Map properties = Map<String, String>.of( |
95 |
| - "modVersion", project.mod_version, |
96 |
| - "supportedMinecraftVersions", project.supported_minecraft_versions |
97 |
| - ) |
98 |
| - |
99 |
| - inputs.properties(properties) |
100 |
| - |
101 |
| - filesMatching("fabric.mod.json") { |
102 |
| - expand(properties) |
| 41 | + dependencies { |
| 42 | + compileOnly "org.jetbrains:annotations:24.0.0" |
| 43 | + compileOnly "org.slf4j:slf4j-api:2.0.16" |
103 | 44 | }
|
104 | 45 |
|
105 |
| - exclude ".cache/**" |
106 |
| -} |
107 |
| - |
108 |
| -tasks.withType(JavaCompile).configureEach { |
109 |
| - it.options.release = 17 |
110 |
| -} |
111 |
| - |
112 |
| -java { |
113 |
| - withSourcesJar() |
114 |
| - withJavadocJar() |
115 |
| -} |
116 |
| - |
117 |
| -tasks.named("javadoc", Javadoc) { |
118 |
| - options.addFileOption('-add-stylesheet', project.file("javadoc-stylesheet.css")) |
119 |
| -} |
| 46 | + publishing { |
| 47 | + repositories { |
| 48 | + maven { |
| 49 | + name = "OffsetMonkey538" |
| 50 | + url = "https://maven.offsetmonkey538.top/releases" |
| 51 | + credentials { |
| 52 | + username = providers.gradleProperty("OffsetMonkey538Username").getOrElse(System.getenv("MAVEN_USERNAME")) |
| 53 | + password = providers.gradleProperty("OffsetMonkey538Password").getOrElse(System.getenv("MAVEN_PASSWORD")) |
| 54 | + } |
| 55 | + authentication { |
| 56 | + basic(BasicAuthentication) |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + publications { |
| 61 | + maven(MavenPublication) { |
| 62 | + artifactId = project.archivesBaseName |
120 | 63 |
|
121 |
| -jar { |
122 |
| - from("LICENSE") { |
123 |
| - rename { "${it}_${project.archivesBaseName}" } |
| 64 | + from(components["java"]) |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + tasks.publishMavenPublicationToMavenLocal.doLast { |
| 69 | + if (System.getenv("IS_DEBUG") == "true") System.out.println("Version: " + version) |
124 | 70 | }
|
125 | 71 | }
|
126 | 72 |
|
127 |
| -modrinth { |
128 |
| - token = System.getenv("MODRINTH_TOKEN") |
129 |
| - projectId = "mesh-lib" |
130 |
| - def customVersionName = System.getenv("VERSION_NAME") |
131 |
| - if (customVersionName != null) versionName = customVersionName |
132 |
| - versionNumber = "${project.version}" |
133 |
| - versionType = "alpha" |
134 |
| - def isPreRelease = System.getenv("VERSION_IS_PRERELEASE") |
135 |
| - versionType = !"false".equals(isPreRelease) ? "beta" : "release" |
136 |
| - uploadFile = remapJar.archiveFile |
137 |
| - //additionalFiles = [sourcesJar.archiveFile, javadocJar.archiveFile] |
138 |
| - additionalFiles = [sourcesJar.archiveFile] |
139 |
| - gameVersions = outlet.mcVersions() |
140 |
| - syncBodyFrom = rootProject.file("README.md").text |
141 |
| - def changelogEnv = System.getenv("VERSION_CHANGELOG") |
142 |
| - if (changelogEnv != null) changelog = changelogEnv |
143 |
| -} |
| 73 | +configure(subprojects.findAll { it.name != "common" }) { |
| 74 | + apply plugin: 'com.modrinth.minotaur' |
| 75 | + apply plugin: 'io.github.dexman545.outlet' |
144 | 76 |
|
145 |
| -tasks.modrinth.dependsOn(tasks.modrinthSyncBody) |
| 77 | + if (System.getenv("IS_DEBUG") == "true") version = "${version}-${rootProject.debugVersion}" |
146 | 78 |
|
147 |
| -publishing { |
148 |
| - repositories { |
149 |
| - maven { |
150 |
| - name = "OffsetMonkey538" |
151 |
| - url = "https://maven.offsetmonkey538.top/releases" |
152 |
| - credentials { |
153 |
| - username = providers.gradleProperty("OffsetMonkey538Username").getOrElse(System.getenv("MAVEN_USERNAME")) |
154 |
| - password = providers.gradleProperty("OffsetMonkey538Password").getOrElse(System.getenv("MAVEN_PASSWORD")) |
155 |
| - } |
156 |
| - authentication { |
157 |
| - basic(BasicAuthentication) |
158 |
| - } |
159 |
| - } |
| 79 | + outlet { |
| 80 | + mcVersionRange = rootProject.supported_minecraft_versions |
| 81 | + allowedReleaseTypes = Set.of(ReleaseType.RELEASE) |
160 | 82 | }
|
161 |
| - publications { |
162 |
| - maven(MavenPublication) { |
163 |
| - artifactId = "mesh-lib" |
164 | 83 |
|
165 |
| - from(components["java"]) |
166 |
| - } |
| 84 | + modrinth { |
| 85 | + token = System.getenv("MODRINTH_TOKEN") |
| 86 | + projectId = "mesh-lib" |
| 87 | + def customVersionName = System.getenv("VERSION_NAME") |
| 88 | + if (customVersionName != null) versionName = customVersionName |
| 89 | + versionNumber = "${project.version}" |
| 90 | + versionType = "alpha" |
| 91 | + def isPreRelease = System.getenv("VERSION_IS_PRERELEASE") |
| 92 | + versionType = !"false".equals(isPreRelease) ? "beta" : "release" |
| 93 | + additionalFiles = [sourcesJar.archiveFile] |
| 94 | + gameVersions = outlet.mcVersions() |
| 95 | + syncBodyFrom = rootProject.file("README.md").text |
| 96 | + def changelogEnv = System.getenv("VERSION_CHANGELOG") |
| 97 | + if (changelogEnv != null) changelog = changelogEnv |
167 | 98 | }
|
| 99 | + |
| 100 | + tasks.modrinth.dependsOn(tasks.modrinthSyncBody) |
168 | 101 | }
|
0 commit comments