Skip to content

Commit

Permalink
🎨 轻微优化Build脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
way-zer committed Feb 24, 2025
1 parent d22ac24 commit 8c1946f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 46 deletions.
59 changes: 43 additions & 16 deletions patches/client/0001-BUILD-build.gradle.kts-and-clear.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ way-zer <himc.wicp@gmail.com> on 2024/6/9
android/proguard-rules.pro | 4 +
.../com/github/bsideup/jabel/Desugar.java | 13 +
.../javax.annotation.processing.Processor | 6 +
build.gradle | 247 ++-------------
build.gradle | 263 ++--------------
core/build.gradle | 2 -
core/build.gradle.kts | 65 ++++
core/build.gradle.kts | 66 ++++
desktop/build.gradle | 166 +----------
gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 43462 bytes
gradlew | 282 +++++++++++-------
Expand All @@ -23,7 +23,7 @@ way-zer <himc.wicp@gmail.com> on 2024/6/9
settings.gradle | 10 +-
tools/build.gradle | 44 ++-
tools/src/mindustry/tools/Generators.java | 2 +-
17 files changed, 384 insertions(+), 620 deletions(-)
17 files changed, 393 insertions(+), 628 deletions(-)
create mode 100644 annotations/src/main/java/com/github/bsideup/jabel/Desugar.java
create mode 100644 annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor
delete mode 100644 core/build.gradle
Expand Down Expand Up @@ -240,7 +240,7 @@ index 0000000000000000000000000000000000000000..181b87c1d5f3755f16a01c0528d0a89f
+mindustry.annotations.misc.LogicStatementProcessor
+mindustry.annotations.remote.RemoteProcess
diff --git a/build.gradle b/build.gradle
index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82d8736933 100644
index 90e98a89dc933d3ddb500d1e78ea5948c8760029..56575297d72fa08f573bdec8ebdef3df86890676 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,19 +10,6 @@ buildscript{
Expand Down Expand Up @@ -395,7 +395,7 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
}

repositories{
@@ -183,48 +49,30 @@ allprojects{
@@ -183,49 +49,31 @@ allprojects{
maven{ url 'https://jitpack.io' }
}

Expand All @@ -407,7 +407,8 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
- }
- }
-
tasks.withType(JavaCompile){
- tasks.withType(JavaCompile){
+ tasks.withType(JavaCompile).configureEach{
targetCompatibility = 8
- sourceCompatibility = JavaVersion.VERSION_17
+ if(project.name == "annotations"){
Expand Down Expand Up @@ -456,9 +457,11 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
- options.compilerArgs.addAll(['--release', '8'])
- }
-
tasks.withType(Javadoc){
- tasks.withType(Javadoc){
+ tasks.withType(Javadoc).configureEach{
options{
addStringOption('Xdoclint:none', '-quiet')
addStringOption('-release', '17')
@@ -234,11 +82,10 @@ configure(subprojects - project(":annotations")){
}
}
Expand All @@ -481,7 +484,7 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
implementation "com.github.Anuken:steamworks4j:$steamworksVersion"

implementation arcModule("backends:backend-sdl")
@@ -267,16 +112,6 @@ project(":core"){
@@ -267,17 +112,7 @@ project(":core"){
}
}

Expand All @@ -495,10 +498,24 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
- writePlugins()
- }
-
task copyChangelog{
- task copyChangelog{
+ tasks.register('copyChangelog'){
doLast{
def props = loadVersionProps()
@@ -301,18 +136,6 @@ project(":core"){
def androidVersion = props['androidBuildCode'].toInteger() - 2
@@ -285,9 +120,9 @@ project(":core"){
def notice = "[This is a truncated changelog, see Github for full notes]"
def maxLength = 460

- def androidLogList = [notice] + loglines.findAll{ line -> !line.endsWith("]") || line.endsWith("[Mobile]") || line.endsWith("[Android]")}
+ def androidLogList = [notice] + loglines.findAll{ line -> !line.endsWith("]") || line.endsWith("[Mobile]") || line.endsWith("[Android]") }
def result = ""
- androidLogList.forEach{line ->
+ androidLogList.forEach{ line ->
if(result.length() + line.length() + 1 < maxLength){
result += line + "\n"
}
@@ -301,19 +136,7 @@ project(":core"){
}
}

Expand All @@ -514,9 +531,11 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
- }
- }
-
task musicJar(type: Jar){
- task musicJar(type: Jar){
+ tasks.register('musicJar', Jar){
archiveClassifier = 'music'
from files("assets"){
include "music/*", "sounds/*"
@@ -321,8 +144,6 @@ project(":core"){
}

Expand Down Expand Up @@ -551,7 +570,7 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82

source rootProject.subprojects.collect{ project ->
if(!blacklist.contains(project) && project.hasProperty("sourceSets")){
@@ -443,37 +262,11 @@ configure([":core", ":server"].collect{project(it)}){
@@ -443,42 +262,16 @@ configure([":core", ":server"].collect{project(it)}){
publications{
maven(MavenPublication){
from components.java
Expand Down Expand Up @@ -586,9 +605,16 @@ index 90e98a89dc933d3ddb500d1e78ea5948c8760029..31c5318bb29640dde16d33ddc81e4c82
- }
-}
-
task resolveDependencies{
-task resolveDependencies{
+tasks.register('resolveDependencies'){
doLast{
rootProject.allprojects{ project ->
Set<Configuration> configurations = project.buildscript.configurations + project.configurations
- configurations.findAll{c -> c.canBeResolved}.forEach{c -> c.resolve()}
+ configurations.findAll{ c -> c.canBeResolved }.forEach{ c -> c.resolve() }
}
}
}
diff --git a/core/build.gradle b/core/build.gradle
deleted file mode 100644
index f7f291ef1ab71577313759a7e9fdfd3c1e0833dc..0000000000000000000000000000000000000000
Expand All @@ -600,10 +626,10 @@ index f7f291ef1ab71577313759a7e9fdfd3c1e0833dc..00000000000000000000000000000000
\ No newline at end of file
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..52d6972f5111e55502e3187e3c600e1843f2ec3f
index 0000000000000000000000000000000000000000..988cebaf5948bff23a01a6bdca87f99d4012ef9c
--- /dev/null
+++ b/core/build.gradle.kts
@@ -0,0 +1,65 @@
@@ -0,0 +1,66 @@
+import org.gradle.jvm.tasks.Jar
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
Expand All @@ -616,7 +642,7 @@ index 0000000000000000000000000000000000000000..52d6972f5111e55502e3187e3c600e18
+ kotlin.setSrcDirs(listOf("src/", "../../src/"))
+}
+
+tasks{
+tasks {
+ withType<KotlinCompile>().configureEach {
+ kotlinOptions {
+ jvmTarget = "1.8"
Expand Down Expand Up @@ -653,6 +679,7 @@ index 0000000000000000000000000000000000000000..52d6972f5111e55502e3187e3c600e18
+ property("modifier", findProperty("versionModifier") ?: "release")
+ property("number", '7')
+ property("build", findProperty("buildversion") ?: "custom build")
+ property("commitHash", "unknown") //TODO commitHash
+ }
+ processResources.configure {
+ dependsOn(generateLocales, generateBasePartNames, writeVersion)
Expand Down
4 changes: 2 additions & 2 deletions patches/client/0002-BUILD-MindustryX.patch
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ way-zer <himc.wicp@gmail.com> on 2024/4/27 at 18:57
4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/build.gradle b/build.gradle
index 31c5318bb29640dde16d33ddc81e4c82d8736933..c106887f71c6877fec692cd380dbd2c561038de6 100644
index 56575297d72fa08f573bdec8ebdef3df86890676..fec635705881ad235b2af81af0e9e6819eb71b32 100644
--- a/build.gradle
+++ b/build.gradle
@@ -13,8 +13,8 @@ buildscript{
Expand Down Expand Up @@ -47,7 +47,7 @@ index 31c5318bb29640dde16d33ddc81e4c82d8736933..c106887f71c6877fec692cd380dbd2c5
jar{
exclude("mindustry/entities/comp/**")
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index 52d6972f5111e55502e3187e3c600e1843f2ec3f..6dfb14b6bb9401ec083a0f6994ed9bab8b303c97 100644
index 988cebaf5948bff23a01a6bdca87f99d4012ef9c..0881a8a6c843fe5c6bfd78cf5a0aeee834ccb769 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Expand Down
10 changes: 5 additions & 5 deletions patches/client/0003-CS-MindustryX-Version-Icon.patch
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ index d42ffe6d4a318ce558f1010eae46140f88ed5c99..bf44ead5c58abfb79c500e6daae30c3e
+ <string name="app_name">MindustryX</string>
</resources>
diff --git a/build.gradle b/build.gradle
index c106887f71c6877fec692cd380dbd2c561038de6..8c629d8d4b8b67461aacc4e0f791166bf915f427 100644
index fec635705881ad235b2af81af0e9e6819eb71b32..b7a2bea39dcfe07ae0e19eb07005f36abf0f95df 100644
--- a/build.gradle
+++ b/build.gradle
@@ -21,7 +21,7 @@ allprojects{
Expand All @@ -80,18 +80,18 @@ index c106887f71c6877fec692cd380dbd2c561038de6..8c629d8d4b8b67461aacc4e0f791166b
ext{
versionNumber = '7'
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index 6dfb14b6bb9401ec083a0f6994ed9bab8b303c97..a68dd5cd58f7f012e3dd27750ae970b97c5bae6c 100644
index 0881a8a6c843fe5c6bfd78cf5a0aeee834ccb769..39332d4d175d89e93c48ebb7b9532c7dc17d77fd 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -47,7 +47,7 @@ tasks{
@@ -47,7 +47,7 @@ tasks {
property("type", findProperty("versionType") ?: "official")
property("modifier", findProperty("versionModifier") ?: "release")
property("number", '7')
- property("build", findProperty("buildversion") ?: "custom build")
+ property("build", findProperty("upstreamBuild") ?: "custom build")
property("commitHash", "unknown") //TODO commitHash
}
processResources.configure {
dependsOn(generateLocales, generateBasePartNames, writeVersion)
diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java
index 8fef2f1616fb0509dd7ad8f5df8e9d1a80531ad6..946a23fbd3da66b408cf177e349d162c869b5b9f 100644
--- a/core/src/mindustry/Vars.java
Expand Down Expand Up @@ -126,7 +126,7 @@ index 32c454304337cfcfcf2c15aca817edec0a309eda..aed03c684b1f88c15c3f90056ff9f733
});
}
diff --git a/core/src/mindustry/core/Version.java b/core/src/mindustry/core/Version.java
index b4415862b13522a275b74b01405e812db95f1b4a..74dc9fde3061f2a524612c064120270b10bdc9ff 100644
index c79594eebd049ba73c62312a246eed6947cbb837..69d93243bc079903003bcd805345b0252e0993a0 100644
--- a/core/src/mindustry/core/Version.java
+++ b/core/src/mindustry/core/Version.java
@@ -6,6 +6,7 @@ import arc.files.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Subject: [PATCH] OC: speedup SchematicsDialog showing.
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index 8c629d8d4b8b67461aacc4e0f791166bf915f427..442bf13a1b6c446a4608c671bdf673a2ddac6f6b 100644
index b7a2bea39dcfe07ae0e19eb07005f36abf0f95df..9b2c1bec5a22dc37d218e71e069f982c4877c621 100644
--- a/build.gradle
+++ b/build.gradle
@@ -147,7 +147,7 @@ project(":core"){
Expand Down
22 changes: 0 additions & 22 deletions patches/picked/0003-FIX-NPE-for-Version.commitHash.patch

This file was deleted.

0 comments on commit 8c1946f

Please sign in to comment.