| buildscript { |
| repositories { |
| mavenCentral() |
| } |
| |
| dependencies { |
| classpath 'com.android.tools.build:gradle:1.2.3' |
| classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' |
| } |
| } |
| |
| apply plugin: 'java' |
| |
| repositories { |
| mavenCentral() |
| |
| maven { |
| url "http://srdjan.mtv:8081/nexus/content/repositories/test_repo/" |
| } |
| } |
| |
| dependencies { |
| compile 'io.v:vanadium:0.1-SNAPSHOT' |
| compile group: 'com.google.guava', name: 'guava', version: '18.0' |
| testCompile group: 'junit', name: 'junit', version: '4.12' |
| testCompile group: 'com.google.truth', name: 'truth', version: '0.25' |
| } |
| |
| class VanadiumEnvironment { |
| File v23Root; |
| File v23Bin; |
| |
| public static getVanadiumEnvironment() { |
| VanadiumEnvironment result = new VanadiumEnvironment() |
| |
| if (!System.getenv().containsKey('V23_ROOT')) { |
| throw new InvalidUserDataException("V23_ROOT is not set. " |
| + "Please follow the Vanadium installation instructions at " |
| + "https://v.io/installation/index.html") |
| } |
| |
| result.v23Root = new File(System.getenv()['V23_ROOT']) |
| result.v23Bin = new File(result.v23Root, ['devtools', 'bin', 'v23'].join(File.separator)) |
| if (!result.v23Bin.exists() || !result.v23Bin.isFile() || !result.v23Bin.canExecute()) { |
| throw new InvalidUserDataException( |
| result.v23Bin.toString() + " does not exist or is not an executable file. " |
| + "Please follow the Vanadium installation instructions at " |
| + "https://v.io/installation/index.html") |
| } |
| return result |
| } |
| } |
| |
| def v23Root = VanadiumEnvironment.getVanadiumEnvironment().v23Root.getAbsolutePath() |
| def v23Bin = VanadiumEnvironment.getVanadiumEnvironment().v23Bin.getAbsolutePath() |
| def vdlBin = [v23Root, 'release', 'go', 'bin', 'vdl'].join(File.separator) |
| def vdlPath = [ [v23Root, 'roadmap', 'go', 'src'].join(File.separator), |
| [v23Root, 'release', 'go', 'src'].join(File.separator) ].join(":") |
| |
| sourceSets.main.java.srcDirs += 'generated-src/vdl' |
| |
| task buildVdlTool(type: Exec) { |
| commandLine v23Bin, 'go', 'install', 'v.io/x/ref/cmd/vdl' |
| } |
| |
| task generateVdl(type: Exec, dependsOn: buildVdlTool) { |
| environment VDLPATH: vdlPath |
| commandLine vdlBin, 'generate', '--lang=java', '--java-out-dir=generated-src/vdl', 'all' |
| } |
| |
| tasks.'compileJava'.dependsOn(generateVdl) |