diff --git a/.gitignore b/.gitignore
index e6e417ffb..d3b8d96dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ build*/
.vscode
*.autosave
.vs
+CMakeSettings.json
# Ignore merge-conflict resolution files
*.orig
@@ -68,6 +69,8 @@ local.properties
# .idea/assetWizardSettings.xml
.externalNativeBuild
.cxx
+.settings
+.project
gradlew
gradlew.bat
diff --git a/doc/changes/misc_features/mr.592.md b/doc/changes/misc_features/mr.592.md
new file mode 100644
index 000000000..bd195e581
--- /dev/null
+++ b/doc/changes/misc_features/mr.592.md
@@ -0,0 +1 @@
+Additional improvements to the Android port.
diff --git a/src/xrt/targets/openxr_android/build.gradle b/src/xrt/targets/openxr_android/build.gradle
index cddbecd5f..3198c0c7d 100644
--- a/src/xrt/targets/openxr_android/build.gradle
+++ b/src/xrt/targets/openxr_android/build.gradle
@@ -1,6 +1,12 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
+import groovy.xml.XmlUtil
+
+plugins {
+ id 'com.android.application'
+ id 'kotlin-android'
+}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
@@ -8,14 +14,38 @@ apply plugin: 'com.mikepenz.aboutlibraries.plugin'
androidGitVersion {
tagPattern(/^v[0-9]+.*/)
codeFormat = 'MNNPPPBBB'
+ format = '%tag%%-count%%-gcommit%%-dirty%'
}
def parseOpenXRVersion(def fn) {
- def matches = file(fn).readLines().find { it.contains('XR_CURRENT_API_VERSION') } =~ ~/XR_MAKE_VERSION\(([^\)]+)\)/
+ def matches = file(fn).readLines().find {
+ it.contains('XR_CURRENT_API_VERSION')
+ } =~ ~/XR_MAKE_VERSION\(([^\)]+)\)/
def components = matches[0][1].split(',').each { it.replace(' ', '').trim() }
String.join('.', components)
}
+
+// TODO: this copies to the source dir for simplicity right now, but it's not great!
+task copyLicenses(type: Copy) {
+ from "${rootDir}/LICENSES/"
+ include 'BSL-1.0.txt'
+ rename {
+ String name ->
+ def lowerNoExtension = name.toLowerCase().replace(".txt", "")
+ def result = lowerNoExtension.replaceAll(~/[\-.]/, "_") + ".txt"
+ return result
+ }
+ into project.layout.projectDirectory.dir('src/main/res/raw').asFile
+ filter { line ->
+ if (line.trim().isEmpty()) {
+ return '
'
+ } else {
+ return groovy.xml.XmlUtil.escapeXml(line)
+ }
+ }
+}
+
android {
compileSdkVersion project.sharedTargetSdk
buildToolsVersion '30.0.2'
@@ -30,10 +60,12 @@ android {
versionCode androidGitVersion.code()
versionName androidGitVersion.name()
+ println versionName
+
resValue "string", "monado_lib_version", "${versionName}"
resValue "string", "app_name", "Monado XR"
- resValue "string", "library_openxrheaders_libraryVersion", parseOpenXRVersion("../../../external/openxr_includes/openxr/openxr.h")
+ resValue "string", "library_openxrheaders_libraryVersion", parseOpenXRVersion("${rootDir}/src/external/openxr_includes/openxr/openxr.h")
externalNativeBuild {
cmake {
@@ -45,6 +77,9 @@ android {
cmake.arguments "-DPYTHON_EXECUTABLE=${project.pythonBinary}"
}
}
+
+ // Be sure to copy over licenses formatted as required.
+ preBuild.dependsOn(copyLicenses)
}
buildTypes {
@@ -57,7 +92,7 @@ android {
externalNativeBuild {
cmake {
- path "../../../../CMakeLists.txt"
+ path "${rootDir}/CMakeLists.txt"
}
}
@@ -80,10 +115,11 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+
}
aboutLibraries {
- configPath = "config"
+ configPath = "${projectDir}/config"
}
dependencies {
@@ -91,7 +127,7 @@ dependencies {
implementation project(':src:xrt:auxiliary:android')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.3'
implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"
implementation "androidx.cardview:cardview:1.*.*"
diff --git a/src/xrt/targets/openxr_android/src/main/res/raw/.gitignore b/src/xrt/targets/openxr_android/src/main/res/raw/.gitignore
new file mode 100644
index 000000000..ab25a59eb
--- /dev/null
+++ b/src/xrt/targets/openxr_android/src/main/res/raw/.gitignore
@@ -0,0 +1 @@
+bsl_1_0.txt
diff --git a/src/xrt/targets/openxr_android/src/main/res/raw/bsl_1_0.txt b/src/xrt/targets/openxr_android/src/main/res/raw/bsl_1_0.txt
deleted file mode 100644
index d8e6322e6..000000000
--- a/src/xrt/targets/openxr_android/src/main/res/raw/bsl_1_0.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute, execute,
-and transmit the Software, and to prepare derivative works of the Software,
-and to permit third-parties to whom the Software is furnished to do so, all
-subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer, must
-be included in all copies of the Software, in whole or in part, and all derivative
-works of the Software, unless such copies or derivative works are solely in
-the form of machine-executable object code generated by a source language
-processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
-OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.