blob: 7019fb143802ea577743a2365e2a6183c6a9a500 [file] [log] [blame]
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
static String getSdkPlatformPath() {
String os = System.getProperty("os.name")
if (os.startsWith("Mac OS")) {
return "darwin"
} else if (os.startsWith("Windows")) {
return "windows"
} else if (os.startsWith("Linux")) {
return "linux"
}
throw RuntimeException("Unexpected platform " + os)
}
File androidJar =
file('../../../../prebuilts/studio/sdk/' + getSdkPlatformPath() + '/platforms/android-27/android.jar')
if (!androidJar.exists()) {
// If not there, we're in one of the AOSP release branches where the
// repo configuration does not include the whole prebuilts repository.
// Fetch the SDK via $ANDROID_HOME instead.
File jar = file(System.env.ANDROID_HOME + '/platforms/android-25/android.jar');
if (jar.exists()) {
androidJar = jar
} else {
throw new RuntimeException("android-25 android.jar not found at " + androidJar.absolutePath)
}
}
repositories {
maven { url System.env.ANDROID_HOME + '/extras/android/m2repository/' }
}
configurations {
provided
}
dependencies {
compile project(':base:instant-run:instant-run-runtime')
provided files(androidJar)
}
sourceSets {
main { compileClasspath += configurations.provided }
}
jar {
from {
configurations.compile.collect { it.isFile() ? zipTree(it) : it }
}
exclude('com/android/annotations/**', 'NOTICE')
}
// set proper classpath and turn off strict mode.
tasks.withType(Javadoc) {
classpath += files(androidJar)
}