Warning, /network/kdeconnect-android/build.gradle is written in an unsupported language. File is not indexed.
0001 import com.android.build.gradle.AppExtension 0002 import com.android.build.gradle.api.ApkVariantOutput 0003 import com.android.build.gradle.api.ApplicationVariant 0004 import com.github.jk1.license.render.TextReportRenderer 0005 0006 buildscript { 0007 ext.kotlin_version = '1.8.0' 0008 dependencies { 0009 classpath 'com.android.tools.build:gradle:7.4.2' 0010 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 0011 } 0012 } 0013 0014 plugins { 0015 id 'com.github.jk1.dependency-license-report' version '1.16' 0016 } 0017 def licenseResDir = new File("$projectDir/build/dependency-license-res") 0018 0019 apply plugin: 'com.android.application' 0020 apply plugin: 'kotlin-android' 0021 0022 android { 0023 compileSdkVersion 33 0024 defaultConfig { 0025 minSdkVersion 21 0026 targetSdkVersion 32 0027 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 0028 } 0029 buildFeatures { 0030 viewBinding true 0031 } 0032 compileOptions { 0033 sourceCompatibility JavaVersion.VERSION_1_8 0034 targetCompatibility JavaVersion.VERSION_1_8 0035 0036 // Flag to enable support for the new language APIs 0037 coreLibraryDesugaringEnabled true 0038 } 0039 kotlinOptions { 0040 jvmTarget = '1.8' 0041 } 0042 sourceSets { 0043 main { 0044 manifest.srcFile 'AndroidManifest.xml' 0045 java.srcDirs = ['src'] 0046 resources.srcDirs = ['resources'] 0047 res.srcDirs = [licenseResDir, 'res'] 0048 assets.srcDirs = ['assets'] 0049 } 0050 test { 0051 java.srcDirs = ['tests'] 0052 } 0053 } 0054 packagingOptions { 0055 resources { 0056 merges += ['META-INF/DEPENDENCIES', 'META-INF/LICENSE', 'META-INF/NOTICE'] 0057 } 0058 } 0059 signingConfigs { 0060 debug { 0061 storeFile file("debug.keystore") 0062 storePassword 'android' 0063 keyAlias 'androiddebugkey' 0064 keyPassword 'android' 0065 } 0066 } 0067 buildTypes { 0068 debug { 0069 minifyEnabled true 0070 shrinkResources true 0071 signingConfig signingConfigs.debug 0072 } 0073 // keep minifyEnabled false above for faster builds; set to 'true' 0074 // when testing to make sure ProGuard/R8 is not deleting important stuff 0075 release { 0076 minifyEnabled true 0077 shrinkResources true 0078 } 0079 } 0080 lint { 0081 abortOnError false 0082 checkReleaseBuilds false 0083 } 0084 } 0085 0086 /** 0087 * This is a special on-demand Gradle object. 0088 * 0089 * Its value will not be determined until someone calls one of the gitHashProvider.getXXX() methods. 0090 * 0091 * If it does not encounter an explicit 'return' statement, getHashProvider.isPresent() will return false. 0092 */ 0093 Provider<String> gitHashProvider = project.provider { 0094 Process gitCommand = null 0095 try { 0096 // This invokes 'git' immediately, but does not wait for it to finish 0097 gitCommand = 'git rev-parse --short HEAD'.execute([], project.rootDir) 0098 } catch (IOException ignored) { 0099 } 0100 0101 if (gitCommand == null) { 0102 logger.log(LogLevel.WARN, "Could not make use of the 'git' command-line tool. Output filenames will not be customized.") 0103 } else if (gitCommand.waitFor() == 0) { 0104 // This call to '::getText' (using the 'text' Groovy accessor syntax) collects the 0105 // output stream 0106 return '-' + gitCommand.text.trim() 0107 } else { 0108 logger.log( 0109 LogLevel.WARN, 0110 "Could not determine which commit is currently checked out -" + 0111 " did you download this code without the .git directory?" 0112 ) 0113 } 0114 } 0115 0116 // We know we can safely cast the 'android' type to the 'AppExtension' class because 0117 // we used the 'com.android.application' plugin at the top of the file. 0118 // 0119 // Note the use of the '::all' extension method; unlike '::each', it can detect every 0120 // object added to the collection, no matter in which build phase that happens. 0121 (android as AppExtension).applicationVariants.all { ApplicationVariant v -> 0122 logger.log(LogLevel.INFO, "Found a variant called '${v.name}'.") 0123 if (v.buildType.debuggable) { 0124 // We're looking at variants made from android.buildTypes.debug! This one 0125 // might have multiple outputs, but only one output will be an APK file. 0126 v.outputs.matching { it instanceof ApkVariantOutput }.all { 0127 // Default output filename is "${project.name}-${v.name}.apk". We want 0128 // the Git commit short-hash to be added onto that default filename. 0129 (it as ApkVariantOutput).outputFileName = "${project.name}-${v.name}${gitHashProvider.getOrElse("")}.apk" 0130 } 0131 } 0132 } 0133 0134 ext { 0135 coroutines_version = '1.6.4' 0136 } 0137 0138 dependencies { 0139 coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2' 0140 implementation 'androidx.multidex:multidex:2.0.1' 0141 0142 implementation 'androidx.media:media:1.6.0' 0143 implementation 'androidx.appcompat:appcompat:1.6.1' 0144 implementation 'androidx.core:core-ktx:1.9.0' 0145 implementation 'androidx.preference:preference-ktx:1.2.0' 0146 implementation 'androidx.recyclerview:recyclerview:1.3.0' 0147 implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' 0148 implementation 'androidx.documentfile:documentfile:1.0.1' 0149 implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0" 0150 implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.0' 0151 implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" 0152 implementation 'androidx.lifecycle:lifecycle-common-java8:2.6.0' 0153 implementation 'androidx.gridlayout:gridlayout:1.0.0' 0154 implementation 'com.google.android.material:material:1.8.0' 0155 implementation 'com.jakewharton:disklrucache:2.0.2' //For caching album art bitmaps 0156 implementation 'com.jaredrummler:android-device-names:1.1.9' //To get a human-friendly device name 0157 0158 implementation 'org.apache.sshd:sshd-core:0.14.0' 0159 implementation 'org.apache.mina:mina-core:2.0.19' //For some reason, makes sshd-core:0.14.0 work without NIO, which isn't available until Android 8 (api 26) 0160 0161 //implementation('com.github.bright:slf4android:0.1.6') { transitive = true } // For org.apache.sshd debugging 0162 implementation 'org.bouncycastle:bcpkix-jdk15on:1.70' //For SSL certificate generation 0163 0164 implementation 'org.atteo.classindex:classindex:3.13' 0165 annotationProcessor 'org.atteo.classindex:classindex:3.13' 0166 0167 // The android-smsmms library is the only way I know to handle MMS in Android 0168 // (Shouldn't a phone OS make phone things easy?) 0169 // This library was originally authored as com.klinkerapps at https://github.com/klinker41/android-smsmms. 0170 // However, that version is under-loved. I have therefore made "some fixes" and published it. 0171 // Please see https://invent.kde.org/sredman/android-smsmms/-/tree/master 0172 implementation 'org.kde.invent.sredman:android-smsmms:kdeconnect-1-21-0' 0173 implementation 'com.klinkerapps:logger:1.0.3' 0174 0175 implementation 'commons-io:commons-io:2.11.0' 0176 implementation 'org.apache.commons:commons-collections4:4.4' 0177 implementation 'org.apache.commons:commons-lang3:3.12.0' 0178 0179 // Kotlin 0180 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 0181 implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" 0182 implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" 0183 0184 // Testing 0185 testImplementation 'junit:junit:4.13.2' 0186 testImplementation 'org.powermock:powermock-core:2.0.0' 0187 testImplementation 'org.powermock:powermock-module-junit4:2.0.0' 0188 testImplementation 'org.powermock:powermock-api-mockito2:2.0.0' 0189 testImplementation 'org.mockito:mockito-core:3.12.4' // powermock isn't compatible with mockito 4 0190 testImplementation 'org.skyscreamer:jsonassert:1.5.1' 0191 0192 // For device controls 0193 implementation 'org.reactivestreams:reactive-streams:1.0.4' 0194 implementation 'io.reactivex.rxjava2:rxjava:2.2.21' 0195 } 0196 0197 licenseReport { 0198 configurations = ALL 0199 renderers = [new TextReportRenderer()] 0200 } 0201 generateLicenseReport.doLast { 0202 def target = new File(licenseResDir, "raw/license") 0203 target.parentFile.mkdirs() 0204 target.text = 0205 files("COPYING", "$projectDir/build/reports/dependency-license/THIRD-PARTY-NOTICES.txt") 0206 .collect { it.getText() }.join('\n') 0207 } 0208 preBuild.dependsOn(generateLicenseReport)