mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-28 01:18:31 +00:00
t/oxr_android: Add resources and build code to grab the CDDL license for display.
Used by a dependency of Hilt.
This commit is contained in:
parent
885dd1d4d5
commit
3c3d628f0c
|
@ -37,6 +37,9 @@ plugins {
|
|||
|
||||
// For getting git describe data and formatting it how Android wants.
|
||||
id "com.gladed.androidgitversion" version "0.4.13"
|
||||
|
||||
// For downloading e.g. the CDDL (for transitive dependencies of hilt)
|
||||
id "de.undercouch.download" version "4.1.1"
|
||||
}
|
||||
|
||||
ext {
|
||||
|
|
|
@ -25,27 +25,51 @@ def parseOpenXRVersion(def fn) {
|
|||
String.join('.', components)
|
||||
}
|
||||
|
||||
// For JSR250 used by Hilt
|
||||
task getCDDL {
|
||||
doLast {
|
||||
ant.invokeMethod("get", [src: "https://spdx.org/licenses/CDDL-1.0.txt", dest: "${} "])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
project.ext.renameLicense = { String name ->
|
||||
def lowerNoExtension = name.toLowerCase().replace(".txt", "")
|
||||
def result = lowerNoExtension.replaceAll(~/[\-.]/, "_") + ".txt"
|
||||
return result
|
||||
}
|
||||
|
||||
project.ext.filterLicense = {String line ->
|
||||
if (line.trim().isEmpty()) {
|
||||
return '<br /><br />'
|
||||
} else {
|
||||
return groovy.xml.XmlUtil.escapeXml(line)
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
rename(renameLicense)
|
||||
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)
|
||||
}
|
||||
}
|
||||
filter(filterLicense)
|
||||
}
|
||||
project.ext.licenseDir = new File(project.buildDir, 'intermediates/licenses/')
|
||||
|
||||
task downloadCddl(type: Download) {
|
||||
src 'https://spdx.org/licenses/CDDL-1.0.txt'
|
||||
dest "${project.licenseDir}/CDDL-1.0.txt"
|
||||
overwrite false
|
||||
}
|
||||
|
||||
task copyDownloadedLicenses(type: Copy) {
|
||||
from downloadCddl.dest
|
||||
rename(renameLicense)
|
||||
into project.layout.projectDirectory.dir('src/main/res/raw').asFile
|
||||
filter(filterLicense)
|
||||
dependsOn downloadCddl
|
||||
}
|
||||
android {
|
||||
compileSdkVersion project.sharedTargetSdk
|
||||
buildToolsVersion '30.0.2'
|
||||
|
@ -79,6 +103,7 @@ android {
|
|||
|
||||
// Be sure to copy over licenses formatted as required.
|
||||
preBuild.dependsOn(copyLicenses)
|
||||
preBuild.dependsOn(copyDownloadedLicenses)
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
cjson:mit
|
||||
# Copyright 2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
javax_annotation__jsr250_api:cddl_1_0
|
||||
|
|
5
src/xrt/targets/openxr_android/src/main/res/.gitignore
vendored
Normal file
5
src/xrt/targets/openxr_android/src/main/res/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
# SPDX-FileCopyrightText: 2020 Collabora, Ltd. and the Monado contributors
|
||||
|
||||
bsl_1_0.txt
|
||||
cddl_1_0.txt
|
|
@ -1 +0,0 @@
|
|||
bsl_1_0.txt
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--
|
||||
Copyright 2020, Collabora, Ltd.
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
-->
|
||||
<string name="define_license_cddl_1_0" translatable="false" />
|
||||
<string name="license_cddl_1_0_licenseName" translatable="false">Common Development and Distribution License 1.0</string>
|
||||
|
||||
<!-- name of the license file under the raw folder -->
|
||||
<string name="license_cddl_1_0_licenseDescription" translatable="false">raw:cddl_1_0</string>
|
||||
</resources>
|
Loading…
Reference in a new issue