Browse Source
Add bazel build for ui and junit.http, and the test packages. A number of different test labels are supported: api attributes dfs diff http lfs lfs-server nls notes pack patch pgm reftree revplot revwalk storage submodule symlinks transport treewalk util To run all tests: bazel test //... To run specific tests, using labels: bazel test --test_tag_filters=api,dfs,revplot,treewalk //... Change-Id: Ic41b05a79d855212e67b1b4707e9c6b4dc9ea70d Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: Jonathan Nieder <jrn@google.com>stable-4.7
David Ostrovsky
8 years ago
committed by
Matthias Sohn
12 changed files with 504 additions and 2 deletions
@ -0,0 +1,42 @@
|
||||
load( |
||||
"@com_googlesource_gerrit_bazlets//tools:junit.bzl", |
||||
"junit_tests", |
||||
) |
||||
|
||||
junit_tests( |
||||
name = "http", |
||||
srcs = glob(["tst/**/*.java"]), |
||||
tags = ["http"], |
||||
deps = [ |
||||
":helpers", |
||||
"//lib:commons-logging", |
||||
"//lib:jetty-http", |
||||
"//lib:jetty-io", |
||||
"//lib:jetty-security", |
||||
"//lib:jetty-server", |
||||
"//lib:jetty-servlet", |
||||
"//lib:jetty-util", |
||||
"//lib:junit", |
||||
"//lib:servlet-api", |
||||
"//lib:slf4j-api", |
||||
"//lib:slf4j-simple", |
||||
"//org.eclipse.jgit.http.apache:http-apache", |
||||
"//org.eclipse.jgit.http.server:jgit-servlet", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit.http:junit-http", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
], |
||||
) |
||||
|
||||
java_library( |
||||
name = "helpers", |
||||
testonly = 1, |
||||
srcs = glob(["src/**/*.java"]), |
||||
deps = [ |
||||
"//lib:junit", |
||||
"//org.eclipse.jgit.http.server:jgit-servlet", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit.http:junit-http", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
], |
||||
) |
@ -0,0 +1,22 @@
|
||||
package(default_visibility = ["//visibility:public"]) |
||||
|
||||
java_library( |
||||
name = "junit-http", |
||||
testonly = 1, |
||||
srcs = glob(["src/**"]), |
||||
resources = glob(["resources/**"]), |
||||
# TODO(davido): we want here provided deps |
||||
deps = [ |
||||
"//lib:jetty-http", |
||||
"//lib:jetty-security", |
||||
"//lib:jetty-server", |
||||
"//lib:jetty-servlet", |
||||
"//lib:jetty-util", |
||||
"//lib:junit", |
||||
"//lib:servlet-api", |
||||
"//lib:slf4j-api", |
||||
"//org.eclipse.jgit.http.server:jgit-servlet", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
], |
||||
) |
@ -0,0 +1,49 @@
|
||||
load( |
||||
"@com_googlesource_gerrit_bazlets//tools:junit.bzl", |
||||
"junit_tests", |
||||
) |
||||
|
||||
TEST_BASE = ["tst/org/eclipse/jgit/lfs/server/fs/LfsServerTest.java"] |
||||
|
||||
DEPS = [ |
||||
"//org.eclipse.jgit.lfs.test:helpers", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
"//org.eclipse.jgit.junit.http:junit-http", |
||||
"//org.eclipse.jgit.lfs:jgit-lfs", |
||||
"//org.eclipse.jgit.lfs.server:jgit-lfs-server", |
||||
"//lib:commons-logging", |
||||
"//lib:httpcore", |
||||
"//lib:httpclient", |
||||
"//lib:junit", |
||||
"//lib:jetty-http", |
||||
"//lib:jetty-io", |
||||
"//lib:jetty-server", |
||||
"//lib:jetty-servlet", |
||||
"//lib:jetty-security", |
||||
"//lib:jetty-util", |
||||
"//lib:servlet-api", |
||||
] |
||||
|
||||
junit_tests( |
||||
name = "lfs_server", |
||||
srcs = glob( |
||||
["tst/**/*.java"], |
||||
exclude = TEST_BASE, |
||||
), |
||||
jvm_flags = [ |
||||
"-Xmx256m", |
||||
"-Dfile.encoding=UTF-8", |
||||
], |
||||
tags = ["lfs-server"], |
||||
deps = DEPS + [ |
||||
":helpers", |
||||
], |
||||
) |
||||
|
||||
java_library( |
||||
name = "helpers", |
||||
testonly = 1, |
||||
srcs = TEST_BASE, |
||||
deps = DEPS, |
||||
) |
@ -0,0 +1,31 @@
|
||||
package(default_visibility = ["//visibility:public"]) |
||||
|
||||
load( |
||||
"@com_googlesource_gerrit_bazlets//tools:junit.bzl", |
||||
"junit_tests", |
||||
) |
||||
|
||||
junit_tests( |
||||
name = "lfs", |
||||
srcs = glob(["tst/**/*.java"]), |
||||
tags = ["lfs"], |
||||
deps = [ |
||||
":helpers", |
||||
"//lib:junit", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
"//org.eclipse.jgit.lfs:jgit-lfs", |
||||
], |
||||
) |
||||
|
||||
java_library( |
||||
name = "helpers", |
||||
testonly = 1, |
||||
srcs = glob(["src/**/*.java"]), |
||||
deps = [ |
||||
"//lib:junit", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
"//org.eclipse.jgit.lfs:jgit-lfs", |
||||
], |
||||
) |
@ -0,0 +1,40 @@
|
||||
load( |
||||
"@com_googlesource_gerrit_bazlets//tools:junit.bzl", |
||||
"junit_tests", |
||||
) |
||||
|
||||
junit_tests( |
||||
name = "pgm", |
||||
srcs = glob(["tst/**/*.java"]), |
||||
jvm_flags = [ |
||||
"-Xmx256m", |
||||
"-Dfile.encoding=UTF-8", |
||||
], |
||||
tags = ["pgm"], |
||||
deps = [ |
||||
":helpers", |
||||
"//lib:commons-compress", |
||||
"//lib:javaewah", |
||||
"//lib:junit", |
||||
"//lib:slf4j-api", |
||||
"//lib:slf4j-simple", |
||||
"//lib:xz", |
||||
"//org.eclipse.jgit.archive:jgit-archive", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
"//org.eclipse.jgit.pgm:pgm", |
||||
], |
||||
) |
||||
|
||||
java_library( |
||||
name = "helpers", |
||||
testonly = 1, |
||||
srcs = glob(["src/**/*.java"]), |
||||
deps = [ |
||||
"//lib:args4j", |
||||
"//lib:junit", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
"//org.eclipse.jgit.pgm:pgm", |
||||
], |
||||
) |
@ -0,0 +1,38 @@
|
||||
java_library( |
||||
name = "pgm", |
||||
srcs = glob(["src/**"]), |
||||
resource_strip_prefix = "org.eclipse.jgit.pgm/resources", |
||||
resources = glob(["resources/**"]), |
||||
visibility = ["//visibility:public"], |
||||
deps = [ |
||||
":services", |
||||
"//lib:args4j", |
||||
"//lib:httpclient", |
||||
"//lib:httpcore", |
||||
"//lib:jetty-http", |
||||
"//lib:jetty-io", |
||||
"//lib:jetty-security", |
||||
"//lib:jetty-server", |
||||
"//lib:jetty-servlet", |
||||
"//lib:jetty-util", |
||||
"//lib:servlet-api", |
||||
"//org.eclipse.jgit.archive:jgit-archive", |
||||
"//org.eclipse.jgit.http.apache:http-apache", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.lfs:jgit-lfs", |
||||
"//org.eclipse.jgit.lfs.server:jgit-lfs-server", |
||||
"//org.eclipse.jgit.ui:ui", |
||||
], |
||||
) |
||||
|
||||
java_import( |
||||
name = "services", |
||||
jars = [":services_jar"], |
||||
) |
||||
|
||||
genrule( |
||||
name = "services_jar", |
||||
srcs = glob(["META-INF/services/*"]), |
||||
outs = ["services_jar.jar"], |
||||
cmd = "r=$$PWD && cd org.eclipse.jgit.pgm && zip -qr $$r/$@ .", |
||||
) |
@ -0,0 +1,61 @@
|
||||
load(":tests.bzl", "tests") |
||||
load( |
||||
"@com_googlesource_gerrit_bazlets//tools:genrule2.bzl", |
||||
"genrule2", |
||||
) |
||||
|
||||
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"], |
||||
exclude = HELPERS + DATA |
||||
)) |
||||
|
||||
java_library( |
||||
name = "helpers", |
||||
testonly = 1, |
||||
srcs = HELPERS, |
||||
resources = DATA, |
||||
deps = [ |
||||
"//lib:junit", |
||||
"//org.eclipse.jgit:jgit", |
||||
"//org.eclipse.jgit.junit:junit", |
||||
], |
||||
) |
||||
|
||||
java_import( |
||||
name = "tst_rsrc", |
||||
jars = [":tst_rsrc_jar"], |
||||
) |
||||
|
||||
genrule2( |
||||
name = 'tst_rsrc_jar', |
||||
cmd = 'o=$$PWD/$@ && tar cf - $(SRCS) | tar -C $$TMP --strip-components=2 -xf - && cd $$TMP && zip -qr $$o .', |
||||
srcs = glob(['tst-rsrc/**']), |
||||
outs = ['tst_rsrc.jar',], |
||||
) |
@ -0,0 +1,51 @@
|
||||
load( |
||||
"@com_googlesource_gerrit_bazlets//tools:junit.bzl", |
||||
"junit_tests", |
||||
) |
||||
|
||||
def tests(tests): |
||||
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') |
||||
|
||||
additional_deps = [] |
||||
if src.endswith("RootLocaleTest.java"): |
||||
additional_deps = [ |
||||
'//org.eclipse.jgit.pgm:pgm', |
||||
'//org.eclipse.jgit.ui:ui', |
||||
] |
||||
if src.endswith("WalkEncryptionTest.java"): |
||||
additional_deps = [ |
||||
'//org.eclipse.jgit:insecure_cipher_factory', |
||||
] |
||||
|
||||
junit_tests( |
||||
name = name, |
||||
tags = labels, |
||||
srcs = [src], |
||||
deps = additional_deps + [ |
||||
':helpers', |
||||
':tst_rsrc', |
||||
'//org.eclipse.jgit:jgit', |
||||
'//org.eclipse.jgit.junit:junit', |
||||
'//org.eclipse.jgit.lfs:jgit-lfs', |
||||
'@hamcrest_core//jar', |
||||
'@hamcrest_library//jar', |
||||
'@javaewah//jar', |
||||
'@junit//jar', |
||||
'@log_api//jar', |
||||
'@slf4j_simple//jar', |
||||
], |
||||
jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"], |
||||
) |
Loading…
Reference in new issue