mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
t/oxr_android: Generate license resource at build time.
This commit is contained in:
parent
e1e7b92372
commit
25967f906b
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -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
|
||||
|
|
1
doc/changes/misc_features/mr.592.md
Normal file
1
doc/changes/misc_features/mr.592.md
Normal file
|
@ -0,0 +1 @@
|
|||
Additional improvements to the Android port.
|
|
@ -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 '<br /><br />'
|
||||
} 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.*.*"
|
||||
|
|
1
src/xrt/targets/openxr_android/src/main/res/raw/.gitignore
vendored
Normal file
1
src/xrt/targets/openxr_android/src/main/res/raw/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
bsl_1_0.txt
|
|
@ -1,23 +0,0 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003<br>
|
||||
<br>
|
||||
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:<br>
|
||||
<br>
|
||||
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.<br>
|
||||
<br>
|
||||
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.
|
Loading…
Reference in a new issue