Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 1 | buildscript { |
| 2 | repositories { |
| 3 | jcenter() |
Ang Li | ec285eb | 2018-05-21 18:39:40 -0700 | [diff] [blame] | 4 | google() |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 5 | } |
| 6 | dependencies { |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 7 | classpath 'com.android.tools.build:gradle:4.1.2' |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 8 | |
| 9 | // NOTE: Do not place your application dependencies here. |
| 10 | } |
| 11 | } |
| 12 | |
Ang Li | 0eb024b | 2017-01-23 15:46:10 -0800 | [diff] [blame] | 13 | plugins { |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 14 | id "com.github.sherter.google-java-format" version "0.9" |
Ang Li | 0eb024b | 2017-01-23 15:46:10 -0800 | [diff] [blame] | 15 | } |
| 16 | |
David T.H. Kao | dd918fe | 2017-02-22 13:54:57 -0800 | [diff] [blame] | 17 | allprojects { |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 18 | repositories { |
| 19 | google() |
| 20 | jcenter() |
| 21 | } |
David T.H. Kao | dd918fe | 2017-02-22 13:54:57 -0800 | [diff] [blame] | 22 | gradle.projectsEvaluated { |
| 23 | tasks.withType(JavaCompile) { |
| 24 | options.compilerArgs << "-Xlint:all" |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 29 | apply plugin: 'com.android.application' |
| 30 | |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 31 | android { |
Ang Li | b058548 | 2019-06-12 17:34:15 -0700 | [diff] [blame] | 32 | compileSdkVersion 29 |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 33 | buildToolsVersion "30.0.2" |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 34 | |
| 35 | defaultConfig { |
| 36 | applicationId "com.google.android.mobly.snippet.bundled" |
tprotopopov-dev | fe52142 | 2020-12-16 03:17:37 -0600 | [diff] [blame] | 37 | minSdkVersion 15 |
Alexander Dorokhine | 9ee1c6e | 2017-02-13 14:09:18 -0800 | [diff] [blame] | 38 | // Set target to 22 to avoid having to deal with runtime permissions. |
| 39 | targetSdkVersion 22 |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 40 | versionCode 1 |
| 41 | versionName "0.0.1" |
| 42 | setProperty("archivesBaseName", "mobly-bundled-snippets") |
Ang Li | 598a232 | 2018-12-10 16:09:57 -0800 | [diff] [blame] | 43 | multiDexEnabled true |
Ang Li | 0eb024b | 2017-01-23 15:46:10 -0800 | [diff] [blame] | 44 | } |
| 45 | compileOptions { |
| 46 | sourceCompatibility JavaVersion.VERSION_1_8 |
| 47 | targetCompatibility JavaVersion.VERSION_1_8 |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 48 | } |
David T.H. Kao | 5b6e67f | 2017-06-13 13:46:27 -0700 | [diff] [blame] | 49 | lintOptions { |
Keith Dart | 1bcd428 | 2017-10-05 12:14:42 -0700 | [diff] [blame] | 50 | abortOnError false |
David T.H. Kao | 5b6e67f | 2017-06-13 13:46:27 -0700 | [diff] [blame] | 51 | checkAllWarnings true |
| 52 | warningsAsErrors true |
Keith Dart | 1bcd428 | 2017-10-05 12:14:42 -0700 | [diff] [blame] | 53 | disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi' |
David T.H. Kao | 5b6e67f | 2017-06-13 13:46:27 -0700 | [diff] [blame] | 54 | } |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 55 | } |
| 56 | |
adorokhine | 583ca8d | 2017-01-30 15:35:45 -0800 | [diff] [blame] | 57 | // Produces a jar of source files. Needed for compliance reasons. |
| 58 | task sourcesJar(type: Jar) { |
| 59 | from android.sourceSets.main.java.srcDirs |
| 60 | classifier = 'src' |
| 61 | } |
| 62 | |
Alexander Dorokhine | 796a975 | 2017-05-02 19:34:59 -0700 | [diff] [blame] | 63 | task javadoc(type: Javadoc) { |
| 64 | source = android.sourceSets.main.java.srcDirs |
| 65 | classpath += project.files( |
| 66 | android.getBootClasspath().join(File.pathSeparator)) |
| 67 | } |
| 68 | |
adorokhine | 583ca8d | 2017-01-30 15:35:45 -0800 | [diff] [blame] | 69 | artifacts { |
| 70 | archives sourcesJar |
| 71 | } |
| 72 | |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 73 | dependencies { |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 74 | implementation 'androidx.test:runner:1.3.0' |
Ang Li | ec285eb | 2018-05-21 18:39:40 -0700 | [diff] [blame] | 75 | implementation 'com.google.android.mobly:mobly-snippet-lib:1.2.0' |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 76 | implementation 'com.google.code.gson:gson:2.8.6' |
| 77 | implementation 'com.google.guava:guava:30.1-jre' |
| 78 | implementation 'com.google.errorprone:error_prone_annotations:2.5.1' |
Alexander Dorokhine | 796a975 | 2017-05-02 19:34:59 -0700 | [diff] [blame] | 79 | |
Eric Lin (Tzu Hsiang Lin) | a548244 | 2021-02-15 22:46:24 +0800 | [diff] [blame] | 80 | testImplementation 'com.google.errorprone:error_prone_annotations:2.5.1' |
| 81 | testImplementation 'com.google.guava:guava:30.1-jre' |
| 82 | testImplementation 'com.google.truth:truth:1.1.2' |
| 83 | testImplementation 'junit:junit:4.13.2' |
Ang Li | 0eb024b | 2017-01-23 15:46:10 -0800 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | googleJavaFormat { |
| 87 | options style: 'AOSP' |
Alexander Dorokhine | 876ea66 | 2017-01-10 17:42:05 -0800 | [diff] [blame] | 88 | } |
Keith Dart | 1bcd428 | 2017-10-05 12:14:42 -0700 | [diff] [blame] | 89 | |
| 90 | // Open lint's HTML report in your default browser or viewer. |
| 91 | task openLintReport(type: Exec) { |
| 92 | def lint_report = "build/reports/lint-results.html" |
| 93 | def cmd = "cat" |
| 94 | def platform = System.getProperty('os.name').toLowerCase(Locale.ROOT) |
| 95 | if (platform.contains("linux")) { |
| 96 | cmd = "xdg-open" |
| 97 | } else if (platform.contains("mac os x")) { |
| 98 | cmd = "open" |
| 99 | } else if (platform.contains("windows")) { |
| 100 | cmd = "launch" |
| 101 | } |
| 102 | commandLine cmd, lint_report |
| 103 | } |
| 104 | |
| 105 | task presubmit { |
| 106 | dependsOn { ['googleJavaFormat', 'lint', 'openLintReport'] } |
| 107 | doLast { |
| 108 | println "Fix any lint issues you see. When it looks good, submit the pull request." |
| 109 | } |
| 110 | } |
| 111 | |