Compare commits

..

13 Commits

Author SHA1 Message Date
Anuken
63b92e6dd6 Better caching 2024-01-28 12:54:16 -05:00
Anuken
3be67aa52a No main executor call 2024-01-28 11:31:03 -05:00
Anuken
a73b783d98 SRV support 2024-01-27 17:46:52 -05:00
Anuken
db4c861dde AAAA record support 2024-01-27 12:50:26 -05:00
Anuken
c7a35ae789 IPv6 address support 2024-01-27 11:15:58 -05:00
Anuken
3e5ad07e8c Merge branch 'master' of https://github.com/Anuken/Mindustry into async-ping
 Conflicts:
	core/src/mindustry/net/ArcNetProvider.java
	gradle.properties
2024-01-27 10:11:09 -05:00
Anuken
584b22300d a few comments 2023-05-09 16:45:46 -04:00
Anuken
6eb049c419 Merge branch 'master' of https://github.com/Anuken/Mindustry into async-ping 2023-05-09 16:45:42 -04:00
Anuken
6be497878c cleanup 2023-02-26 15:44:51 -05:00
Anuken
8e9b409b63 cleanup 2023-02-26 15:41:49 -05:00
Anuken
b496e8457c it works minus SRV 2023-02-26 15:32:35 -05:00
Anuken
41b87b9345 static 2023-02-26 12:06:06 -05:00
Anuken
84e52bdee3 async UDP ping 2023-02-26 11:40:53 -05:00
1642 changed files with 26266 additions and 63647 deletions

View File

@@ -72,5 +72,3 @@ body:
required: true required: true
- label: I have searched the closed and open issues to make sure that this problem has not already been reported. - label: I have searched the closed and open issues to make sure that this problem has not already been reported.
required: true required: true
- label: "I am not using Foo's Client, and have made sure the bug is not caused by mods I have installed."
required: true

View File

@@ -45,12 +45,13 @@ jobs:
rm README.md rm README.md
git add . git add .
git commit --allow-empty -m "Updating" git commit --allow-empty -m "Updating"
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack
git tag ${RELEASE_VERSION} git tag ${RELEASE_VERSION}
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack ${RELEASE_VERSION} git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack
cd ../Mindustry cd ../Mindustry
- name: Create artifacts - name: Create artifacts
run: | run: |
./gradlew desktop:dist server:dist core:depsJar core:mergedJavadoc -Pbuildversion=${RELEASE_VERSION:1} ./gradlew desktop:dist server:dist core:mergedJavadoc -Pbuildversion=${RELEASE_VERSION:1}
- name: Update docs - name: Update docs
run: | run: |
cd ../ cd ../
@@ -72,7 +73,7 @@ jobs:
cd ../MindustryBuilds cd ../MindustryBuilds
echo "Updating version to ${RELEASE_VERSION:1}" echo "Updating version to ${RELEASE_VERSION:1}"
BNUM=$(($GITHUB_RUN_NUMBER + 1000)) BNUM=$(($GITHUB_RUN_NUMBER + 1000))
echo versionName=8-fdroid-${RELEASE_VERSION:1}$'\n'versionCode=${BNUM} > version_fdroid.txt echo versionName=7-fdroid-${RELEASE_VERSION:1}$'\n'versionCode=${BNUM} > version_fdroid.txt
git add . git add .
git commit -m "Updating to build ${RELEASE_VERSION:1}" git commit -m "Updating to build ${RELEASE_VERSION:1}"
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds
@@ -90,10 +91,3 @@ jobs:
file: server/build/libs/server-release.jar file: server/build/libs/server-release.jar
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Upload dependency JAR
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: core/build/libs/core-release-deps.jar
asset_name: dependencies.jar
tag: ${{ github.ref }}

View File

@@ -1,10 +0,0 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2

View File

@@ -15,16 +15,14 @@ jobs:
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 17 java-version: 17
- name: Fetch latest Arc
run: git clone --depth=1 --branch=master https://github.com/Anuken/Arc ../Arc
- name: Setup Gradle - name: Setup Gradle
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
- name: Run unit tests - name: Run unit tests
run: ./gradlew tests:test --stacktrace --rerun run: ./gradlew clean cleanTest test --stacktrace
- name: Run unit tests and build JAR - name: Run unit tests and build JAR
run: ./gradlew desktop:dist run: ./gradlew desktop:dist
- name: Upload desktop JAR for testing - name: Upload desktop JAR for testing
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: Desktop JAR (zipped) name: Desktop JAR (zipped)
path: desktop/build/libs/Mindustry.jar path: desktop/build/libs/Mindustry.jar

View File

@@ -25,8 +25,6 @@ jobs:
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 17 java-version: 17
- name: Fetch latest Arc
run: git clone --depth=1 --branch=master https://github.com/Anuken/Arc ../Arc
- name: Setup Gradle - name: Setup Gradle
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
- name: Update bundles - name: Update bundles
@@ -36,28 +34,15 @@ jobs:
if [ -n "$(git status --porcelain)" ]; then if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "Github Actions" git config --global user.name "Github Actions"
git config --global user.email "actions@github.com"
git add core/assets/bundles/* git add core/assets/bundles/*
git commit -m "Automatic bundle update" git commit -m "Automatic bundle update"
git push git push
fi fi
- name: Update scripts and class mappings
if: ${{ github.repository == 'Anuken/Mindustry' }}
run: |
./gradlew updateScripts
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "Github Actions"
git config --global user.email "actions@github.com"
git add core/assets/scripts/* core/src/mindustry/mod/ClassMap.java
git commit -m "Automatic class mapping update"
git push
fi
- name: Update JITpack repo - name: Update JITpack repo
if: ${{ github.repository == 'Anuken/Mindustry' }} if: ${{ github.repository == 'Anuken/Mindustry' }}
run: | run: |
git config --global user.name "Github Actions" git config --global user.name "Github Actions"
git config --global user.email "actions@github.com" git config --global user.email "cli@github.com"
cd ../ cd ../
cp -r ./Mindustry ./MindustryJitpack cp -r ./Mindustry ./MindustryJitpack
cd MindustryJitpack cd MindustryJitpack
@@ -72,4 +57,4 @@ jobs:
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack
cd ../Mindustry cd ../Mindustry
- name: Run unit tests - name: Run unit tests
run: ./gradlew tests:test --rerun --stacktrace run: ./gradlew clean cleanTest test --stacktrace

4
.gitignore vendored
View File

@@ -23,7 +23,6 @@ ios/libs/
/tools/build/ /tools/build/
/tests/build/ /tests/build/
/server/build/ /server/build/
ios/libs/
changelog changelog
saves/ saves/
/core/assets-raw/fontgen/out/ /core/assets-raw/fontgen/out/
@@ -168,6 +167,3 @@ android/libs/
# ignored due to frequent branch conflicts. # ignored due to frequent branch conflicts.
core/assets/logicids.dat core/assets/logicids.dat
# project files for the sectors
core/assets-raw/sprites/ui/sectors/*.json

View File

@@ -13,19 +13,11 @@ If you are submitting a new block, make sure it has a name and description, and
### Do not make large changes before discussing them first. ### Do not make large changes before discussing them first.
If you are interested in adding a large mechanic/feature or changing large amounts of code, first contact me (Anuken) via [Discord](https://discord.gg/mindustry) - either via PM or by posting in the `#pulls` channel. If you are interested in adding a large mechanic/feature or changing large amounts of code, first contact me (Anuken) via [Discord](https://discord.gg/mindustry) - either via PM or by posting in the `#pulls` channel.
For most changes, this should not be necessary. I just want to know if you're doing something big, so I can offer advice and/or make sure you're not wasting your time on it. For most changes, this should not be necessary. I just want to know if you're doing something big so I can offer advice and/or make sure you're not wasting your time on it.
### Do not make formatting or "cleanup" PRs. ### Do not make formatting PRs.
Yes, there are occurrences of trailing spaces, extra newlines, empty indents, and other tiny errors. No, I don't want to merge, view, or get notified by your 1-line PR fixing it. If you're implementing a PR with modification of *actual code*, feel free to fix formatting in the general vicinity of your changes, but please don't waste everyone's time with pointless changes. Yes, there are occurrences of trailing spaces, extra newlines, empty indents, and other tiny errors. No, I don't want to merge, view, or get notified by your 1-line PR fixing it. If you're implementing a PR with modification of *actual code*, feel free to fix formatting in the general vicinity of your changes, but please don't waste everyone's time with pointless changes.
I **especially** do not want to see PRs that apply any kind of automated analysis to the source code to "optimize" anything - my IDE can do that already. If the PR doesn't actually change anything useful, I'm not going to review or merge it.
### Do not make AI "contributions".
If I see a PR with significant amounts of code that's obviously written by AI, I will reject your PR, and you will be blocked. Don't waste my time with slop.
Asking AI questions, and using that information to help you write code? Fine. Using it to actually write code? No.
## Style Guidelines ## Style Guidelines
### Follow the formatting guidelines. ### Follow the formatting guidelines.
@@ -42,7 +34,7 @@ This means:
Import [this style file](.github/Mindustry-CodeStyle-IJ.xml) into IntelliJ to get correct formatting when developing Mindustry. Import [this style file](.github/Mindustry-CodeStyle-IJ.xml) into IntelliJ to get correct formatting when developing Mindustry.
### Do not use incompatible Java features (java.util.function, java.awt, java.lang.Objects). ### Do not use incompatible Java features (java.util.function, java.awt).
Android and RoboVM (iOS) do not support many of Java 8's features, such as the packages `java.util.function`, `java.util.stream` or `forEach` in collections. Do not use these in your code. Android and RoboVM (iOS) do not support many of Java 8's features, such as the packages `java.util.function`, `java.util.stream` or `forEach` in collections. Do not use these in your code.
If you need to use functional interfaces, use the ones in `arc.func`, which are more or less the same with different naming schemes. If you need to use functional interfaces, use the ones in `arc.func`, which are more or less the same with different naming schemes.
@@ -74,7 +66,7 @@ Otherwise, use the `Tmp` variables for things like vector/shape operations, or c
If using a list, make it a static variable and clear it every time it is used. Re-use as much as possible. If using a list, make it a static variable and clear it every time it is used. Re-use as much as possible.
### Avoid bloated code and unnecessary getters/setters. ### Avoid bloated code and unnecessary getters/setters.
This is situational, but in essence, what it means is to avoid using any sort of getters and setters unless absolutely necessary. Public or protected fields should suffice for most things. This is situational, but in essence what it means is to avoid using any sort of getters and setters unless absolutely necessary. Public or protected fields should suffice for most things.
If something needs to be encapsulated in the future, IntelliJ can handle it with a few clicks. If something needs to be encapsulated in the future, IntelliJ can handle it with a few clicks.

View File

@@ -11,16 +11,14 @@ _[Javadoc](https://mindustrygame.github.io/docs/)_
## Contributing ## Contributing
See [CONTRIBUTING](CONTRIBUTING.md) for general code style and PR guidelines. See [CONTRIBUTING](CONTRIBUTING.md).
If you are a first-time contributor looking for features to implement or bugs to fix, see the issues tagged with 'candidate' [in the Mindustry-Suggestions repostiory](https://github.com/Anuken/Mindustry-Suggestions/issues?q=is%3Aissue%20state%3Aopen%20label%3Acandidate).
## Building ## Building
Bleeding-edge builds are generated automatically for every commit. You can see them [here](https://github.com/Anuken/MindustryBuilds/releases). Bleeding-edge builds are generated automatically for every commit. You can see them [here](https://github.com/Anuken/MindustryBuilds/releases).
If you'd rather compile on your own, follow these instructions. If you'd rather compile on your own, follow these instructions.
First, make sure you have [JDK 17](https://adoptium.net/temurin/releases/?os=any&arch=any&version=17) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands: First, make sure you have [JDK 16-17](https://adoptium.net/archive.html?variant=openjdk17&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands:
### Windows ### Windows
@@ -55,16 +53,6 @@ To debug the application on a connected device/emulator, run `gradlew android:in
If the terminal returns `Permission denied` or `Command not found` on Mac/Linux, run `chmod +x ./gradlew` before running `./gradlew`. *This is a one-time procedure.* If the terminal returns `Permission denied` or `Command not found` on Mac/Linux, run `chmod +x ./gradlew` before running `./gradlew`. *This is a one-time procedure.*
#### Where is the `mindustry.gen` package?
As the name implies, `mindustry.gen` is generated *at build time* based on other code. You will not find source code for this package in the repository, and it should not be edited by hand.
The following is a non-exhaustive list of the "source" of generated code in `mindustry.gen`:
- `Call`, `*Packet` classes: Generated from methods marked with `@Remote`.
- All entity classes (`Unit`, `EffectState`, `Posc`, etc): Generated from component classes in the `mindustry.entities.comp` package, and combined using definitions in `mindustry.content.UnitTypes`.
- `Sounds`, `Musics`, `Tex`, `Icon`, etc: Generated based on files in the respective asset folders.
--- ---
Gradle may take up to several minutes to download files. Be patient. <br> Gradle may take up to several minutes to download files. Be patient. <br>

View File

@@ -1,3 +1,30 @@
# Note: The v7 server list is frozen. No new servers will be accepted. All v8 server PRs should be made [here](https://github.com/Anuken/MindustryServerList). ### Adding a server to the list
*PRs to edit addresses of existing servers will still be accepted, although very infrequently.* Mindustry now has a public list of servers that everyone can see and connect to.
This is done by letting clients `GET` a [JSON list of servers](https://github.com/Anuken/Mindustry/blob/master/servers_v7.json) in this repository.
You may want to add your server to this list. The steps for getting this done are as follows:
0. **Take note of the fact that modded servers are not allowed on this list.** Such servers confuse users, and there's currently no easy way to fix mod incompatibilities after a failed connection.
1. **Ensure your server is properly moderated.** For the most part, this applies to survival servers, but PvP servers can be affected as well.
You'll need to either hire some moderators, or make use of (currently non-existent) anti-grief and anti-curse plugins.
*Consider enabling a rate limit:* `config messageRateLimit 2` will make it so that players can only send messages every 2 seconds, for example.
2. Make sure that your server is able to handle inappropriate content - this includes NSFW display/sorter art and abusive messages. **Servers that allow such content will be removed immediately.** Consider banning display blocks if it is a problem for your server: `rules add bannedBlocks ["canvas", "logic-display", "large-logic-display"]`.
3. **Set an appropriate MOTD, name and description.** This is set with `config <name/desc/motd> <value>`. "Appropriate" means that:
- Your name or description must reflect the type of server you're hosting.
Since new players may be exposed to the server list early on, put in a phrase like "Co-op survival" or "PvP" so players know what they're getting into. Yes, this is also displayed in the server mode info text, but having extra info in the name doesn't hurt.
- Make sure players know where to refer to for server support. It should be fairly clear that the server owner is not me, but you.
- Try to be professional in your text; use common sense.
4. **Get some good maps.** *(optional, but highly recommended)*. Add some maps to your server and set the map rotation to custom-only. You can get maps from the Steam workshop by subscribing and exporting them; using the `#maps` channel on Discord is also an option.
5. **Check your server configuration.** *(optional)* I would recommend adding a message rate limit of 1 second (`config messageRateLimit 1`), and disabling connect/disconnect messages to reduce spam (`config showConnectMessages false`).
6. Finally, **submit a pull request** to add your server's IP to the list.
This should be fairly straightforward: Press the edit button on the [server file](https://github.com/Anuken/Mindustry/blob/master/servers_v7.json), then add a JSON object with a single key, indicating your server address.
For example, if your server address is `example.com:6000`, you would add a comma after the last entry and insert:
```json
{
"address": "example.com:6000"
}
```
> Note that Mindustry also support SRV records. This allows you to use a subdomain for your server address instead of specifying the port. For example, if you want to use `play.example.com` instead of `example.com:6000`, in the dns settings of your domain, add an SRV record with `_mindustry` as the service, `tcp` as the protocol, `play` as the target and `6000` as the port. You can also setup fallback servers by modifying the weight or priority of the record. Although SRV records are very convenient, keep in mind they are slower than regular addresses. Avoid using them in the server list, but rather as an easy way to share your server address.
Then, press the *'submit pull request'* button and I'll take a look at your server. If I have any issues with it, I'll let you know in the PR comments.

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.anuke.mindustry">
<uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-feature android:name="android.hardware.type.pc" android:required="false" /> <uses-feature android:name="android.hardware.type.pc" android:required="false" />
@@ -14,10 +15,10 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:isGame="true" android:isGame="true"
android:theme="@style/ArcTheme" android:theme="@style/ArcTheme"
android:usesCleartextTraffic="true"
android:appCategory="game" android:appCategory="game"
android:label="@string/app_name" android:label="@string/app_name"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules">
android:largeHeap="true">
<meta-data android:name="android.max_aspect" android:value="2.1"/> <meta-data android:name="android.max_aspect" android:value="2.1"/>
<activity <activity
android:name="mindustry.android.AndroidLauncher" android:name="mindustry.android.AndroidLauncher"
@@ -31,6 +32,13 @@
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="application/octet-stream" />
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.msav"/>
</intent-filter>
</activity> </activity>
</application> </application>

View File

@@ -3,10 +3,11 @@ buildscript{
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
google() google()
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
} }
dependencies{ dependencies{
classpath 'com.android.tools.build:gradle:8.2.2' classpath 'com.android.tools.build:gradle:7.2.1'
} }
} }
@@ -16,7 +17,7 @@ configurations{ natives }
repositories{ repositories{
mavenCentral() mavenCentral()
maven{ url = "https://maven.google.com" } maven{ url "https://maven.google.com" }
} }
task deploy(type: Copy){ task deploy(type: Copy){
@@ -28,9 +29,8 @@ task deploy(type: Copy){
} }
android{ android{
namespace = "io.anuke.mindustry" buildToolsVersion '33.0.2'
buildToolsVersion = '36.0.0' compileSdkVersion 33
compileSdk = 36
sourceSets{ sourceSets{
main{ main{
manifest.srcFile 'AndroidManifest.xml' manifest.srcFile 'AndroidManifest.xml'
@@ -39,13 +39,8 @@ android{
renderscript.srcDirs = ['src'] renderscript.srcDirs = ['src']
res.srcDirs = ['res'] res.srcDirs = ['res']
assets.srcDirs = ['assets', 'src/main/assets', '../core/assets/'] assets.srcDirs = ['assets', 'src/main/assets', '../core/assets/']
if(localArc){
jniLibs.srcDirs += ['../../Arc/natives/natives-android/libs', '../../Arc/natives/natives-freetype-android/libs']
}else{
jniLibs.srcDirs = ['libs'] jniLibs.srcDirs = ['libs']
} }
}
androidTest.setRoot('tests') androidTest.setRoot('tests')
} }
@@ -61,7 +56,7 @@ android{
applicationId "io.anuke.mindustry" applicationId "io.anuke.mindustry"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 36 targetSdkVersion 33
versionName versionNameResult versionName versionNameResult
versionCode = vcode versionCode = vcode
@@ -70,8 +65,6 @@ android{
props['androidBuildCode'] = (vcode + 1).toString() props['androidBuildCode'] = (vcode + 1).toString()
} }
props.store(file('../core/assets/version.properties').newWriter(), null) props.store(file('../core/assets/version.properties').newWriter(), null)
multiDexEnabled = true
} }
compileOptions{ compileOptions{
@@ -79,7 +72,7 @@ android{
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
flavorDimensions = ["google"] flavorDimensions "google"
signingConfigs{ signingConfigs{
release{ release{
@@ -114,7 +107,7 @@ android{
if(project.hasProperty("RELEASE_STORE_FILE") || System.getenv("CI") == "true"){ if(project.hasProperty("RELEASE_STORE_FILE") || System.getenv("CI") == "true"){
buildTypes{ buildTypes{
release{ release{
signingConfig = signingConfigs.release signingConfig signingConfigs.release
} }
} }
} }
@@ -126,15 +119,14 @@ dependencies{
implementation arcModule("backends:backend-android") implementation arcModule("backends:backend-android")
implementation 'com.jakewharton.android.repackaged:dalvik-dx:9.0.0_r3' implementation 'com.jakewharton.android.repackaged:dalvik-dx:9.0.0_r3'
if(!localArc){
natives "com.github.Anuken.Arc:natives-android:$arcHash" natives "com.github.Anuken.Arc:natives-android:$arcHash"
natives "com.github.Anuken.Arc:natives-freetype-android:$arcHash" natives "com.github.Anuken.Arc:natives-freetype-android:$arcHash"
}
def version, highestVersion def version;
def highestVersion;
new File((String)findSdkDir(), "/platforms").eachFileMatch ~/android-\d+/, { new File((String)findSdkDir(), "/platforms").eachFileMatch ~/android-\d+/, {
version = it.name.find(/\d+/).toInteger() version = it.name.find(/\d+/).toInteger();
highestVersion = version > highestVersion ? version : highestVersion highestVersion = version > highestVersion ? version : highestVersion;
} }
def sdkFile = new File((String)findSdkDir(), "/platforms/android-${highestVersion}/android.jar") def sdkFile = new File((String)findSdkDir(), "/platforms/android-${highestVersion}/android.jar")
@@ -142,7 +134,6 @@ dependencies{
} }
task copyAndroidNatives(){ task copyAndroidNatives(){
if(!localArc){
configurations.natives.files.each{ jar -> configurations.natives.files.each{ jar ->
copy{ copy{
from zipTree(jar) from zipTree(jar)
@@ -151,7 +142,6 @@ task copyAndroidNatives(){
} }
} }
} }
}
task run(type: Exec){ task run(type: Exec){
commandLine "${findSdkDir()}/platform-tools/adb", 'shell', 'am', 'start', '-n', 'io.anuke.mindustry/mindustry.android.AndroidLauncher' commandLine "${findSdkDir()}/platform-tools/adb", 'shell', 'am', 'start', '-n', 'io.anuke.mindustry/mindustry.android.AndroidLauncher'

View File

@@ -1,13 +1,11 @@
-dontobfuscate -dontobfuscate
#these are essential packages that should not be "optimized" in any way
#the main purpose of d8 here is to shrink the absurdly-large google play games libraries
-keep class mindustry.** { *; } -keep class mindustry.** { *; }
-keep class arc.** { *; } -keep class arc.** { *; }
-keep class net.jpountz.** { *; } -keep class net.jpountz.** { *; }
-keep class rhino.** { *; } -keep class rhino.** { *; }
-keep class com.android.dex.** { *; } -keep class com.android.dex.** { *; }
-keep class com.android.dx.** { *; }
-keepattributes Signature,*Annotation*,InnerClasses,EnclosingMethod
-dontwarn javax.naming.**
#-printusage out.txt #-printusage out.txt

View File

@@ -38,7 +38,7 @@ public class AndroidLauncher extends AndroidApplication{
UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler((thread, error) -> { Thread.setDefaultUncaughtExceptionHandler((thread, error) -> {
CrashHandler.log(error); CrashSender.log(error);
//try to forward exception to system handler //try to forward exception to system handler
if(handler != null){ if(handler != null){
@@ -72,9 +72,6 @@ public class AndroidLauncher extends AndroidApplication{
@Override @Override
public ClassLoader loadJar(Fi jar, ClassLoader parent) throws Exception{ public ClassLoader loadJar(Fi jar, ClassLoader parent) throws Exception{
//Required to load jar files in Android 14: https://developer.android.com/about/versions/14/behavior-changes-14#safer-dynamic-code-loading
try{
jar.file().setReadOnly();
return new DexClassLoader(jar.file().getPath(), getFilesDir().getPath(), null, parent){ return new DexClassLoader(jar.file().getPath(), getFilesDir().getPath(), null, parent){
@Override @Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException{ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException{
@@ -96,34 +93,6 @@ public class AndroidLauncher extends AndroidApplication{
return loadedClass; return loadedClass;
} }
}; };
}catch(SecurityException e){
//`setReadOnly` to jar file in `/sdcard/Android/data/...` does not work on some Android 14 device
//But in `/data/...` it works
if(Build.VERSION.SDK_INT < VERSION_CODES.O_MR1){
throw e;
}
Fi cacheDir = new Fi(getCacheDir()).child("mods");
cacheDir.mkdirs();
//long file name support
Fi modCacheDir = cacheDir.child(jar.nameWithoutExtension());
Fi modCache = modCacheDir.child(Long.toHexString(jar.lastModified()) + ".zip");
if(modCacheDir.equals(jar.parent())){
//should not reach here, just in case
throw e;
}
//Cache will be deleted when mod is removed
if(!modCache.exists() || jar.length() != modCache.length()){
modCacheDir.mkdirs();
jar.copyTo(modCache);
}
modCache.file().setReadOnly();
return loadJar(modCache, parent);
}
} }
@Override @Override
@@ -132,14 +101,12 @@ public class AndroidLauncher extends AndroidApplication{
} }
void showFileChooser(boolean open, String title, Cons<Fi> cons, String... extensions){ void showFileChooser(boolean open, String title, Cons<Fi> cons, String... extensions){
try{
String extension = extensions[0]; String extension = extensions[0];
if(VERSION.SDK_INT >= VERSION_CODES.Q){ if(VERSION.SDK_INT >= VERSION_CODES.Q){
Intent intent = new Intent(open ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_CREATE_DOCUMENT); Intent intent = new Intent(open ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(extension.equals("zip") && !open && extensions.length == 1 ? "application/zip" : "*/*"); intent.setType(extension.equals("zip") && !open && extensions.length == 1 ? "application/zip" : "*/*");
intent.putExtra(Intent.EXTRA_TITLE, "export." + extension);
addResultListener(i -> startActivityForResult(intent, i), (code, in) -> { addResultListener(i -> startActivityForResult(intent, i), (code, in) -> {
if(code == Activity.RESULT_OK && in != null && in.getData() != null){ if(code == Activity.RESULT_OK && in != null && in.getData() != null){
@@ -160,7 +127,7 @@ public class AndroidLauncher extends AndroidApplication{
@Override @Override
public OutputStream write(boolean append){ public OutputStream write(boolean append){
try{ try{
return getContentResolver().openOutputStream(uri, "rwt"); return getContentResolver().openOutputStream(uri);
}catch(IOException e){ }catch(IOException e){
throw new ArcRuntimeException(e); throw new ArcRuntimeException(e);
} }
@@ -193,9 +160,6 @@ public class AndroidLauncher extends AndroidApplication{
super.showFileChooser(open, "@open", extension, cons); super.showFileChooser(open, "@open", extension, cons);
} }
} }
}catch(Throwable error){
Core.app.post(() -> Vars.ui.showException(error));
}
} }
@Override @Override
@@ -216,7 +180,6 @@ public class AndroidLauncher extends AndroidApplication{
}, new AndroidApplicationConfiguration(){{ }, new AndroidApplicationConfiguration(){{
useImmersiveMode = true; useImmersiveMode = true;
hideStatusBar = true; hideStatusBar = true;
useGL30 = true;
}}); }});
checkFiles(getIntent()); checkFiles(getIntent());

View File

@@ -54,8 +54,6 @@ public class Annotations{
/** Whether to generate a base class for this components. /** Whether to generate a base class for this components.
* An entity cannot have two base classes, so only one component can have base be true. */ * An entity cannot have two base classes, so only one component can have base be true. */
boolean base() default false; boolean base() default false;
/** Whether to generate a proper interface for this component class. */
boolean genInterface() default true;
} }
/** Indicates that a method is implemented by the annotation processor. */ /** Indicates that a method is implemented by the annotation processor. */
@@ -184,16 +182,18 @@ public class Annotations{
/** A set of two booleans, one specifying server and one specifying client. */ /** A set of two booleans, one specifying server and one specifying client. */
public enum Loc{ public enum Loc{
/** Server only. */ /** Method can only be invoked on the client from the server. */
server(true, false), server(true, false),
/** Client only. */ /** Method can only be invoked on the server from the client. */
client(false, true), client(false, true),
/** Both server and client. */ /** Method can be invoked from anywhere */
both(true, true), both(true, true),
/** Neither server nor client. */ /** Neither server nor client. */
none(false, false); none(false, false);
/** If true, this method can be invoked ON clients FROM servers. */
public final boolean isServer; public final boolean isServer;
/** If true, this method can be invoked ON servers FROM clients. */
public final boolean isClient; public final boolean isClient;
Loc(boolean server, boolean client){ Loc(boolean server, boolean client){
@@ -222,16 +222,16 @@ public class Annotations{
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Remote{ public @interface Remote{
/** Specifies the locations from which this method can cause remote invocations (This -> Remote) [Default: Server -> Client]. */ /** Specifies the locations from which this method can be invoked. */
Loc targets() default Loc.server; Loc targets() default Loc.server;
/** Specifies which methods are generated. Only affects server-to-client methods (Server -> Client(s)) [Default: Server -> Client & Server -> All Clients]. */ /** Specifies which methods are generated. Only affects server-to-client methods. */
Variant variants() default Variant.all; Variant variants() default Variant.all;
/** The locations where this method is called locally, when invoked locally (This -> This) [Default: No local invocations]. */ /** The local locations where this method is called locally, when invoked. */
Loc called() default Loc.none; Loc called() default Loc.none;
/** Whether the server should forward this packet to all other clients upon receival from a client (Client -> Server -> Other Clients). [Default: Don't Forward Client Invocations] */ /** Whether to forward this packet to all other clients upon receival. Client only. */
boolean forward() default false; boolean forward() default false;
/** /**

View File

@@ -229,7 +229,7 @@ public class EntityIO{
s(type.equals("boolean") ? "bool" : type.charAt(0) + "", field); s(type.equals("boolean") ? "bool" : type.charAt(0) + "", field);
}else if(instanceOf(type, "mindustry.ctype.Content") && !type.equals("mindustry.ai.UnitStance") && !type.equals("mindustry.ai.UnitCommand")){ }else if(instanceOf(type, "mindustry.ctype.Content") && !type.equals("mindustry.ai.UnitStance") && !type.equals("mindustry.ai.UnitCommand")){
if(write){ if(write){
s("s", field + " == null ? -1 : " + field + ".id"); s("s", field + ".id");
}else{ }else{
st(field + "mindustry.Vars.content.getByID(mindustry.ctype.ContentType.$L, read.s())", BaseProcessor.simpleName(type).toLowerCase().replace("type", "")); st(field + "mindustry.Vars.content.getByID(mindustry.ctype.ContentType.$L, read.s())", BaseProcessor.simpleName(type).toLowerCase().replace("type", ""));
} }

View File

@@ -19,7 +19,6 @@ import javax.annotation.processing.*;
import javax.lang.model.element.*; import javax.lang.model.element.*;
import javax.lang.model.type.*; import javax.lang.model.type.*;
import java.lang.annotation.*; import java.lang.annotation.*;
import java.util.*;
@SupportedAnnotationTypes({ @SupportedAnnotationTypes({
"mindustry.annotations.Annotations.EntityDef", "mindustry.annotations.Annotations.EntityDef",
@@ -98,8 +97,6 @@ public class EntityProcess extends BaseProcessor{
//create component interfaces //create component interfaces
for(Stype component : allComponents){ for(Stype component : allComponents){
TypeSpec.Builder inter = TypeSpec.interfaceBuilder(interfaceName(component)) TypeSpec.Builder inter = TypeSpec.interfaceBuilder(interfaceName(component))
.addModifiers(Modifier.PUBLIC).addAnnotation(EntityInterface.class); .addModifiers(Modifier.PUBLIC).addAnnotation(EntityInterface.class);
@@ -119,7 +116,6 @@ public class EntityProcess extends BaseProcessor{
inter.addSuperinterface(ClassName.get(packageName, interfaceName(type))); inter.addSuperinterface(ClassName.get(packageName, interfaceName(type)));
} }
if(component.annotation(Component.class).genInterface()){
ObjectSet<String> signatures = new ObjectSet<>(); ObjectSet<String> signatures = new ObjectSet<>();
//add utility methods to interface //add utility methods to interface
@@ -161,7 +157,6 @@ public class EntityProcess extends BaseProcessor{
.select(a -> a.toString().contains("Null") || a.toString().contains("Deprecated")).map(AnnotationSpec::get)).build()).build()); .select(a -> a.toString().contains("Null") || a.toString().contains("Deprecated")).map(AnnotationSpec::get)).build()).build());
} }
} }
}
write(inter); write(inter);
@@ -421,34 +416,19 @@ public class EntityProcess extends BaseProcessor{
//add all methods from components //add all methods from components
for(ObjectMap.Entry<String, Seq<Smethod>> entry : methods){ for(ObjectMap.Entry<String, Seq<Smethod>> entry : methods){
if(entry.value.contains(m -> m.has(Replace.class))){
//there are multiple @Replace implementations, or multiple non-void implementations. //check replacements
if(entry.value.size > 1 && (entry.value.contains(m -> m.has(Replace.class)) || entry.value.count(m -> !m.isAny(Modifier.NATIVE, Modifier.ABSTRACT) && !m.isVoid()) > 1)){ if(entry.value.count(m -> m.has(Replace.class)) > 1){
err("Type " + type + " has multiple components replacing method " + entry.key + ".");
//remove clutter }
entry.value.removeAll(s -> s.is(Modifier.ABSTRACT)); Smethod base = entry.value.find(m -> m.has(Replace.class));
entry.value.clear();
Comparator<Smethod> comp = Structs.comps( entry.value.add(base);
Structs.comps(
//highest priority first
Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0f),
//replacement means priority
Structs.comparingBool(m -> m.has(Replace.class))
),
//otherwise, the 'highest' subclass (most dependencies)
Structs.comparingInt(m -> getDependencies(m.type()).size)
);
Smethod best = entry.value.max(comp);
if(entry.value.contains(s -> best != s && comp.compare(s, best) == 0)){
err("Type " + type + " has multiple components implementing method " + entry.value.first() + " in an ambiguous way. Use MethodPriority to designate which one should be used. Implementations: " +
entry.value.map(s -> s.descString()));
} }
entry.value.clear(); //check multi return
entry.value.add(best); if(entry.value.count(m -> !m.isAny(Modifier.NATIVE, Modifier.ABSTRACT) && !m.isVoid()) > 1){
err("Type " + type + " has multiple components implementing non-void method " + entry.key + ".");
} }
entry.value.sort(Structs.comps(Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0), Structs.comparing(s -> s.up().getSimpleName().toString()))); entry.value.sort(Structs.comps(Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0), Structs.comparing(s -> s.up().getSimpleName().toString())));
@@ -465,7 +445,6 @@ public class EntityProcess extends BaseProcessor{
MethodSpec.Builder mbuilder = MethodSpec.methodBuilder(first.name()).addModifiers(first.is(Modifier.PRIVATE) ? Modifier.PRIVATE : Modifier.PUBLIC); MethodSpec.Builder mbuilder = MethodSpec.methodBuilder(first.name()).addModifiers(first.is(Modifier.PRIVATE) ? Modifier.PRIVATE : Modifier.PUBLIC);
//if(isFinal || entry.value.contains(s -> s.has(Final.class))) mbuilder.addModifiers(Modifier.FINAL); //if(isFinal || entry.value.contains(s -> s.has(Final.class))) mbuilder.addModifiers(Modifier.FINAL);
if(entry.value.contains(s -> s.has(CallSuper.class))) mbuilder.addAnnotation(CallSuper.class); //add callSuper here if necessary if(entry.value.contains(s -> s.has(CallSuper.class))) mbuilder.addAnnotation(CallSuper.class); //add callSuper here if necessary
if(first.has(Nullable.class)) mbuilder.addAnnotation(Nullable.class);
if(first.is(Modifier.STATIC)) mbuilder.addModifiers(Modifier.STATIC); if(first.is(Modifier.STATIC)) mbuilder.addModifiers(Modifier.STATIC);
mbuilder.addTypeVariables(first.typeVariables().map(TypeVariableName::get)); mbuilder.addTypeVariables(first.typeVariables().map(TypeVariableName::get));
mbuilder.returns(first.retn()); mbuilder.returns(first.retn());
@@ -872,6 +851,89 @@ public class EntityProcess extends BaseProcessor{
for(TypeSpec.Builder b : baseClasses){ for(TypeSpec.Builder b : baseClasses){
write(b, imports.toSeq()); write(b, imports.toSeq());
} }
//TODO nulls were an awful idea
//store nulls
TypeSpec.Builder nullsBuilder = TypeSpec.classBuilder("Nulls").addModifiers(Modifier.PUBLIC).addModifiers(Modifier.FINAL);
//TODO should be dynamic
ObjectSet<String> nullList = ObjectSet.with("unit");
//create mock types of all components
for(Stype interf : allInterfaces){
//indirect interfaces to implement methods for
Seq<Stype> dependencies = interf.allInterfaces().add(interf);
Seq<Smethod> methods = dependencies.flatMap(Stype::methods);
methods.sortComparing(Object::toString);
//optionally add superclass
Stype superclass = dependencies.map(this::interfaceToComp).find(s -> s != null && s.annotation(Component.class).base());
//use the base type when the interface being emulated has a base
TypeName type = superclass != null && interfaceToComp(interf).annotation(Component.class).base() ? tname(baseName(superclass)) : interf.tname();
//used method signatures
ObjectSet<String> signatures = new ObjectSet<>();
//create null builder
String baseName = interf.name().substring(0, interf.name().length() - 1);
//prevent Nulls bloat
if(!nullList.contains(Strings.camelize(baseName))){
continue;
}
String className = "Null" + baseName;
TypeSpec.Builder nullBuilder = TypeSpec.classBuilder(className)
.addModifiers(Modifier.FINAL);
skipDeprecated(nullBuilder);
nullBuilder.addSuperinterface(interf.tname());
if(superclass != null) nullBuilder.superclass(tname(baseName(superclass)));
for(Smethod method : methods){
String signature = method.toString();
if(!signatures.add(signature)) continue;
Stype compType = interfaceToComp(method.type());
MethodSpec.Builder builder = MethodSpec.overriding(method.e).addModifiers(Modifier.PUBLIC, Modifier.FINAL);
int index = 0;
for(ParameterSpec spec : builder.parameters){
Reflect.set(spec, "name", "arg" + index++);
}
builder.addAnnotation(OverrideCallSuper.class); //just in case
if(!method.isVoid()){
String methodName = method.name();
switch(methodName){
case "isNull":
builder.addStatement("return true");
break;
case "id":
builder.addStatement("return -1");
break;
case "toString":
builder.addStatement("return $S", className);
break;
default:
Svar variable = compType == null || method.params().size > 0 ? null : compType.fields().find(v -> v.name().equals(methodName));
String desc = variable == null ? null : variable.descString();
if(variable == null || !varInitializers.containsKey(desc)){
builder.addStatement("return " + getDefault(method.ret().toString()));
}else{
String init = varInitializers.get(desc);
builder.addStatement("return " + (init.equals("{}") ? "new " + variable.mirror().toString() : "") + init);
}
}
}
nullBuilder.addMethod(builder.build());
}
nullsBuilder.addField(FieldSpec.builder(type, Strings.camelize(baseName)).initializer("new " + className + "()").addModifiers(Modifier.FINAL, Modifier.STATIC, Modifier.PUBLIC).build());
write(nullBuilder, imports.toSeq());
}
write(nullsBuilder);
} }
} }

View File

@@ -57,9 +57,6 @@ public class AssetsProcess extends BaseProcessor{
ichtype.addField(FieldSpec.builder(ParameterizedTypeName.get(ObjectIntMap.class, String.class), ichtype.addField(FieldSpec.builder(ParameterizedTypeName.get(ObjectIntMap.class, String.class),
"codes", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).initializer("new ObjectIntMap<>()").build()); "codes", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).initializer("new ObjectIntMap<>()").build());
ichtype.addField(FieldSpec.builder(ParameterizedTypeName.get(IntMap.class, String.class),
"codeToName", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).initializer("new IntMap<>()").build());
ObjectSet<String> used = new ObjectSet<>(); ObjectSet<String> used = new ObjectSet<>();
for(Jval val : icons.get("glyphs").asArray()){ for(Jval val : icons.get("glyphs").asArray()){
@@ -70,9 +67,7 @@ public class AssetsProcess extends BaseProcessor{
int code = val.getInt("code", 0); int code = val.getInt("code", 0);
iconcAll.append((char)code); iconcAll.append((char)code);
ichtype.addField(FieldSpec.builder(char.class, name, Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).addJavadoc(String.format("\\u%04x", code)).initializer("'" + ((char)code) + "'").build()); ichtype.addField(FieldSpec.builder(char.class, name, Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).addJavadoc(String.format("\\u%04x", code)).initializer("'" + ((char)code) + "'").build());
ichinit.addStatement("codes.put($S, $L)", name, code); ichinit.addStatement("codes.put($S, $L)", name, code);
ichinit.addStatement("codeToName.put($L, $S)", code, name);
ictype.addField(TextureRegionDrawable.class, name + "Small", Modifier.PUBLIC, Modifier.STATIC); ictype.addField(TextureRegionDrawable.class, name + "Small", Modifier.PUBLIC, Modifier.STATIC);
icload.addStatement(name + "Small = mindustry.ui.Fonts.getGlyph(mindustry.ui.Fonts.def, (char)" + code + ")"); icload.addStatement(name + "Small = mindustry.ui.Fonts.getGlyph(mindustry.ui.Fonts.def, (char)" + code + ")");
@@ -183,11 +178,7 @@ public class AssetsProcess extends BaseProcessor{
} }
if(classname.equals("Sounds")){ if(classname.equals("Sounds")){
type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()") type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build());
.addJavadoc("Does not play anything.").build());
type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "unset", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()")
.addJavadoc("Used a placeholder value for unset default values. This is usually reassigned in init() of the relevant block or unit. Does not play anything.").build());
} }
type.addMethod(loadBegin.build()); type.addMethod(loadBegin.build());

View File

@@ -102,7 +102,7 @@ public class StructProcess extends BaseProcessor{
//bools: single bit, needs special case to clear things //bools: single bit, needs special case to clear things
setter.beginControlFlow("if(value)"); setter.beginControlFlow("if(value)");
setter.addStatement("return ($T)($L | (1L << $LL))", structType, structParam, offset); setter.addStatement("return ($T)(($L & ~(1L << $LL)) | (1L << $LL))", structType, structParam, offset, offset);
setter.nextControlFlow("else"); setter.nextControlFlow("else");
setter.addStatement("return ($T)(($L & ~(1L << $LL)))", structType, structParam, offset); setter.addStatement("return ($T)(($L & ~(1L << $LL)))", structType, structParam, offset);
setter.endControlFlow(); setter.endControlFlow();

View File

@@ -28,10 +28,6 @@ public class Stype extends Selement<TypeElement>{
return interfaces().flatMap(s -> s.allInterfaces().add(s)).distinct(); return interfaces().flatMap(s -> s.allInterfaces().add(s)).distinct();
} }
public boolean isInterface(){
return e.getKind() == ElementKind.INTERFACE;
}
public Seq<Stype> superclasses(){ public Seq<Stype> superclasses(){
return Seq.with(BaseProcessor.typeu.directSupertypes(mirror())).map(Stype::of); return Seq.with(BaseProcessor.typeu.directSupertypes(mirror())).map(Stype::of);
} }

View File

@@ -1 +0,0 @@
{version:2,fields:[{name:admin,type:boolean},{name:boosting,type:boolean},{name:color,type:arc.graphics.Color},{name:lastCommand,type:mindustry.ai.UnitCommand},{name:mouseX,type:float},{name:mouseY,type:float},{name:name,type:java.lang.String},{name:selectedBlock,type:mindustry.world.Block},{name:selectedRotation,type:int},{name:shooting,type:boolean},{name:team,type:mindustry.game.Team},{name:typing,type:boolean},{name:unit,type:Unit},{name:x,type:float},{name:y,type:float}]}

View File

@@ -1,10 +1,8 @@
import java.text.SimpleDateFormat
buildscript{ buildscript{
ext{ ext{
arcHash = property("archash") arcHash = property("archash")
localArc = new File(rootDir.parent, 'Arc').exists() && !project.hasProperty("noLocalArc") localArc = !project.hasProperty("release") && new File(rootDir.parent, 'Arc').exists() && !project.hasProperty("noLocalArc")
arcModule = { String name -> arcModule = { String name ->
//skip to last submodule //skip to last submodule
@@ -17,7 +15,8 @@ buildscript{
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
google() google()
maven{ url = 'https://jitpack.io' } maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven{ url 'https://jitpack.io' }
} }
dependencies{ dependencies{
@@ -27,8 +26,8 @@ buildscript{
} }
plugins{ plugins{
id "org.jetbrains.kotlin.jvm" version "2.1.10" id "org.jetbrains.kotlin.jvm" version "1.6.0"
id "org.jetbrains.kotlin.kapt" version "2.1.10" id "org.jetbrains.kotlin.kapt" version "1.6.0"
} }
allprojects{ allprojects{
@@ -38,12 +37,12 @@ allprojects{
group = 'com.github.Anuken' group = 'com.github.Anuken'
ext{ ext{
versionNumber = '8' versionNumber = '7'
if(!project.hasProperty("versionModifier")) versionModifier = 'beta' if(!project.hasProperty("versionModifier")) versionModifier = 'release'
if(!project.hasProperty("versionType")) versionType = 'official' if(!project.hasProperty("versionType")) versionType = 'official'
appName = 'Mindustry' appName = 'Mindustry'
steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94' steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94'
rhinoVersion = '54b75cbd1207ef1fd5cff517cbd188e763c85baa' rhinoVersion = '73a812444ac388ac2d94013b5cadc8f70b7ea027'
loadVersionProps = { loadVersionProps = {
return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p } return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p }
@@ -90,10 +89,6 @@ allprojects{
return project.getProperties()["buildversion"] return project.getProperties()["buildversion"]
} }
getCommitHash = {
return 'git rev-parse --verify --short HEAD'.execute().text.trim()
}
getPackage = { getPackage = {
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1) return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
} }
@@ -112,11 +107,11 @@ allprojects{
def output = 'en\n' def output = 'en\n'
def bundles = new File(project(':core').projectDir, 'assets/bundles/') def bundles = new File(project(':core').projectDir, 'assets/bundles/')
bundles.list().sort().each{ name -> bundles.list().sort().each{ name ->
if(name == "bundle.properties" || name == "global.properties") return if(name == "bundle.properties") return
output += name.substring("bundle".length() + 1, name.lastIndexOf('.')) + "\n" output += name.substring("bundle".length() + 1, name.lastIndexOf('.')) + "\n"
} }
new File(project(':core').projectDir, 'assets/locales').text = output new File(project(':core').projectDir, 'assets/locales').text = output
new File(project(':core').projectDir, 'assets/basepartnames').text = new File(project(':core').projectDir, 'assets/baseparts/').list().sort().findAll{f -> f.endsWith(".msch")}.join("\n") new File(project(':core').projectDir, 'assets/basepartnames').text = new File(project(':core').projectDir, 'assets/baseparts/').list().sort().join("\n")
} }
writeVersion = { writeVersion = {
@@ -138,11 +133,6 @@ allprojects{
props["number"] = versionNumber props["number"] = versionNumber
props["modifier"] = versionModifier props["modifier"] = versionModifier
props["build"] = buildid props["build"] = buildid
props["buildDate"] = new SimpleDateFormat("MMMM d, yyyy HH:mm a", Locale.getDefault()).format(new Date())
props["commitHash"] = "unknown"
if(project.hasProperty("showCommitHash")){
props["commitHash"] = getCommitHash()
}
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.") props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
} }
@@ -180,8 +170,9 @@ allprojects{
repositories{ repositories{
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
maven{ url = "https://central.sonatype.com/repository/maven-snapshots" } maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven{ url = 'https://jitpack.io' } maven{ url "https://oss.sonatype.org/content/repositories/releases/" }
maven{ url 'https://jitpack.io' }
} }
task clearCache{ task clearCache{
@@ -221,7 +212,7 @@ configure(project(":annotations")){
} }
//compile with java 8 compatibility for everything except the annotation project //compile with java 8 compatibility for everything except the annotation project
configure(subprojects - project(":annotations") - project(":tests")){ configure(subprojects - project(":annotations")){
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.compilerArgs.addAll(['--release', '8']) options.compilerArgs.addAll(['--release', '8'])
} }
@@ -229,7 +220,7 @@ configure(subprojects - project(":annotations") - project(":tests")){
tasks.withType(Javadoc){ tasks.withType(Javadoc){
options{ options{
addStringOption('Xdoclint:none', '-quiet') addStringOption('Xdoclint:none', '-quiet')
addStringOption('-release', '17') addStringOption('-release', '16')
encoding('UTF-8') encoding('UTF-8')
} }
} }
@@ -242,10 +233,7 @@ project(":desktop"){
dependencies{ dependencies{
implementation project(":core") implementation project(":core")
implementation arcModule("extensions:profiling")
implementation arcModule("extensions:discord") implementation arcModule("extensions:discord")
implementation arcModule("natives:natives-filedialogs")
implementation arcModule("extensions:filedialogs")
implementation arcModule("natives:natives-desktop") implementation arcModule("natives:natives-desktop")
implementation arcModule("natives:natives-freetype-desktop") implementation arcModule("natives:natives-freetype-desktop")
@@ -254,7 +242,6 @@ project(":desktop"){
implementation "com.github.Anuken:steamworks4j:$steamworksVersion" implementation "com.github.Anuken:steamworks4j:$steamworksVersion"
implementation arcModule("backends:backend-sdl") implementation arcModule("backends:backend-sdl")
annotationProcessor 'com.github.Anuken:jabel:0.9.0'
} }
} }
@@ -265,7 +252,7 @@ project(":core"){
kapt{ kapt{
javacOptions{ javacOptions{
option("-source", "17") option("-source", "16")
option("-target", "1.8") option("-target", "1.8")
} }
} }
@@ -304,27 +291,6 @@ project(":core"){
} }
} }
task depsJar(type: Jar, dependsOn: [classes, ":server:dist"]){
archiveClassifier = 'deps'
from files(sourceSets.main.output.classesDirs)
from{ configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) } }
from zipTree("../server/build/libs/server-release.jar")
from files("src/")
from files("../../Arc/arc-core/src/")
from files("../../Arc/extensions/arcnet/src/")
from files("../../Arc/extensions/g3d/src/")
from files("../../Arc/extensions/flabel/src/")
from files("../../Arc/extensions/freetype/src/")
from files("../server/src/")
exclude("META-INF/**")
exclude("vfxshaders/**")
exclude("maps/**")
exclude("baseparts/**")
exclude("vfxshaders/**")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task sourcesJar(type: Jar, dependsOn: classes){ task sourcesJar(type: Jar, dependsOn: classes){
archiveClassifier = 'sources' archiveClassifier = 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
@@ -333,7 +299,7 @@ project(":core"){
task assetsJar(type: Jar, dependsOn: ":tools:pack"){ task assetsJar(type: Jar, dependsOn: ":tools:pack"){
archiveClassifier = 'assets' archiveClassifier = 'assets'
from files("assets"){ from files("assets"){
exclude "config", "cache", "music", "sounds", "sprites/fallback" exclude "config", "cache", "music", "sounds"
} }
} }
@@ -347,7 +313,7 @@ project(":core"){
dependencies{ dependencies{
compileJava.dependsOn(preGen) compileJava.dependsOn(preGen)
api "at.yawk.lz4:lz4-java:1.10.2" api "org.lz4:lz4-java:1.8.0"
api arcModule("arc-core") api arcModule("arc-core")
api arcModule("extensions:flabel") api arcModule("extensions:flabel")
api arcModule("extensions:freetype") api arcModule("extensions:freetype")
@@ -389,6 +355,7 @@ project(":core"){
//these are completely unnecessary //these are completely unnecessary
tasks.kaptGenerateStubsKotlin.onlyIf{ false } tasks.kaptGenerateStubsKotlin.onlyIf{ false }
tasks.compileKotlin.onlyIf{ false } tasks.compileKotlin.onlyIf{ false }
tasks.inspectClassesForKotlinIC.onlyIf{ false }
} }
//comp** classes are only used for code generation //comp** classes are only used for code generation
@@ -403,7 +370,6 @@ project(":server"){
dependencies{ dependencies{
implementation project(":core") implementation project(":core")
implementation arcModule("backends:backend-headless") implementation arcModule("backends:backend-headless")
annotationProcessor 'com.github.Anuken:jabel:0.9.0'
} }
} }
@@ -417,19 +383,11 @@ project(":tests"){
testImplementation arcModule("backends:backend-headless") testImplementation arcModule("backends:backend-headless")
testImplementation "org.json:json:20230618" testImplementation "org.json:json:20230618"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.1" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.1"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}
tasks.withType(JavaCompile){
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
options.compilerArgs.addAll(['--release', '17'])
} }
test{ test{
//fork every test so mods don't interact with each other //fork every test so mods don't interact with each other
forkEvery = 1 forkEvery = 1
jvmArgs = ["-XX:+HeapDumpOnOutOfMemoryError"]
useJUnitPlatform() useJUnitPlatform()
workingDir = new File("../core/assets") workingDir = new File("../core/assets")
testLogging{ testLogging{
@@ -448,9 +406,6 @@ project(":tools"){
implementation arcModule("natives:natives-desktop") implementation arcModule("natives:natives-desktop")
implementation arcModule("natives:natives-freetype-desktop") implementation arcModule("natives:natives-freetype-desktop")
implementation arcModule("backends:backend-headless") implementation arcModule("backends:backend-headless")
implementation("com.google.guava:guava:33.3.1-jre")
annotationProcessor 'com.github.Anuken:jabel:0.9.0'
} }
} }
@@ -473,10 +428,9 @@ configure([":core", ":server"].collect{project(it)}){
publications{ publications{
maven(MavenPublication){ maven(MavenPublication){
from components.java from components.java
//TODO: uncomment this once the jitpack packing is fixed (currently depends on a newer glibc version) if(project.name == "core"){
//if(project.name == "core"){ artifact(tasks.named("assetsJar"))
// artifact(tasks.named("assetsJar")) }
//}
} }
} }
} }

View File

@@ -1069,20 +1069,6 @@
"search": [ "search": [
"planet" "planet"
] ]
},
{
"uid": "ec43f846ca53702f30310718d627f2b5",
"css": "arrow-note",
"code": 59444,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M50 0L0 50V150 250 350 450 550 650L50 700H150 250 350 450 550 650 750L800 750 750 800 700 850V950L750 1000H850L900 950 950 900 1000 850 1050 800 1100 750 1150 700 1200 650V550L1150 500 1100 450 1050 400 1000 350 950 300 900 250 850 200H750L700 250V350L750 400 800 450 750 500H650 550 450 350 250L200 450V350 250 150 50L150 0Z",
"width": 1200
},
"search": [
"arrow-note"
]
} }
] ]
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

Some files were not shown because too many files have changed in this diff Show More