blob: 82e103d1d1c73f17ba3e7b890317dd33d8bf112e [file] [log] [blame]
Alexander Dorokhine876ea662017-01-10 17:42:05 -08001buildscript {
2 repositories {
3 jcenter()
Ang Liec285eb2018-05-21 18:39:40 -07004 google()
Alexander Dorokhine876ea662017-01-10 17:42:05 -08005 }
6 dependencies {
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +08007 classpath 'com.android.tools.build:gradle:4.1.2'
Alexander Dorokhine876ea662017-01-10 17:42:05 -08008
9 // NOTE: Do not place your application dependencies here.
10 }
11}
12
Ang Li0eb024b2017-01-23 15:46:10 -080013plugins {
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080014 id "com.github.sherter.google-java-format" version "0.9"
Ang Li0eb024b2017-01-23 15:46:10 -080015}
16
David T.H. Kaodd918fe2017-02-22 13:54:57 -080017allprojects {
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080018 repositories {
19 google()
20 jcenter()
21 }
David T.H. Kaodd918fe2017-02-22 13:54:57 -080022 gradle.projectsEvaluated {
23 tasks.withType(JavaCompile) {
24 options.compilerArgs << "-Xlint:all"
25 }
26 }
27}
28
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080029apply plugin: 'com.android.application'
30
Alexander Dorokhine876ea662017-01-10 17:42:05 -080031android {
Ang Lib0585482019-06-12 17:34:15 -070032 compileSdkVersion 29
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080033 buildToolsVersion "30.0.2"
Alexander Dorokhine876ea662017-01-10 17:42:05 -080034
35 defaultConfig {
36 applicationId "com.google.android.mobly.snippet.bundled"
tprotopopov-devfe521422020-12-16 03:17:37 -060037 minSdkVersion 15
Alexander Dorokhine9ee1c6e2017-02-13 14:09:18 -080038 // Set target to 22 to avoid having to deal with runtime permissions.
39 targetSdkVersion 22
Alexander Dorokhine876ea662017-01-10 17:42:05 -080040 versionCode 1
41 versionName "0.0.1"
42 setProperty("archivesBaseName", "mobly-bundled-snippets")
Ang Li598a2322018-12-10 16:09:57 -080043 multiDexEnabled true
Ang Li0eb024b2017-01-23 15:46:10 -080044 }
45 compileOptions {
46 sourceCompatibility JavaVersion.VERSION_1_8
47 targetCompatibility JavaVersion.VERSION_1_8
Alexander Dorokhine876ea662017-01-10 17:42:05 -080048 }
David T.H. Kao5b6e67f2017-06-13 13:46:27 -070049 lintOptions {
Keith Dart1bcd4282017-10-05 12:14:42 -070050 abortOnError false
David T.H. Kao5b6e67f2017-06-13 13:46:27 -070051 checkAllWarnings true
52 warningsAsErrors true
Keith Dart1bcd4282017-10-05 12:14:42 -070053 disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi'
David T.H. Kao5b6e67f2017-06-13 13:46:27 -070054 }
Alexander Dorokhine876ea662017-01-10 17:42:05 -080055}
56
adorokhine583ca8d2017-01-30 15:35:45 -080057// Produces a jar of source files. Needed for compliance reasons.
58task sourcesJar(type: Jar) {
59 from android.sourceSets.main.java.srcDirs
60 classifier = 'src'
61}
62
Alexander Dorokhine796a9752017-05-02 19:34:59 -070063task javadoc(type: Javadoc) {
64 source = android.sourceSets.main.java.srcDirs
65 classpath += project.files(
66 android.getBootClasspath().join(File.pathSeparator))
67}
68
adorokhine583ca8d2017-01-30 15:35:45 -080069artifacts {
70 archives sourcesJar
71}
72
Alexander Dorokhine876ea662017-01-10 17:42:05 -080073dependencies {
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080074 implementation 'androidx.test:runner:1.3.0'
Ang Liec285eb2018-05-21 18:39:40 -070075 implementation 'com.google.android.mobly:mobly-snippet-lib:1.2.0'
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080076 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 Dorokhine796a9752017-05-02 19:34:59 -070079
Eric Lin (Tzu Hsiang Lin)a5482442021-02-15 22:46:24 +080080 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 Li0eb024b2017-01-23 15:46:10 -080084}
85
86googleJavaFormat {
87 options style: 'AOSP'
Alexander Dorokhine876ea662017-01-10 17:42:05 -080088}
Keith Dart1bcd4282017-10-05 12:14:42 -070089
90// Open lint's HTML report in your default browser or viewer.
91task 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
105task 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