xref: /aosp_15_r20/external/mobly-bundled-snippets/build.gradle (revision f8709298c7f2c449bb8c80b03fabe16c67b8969c)
1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.3.1'
8
9        // NOTE: Do not place your application dependencies here.
10    }
11}
12
13plugins {
14    id "com.github.sherter.google-java-format" version "0.9"
15}
16
17allprojects {
18    repositories {
19        google()
20        mavenCentral()
21    }
22    gradle.projectsEvaluated {
23        tasks.withType(JavaCompile) {
24            options.compilerArgs << "-Xlint:all"
25        }
26    }
27}
28
29apply plugin: 'com.android.application'
30
31android {
32    compileSdk 33
33
34    defaultConfig {
35        applicationId "com.google.android.mobly.snippet.bundled"
36        minSdk 26
37        targetSdk 33
38        versionCode 1
39        versionName "0.0.1"
40        setProperty("archivesBaseName", "mobly-bundled-snippets")
41        multiDexEnabled true
42    }
43    compileOptions {
44        sourceCompatibility JavaVersion.VERSION_1_8
45        targetCompatibility JavaVersion.VERSION_1_8
46    }
47    lintOptions {
48        abortOnError false
49        checkAllWarnings true
50        warningsAsErrors true
51        disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi'
52    }
53}
54
55// Produces a jar of source files. Needed for compliance reasons.
56task sourcesJar(type: Jar) {
57    from android.sourceSets.main.java.srcDirs
58    classifier = 'src'
59}
60
61task javadoc(type: Javadoc) {
62    source = android.sourceSets.main.java.srcDirs
63    classpath += project.files(
64        android.getBootClasspath().join(File.pathSeparator))
65}
66
67artifacts {
68    archives sourcesJar
69}
70
71dependencies {
72    implementation 'androidx.test:runner:1.5.2'
73    implementation 'com.android.support:multidex:1.0.3'
74    implementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
75    implementation 'com.google.android.mobly:mobly-snippet-lib:1.4.0'
76    implementation 'com.google.code.gson:gson:2.8.6'
77    implementation 'com.google.guava:guava:31.0.1-jre'
78    implementation 'com.google.errorprone:error_prone_annotations:2.15.0'
79    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10'
80
81    testImplementation 'com.google.errorprone:error_prone_annotations:2.15.0'
82    testImplementation 'com.google.guava:guava:31.0.1-jre'
83    testImplementation 'com.google.truth:truth:1.1.2'
84    testImplementation 'junit:junit:4.13.2'
85}
86
87googleJavaFormat {
88    options style: 'AOSP'
89}
90
91// Open lint's HTML report in your default browser or viewer.
92task openLintReport(type: Exec) {
93    def lint_report = "build/reports/lint-results.html"
94    def cmd = "cat"
95    def platform = System.getProperty('os.name').toLowerCase(Locale.ROOT)
96    if (platform.contains("linux")) {
97        cmd = "xdg-open"
98    } else if (platform.contains("mac os x")) {
99        cmd = "open"
100    } else if (platform.contains("windows")) {
101        cmd = "launch"
102    }
103    commandLine cmd, lint_report
104}
105
106task presubmit {
107    dependsOn { ['googleJavaFormat', 'lint', 'openLintReport'] }
108    doLast {
109        println "Fix any lint issues you see. When it looks good, submit the pull request."
110    }
111}
112
113