mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-08 23:07:46 +07:00
Created :core:createVersionSource gradle task
Gradle build info is now output to a generated source RiiabloVersion.java Renamed generatedSourceDirs to vcsGeneratedSourceDir for version controlled generated sources Created generatedSourceDir for build generated sources Integrated RiiabloVersion into Client and MenuScreen Changed Client.properties diablo->riiablo=Riiablo (e.g., Riiablo) Changed Client.properties version->V {0} (e.g., V 0.0.3-SNAPSHOT)
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
diablo=Diablo II
|
riiablo=Riiablo
|
||||||
version=V 1.0
|
version=V {0}
|
||||||
|
|
||||||
press_any_key=Press any Key
|
press_any_key=Press any Key
|
||||||
press_any_button=Press any Button
|
press_any_button=Press any Button
|
||||||
@ -7,4 +7,4 @@ touch_the_screen=Touch the Screen
|
|||||||
|
|
||||||
unpacking_audio_files=Unpacking audio files...
|
unpacking_audio_files=Unpacking audio files...
|
||||||
unpacking_description=This should only take a few minutes
|
unpacking_description=This should only take a few minutes
|
||||||
unpacking_file={0}
|
unpacking_file={0}
|
||||||
|
@ -5,14 +5,20 @@ apply plugin: 'io.netifi.flatbuffers'
|
|||||||
import io.netifi.flatbuffers.plugin.tasks.FlatBuffers
|
import io.netifi.flatbuffers.plugin.tasks.FlatBuffers
|
||||||
import org.gradle.internal.os.OperatingSystem
|
import org.gradle.internal.os.OperatingSystem
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
sourceSets.main.resources.srcDirs += rootProject.file('assets')
|
sourceSets.main.resources.srcDirs += rootProject.file('assets')
|
||||||
idea.module.resourceDirs += rootProject.file('assets')
|
idea.module.resourceDirs += rootProject.file('assets')
|
||||||
|
|
||||||
project.ext.generatedSourceDirs = file('gen/main/java/')
|
project.ext.generatedSourceDir = file("$buildDir/generated-src/main/java/")
|
||||||
sourceSets.main.java.srcDirs += generatedSourceDirs
|
sourceSets.main.java.srcDirs += generatedSourceDir
|
||||||
idea.module.generatedSourceDirs += generatedSourceDirs
|
idea.module.generatedSourceDirs += generatedSourceDir
|
||||||
|
|
||||||
|
project.ext.vcsGeneratedSourceDir = file('gen/main/java/')
|
||||||
|
sourceSets.main.java.srcDirs += vcsGeneratedSourceDir
|
||||||
|
idea.module.generatedSourceDirs += vcsGeneratedSourceDir
|
||||||
|
|
||||||
project.ext.flatbuffersSourceDirs = file('src/main/flatbuffers/')
|
project.ext.flatbuffersSourceDirs = file('src/main/flatbuffers/')
|
||||||
|
|
||||||
@ -105,7 +111,7 @@ task createFlatBuffers(type: FlatBuffers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inputDir = flatbuffersSourceDirs
|
inputDir = flatbuffersSourceDirs
|
||||||
outputDir = generatedSourceDirs
|
outputDir = vcsGeneratedSourceDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task generateSources {
|
task generateSources {
|
||||||
@ -118,8 +124,32 @@ if (OperatingSystem.current() != OperatingSystem.WINDOWS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateSources.dependsOn 'createFlatBuffers'
|
generateSources.dependsOn 'createFlatBuffers'
|
||||||
|
generateSources.dependsOn 'createVersionSource'
|
||||||
compileJava.dependsOn 'generateSources'
|
compileJava.dependsOn 'generateSources'
|
||||||
|
|
||||||
|
task createVersionSource {
|
||||||
|
def versionClassName = 'RiiabloVersion'
|
||||||
|
|
||||||
|
def timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
def dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
|
||||||
|
dateFormat.setTimeZone(timeZone)
|
||||||
|
def buildDate = dateFormat.format(new Date())
|
||||||
|
|
||||||
|
def versionFile = file("${generatedSourceDir}/com/riiablo/${versionClassName}.java")
|
||||||
|
outputs.file(versionFile)
|
||||||
|
doLast {
|
||||||
|
versionFile.text =
|
||||||
|
"""// Generated by ${path} on ${buildDate}
|
||||||
|
package com.riiablo;
|
||||||
|
|
||||||
|
public final class ${versionClassName} {
|
||||||
|
public static final String VERSION = "${version}";
|
||||||
|
public static final String BUILD_DATE = "${buildDate}";
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//tasks.withType(JavaCompile) {
|
//tasks.withType(JavaCompile) {
|
||||||
// options.compilerArgs << '-Xlint:unchecked'
|
// options.compilerArgs << '-Xlint:unchecked'
|
||||||
// options.deprecation = true
|
// options.deprecation = true
|
||||||
|
@ -258,6 +258,7 @@ public class Client extends Game {
|
|||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
DateFormat format = DateFormat.getDateTimeInstance();
|
DateFormat format = DateFormat.getDateTimeInstance();
|
||||||
console.out.println(format.format(calendar.getTime()));
|
console.out.println(format.format(calendar.getTime()));
|
||||||
|
console.out.println(RiiabloVersion.VERSION + " - " + RiiabloVersion.BUILD_DATE);
|
||||||
console.out.println(home.path());
|
console.out.println(home.path());
|
||||||
console.out.println(saves.path());
|
console.out.println(saves.path());
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
import com.riiablo.Riiablo;
|
import com.riiablo.Riiablo;
|
||||||
|
import com.riiablo.RiiabloVersion;
|
||||||
import com.riiablo.codec.Animation;
|
import com.riiablo.codec.Animation;
|
||||||
import com.riiablo.codec.DC6;
|
import com.riiablo.codec.DC6;
|
||||||
import com.riiablo.graphics.BlendMode;
|
import com.riiablo.graphics.BlendMode;
|
||||||
@ -147,7 +149,7 @@ public class MenuScreen extends ScreenAdapter {
|
|||||||
//btnExit.setVisible(Gdx.app.getType() == Application.ApplicationType.Android);
|
//btnExit.setVisible(Gdx.app.getType() == Application.ApplicationType.Android);
|
||||||
stage.addActor(btnExit);
|
stage.addActor(btnExit);
|
||||||
|
|
||||||
lbVersion = new Label(Riiablo.bundle.get("version"), Riiablo.fonts.font16);
|
lbVersion = new Label(Riiablo.bundle.format("version", RiiabloVersion.VERSION), Riiablo.fonts.font16);
|
||||||
lbVersion.setPosition(stage.getWidth() - 20, 20, Align.bottomRight);
|
lbVersion.setPosition(stage.getWidth() - 20, 20, Align.bottomRight);
|
||||||
stage.addActor(lbVersion);
|
stage.addActor(lbVersion);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user