summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/BUCK
blob: 3df3336b4e3001a3924638772eab1523ed7ab856 (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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
PKG = 'tst/org/eclipse/jgit/'
HELPERS = glob(['src/**/*.java']) + [PKG + c for c in [
  'api/AbstractRemoteCommandTest.java',
  'diff/AbstractDiffTestCase.java',
  'internal/storage/file/GcTestCase.java',
  'internal/storage/file/PackIndexTestCase.java',
  'internal/storage/file/XInputStream.java',
  'nls/GermanTranslatedBundle.java',
  'nls/MissingPropertyBundle.java',
  'nls/NoPropertiesBundle.java',
  'nls/NonTranslatedBundle.java',
  'revwalk/RevQueueTestCase.java',
  'revwalk/RevWalkTestCase.java',
  'transport/SpiTransport.java',
  'treewalk/FileTreeIteratorWithTimeControl.java',
  'treewalk/filter/AlwaysCloneTreeFilter.java',
  'test/resources/SampleDataRepositoryTestCase.java',
  'util/CPUTimeStopWatch.java',
  'util/io/Strings.java',
]]

DATA = [
  PKG + 'lib/empty.gitindex.dat',
  PKG + 'lib/sorttest.gitindex.dat',
]

TESTS = glob(
  ['tst/**/*.java'],
  excludes = HELPERS + DATA,
)

DEPS = {
  PKG + 'nls/RootLocaleTest.java': [
    '//org.eclipse.jgit.pgm:pgm',
    '//org.eclipse.jgit.ui:ui',
  ],
}

for src in TESTS:
  name = src[len('tst/'):len(src)-len('.java')].replace('/', '.')
  labels = []
  if name.startswith('org.eclipse.jgit.'):
    l = name[len('org.eclipse.jgit.'):]
    if l.startswith('internal.storage.'):
      l = l[len('internal.storage.'):]
    i = l.find('.')
    if i > 0:
      labels.append(l[:i])
    else:
      labels.append(i)
  if 'lib' not in labels:
    labels.append('lib')

  java_test(
    name = name,
    labels = labels,
    srcs = [src],
    deps = [
      ':helpers',
      ':tst_rsrc',
      '//org.eclipse.jgit:jgit',
      '//org.eclipse.jgit.junit:junit',
      '//lib:hamcrest-core',
      '//lib:hamcrest-library',
      '//lib:javaewah',
      '//lib:junit',
      '//lib:slf4j-api',
      '//lib:slf4j-simple',
    ] + DEPS.get(src, []),
    source_under_test = ['//org.eclipse.jgit:jgit'],
    vm_args = ['-Xmx256m', '-Dfile.encoding=UTF-8'],
  )

java_library(
  name = 'helpers',
  srcs = HELPERS,
  resources = DATA,
  deps = [
    '//org.eclipse.jgit:jgit',
    '//org.eclipse.jgit.junit:junit',
    '//lib:junit',
  ],
)

prebuilt_jar(
  name = 'tst_rsrc',
  binary_jar = ':tst_rsrc_jar',
)

genrule(
  name = 'tst_rsrc_jar',
  cmd = 'cd $SRCDIR/tst-rsrc ; zip -qr $OUT .',
  srcs = glob(['tst-rsrc/**']),
  out = 'tst_rsrc.jar',
)