Added completely new build version system
@@ -1,8 +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"
|
package="io.anuke.mindustry">
|
||||||
android:versionCode="71"
|
|
||||||
android:versionName="3.3b20" >
|
|
||||||
|
|
||||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ dependencies {
|
|||||||
implementation 'org.sufficientlysecure:donations:2.5'
|
implementation 'org.sufficientlysecure:donations:2.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task deploy(type: Copy){
|
||||||
|
dependsOn "assembleRelease"
|
||||||
|
|
||||||
|
from "build/outputs/apk/google/release/android-google-release.apk"
|
||||||
|
into "../deploy/";
|
||||||
|
rename ("android-google-release.apk", appName + "-android-" + getVersionString() + ".apk");
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
buildToolsVersion '26.0.2'
|
buildToolsVersion '26.0.2'
|
||||||
compileSdkVersion 26
|
compileSdkVersion 26
|
||||||
@@ -31,10 +39,21 @@ android {
|
|||||||
packagingOptions {
|
packagingOptions {
|
||||||
exclude 'META-INF/robovm/ios/robovm.xml'
|
exclude 'META-INF/robovm/ios/robovm.xml'
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
def vfile = file('../core/assets/version.properties')
|
||||||
|
def props = new Properties()
|
||||||
|
props.load(new FileInputStream(vfile))
|
||||||
|
|
||||||
|
def code = props['androidBuildCode'].toInteger() + 1
|
||||||
|
props['androidBuildCode'] = code.toString()
|
||||||
|
props.store(vfile.newWriter(), "Autogenerated file. Do not modify.")
|
||||||
|
|
||||||
applicationId "io.anuke.mindustry"
|
applicationId "io.anuke.mindustry"
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
|
versionCode code
|
||||||
|
versionName "$versionNumber-$versionType-${props['build'].replace(" ", "-")}"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -49,6 +68,21 @@ android {
|
|||||||
buildConfigField "boolean", "DONATIONS_GOOGLE", "true"
|
buildConfigField "boolean", "DONATIONS_GOOGLE", "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
storeFile file(RELEASE_STORE_FILE)
|
||||||
|
storePassword RELEASE_STORE_PASSWORD
|
||||||
|
keyAlias RELEASE_KEY_ALIAS
|
||||||
|
keyPassword RELEASE_KEY_PASSWORD
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// called every time gradle gets executed, takes the native dependencies of
|
// called every time gradle gets executed, takes the native dependencies of
|
||||||
// the natives configuration, and extracts them to the proper libs/ folders
|
// the natives configuration, and extracts them to the proper libs/ folders
|
||||||
|
|||||||
18
build.gradle
@@ -19,10 +19,26 @@ allprojects {
|
|||||||
|
|
||||||
version = 'release'
|
version = 'release'
|
||||||
ext {
|
ext {
|
||||||
appName = "Mindustry"
|
versionNumber = '3.3'
|
||||||
|
versionType = 'beta'
|
||||||
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = 'a480029'
|
uCoreVersion = 'a480029'
|
||||||
|
|
||||||
|
getVersionString = {
|
||||||
|
String buildVersion = getBuildVersion()
|
||||||
|
return "$versionNumber-$versionType-$buildVersion"
|
||||||
|
}
|
||||||
|
|
||||||
|
getBuildVersion = {
|
||||||
|
if(!project.hasProperty("buildversion")) return "custom build"
|
||||||
|
return project.getProperties()["buildversion"]
|
||||||
|
}
|
||||||
|
|
||||||
|
getPackage = {
|
||||||
|
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
7
core/assets/version.properties
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#Autogenerated file. Do not modify.
|
||||||
|
#Thu Feb 08 23:39:41 EST 2018
|
||||||
|
version=beta
|
||||||
|
androidBuildCode=124
|
||||||
|
name=Mindustry
|
||||||
|
code=3.3
|
||||||
|
build=custom build
|
||||||
@@ -22,11 +22,6 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Vars{
|
public class Vars{
|
||||||
public static final String versionName = "Mindustry";
|
|
||||||
public static final String versionType = "Beta";
|
|
||||||
public static final byte versionBuild = 20;
|
|
||||||
public static final byte versionMajor = 3;
|
|
||||||
public static final byte versionMinor = 3;
|
|
||||||
|
|
||||||
public static final boolean testAndroid = false;
|
public static final boolean testAndroid = false;
|
||||||
//shorthand for whether or not this is running on android
|
//shorthand for whether or not this is running on android
|
||||||
|
|||||||
@@ -304,12 +304,12 @@ public class NetClient extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void finishConnecting(){
|
private void finishConnecting(){
|
||||||
Net.send(new ConnectConfirmPacket(), SendMode.tcp);
|
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
connecting = false;
|
connecting = false;
|
||||||
ui.loadfrag.hide();
|
ui.loadfrag.hide();
|
||||||
ui.join.hide();
|
ui.join.hide();
|
||||||
Net.setClientLoaded(true);
|
Net.setClientLoaded(true);
|
||||||
|
Timers.runTask(1f, () -> Net.send(new ConnectConfirmPacket(), SendMode.tcp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beginConnecting(){
|
public void beginConnecting(){
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.mindustry.entities.Player;
|
|||||||
import io.anuke.mindustry.entities.SyncEntity;
|
import io.anuke.mindustry.entities.SyncEntity;
|
||||||
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||||
import io.anuke.mindustry.io.Platform;
|
import io.anuke.mindustry.io.Platform;
|
||||||
|
import io.anuke.mindustry.io.Version;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.net.Net.SendMode;
|
import io.anuke.mindustry.net.Net.SendMode;
|
||||||
import io.anuke.mindustry.net.NetworkIO;
|
import io.anuke.mindustry.net.NetworkIO;
|
||||||
@@ -47,8 +48,8 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
Net.handleServer(ConnectPacket.class, (id, packet) -> {
|
Net.handleServer(ConnectPacket.class, (id, packet) -> {
|
||||||
|
|
||||||
if(packet.version != versionBuild){
|
if(packet.version != Version.build && packet.version != -1){ //ignore 'custom builds'
|
||||||
Net.kickConnection(id, packet.version > versionBuild ? KickReason.serverOutdated : KickReason.clientOutdated);
|
Net.kickConnection(id, packet.version > Version.build ? KickReason.serverOutdated : KickReason.clientOutdated);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ThreadHandler {
|
|||||||
|
|
||||||
synchronized (updateLock) {
|
synchronized (updateLock) {
|
||||||
rendered = true;
|
rendered = true;
|
||||||
updateLock.notify();
|
impl.notify(updateLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class ThreadHandler {
|
|||||||
|
|
||||||
synchronized(updateLock) {
|
synchronized(updateLock) {
|
||||||
while(!rendered) {
|
while(!rendered) {
|
||||||
updateLock.wait();
|
impl.wait(updateLock);
|
||||||
}
|
}
|
||||||
rendered = false;
|
rendered = false;
|
||||||
}
|
}
|
||||||
@@ -105,5 +105,7 @@ public class ThreadHandler {
|
|||||||
void sleep(long ms) throws InterruptedException;
|
void sleep(long ms) throws InterruptedException;
|
||||||
void start(Runnable run);
|
void start(Runnable run);
|
||||||
void stop();
|
void stop();
|
||||||
|
void wait(Object object) throws InterruptedException;
|
||||||
|
void notify(Object object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ public class Maps implements Disposable{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
if(!android) Log.err(e);
|
Log.err(e);
|
||||||
Gdx.app.error("Mindustry-Maps", "Failed loading map file: " + file);
|
Log.err("Failed loading map file: {0}", file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,25 +30,12 @@ public abstract class Platform {
|
|||||||
public boolean isDebug(){return false;}
|
public boolean isDebug(){return false;}
|
||||||
public ThreadProvider getThreadProvider(){
|
public ThreadProvider getThreadProvider(){
|
||||||
return new ThreadProvider() {
|
return new ThreadProvider() {
|
||||||
@Override
|
@Override public boolean isOnThread() {return true;}
|
||||||
public boolean isOnThread() {
|
@Override public void sleep(long ms) {}
|
||||||
return true;
|
@Override public void start(Runnable run) {}
|
||||||
}
|
@Override public void stop() {}
|
||||||
|
@Override public void notify(Object object) {}
|
||||||
@Override
|
@Override public void wait(Object object) {}
|
||||||
public void sleep(long ms) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start(Runnable run) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
core/src/io/anuke/mindustry/io/Version.java
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package io.anuke.mindustry.io;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
|
import com.badlogic.gdx.utils.ObjectMap;
|
||||||
|
import com.badlogic.gdx.utils.PropertiesUtils;
|
||||||
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Version {
|
||||||
|
public static final String name;
|
||||||
|
public static final String type;
|
||||||
|
public static final String code;
|
||||||
|
public static final int build;
|
||||||
|
public static final String buildName;
|
||||||
|
|
||||||
|
static{
|
||||||
|
try {
|
||||||
|
FileHandle file = Gdx.files.internal("version.properties");
|
||||||
|
|
||||||
|
ObjectMap<String, String> map = new ObjectMap<>();
|
||||||
|
PropertiesUtils.load(map, file.reader());
|
||||||
|
|
||||||
|
name = map.get("name");
|
||||||
|
type = map.get("version");
|
||||||
|
code = map.get("code");
|
||||||
|
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
|
||||||
|
buildName = build == -1 ? map.get("build") : "build " + build;
|
||||||
|
|
||||||
|
}catch (IOException e){
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.utils.reflect.ClassReflection;
|
|||||||
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.SyncEntity;
|
import io.anuke.mindustry.entities.SyncEntity;
|
||||||
|
import io.anuke.mindustry.io.Version;
|
||||||
import io.anuke.mindustry.net.Packet.ImportantPacket;
|
import io.anuke.mindustry.net.Packet.ImportantPacket;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
@@ -11,8 +12,6 @@ import io.anuke.ucore.entities.EntityGroup;
|
|||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.versionBuild;
|
|
||||||
|
|
||||||
/**Class for storing all packets.*/
|
/**Class for storing all packets.*/
|
||||||
public class Packets {
|
public class Packets {
|
||||||
|
|
||||||
@@ -58,7 +57,7 @@ public class Packets {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuffer buffer) {
|
public void write(ByteBuffer buffer) {
|
||||||
buffer.putInt(versionBuild);
|
buffer.putInt(Version.build);
|
||||||
buffer.put((byte)name.getBytes().length);
|
buffer.put((byte)name.getBytes().length);
|
||||||
buffer.put(name.getBytes());
|
buffer.put(name.getBytes());
|
||||||
buffer.put(android ? (byte)1 : 0);
|
buffer.put(android ? (byte)1 : 0);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.io.Platform;
|
import io.anuke.mindustry.io.Platform;
|
||||||
|
import io.anuke.mindustry.io.Version;
|
||||||
import io.anuke.mindustry.ui.MenuButton;
|
import io.anuke.mindustry.ui.MenuButton;
|
||||||
import io.anuke.mindustry.ui.PressGroup;
|
import io.anuke.mindustry.ui.PressGroup;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
@@ -99,7 +100,7 @@ public class MenuFragment implements Fragment{
|
|||||||
new table(){{
|
new table(){{
|
||||||
visible(() -> state.is(State.menu));
|
visible(() -> state.is(State.menu));
|
||||||
abottom().aleft();
|
abottom().aleft();
|
||||||
new label(versionName + " " + versionMajor + "." + versionMinor + " " + versionType + " / build " + versionBuild);
|
new label("Mindustry " + Version.code + " " + Version.type + " / " + Version.buildName);
|
||||||
}}.end();
|
}}.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public class TunnelConveyor extends Block{
|
|||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
TunnelEntity entity = tile.entity();
|
TunnelEntity entity = tile.entity();
|
||||||
|
|
||||||
|
if(entity.index >= entity.buffer.length) return;
|
||||||
|
|
||||||
Tile tunnel = getDestTunnel(tile, item);
|
Tile tunnel = getDestTunnel(tile, item);
|
||||||
if(tunnel == null) return;
|
if(tunnel == null) return;
|
||||||
Tile to = tunnel.getNearby(tunnel.getRotation());
|
Tile to = tunnel.getNearby(tunnel.getRotation());
|
||||||
|
|||||||
@@ -4,11 +4,45 @@ sourceCompatibility = 1.8
|
|||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
project.ext.mainClassName = "io.anuke.mindustry.desktop.DesktopLauncher"
|
project.ext.mainClassName = "io.anuke.mindustry.desktop.DesktopLauncher"
|
||||||
project.ext.assetsDir = new File("../core/assets");
|
project.ext.assetsDir = new File("../core/assets")
|
||||||
|
|
||||||
def PACKR_DIR = "$System.env.PACKR_DIR"
|
def PACKR_DIR = "$System.env.PACKR_DIR"
|
||||||
def ICON_DIR = new File("core/assets/sprites/icon.icns")
|
def ICON_DIR = new File("core/assets/sprites/icon.icns")
|
||||||
|
|
||||||
|
ext.writeVersion = {
|
||||||
|
def pfile = new File('core/assets/version.properties')
|
||||||
|
def props = new Properties()
|
||||||
|
props.load(new FileInputStream(pfile))
|
||||||
|
|
||||||
|
String code = getBuildVersion()
|
||||||
|
|
||||||
|
props["name"] = appName
|
||||||
|
props["version"] = versionType
|
||||||
|
props["code"] = versionNumber
|
||||||
|
props["build"] = code
|
||||||
|
|
||||||
|
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
|
||||||
|
}
|
||||||
|
|
||||||
|
ext.getPlatform = {
|
||||||
|
if (project.hasProperty("platform")) {
|
||||||
|
def lc = platform.toLowerCase()
|
||||||
|
if (lc == "windows64") {
|
||||||
|
return "windows64"
|
||||||
|
} else if (lc == "windows32") {
|
||||||
|
return "windows32"
|
||||||
|
} else if (lc == "linux") {
|
||||||
|
return "linux64"
|
||||||
|
} else if (lc == "mac") {
|
||||||
|
return "mac"
|
||||||
|
} else {
|
||||||
|
throw new InvalidUserDataException("Invalid platform. Set platform with -Pplatform=windows/linux/mac")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new InvalidUserDataException("No platform defined. Set platform with -Pplatform=windows/linux/mac")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec) {
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
@@ -30,80 +64,50 @@ task debug(dependsOn: classes, type: JavaExec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task dist(type: Jar) {
|
task dist(type: Jar) {
|
||||||
|
dependsOn classes
|
||||||
|
|
||||||
|
writeVersion()
|
||||||
|
|
||||||
from files(sourceSets.main.output.classesDirs)
|
from files(sourceSets.main.output.classesDirs)
|
||||||
from files(sourceSets.main.output.resourcesDir)
|
from files(sourceSets.main.output.resourcesDir)
|
||||||
from {configurations.compile.collect {zipTree(it)}}
|
from {configurations.compile.collect {zipTree(it)}}
|
||||||
from files(project.assetsDir);
|
from files(project.assetsDir)
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Main-Class': project.mainClassName
|
attributes 'Main-Class': project.mainClassName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dist.dependsOn classes
|
|
||||||
|
|
||||||
task clearOut(type: Delete){
|
task clearOut(type: Delete){
|
||||||
delete "packr-out/"
|
doLast {
|
||||||
}
|
delete "packr-out/"
|
||||||
|
|
||||||
ext.getPlatform = {
|
|
||||||
if(project.gradle.startParameter.taskNames.size() == 0 || !project.gradle.startParameter.taskNames.first().contains("packr")) return;
|
|
||||||
|
|
||||||
if(!project.hasProperty("version")){
|
|
||||||
throw new InvalidUserDataException("No version set. Set version with -Pversion=name");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.hasProperty("platform")) {
|
|
||||||
def lc = platform.toLowerCase()
|
|
||||||
if(lc.equals("windows64")) {
|
|
||||||
return "windows64";
|
|
||||||
}else if(lc.equals("windows32")){
|
|
||||||
return "windows32";
|
|
||||||
}else if(lc.equals("linux")){
|
|
||||||
return "linux64";
|
|
||||||
}else if(lc.equals("mac")){
|
|
||||||
return "mac";
|
|
||||||
}else{
|
|
||||||
throw new InvalidUserDataException("Invalid platform. Set platform with -Pplatform=windows/linux/mac");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
throw new InvalidUserDataException("No platform defined. Set platform with -Pplatform=windows/linux/mac");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.getDeployVersion = {
|
|
||||||
if(project.gradle.startParameter.taskNames.size() == 0 || !project.gradle.startParameter.taskNames.first().contains("packr")) return;
|
|
||||||
|
|
||||||
if(!project.hasProperty("deployversion")){
|
|
||||||
throw new InvalidUserDataException("No version set. Set version with -Pdeployversion=name");
|
|
||||||
}
|
|
||||||
|
|
||||||
return deployversion;
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.getPackage = {
|
|
||||||
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//note: call desktop:dist beforehand
|
//note: call desktop:dist beforehand
|
||||||
task packrCmd(type: Exec) {
|
task packrCmd() {
|
||||||
|
|
||||||
copy{
|
doLast {
|
||||||
into PACKR_DIR
|
|
||||||
from "build/libs/desktop-release.jar"
|
|
||||||
}
|
|
||||||
|
|
||||||
commandLine "java", "-jar", PACKR_DIR+"packr.jar",
|
copy {
|
||||||
"--verbose",
|
into PACKR_DIR
|
||||||
"--bundle", getPackage(),
|
from "build/libs/desktop-release.jar"
|
||||||
"--platform", getPlatform(),
|
}
|
||||||
"--executable", appName,
|
|
||||||
"--output", "packr-out/",
|
|
||||||
"--mainclass", project.ext.mainClassName,
|
|
||||||
"--jdk", PACKR_DIR+"jdk-"+getPlatform()+".zip",
|
|
||||||
"--icon", ICON_DIR.getAbsolutePath(),
|
|
||||||
"--classpath", "--", PACKR_DIR+"config.json"
|
|
||||||
|
|
||||||
|
exec {
|
||||||
|
|
||||||
|
commandLine "java", "-jar", PACKR_DIR + "packr.jar",
|
||||||
|
"--verbose",
|
||||||
|
"--bundle", getPackage(),
|
||||||
|
"--platform", getPlatform(),
|
||||||
|
"--executable", appName,
|
||||||
|
"--output", "packr-out/",
|
||||||
|
"--mainclass", project.ext.mainClassName,
|
||||||
|
"--jdk", PACKR_DIR + "jdk-" + getPlatform() + ".zip",
|
||||||
|
"--icon", ICON_DIR.getAbsolutePath(),
|
||||||
|
"--classpath", "--", PACKR_DIR + "config.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task fixMac (type: Copy){
|
task fixMac (type: Copy){
|
||||||
@@ -134,26 +138,27 @@ task fixWindows32 (type: Copy){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task packrZip(type: Zip) {
|
task packrZip() {
|
||||||
dependsOn "packrCmd"
|
dependsOn "packrCmd"
|
||||||
finalizedBy "clearOut"
|
finalizedBy "clearOut"
|
||||||
|
|
||||||
if(getPlatform().equals("mac")){
|
if(project.hasProperty("platform")) {
|
||||||
dependsOn "fixMac"
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getPlatform().equals("windows32")){
|
if (getPlatform() == "mac") {
|
||||||
dependsOn "fixWindows32"
|
dependsOn "fixMac"
|
||||||
}
|
|
||||||
|
|
||||||
from "packr-out/"
|
|
||||||
archiveName appName + "-" + getPlatform() + "-" + getDeployVersion() + ".zip"
|
|
||||||
destinationDir(file("packr-export"))
|
|
||||||
|
|
||||||
doLast{
|
|
||||||
delete{
|
|
||||||
delete "null/"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getPlatform() == "windows32") {
|
||||||
|
dependsOn "fixWindows32"
|
||||||
|
}
|
||||||
|
|
||||||
|
task zip (type: Zip){
|
||||||
|
from "packr-out/"
|
||||||
|
archiveName "$appName-${getPlatform()}-${getVersionString()}.zip"
|
||||||
|
destinationDir(file("packr-export"))
|
||||||
|
}
|
||||||
|
|
||||||
|
finalizedBy 'zip'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +172,7 @@ eclipse {
|
|||||||
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
|
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
|
||||||
doLast {
|
doLast {
|
||||||
def classpath = new XmlParser().parse(file(".classpath"))
|
def classpath = new XmlParser().parse(file(".classpath"))
|
||||||
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
|
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ])
|
||||||
def writer = new FileWriter(file(".classpath"))
|
def writer = new FileWriter(file(".classpath"))
|
||||||
def printer = new XmlNodePrinter(new PrintWriter(writer))
|
def printer = new XmlNodePrinter(new PrintWriter(writer))
|
||||||
printer.setPreserveWhitespace(true)
|
printer.setPreserveWhitespace(true)
|
||||||
|
|||||||
@@ -37,4 +37,14 @@ public class DefaultThreadImpl implements ThreadProvider {
|
|||||||
thread = null;
|
thread = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wait(Object object) throws InterruptedException{
|
||||||
|
object.wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notify(Object object) {
|
||||||
|
object.notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,6 @@ sourceSets.main.java.srcDirs = [ "src/" ]
|
|||||||
project.ext.mainClassName = "io.anuke.mindustry.server.ServerLauncher"
|
project.ext.mainClassName = "io.anuke.mindustry.server.ServerLauncher"
|
||||||
project.ext.assetsDir = new File("../core/assets");
|
project.ext.assetsDir = new File("../core/assets");
|
||||||
|
|
||||||
ext.getDeployVersion = {
|
|
||||||
if(project.gradle.startParameter.taskNames.size() == 0 || !project.gradle.startParameter.taskNames.first().contains("deploy")) return;
|
|
||||||
|
|
||||||
if(!project.hasProperty("deployversion")){
|
|
||||||
throw new InvalidUserDataException("No version set. Set version with -Pdeployversion=name");
|
|
||||||
}
|
|
||||||
|
|
||||||
return deployversion;
|
|
||||||
}
|
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec) {
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
@@ -52,7 +42,7 @@ task deploy(type: Copy){
|
|||||||
|
|
||||||
from "build/libs/server-release.jar"
|
from "build/libs/server-release.jar"
|
||||||
into "../deploy/";
|
into "../deploy/";
|
||||||
rename ("server-release.jar", appName + "-server-" + getDeployVersion() + ".jar");
|
rename ("server-release.jar", appName + "-server-" + getVersionString() + ".jar");
|
||||||
}
|
}
|
||||||
|
|
||||||
dist.dependsOn classes
|
dist.dependsOn classes
|
||||||
|
|||||||