The open source OpenXR runtime
1// Copyright 2020-2025, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3
4plugins {
5 id 'com.android.library'
6 id 'kotlin-android'
7
8 // Hilt dependency injection
9 id 'kotlin-kapt'
10 id 'dagger.hilt.android.plugin'
11
12 // SVG files in the "raw" resource directory will be transformed into vector drawables of the same name.
13 id 'com.quittle.svg-2-android-vector'
14
15 // Use spotless to format Java and Kotlin code.
16 id 'com.diffplug.spotless'
17}
18
19spotless {
20 java {
21 target 'src/main/java/**/*.java'
22 // apply a specific flavor of google-java-format.
23 googleJavaFormat('1.18.1').aosp().reflowLongStrings()
24 // fix formatting of type annotations.
25 formatAnnotations()
26 }
27
28 kotlin {
29 target 'src/main/java/**/*.kt'
30 // Use ktfmt(https://github.com/facebook/ktfmt) as the default Kotlin formatter. .
31 ktfmt("$ktfmtVersion").kotlinlangStyle()
32 }
33}
34
35android {
36 compileSdk project.sharedCompileSdk
37 buildToolsVersion = buildToolsVersion
38
39 defaultConfig {
40 minSdkVersion project.sharedMinSdk
41 targetSdkVersion project.sharedTargetSdk
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.android_common'
65 lint {
66 fatal 'StopShip'
67 }
68}
69
70dependencies {
71 implementation project(':src:xrt:auxiliary')
72 implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
73 implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
74 implementation "androidx.constraintlayout:constraintlayout:$androidxConstraintLayoutVersion"
75 implementation "com.google.android.material:material:$materialVersion"
76
77 // Not directly used but included to avoid version conflicts
78 implementation "androidx.lifecycle:lifecycle-viewmodel:$androidxLifecycleVersion"
79 implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$androidxLifecycleVersion"
80
81 // for Hilt dependency injection
82 implementation "com.google.dagger:hilt-android:$hiltVersion"
83 kapt "com.google.dagger:hilt-compiler:$hiltVersion"
84}