mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-24 04:51:36 +00:00
Improved build properties
This commit is contained in:
parent
5711fe3eeb
commit
6e119d989a
12 changed files with 109 additions and 293 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.jkxr"
|
||||
android:versionCode="69"
|
||||
android:versionName="1.1.27" android:installLocation="auto" >
|
||||
android:versionCode="70"
|
||||
android:versionName="1.1.28" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
|
@ -17,6 +17,7 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
|
||||
<application android:allowBackup="false"
|
||||
android:icon="@mipmap/teambeef"
|
||||
android:label="@string/jkxr"
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
google() // For Gradle 4.0+
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: "${rootProject.projectDir}/XrApp.gradle"
|
||||
|
||||
android {
|
||||
// This is the name of the generated apk file, which will have
|
||||
|
@ -14,12 +24,13 @@ android {
|
|||
// will replace an older one.
|
||||
applicationId "com.drbeef." + project.archivesBaseName
|
||||
|
||||
// override app plugin abiFilters for both 32 and 64-bit support
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
ndkBuild {
|
||||
def numProcs = Runtime.runtime.availableProcessors()
|
||||
arguments "V=0", "-j$numProcs", "-C$project.buildDir.parent", "APP_PLATFORM=android-29", "NDK_TOOLCHAIN_VERSION=clang", "APP_STL=c++_static"
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
}
|
||||
|
@ -28,26 +39,95 @@ android {
|
|||
targetSdkVersion 29
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path file('jni/Android.mk')
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
def keystorePath = (project.hasProperty('key.store')) ?
|
||||
new File(project.getProperty('key.store')) :
|
||||
project.file('android.debug.keystore')
|
||||
|
||||
def keystorePassword = (project.hasProperty('key.store.password')) ?
|
||||
project.getProperty('key.store.password') : 'android'
|
||||
|
||||
def keystoreKeyAlias = (project.hasProperty('key.alias')) ?
|
||||
project.getProperty('key.alias') : 'androiddebugkey'
|
||||
|
||||
def keystoreKeyPassword = (project.hasProperty('key.alias.password')) ?
|
||||
project.getProperty('key.alias.password') : 'android'
|
||||
|
||||
debug {
|
||||
storeFile keystorePath
|
||||
storePassword keystorePassword
|
||||
keyAlias keystoreKeyAlias
|
||||
keyPassword keystoreKeyPassword
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
release {
|
||||
storeFile keystorePath
|
||||
storePassword keystorePassword
|
||||
keyAlias keystoreKeyAlias
|
||||
keyPassword keystoreKeyPassword
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "NDK_DEBUG=1","USE_ASAN=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "NDK_DEBUG=0","USE_ASAN=0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['../../java']
|
||||
jniLibs.srcDir 'libs'
|
||||
res.srcDirs = ['../../res']
|
||||
assets.srcDirs = ['../../assets']
|
||||
}
|
||||
jni.srcDirs = ['jni']
|
||||
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'lib/arm64-v8a/libopenxr_loader.so'
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
disable 'ExpiredTargetSdkVersion'
|
||||
}
|
||||
|
||||
//packagingOptions {
|
||||
// exclude 'lib/arm64-v8a/libopenxr_loader.so'
|
||||
//}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
}
|
||||
compileSdkVersion = 29
|
||||
buildToolsVersion = '29.0.3'
|
||||
ndkVersion '21.1.6352462'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -59,12 +139,15 @@ dependencies {
|
|||
repositories {
|
||||
google()
|
||||
}
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
}
|
||||
|
||||
// Workaround to fix issue in Android Studio Chipmunk 2021.2.1 and later
|
||||
// where opening a project would result in a 'prepareKotlinBuildScriptModel'
|
||||
// not found error
|
||||
if (!tasks.findByName("prepareKotlinBuildScriptModel")) {
|
||||
tasks.register("prepareKotlinBuildScriptModel") {}
|
||||
}
|
||||
|
||||
|
||||
task packBaseResources(type: Zip) {
|
||||
from "../../z_vr_assets_base/"
|
||||
destinationDir file("../../assets/")
|
||||
|
|
8
Projects/Android/gradle.properties
Normal file
8
Projects/Android/gradle.properties
Normal file
|
@ -0,0 +1,8 @@
|
|||
org.gradle.jvmargs=-Xmx1536M \
|
||||
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED \
|
||||
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
|
||||
--add-opens=java.base/java.io=ALL-UNNAMED \
|
||||
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
||||
org.gradle.caching=true
|
||||
org.gradle.configureondemand=true
|
|
@ -1,6 +1,5 @@
|
|||
#Sun Sep 04 16:36:21 BST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
// Current version of the single player game
|
||||
#include "../win32/AutoVersion.h"
|
||||
|
||||
#define JKXR_VERSION "1.1.27"
|
||||
#define JKXR_VERSION "1.1.28"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION
|
||||
|
|
|
@ -5,5 +5,4 @@
|
|||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Thu Dec 12 20:21:11 GMT 2019
|
||||
ndk.dir=C\:\\Users\\Simon\\AppData\\Local\\Android\\Sdk\\ndk\\21.1.6352462
|
||||
sdk.dir=C\:\\Users\\Simon\\AppData\\Local\\Android\\Sdk
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
rootProject.projectDir = new File(settingsDir, '../..')
|
||||
//rootProject.projectDir = settingsDir
|
||||
rootProject.name = "JKXR"
|
||||
|
||||
include ':', 'Projects:Android'
|
||||
|
|
Binary file not shown.
238
XrApp.gradle
238
XrApp.gradle
|
@ -1,238 +0,0 @@
|
|||
import org.gradle.internal.os.OperatingSystem;
|
||||
import com.android.ddmlib.AndroidDebugBridge
|
||||
import com.android.ddmlib.IDevice
|
||||
import com.android.ddmlib.CollectingOutputReceiver
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
}
|
||||
|
||||
tasks.register("wrapper")
|
||||
}
|
||||
|
||||
class XrAppPlugin implements Plugin<Project> {
|
||||
Project project = null
|
||||
|
||||
void installApk( IDevice device, File apkFile, String applicationId ) {
|
||||
project.logger.quiet "Installing ${applicationId} on device ${device.serialNumber}"
|
||||
|
||||
String toinstall = "/data/local/tmp/toinstall.apk"
|
||||
|
||||
try {
|
||||
device.pushFile( apkFile.path, toinstall )
|
||||
} catch ( Exception e ) {
|
||||
throw new RuntimeException( "Failed to push ${apkFile.path} to ${toinstall}. ${e}", e )
|
||||
}
|
||||
|
||||
while ( true ) {
|
||||
try {
|
||||
device.installRemotePackage( toinstall, true )
|
||||
break
|
||||
} catch ( Exception e ) {
|
||||
project.logger.quiet "Failed to install ${applicationId} on device ${device.serialNumber} (${e}). Trying to uninstall first."
|
||||
}
|
||||
try {
|
||||
device.uninstallPackage( applicationId )
|
||||
} catch ( Exception e ) {
|
||||
throw new RuntimeException( "Failed to uninstall ${applicationId}. ${e}", e )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void stopApk( IDevice device, String packageName ) {
|
||||
CollectingOutputReceiver receiver = new CollectingOutputReceiver()
|
||||
device.executeShellCommand( "am force-stop ${packageName}", receiver )
|
||||
}
|
||||
|
||||
void runApk( IDevice device, manifestFile ) {
|
||||
CollectingOutputReceiver receiver = new CollectingOutputReceiver()
|
||||
def activityClass = new XmlSlurper().parse( manifestFile ).application.activity.find{ it.'intent-filter'.find{ filter ->
|
||||
return filter.action .find{it.'@android:name'.text() == 'android.intent.action.MAIN' } \
|
||||
&& ( filter.category.find{it.'@android:name'.text() == 'android.intent.category.LAUNCHER'} \
|
||||
|| filter.category.find{it.'@android:name'.text() == 'android.intent.category.INFO'} )
|
||||
}}.'@android:name'
|
||||
def startActivity = "${project.android.defaultConfig.applicationId}/${activityClass}"
|
||||
project.logger.quiet "Starting \'$startActivity\' on ${project.deviceMap.size()} devices:"
|
||||
project.logger.quiet "- ${device.serialNumber}"
|
||||
device.executeShellCommand( "am start $startActivity", receiver )
|
||||
}
|
||||
|
||||
void apply( Project project ) {
|
||||
this.project = project
|
||||
|
||||
// FIXME: The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
|
||||
project.task( "cleanWorkAround" ) {
|
||||
description "Workaround for .externalNativeBuild not being deleted on clean"
|
||||
}.doLast {
|
||||
project.delete project.file( ".externalNativeBuild" )
|
||||
}
|
||||
|
||||
project.android {
|
||||
compileSdkVersion 26
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 25
|
||||
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
}
|
||||
ndkBuild {
|
||||
def numProcs = Runtime.runtime.availableProcessors()
|
||||
arguments "V=0", "-j$numProcs", "-C$project.buildDir.parent", "APP_PLATFORM=android-24", "NDK_TOOLCHAIN_VERSION=clang", "APP_STL=c++_static"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path 'jni/Android.mk'
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
def keystorePath = (project.hasProperty('key.store')) ?
|
||||
new File(project.getProperty('key.store')) :
|
||||
project.file('android.debug.keystore')
|
||||
|
||||
def keystorePassword = (project.hasProperty('key.store.password')) ?
|
||||
project.getProperty('key.store.password') : 'android'
|
||||
|
||||
def keystoreKeyAlias = (project.hasProperty('key.alias')) ?
|
||||
project.getProperty('key.alias') : 'androiddebugkey'
|
||||
|
||||
def keystoreKeyPassword = (project.hasProperty('key.alias.password')) ?
|
||||
project.getProperty('key.alias.password') : 'android'
|
||||
|
||||
debug {
|
||||
storeFile keystorePath
|
||||
storePassword keystorePassword
|
||||
keyAlias keystoreKeyAlias
|
||||
keyPassword keystoreKeyPassword
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
release {
|
||||
storeFile keystorePath
|
||||
storePassword keystorePassword
|
||||
keyAlias keystoreKeyAlias
|
||||
keyPassword keystoreKeyPassword
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "NDK_DEBUG=1","USE_ASAN=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "NDK_DEBUG=0","USE_ASAN=0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WORKAROUND: On Mac OS X, running ndk-build clean with a high num of parallel executions
|
||||
// set may result in the following build error: rm: fts_read: No such file or directory.
|
||||
// Currently, there isn't a good way to specify numProcs=1 only on clean. So, in order
|
||||
// to work around the issue, delete the auto-generated .externalNativeBuild artifacts
|
||||
// (where $numProcs specified) before executing the clean task.
|
||||
project.clean.dependsOn project.cleanWorkAround
|
||||
|
||||
project.clean {
|
||||
// remove the auto-generated debug keystore (currently generated by python build script)
|
||||
// delete "android.debug.keystore"
|
||||
}
|
||||
|
||||
project.afterEvaluate {
|
||||
Task initDeviceList = project.task( "initDeviceList()" ).doLast {
|
||||
project.ext.deviceMap = [ : ]
|
||||
if (project.hasProperty( "should_install" ) == true) {
|
||||
AndroidDebugBridge.initIfNeeded( false )
|
||||
AndroidDebugBridge bridge = AndroidDebugBridge.createBridge( project.android.getAdbExe().absolutePath, false )
|
||||
|
||||
long timeOut = 30000 // 30 sec
|
||||
int sleepTime = 1000
|
||||
while ( !bridge.hasInitialDeviceList() && timeOut > 0 ) {
|
||||
sleep( sleepTime )
|
||||
timeOut -= sleepTime
|
||||
}
|
||||
if ( timeOut <= 0 && !bridge.hasInitialDeviceList() ) {
|
||||
throw new RuntimeException( "Timeout getting device list.", null )
|
||||
}
|
||||
|
||||
// if a device is connected both physically and over the network, only include the physical ID
|
||||
if ( project.hasProperty( "should_install" ) == true ) {
|
||||
bridge.devices.split { it.getProperty( "ro.serialno" ) != it.serialNumber }.each {
|
||||
it.collectEntries( project.deviceMap, { [ ( it.getProperty( "ro.serialno" )) : it ] } )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.task( "stopApk", dependsOn: initDeviceList ) {
|
||||
description "Stops app if currently running on device"
|
||||
}.doLast {
|
||||
project.deviceMap.each { deviceSerial, device ->
|
||||
stopApk( device, android.defaultConfig.applicationId )
|
||||
}
|
||||
}
|
||||
|
||||
project.android.applicationVariants.all { variant ->
|
||||
Task installAndRun = project.task( "installAndRun${variant.name.capitalize()}" ) {
|
||||
dependsOn variant.assembleProvider.get()
|
||||
dependsOn initDeviceList
|
||||
onlyIf { project.hasProperty( "should_install" ) }
|
||||
description "Installs and runs the APK file"
|
||||
}.doLast { variant.outputs.each { output ->
|
||||
if ( output.outputFile.exists() ) {
|
||||
if ( project.deviceMap.size() == 0 ) {
|
||||
project.logger.quiet "Install requested, but no devices found."
|
||||
} else {
|
||||
project.deviceMap.each { deviceSerial, device ->
|
||||
installApk( device, output.outputFile, project.android.defaultConfig.applicationId )
|
||||
runApk( device, new File(output.processManifest.manifestOutputDirectory.get().asFile, "AndroidManifest.xml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
variant.assembleProvider.get().finalizedBy installAndRun
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround to fix issue in Android Studio Chipmunk 2021.2.1 and later
|
||||
// where opening a project would result in a 'prepareKotlinBuildScriptModel'
|
||||
// not found error
|
||||
if (!tasks.findByName("prepareKotlinBuildScriptModel")) {
|
||||
tasks.register("prepareKotlinBuildScriptModel") {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
apply plugin: XrAppPlugin
|
22
build.gradle
22
build.gradle
|
@ -1,22 +0,0 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
org.gradle.jvmargs=-Xmx1536M
|
||||
org.gradle.caching=true
|
||||
org.gradle.configureondemand=true
|
|
@ -1,9 +0,0 @@
|
|||
## This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Thu Dec 12 20:21:11 GMT 2019
|
||||
ndk.dir=C\:\\Users\\Simon\\AppData\\Local\\Android\\Sdk\\ndk\\21.1.6352462
|
||||
sdk.dir=C\:\\Users\\Simon\\AppData\\Local\\Android\\Sdk
|
Loading…
Reference in a new issue