blob: 82e103d1d1c73f17ba3e7b890317dd33d8bf112e [file] [log] [blame]
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here.
}
}
plugins {
id "com.github.sherter.google-java-format" version "0.9"
}
allprojects {
repositories {
google()
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.google.android.mobly.snippet.bundled"
minSdkVersion 15
// Set target to 22 to avoid having to deal with runtime permissions.
targetSdkVersion 22
versionCode 1
versionName "0.0.1"
setProperty("archivesBaseName", "mobly-bundled-snippets")
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
checkAllWarnings true
warningsAsErrors true
disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi'
}
}
// Produces a jar of source files. Needed for compliance reasons.
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'src'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(
android.getBootClasspath().join(File.pathSeparator))
}
artifacts {
archives sourcesJar
}
dependencies {
implementation 'androidx.test:runner:1.3.0'
implementation 'com.google.android.mobly:mobly-snippet-lib:1.2.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.guava:guava:30.1-jre'
implementation 'com.google.errorprone:error_prone_annotations:2.5.1'
testImplementation 'com.google.errorprone:error_prone_annotations:2.5.1'
testImplementation 'com.google.guava:guava:30.1-jre'
testImplementation 'com.google.truth:truth:1.1.2'
testImplementation 'junit:junit:4.13.2'
}
googleJavaFormat {
options style: 'AOSP'
}
// Open lint's HTML report in your default browser or viewer.
task openLintReport(type: Exec) {
def lint_report = "build/reports/lint-results.html"
def cmd = "cat"
def platform = System.getProperty('os.name').toLowerCase(Locale.ROOT)
if (platform.contains("linux")) {
cmd = "xdg-open"
} else if (platform.contains("mac os x")) {
cmd = "open"
} else if (platform.contains("windows")) {
cmd = "launch"
}
commandLine cmd, lint_report
}
task presubmit {
dependsOn { ['googleJavaFormat', 'lint', 'openLintReport'] }
doLast {
println "Fix any lint issues you see. When it looks good, submit the pull request."
}
}