Skip to content

Commit

Permalink
Merge pull request #5 from CleverRaven/master
Browse files Browse the repository at this point in the history
Update #5
  • Loading branch information
Xenomorph-III authored Oct 22, 2019
2 parents 73259d4 + f7e743c commit 973cd20
Show file tree
Hide file tree
Showing 391 changed files with 114,550 additions and 64,575 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ misc-*,\
modernize-*,\
performance-*,\
readability-*,\
-cata-text-style,\
-bugprone-misplaced-widening-cast,\
-bugprone-narrowing-conversions,\
-bugprone-unused-return-value,\
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ See the [Changelog Guidelines](https://github.com/CleverRaven/Cataclysm-DDA/blob
#### Purpose of change
<!--
If there's an existing issue describing the problem this PR addresses or the feature it adds, please link it like: ```#1234```
If it *fully* resolves an issue, link it like: ```Fixes #1234```
If it *fully* resolves an issue, link it like: Fixes #1234
Even if the issue describes the problem, please provide a few-sentence summary here.
Example: ```Fixes #1234 - XL mutants cannot wear arm/leg splints due to missing OVERSIZE flag.```
Example: Fixes #1234 - XL mutants cannot wear arm/leg splints due to missing OVERSIZE flag.
If there is no related issue, please describe the issue you are addressing, including how to trigger a bug if this is a bugfix.
Don't put the backticks around the `#` and issue or pull request number to allow the GitHub automatically reference to it.
-->
Expand Down
153 changes: 101 additions & 52 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
def buildAsApplication = !buildAsLibrary
if (buildAsApplication) {
apply plugin: 'com.android.application'
}
else {
} else {
apply plugin: 'com.android.library'
}

Expand All @@ -23,7 +22,7 @@ if (localPropertiesFile.exists()) {
}

def keystorePropertiesFilename = 'keystore.properties'
if( localProperties.getProperty('keystorePropertiesFilename') != null ) {
if (localProperties.getProperty('keystorePropertiesFilename') != null) {
keystorePropertiesFilename = localProperties.getProperty("keystorePropertiesFilename")
}

Expand All @@ -37,85 +36,135 @@ if (keystorePropertiesFile.exists()) {

def njobs = getProperty("j")

def localize = getProperty("localize").toBoolean()
def abi32 = getProperty("abi32").toBoolean()
def abi64 = getProperty("abi64").toBoolean()
def deps = getProperty("deps")
def override_version = getProperty("override_version")
def version_header_path = getProperty("version_header_path")

if (!abi32 && !abi64) {
throw new GradleException("Both `abi32` and `abi64` properties are set to false")
}
if (!file(deps).exists()) {
throw new GradleException("Dependencies file does not exist:" + deps)
}

if (!override_version.isEmpty()) {
if (version_header_path.isEmpty()) {
throw new GradleException("`version_header_path` cannot be empty when `override_version` is not empty")
} else {
println("Overriding version number to $override_version using path $version_header_path")
}
}

task unzipDeps(type: Copy) {
def zipFile = new File('./deps.zip')
println("Using dependencies file: $deps")
def zipFile = new File("$deps")
def outputDir = new File('.')
from zipTree(zipFile)
into outputDir
}

preBuild.dependsOn unzipDeps

switch(OperatingSystem.current()) {
case OperatingSystem.LINUX:
task makeLocalization(type: Exec) {
workingDir './../..'
commandLine 'make', 'localization', 'LANGUAGES=all'
}

preBuild.dependsOn makeLocalization
break
case OperatingSystem.WINDOWS:
task makeLocalization(type: Exec) {
workingDir './../..'
commandLine 'sh.exe', 'android/app/makelocalizations.sh'
task makeLocalization(type: Exec) {
if (localize) {
println("Building with localization'")
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
workingDir './../..'
commandLine 'make', 'localization', 'LANGUAGES=all'
break
case OperatingSystem.WINDOWS:
workingDir './../..'
commandLine 'sh.exe', 'android/app/makelocalizations.sh'
break
default:
workingDir './../..'
commandLine 'echo', 'Building without localization'
break
}

unzipDeps.dependsOn makeLocalization
break
} else {
workingDir './../..'
commandLine 'echo', 'Building without localization'
}
}

makeLocalization
unzipDeps.dependsOn makeLocalization
preBuild.dependsOn unzipDeps

android {
compileSdkVersion 28

if(OperatingSystem.current().isLinux()) {
exec {
workingDir './../..'
commandLine 'make', 'version'
if (override_version.isEmpty()) {
println("Generating version number to $version_header_path")
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
exec {
workingDir './../..'
commandLine 'make', 'version'
}
break
case OperatingSystem.WINDOWS:
exec {
workingDir './../..'
commandLine 'sh.exe', '-c', 'make version'
}
break
default:
exec {
workingDir './../..'
commandLine 'make', 'version'
}
break
}
}
if(OperatingSystem.current().isWindows()) {
} else {
println("Overriding version number to $override_version")
exec {
workingDir './../..'
commandLine 'sh.exe', '-c', 'make version'
commandLine 'echo', '#define VERSION $override_version', '>', '$version_header_path'
}
}

defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode Integer.valueOf(System.env.UPSTREAM_BUILD_NUMBER ?: 1 )
versionName new File('app/jni/src/version.h').text.split("\"")[1]
versionCode Integer.valueOf(System.env.UPSTREAM_BUILD_NUMBER ?: 1)
versionName new File("$version_header_path").text.split('\"')[1]
if (buildAsApplication) {
applicationId "com.cleverraven.cataclysmdda"
setProperty("archivesBaseName", "cataclysmdda-" + versionName)
}

splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "armeabi-v7a"
include "arm64-v8a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
if (abi32) {
include "armeabi-v7a"
}
if (abi64) {
include "arm64-v8a"
}
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
}

externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21", "-j$njobs"
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21", "-j$njobs"
}
}
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
if( keystoreProperties.getProperty('storeFile') != null ) {
if( file(keystoreProperties.getProperty('storeFile')).exists() ) {
if (keystoreProperties.getProperty('storeFile') != null) {
if (file(keystoreProperties.getProperty('storeFile')).exists()) {
release {
storeFile file(keystoreProperties.getProperty("storeFile"))
storePassword keystoreProperties.getProperty("storePassword")
Expand All @@ -131,7 +180,7 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if( signingConfigs.hasProperty("release") ) {
if (signingConfigs.hasProperty("release")) {
signingConfig signingConfigs.release
}
externalNativeBuild {
Expand Down
Binary file modified android/app/deps.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions android/app/src/main/java/org/libsdl/app/SDLActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ public void handleMessage(Message msg) {
} else {
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
window.getDecorView().setSystemUiVisibility(flags);
window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
SDLActivity.mFullscreenModeActive = false;
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
SDLActivity.mFullscreenModeActive = true;
}
}
} else {
Expand Down
24 changes: 24 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,27 @@ org.gradle.jvmargs=-Xmx1536m
# This property controls the number of jobs sent by -j switch to ndk-build
# You can override this from the command line by passing "-Pj=#"
j=2

# This property controls whether build should be run with localization
# You can override this from the command line by passing "-Plocalize=#"
localize=true

# This property controls whether to build 32 bit ABI
# You can override this from the command line by passing "-Pabi32=#"
abi32=true

# This property controls whether to build 64 bit ABI
# You can override this from the command line by passing "-Pabi64=#"
abi64=true

# This property controls which dependencies file to use
# You can override this from the command line by passing "-Pdeps=#"
deps=./deps.zip

# This property controls which override version number to use
# You can override this from the command line by passing "-Poverride_version=#"
override_version=

# This property controls path where overriden version number header should be generated
# You can override this from the command line by passing "-pversion_header_path=#"
version_header_path=app/jni/src/version.h
2 changes: 1 addition & 1 deletion build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ then
cd android
# Specify dumb terminal to suppress gradle's constatnt output of time spent building, which
# fills the log with nonsense.
TERM=dumb ./gradlew assembleDebug -Pj=3
TERM=dumb ./gradlew assembleRelease -Pj=$num_jobs -Plocalize=false -Pabi32=false -Pabi64=true -Pdeps=/home/travis/build/CleverRaven/Cataclysm-DDA/android/app/deps.zip
else
make -j "$num_jobs" RELEASE=1 CCACHE=1 BACKTRACE=1 CROSS="$CROSS_COMPILATION" LINTJSON=0

Expand Down
Loading

0 comments on commit 973cd20

Please sign in to comment.