aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: c7898214228e109c72eaaaf07d7299697045653f (plain) (blame)
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
/*
 buildfile for gradle (http://gradle.org/)
*/

apply plugin: 'java'

buildDir = "$projectDir/build-gradle"

if (null == System.getenv('GNJ_HOME')) {
  throw new InvalidUserDataException('environment variable GNJ_HOME not set')
}

if (null == System.getenv('GNJ_DEPS')) {
  throw new InvalidUserDataException('environment variable GNJ_DEPS not set')
}

repositories {
  flatDir {
    dirs "$System.env.GNJ_HOME", "$System.env.GNJ_DEPS"
  }
}

dependencies {
  compile name: 'gnunet-java'
  compile name: 'guava', version: '12.0'
}

sourceSets {
  main {
    java {
      srcDir 'src'
    }
    resources {
      srcDir 'src'
    }
  }
  test {
    java {
      srcDir 'test'
    }
    resources {
      srcDir 'test'
    }
  }
}

compileJava.options.debugOptions.debugLevel = "source,lines,vars"

/*
TODO: should we really use the compile task for this?
*/
task msgtypes (type: JavaCompile) {
  description = "Updates the index of GNUnet message types known to gnunet-java."
  classpath = project.sourceSets.main.runtimeClasspath
  source = files(project.sourceSets.main.allJava)
  options.setCompilerArgs(["-processor", "org.gnunet.construct.MessageIdAnnotationProcessor",
                           "-proc:only",
                           "-s", "src"])
  destinationDir = file("$buildDir/classes/main/")
}