The open source OpenXR runtime
at main 99 lines 3.1 kB view raw
1// Copyright 2020-2022, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3 4plugins { 5 id 'com.android.library' 6 id 'kotlin-android' 7 8 id 'kotlin-kapt' 9 id 'dagger.hilt.android.plugin' 10 11 id 'com.diffplug.spotless' 12} 13 14android { 15 compileSdk project.sharedCompileSdk 16 buildToolsVersion = buildToolsVersion 17 18 19 defaultConfig { 20 // needed for ASharedMemory, etc. 21 minSdkVersion 26 22 targetSdkVersion project.sharedTargetSdk 23 24 def defaultServiceLibName = "monado-service" 25 def serviceLibName = project.hasProperty("serviceLibName") ? 26 project.serviceLibName : defaultServiceLibName 27 if (serviceLibName == null || serviceLibName.length() == 0) { 28 serviceLibName = defaultServiceLibName 29 } 30 31 // Single point of truth for these names. 32 def serviceAction = "org.freedesktop.monado.ipc.CONNECT" 33 def shutdownAction = "org.freedesktop.monado.ipc.SHUTDOWN" 34 manifestPlaceholders = [ 35 serviceActionName : serviceAction, 36 shutdownActionName: shutdownAction 37 ] 38 buildConfigField("String", "SERVICE_ACTION", "\"${serviceAction}\"") 39 buildConfigField("String", "SHUTDOWN_ACTION", "\"${shutdownAction}\"") 40 buildConfigField("Long", "WATCHDOG_TIMEOUT_MILLISECONDS", "1500L") 41 buildConfigField("String", "SERVICE_LIB_NAME", "\"${serviceLibName}\"") 42 } 43 44 buildTypes { 45 release { 46 minifyEnabled false 47 // Gradle plugin produces proguard-android-optimize.txt from @Keep annotations 48 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 49 } 50 } 51 52 compileOptions { 53 sourceCompatibility JavaVersion.VERSION_17 54 targetCompatibility JavaVersion.VERSION_17 55 } 56 kotlinOptions { 57 jvmTarget = JavaVersion.VERSION_17 58 } 59 packagingOptions { 60 resources { 61 excludes += ['META-INF/*.kotlin_module'] 62 } 63 } 64 namespace 'org.freedesktop.monado.ipc' 65 lint { 66 fatal 'StopShip' 67 } 68 buildFeatures { 69 aidl true 70 buildConfig true 71 } 72} 73 74dependencies { 75 implementation project(':src:xrt:auxiliary') 76 implementation "androidx.annotation:annotation:$androidxAnnotationVersion" 77 implementation "androidx.core:core-ktx:$androidxCoreVersion" 78 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" 79 80 // for Hilt dependency injection 81 api "com.google.dagger:hilt-android:$hiltVersion" 82 kapt "com.google.dagger:hilt-compiler:$hiltVersion" 83} 84 85spotless { 86 java { 87 target 'src/main/java/**/*.java' 88 // apply a specific flavor of google-java-format. 89 googleJavaFormat('1.18.1').aosp().reflowLongStrings() 90 // fix formatting of type annotations. 91 formatAnnotations() 92 } 93 94 kotlin { 95 target 'src/main/java/**/*.kt' 96 // Use ktfmt(https://github.com/facebook/ktfmt) as the default Kotlin formatter. 97 ktfmt("$ktfmtVersion").kotlinlangStyle() 98 } 99}