Skip to content

Commit

Permalink
Merge pull request #29 from CleverRaven/master
Browse files Browse the repository at this point in the history
catchup November
  • Loading branch information
xanderrootslayer authored Nov 21, 2019
2 parents f554335 + 32e0c35 commit 775d4fc
Show file tree
Hide file tree
Showing 889 changed files with 203,350 additions and 106,688 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
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ If you are also looking for suggestions then mark it with [CR] — "comments req

This can help speed up our review process by allowing us to only review the things that are ready for it, and will prevent anything that isn't completely ready from being merged in.

It is not required to solve or reference an open issue to file a PR, however, if you do so, you need to explain the problem your PR is solving in full detail.

### All PRs should have a "Summary" line
Summary is a one-line description of your change that will be extracted and added to the project changelog at https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/changelog.txt

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
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ WARNINGS += -Wimplicit-fallthrough=0
endif

CXXFLAGS += $(WARNINGS) $(DEBUG) $(DEBUGSYMS) $(PROFILE) $(OTHERS) -MMD -MP
TOOL_CXXFLAGS = -DCATA_IN_TOOL

BINDIST_EXTRAS += README.md data doc
BINDIST = $(BUILD_PREFIX)cataclysmdda-$(VERSION).tar.gz
Expand Down Expand Up @@ -801,7 +802,7 @@ localization:
lang/compile_mo.sh $(LANGUAGES)

$(CHKJSON_BIN): $(CHKJSON_SOURCES)
$(CXX) $(CXXFLAGS) -Isrc/chkjson -Isrc $(CHKJSON_SOURCES) -o $(CHKJSON_BIN)
$(CXX) $(CXXFLAGS) $(TOOL_CXXFLAGS) -Isrc/chkjson -Isrc $(CHKJSON_SOURCES) -o $(CHKJSON_BIN)

json-check: $(CHKJSON_BIN)
./$(CHKJSON_BIN)
Expand Down Expand Up @@ -1040,7 +1041,8 @@ style-all-json: json_formatter
find data -name "*.json" -print0 | xargs -0 -L 1 $(JSON_FORMATTER_BIN)

json_formatter: $(JSON_FORMATTER_SOURCES)
$(CXX) $(CXXFLAGS) -Itools/format -Isrc $(JSON_FORMATTER_SOURCES) -o $(JSON_FORMATTER_BIN)
$(CXX) $(CXXFLAGS) $(TOOL_CXXFLAGS) -Itools/format -Isrc \
$(JSON_FORMATTER_SOURCES) -o $(JSON_FORMATTER_BIN)

tests: version $(BUILD_PREFIX)cataclysm.a
$(MAKE) -C tests
Expand Down
155 changes: 102 additions & 53 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
minSdkVersion 16
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-16", "-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.
29 changes: 12 additions & 17 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 Expand Up @@ -1844,7 +1844,9 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {

if (source == InputDevice.SOURCE_UNKNOWN) {
InputDevice device = InputDevice.getDevice(deviceId);
source = device.getSources();
if (device != null) {
source = device.getSources();
}
}

if ((source & InputDevice.SOURCE_KEYBOARD) != 0) {
Expand Down Expand Up @@ -2119,32 +2121,25 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
//
@Override
public boolean onKeyPreIme (int keyCode, KeyEvent event) {
// HACK: Make sure the SDL activity receives native events for back button, even if DummyEdit is in focus
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (event.getAction()==KeyEvent.ACTION_DOWN)
SDLActivity.onNativeKeyDown(keyCode);
else if (event.getAction()==KeyEvent.ACTION_UP)
SDLActivity.onNativeKeyUp(keyCode);
}
// As seen on StackOverflow: http://stackoverflow.com/questions/7634346/keyboard-hide-event
// FIXME: Discussion at http://bugzilla.libsdl.org/show_bug.cgi?id=1639
// FIXME: This is not a 100% effective solution to the problem of detecting if the keyboard is showing or not
// FIXME: A more effective solution would be to assume our Layout to be RelativeLayout or LinearLayout
// FIXME: And determine the keyboard presence doing this: http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android
// FIXME: An even more effective way would be if Android provided this out of the box, but where would the fun be in that :)
//if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
// if (SDLActivity.mTextEdit != null && SDLActivity.mTextEdit.getVisibility() == View.VISIBLE) {
// SDLActivity.onNativeKeyboardFocusLost();
// }
//}
if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
if (SDLActivity.mTextEdit != null && SDLActivity.mTextEdit.getVisibility() == View.VISIBLE) {
SDLActivity.onNativeKeyboardFocusLost();
}
}
return super.onKeyPreIme(keyCode, event);
}

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);

outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL;
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;

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
7 changes: 4 additions & 3 deletions build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

# Build script intended for use in Travis CI

set -ex
set -ex pipefail

num_jobs=3

function run_tests
{
$WINE "$@" -d yes --rng-seed time $EXTRA_TEST_OPTS
# The grep supresses lines that begin with "0.0## s:", which are timing lines for tests with a very short duration.
$WINE "$@" -d yes --use-colour yes --rng-seed time $EXTRA_TEST_OPTS | grep -Ev "^0\.0[0-9]{2} s:"
}

date +%s > build-start-time
Expand Down Expand Up @@ -144,7 +145,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 775d4fc

Please sign in to comment.