build.gradle 1.28 KB
Newer Older
1
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2 3

allprojects {
4
	repositories {
5 6
		jcenter()
		mavenLocal()
7
		google()
8 9 10 11 12
	}
}

buildscript {
	repositories {
13
		jcenter()
14
		mavenLocal()
15
		google()
16
		maven {
17
			url 'https://plugins.gradle.org/m2/'
18
		}
19
	}
20

21
	dependencies {
akwizgran's avatar
akwizgran committed
22
		classpath 'com.android.tools.build:gradle:3.1.2'
23
		classpath 'net.ltgt.gradle:gradle-apt-plugin:0.9'
24
		classpath 'de.undercouch:gradle-download-task:3.2.0'
akwizgran's avatar
akwizgran committed
25
		classpath files('libs/gradle-witness.jar')
26
	}
27
}
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs
ext.useJava6StandardLibrary = { task ->
	def home = System.env.JAVA_6_HOME;
	if (home != null && !home.isEmpty()) {
		println "Setting Java 6 bootstrap classpath for ${task.name}"
		task.dependsOn createJavaLangInvokeJar
		task.options.bootstrapClasspath = files(
				"${project.rootDir}/build/invoke.jar",
				"${home}/jre/lib/rt.jar",
				"${home}/jre/lib/jsse.jar"
		)
	}
}

// Create a jar containing the java.lang.invoke classes for the Java 6 bootstrap classpath
task createJavaLangInvokeJar(type: Zip) {
	archiveName 'invoke.jar'
	destinationDir file("${project.rootDir}/build")
	from zipTree("${System.getProperty('java.home')}/lib/rt.jar").matching {
		include 'java/lang/invoke/*'
	}
	include '**/*'
}