blob: 419a77409249e80c30ddb3345cfb34ed633451c0 [file] [log] [blame]
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'wrapper'
repositories {
mavenCentral()
}
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
def isLinux() {
return System.properties['os.name'].toLowerCase().contains("linux")
}
def isMacOsX() {
return System.properties['os.name'].toLowerCase().contains("os x")
}
def String getOsName() {
if (isLinux()) {
return "linux";
} else if (isMacOsX()) {
return "macosx";
} else {
throw new IllegalStateException("Unsupported operating system " + System.properties.'os.name')
}
}
dependencies {
compile gradleApi()
compile localGroovy()
testCompile 'com.google.truth:truth:0.27'
}
task buildVdl(type: Exec) {
description 'Build the VDL tool'
group 'Build'
commandLine 'jiri', 'go', 'build', '-o', 'build/vdltool/vdl-' + getOsName(), 'v.io/x/ref/cmd/vdl'
}
task natives(type: Jar, dependsOn: buildVdl) {
from 'build/vdltool/vdl-' + getOsName()
}
tasks.'processResources'.dependsOn(buildVdl)
def pomDependencyText = '''
<dependencies>
<dependency>
<groupId>io.v</groupId>
<artifactId>gradle-plugin-vdltool-linux</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.v</groupId>
<artifactId>gradle-plugin-vdltool-macosx</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
'''
def pomDependencies = new XmlParser().parseText(pomDependencyText)
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'io.v'
artifactId 'gradle-plugin'
version '0.1-SNAPSHOT'
from components.java
pom.withXml {
asNode().append(pomDependencies)
}
}
mavenNatives(MavenPublication) {
groupId 'io.v'
artifactId 'gradle-plugin-vdltool-' + getOsName()
version '0.1-SNAPSHOT'
artifact natives
}
}
repositories {
maven {
credentials {
username 'admin'
password 'admin123'
}
url 'http://srdjan.mtv:8081/nexus/content/repositories/test_repo'
}
}
}
wrapper {
gradleVersion = '2.4'
}