Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
buthed010203 committed Apr 11, 2022
0 parents commit acdf990
Show file tree
Hide file tree
Showing 10 changed files with 606 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/commitTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Commit Testing

on: [push]

jobs:
buildJar:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up PATH
run: echo "${ANDROID_HOME}/build-tools/30.0.1" >> $GITHUB_PATH

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Build mod jar
run: ./gradlew deploy

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{github.run_number}}
release_name: ${{github.run_number}}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/${{ github.event.repository.name }}.jar
asset_name: NetPause.jar
asset_content_type: application/zip
24 changes: 24 additions & 0 deletions .github/workflows/prTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Pull Request Testing

on: [pull_request]

jobs:
buildJar:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up PATH
run: |
echo "${ANDROID_HOME}/build-tools/30.0.1" >> $GITHUB_PATH
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
- name: Build mod jar
run: ./gradlew deploy
- name: Upload built jar file
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }} Pull Request
path: build/libs/${{ github.event.repository.name }}.jar
156 changes: 156 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
logs/
/core/assets/mindustry-saves/
/core/assets/mindustry-maps/
/core/assets/bundles/output/
/core/assets/.gifimages/
/deploy/
/desktop/packr-out/
/desktop/packr-export/
/desktop/mindustry-saves/
/desktop/mindustry-maps/
/desktop/gifexport/
/core/lib/
/ios/assets/
/core/assets-raw/sprites/generated/
/core/assets-raw/sprites_out/
/annotations/build/
/annotations/out/
/net/build/
/tools/build/
/tests/build/
/server/build/
/test_files/
/annotations/build/
/desktop-sdl/build/
desktop-sdl/build/
/android/assets/mindustry-maps/
/android/assets/mindustry-saves/
/core/assets/gifexport/
/core/assets/version.properties
/core/assets/locales
/ios/src/io/anuke/mindustry/gen/
/core/src/io/anuke/mindustry/gen/
ios/robovm.properties
packr-out/
config/
*.gif

version.properties

.attach_*
## Java

*.class
*.war
*.ear
hs_err_pid*
crash-report-*

## Robovm
/ios/robovm-build/

## GWT
/html/war/
/html/gwt-unitCache/
.apt_generated/
.gwt/
gwt-unitCache/
www-test/
.gwt-tmp/

## Android Studio and Intellij and Android in general
/android/libs/armeabi/
/android/libs/armeabi-v7a/
/android/libs/arm64-v8a/
/android/libs/x86/
/android/libs/x86_64/
/android/gen/
.idea/
*.ipr
*.iws
*.iml
/android/out/
com_crashlytics_export_strings.xml

## Eclipse

.classpath
.project
.metadata/
/android/bin/
/core/bin/
/desktop/bin/
/html/bin/
/ios/bin/
/ios-moe/bin/
*.tmp
*.bak
*.swp
*~.nib
.settings/
.loadpath
.externalToolBuilders/
*.launch

## NetBeans

/nbproject/private/
/android/nbproject/private/
/core/nbproject/private/
/desktop/nbproject/private/
/html/nbproject/private/
/ios/nbproject/private/
/ios-moe/nbproject/private/

/build/
/android/build/
/core/build/
/desktop/build/
/html/build/
/ios/build/
/ios-moe/build/

/nbbuild/
/android/nbbuild/
/core/nbbuild/
/desktop/nbbuild/
/html/nbbuild/
/ios/nbbuild/
/ios-moe/nbbuild/

/dist/
/android/dist/
/core/dist/
/desktop/dist/
/html/dist/
/ios/dist/
/ios-moe/dist/

/nbdist/
/android/nbdist/
/core/nbdist/
/desktop/nbdist/
/html/nbdist/
/ios/nbdist/
/ios-moe/nbdist/

nbactions.xml
nb-configuration.xml

## Gradle

/local.properties
.gradle/
gradle-app.setting
/build/
/android/build/
/core/build/
/desktop/build/
/html/build/
/ios/build/
/ios-moe/build/

## OS Specific
.DS_Store
Thumbs.db
android/libs/
87 changes: 87 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
apply plugin: "java"

version '1.0'

targetCompatibility = 8
//switch to JavaVersion.VERSION_17 to use Java 17 features; this requires adding jabel (see dependencies block below)
sourceCompatibility = 8

sourceSets.main.java.srcDirs = ["src"]

repositories{
mavenCentral()
maven{ url 'https://www.jitpack.io' }
}

ext{
//the build number that this mod is made for
mindustryVersion = 'v126.2'
jabelVersion = "0.6.0"
sdkRoot = System.getenv("ANDROID_HOME") ?: System.getenv("ANDROID_SDK_ROOT")
}

//java 8 backwards compatibility flag
allprojects{
tasks.withType(JavaCompile){
options.compilerArgs.addAll(['--release', '8'])
}
}

dependencies{
compileOnly "com.github.Anuken.Arc:arc-core:$mindustryVersion"
compileOnly "com.github.Anuken.Mindustry:core:$mindustryVersion"

//you may uncomment this dependency to properly use Java 17 features while still targeting Java 8.
//note that this fails on some systems for as-of-yet unknown reasons - if this happens to you, revert the changes
//annotationProcessor "com.github.Anuken:jabel:$jabelVersion"
}

task jarAndroid{
dependsOn "jar"

doLast{
if(!sdkRoot || !new File(sdkRoot).exists()) throw new GradleException("No valid Android SDK found. Ensure that ANDROID_HOME is set to your Android SDK directory.");

def platformRoot = new File("$sdkRoot/platforms/").listFiles().sort().reverse().find{ f -> new File(f, "android.jar").exists()}

if(!platformRoot) throw new GradleException("No android.jar found. Ensure that you have an Android platform installed.")

//collect dependencies needed for desugaring
def dependencies = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File(platformRoot, "android.jar")]).collect{ "--classpath $it.path" }.join(" ")

//dex and desugar files - this requires d8 in your PATH
"d8 $dependencies --min-api 14 --output ${project.archivesBaseName}Android.jar ${project.archivesBaseName}Desktop.jar"
.execute(null, new File("$buildDir/libs")).waitForProcessOutput(System.out, System.err)
}
}

jar{
archiveFileName = "${project.archivesBaseName}Desktop.jar"

from{
configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }
}

from(rootDir){
include "mod.hjson"
}

from("assets/"){
include "**"
}
}

task deploy(type: Jar){
dependsOn jarAndroid
dependsOn jar
archiveFileName = "${project.archivesBaseName}.jar"

from{ [zipTree("$buildDir/libs/${project.archivesBaseName}Desktop.jar"), zipTree("$buildDir/libs/${project.archivesBaseName}Android.jar")] }

doLast{
delete{
delete "$buildDir/libs/${project.archivesBaseName}Desktop.jar"
delete "$buildDir/libs/${project.archivesBaseName}Android.jar"
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit acdf990

Please sign in to comment.