summaryrefslogtreecommitdiffstats
path: root/solenv/buck/build.defs
blob: f6a1a7463b9481cd1ebc2e387f8be25a4d703946 (plain)
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
def java_sources(
    name,
    srcs,
    root = None,
    visibility = []
  ):
  java_library(
    name = name,
    resources = srcs,
    resources_root = root,
    visibility = visibility,
  )

def java_doc(
    name,
    title,
    pkgs,
    paths,
    srcs = [],
    deps = [],
    visibility = [],
    do_it_wrong = False,
  ):
  if do_it_wrong:
    sourcepath = paths
  else:
    sourcepath = ['$SRCDIR/' + n for n in paths]
  genrule(
    name = name,
    cmd = ' '.join([
      'while ! test -f .buckconfig; do cd ..; done;',
      'javadoc',
      '-quiet',
      '-protected',
      '-encoding UTF-8',
      '-charset UTF-8',
      '-notimestamp',
      '-windowtitle "' + title + '"',
      '-link http://docs.oracle.com/javase/7/docs/api',
      '-subpackages ',
      ':'.join(pkgs),
      '-sourcepath ',
      ':'.join(sourcepath),
      ' -classpath ',
      ':'.join(['$(location %s)' % n for n in deps]),
      '-d $TMP',
    ]) + ';jar cf $OUT -C $TMP .',
    srcs = srcs,
    out = name + '.jar',
    visibility = visibility,
)