Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5d5e6f709580b97c92f8b3b59ab4f4d44328d5a4 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
include_defs('//tools/git.defs')

java_library(
  name = 'pgm',
  srcs = glob(['src/**']),
  resources = glob(['resources/**']),
  deps = [
    ':services',
    '//org.eclipse.jgit:jgit',
    '//org.eclipse.jgit.archive:jgit-archive',
    '//org.eclipse.jgit.http.apache:http-apache',
    '//org.eclipse.jgit.lfs:jgit-lfs',
    '//org.eclipse.jgit.lfs.server:jgit-lfs-server',
    '//org.eclipse.jgit.ui:ui',
    '//lib:args4j',
    '//lib:httpcomponents',
    '//lib:httpcore',
    '//lib/jetty:http',
    '//lib/jetty:io',
    '//lib/jetty:server',
    '//lib/jetty:servlet',
    '//lib/jetty:security',
    '//lib/jetty:util',
    '//lib:servlet-api'
  ],
  visibility = ['PUBLIC'],
)

prebuilt_jar(
  name = 'services',
  binary_jar = ':services__jar',
)

genrule(
  name = 'services__jar',
  cmd = 'cd $SRCDIR ; zip -qr $OUT .',
  srcs = glob(['META-INF/services/*']),
  out = 'services.jar',
)

genrule(
  name = 'jgit',
  cmd = ''.join([
    'mkdir $TMP/META-INF &&',
    'cp $(location :binary_manifest) $TMP/META-INF/MANIFEST.MF &&',
    'cp $(location :jgit_jar) $TMP/jgit.jar &&',
    'cd $TMP && zip $TMP/jgit.jar META-INF/MANIFEST.MF &&',
    'cat $SRCDIR/jgit.sh $TMP/jgit.jar >$OUT &&',
    'chmod a+x $OUT',
  ]),
  srcs = ['jgit.sh'],
  out = 'jgit',
  visibility = ['PUBLIC'],
)

java_binary(
  name = 'jgit_jar',
  deps = [
    ':pgm',
    '//lib:slf4j-simple',
    '//lib:tukaani-xz',
  ],
  blacklist = [
    'META-INF/DEPENDENCIES',
    'META-INF/maven/.*',
  ],
)

genrule(
  name = 'binary_manifest',
  cmd = ';'.join(['echo "%s: %s" >>$OUT' % e for e in [
    ('Manifest-Version', '1.0'),
    ('Main-Class', 'org.eclipse.jgit.pgm.Main'),
    ('Bundle-Version', git_version()),
    ('Implementation-Title', 'JGit Command Line Interface'),
    ('Implementation-Vendor', 'Eclipse.org - JGit'),
    ('Implementation-Vendor-URL', 'http://www.eclipse.org/jgit/'),
    ('Implementation-Vendor-Id', 'org.eclipse.jgit'),
  ]] + ['echo >>$OUT']),
  out = 'MANIFEST.MF',
)

Back to the top