1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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 52 53 54 55 56 57 58 59 60 61
|
plugins {
id 'java'
id 'java-gradle-plugin'
}
if (!gradle.gradleVersion.startsWith("2.")) {
throw new GradleException("Use build.gradle for executing build with modern Gradle")
} else if (Boolean.getBoolean('net.bytebuddy.gradle.release')) {
throw new GradleException("Cannot apply release using legacy build");
}
ext.pom = new groovy.util.XmlSlurper().parse(rootProject.file('pom.xml'))
ext.outerPom = new groovy.util.XmlSlurper().parse(file('../pom.xml'))
apply from: 'common.gradle'
group = pom.parent.groupId.text().toString()
version = pom.parent.version.text().toString()
description = pom.description.text().toString()
repositories {
maven {
url 'http://insecure.repo1.maven.org/maven2/'
}
}
dependencies {
compile gradleApi()
// At this point, it is not given that any artifact from the Maven build can be found in a repository.
def location = new File(project.buildscript.sourceFile.getParentFile(), "../byte-buddy/target/byte-buddy-${version}.jar").canonicalFile
logger.info("Relying on ${location.absolutePath} as Byte Buddy dependency")
if (location.exists()) {
compile files(location.absolutePath)
} else {
logger.warn("${location.absolutePath} does not exist, can clean but not build project")
}
compileOnly group: 'com.google.code.findbugs', name: 'findbugs-annotations', version: outerPom.properties.'version.utility.findbugs'
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: outerPom.properties.'version.utility.jsr305'
testCompile gradleTestKit()
testCompile group: 'junit', name: 'junit', version: outerPom.properties.'version.junit'
testCompile(group: 'org.mockito', name: 'mockito-core', version: outerPom.properties.'version.mockito') {
exclude group: 'net.bytebuddy'
}
testCompileOnly group: 'com.google.code.findbugs', name: 'findbugs-annotations', version: outerPom.properties.'version.utility.findbugs'
testCompileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: outerPom.properties.'version.utility.jsr305'
}
sourceSets.main.java.srcDirs += ['src/main/java-gradle-api']
jar {
exclude('org/**')
}
gradlePlugin {
plugins {
byteBuddyPlugin {
id = pom.parent.groupId.text().toString() + '.' + pom.artifactId.text().toString()
description = pom.description.text().toString()
implementationClass = 'net.bytebuddy.build.gradle.ByteBuddyPlugin'
}
}
}
|