1load( 2 "@com_googlesource_gerrit_bazlets//tools:genrule2.bzl", 3 "genrule2", 4) 5load("@rules_java//java:defs.bzl", "java_import", "java_library") 6load(":tests.bzl", "tests") 7 8PKG = "tst/org/eclipse/jgit/" 9 10HELPERS = glob( 11 ["src/**/*.java"], 12 exclude = ["src/org/eclipse/jgit/transport/ssh/*.java"], 13) + [PKG + c for c in [ 14 "api/AbstractRemoteCommandTest.java", 15 "diff/AbstractDiffTestCase.java", 16 "internal/revwalk/ObjectReachabilityTestCase.java", 17 "internal/revwalk/ReachabilityCheckerTestCase.java", 18 "internal/storage/file/GcTestCase.java", 19 "internal/storage/file/PackIndexTestCase.java", 20 "internal/storage/file/XInputStream.java", 21 "nls/GermanTranslatedBundle.java", 22 "nls/MissingPropertyBundle.java", 23 "nls/NoPropertiesBundle.java", 24 "nls/NonTranslatedBundle.java", 25 "revwalk/RevQueueTestCase.java", 26 "revwalk/RevWalkTestCase.java", 27 "transport/ObjectIdMatcher.java", 28 "transport/RequestValidatorTestCase.java", 29 "transport/SpiTransport.java", 30 "treewalk/filter/AlwaysCloneTreeFilter.java", 31 "test/resources/SampleDataRepositoryTestCase.java", 32 "util/CPUTimeStopWatch.java", 33 "util/http/HttpCookiesMatcher.java", 34 "util/io/Strings.java", 35]] 36 37DATA = [ 38 PKG + "lib/empty.gitindex.dat", 39 PKG + "lib/sorttest.gitindex.dat", 40] 41 42EXCLUDED = [ 43 PKG + "api/SecurityManagerTest.java", 44 PKG + "api/SecurityManagerMissingPermissionsTest.java", 45] 46 47tests(tests = glob( 48 ["tst/**/*.java"], 49 exclude = HELPERS + DATA + EXCLUDED, 50)) 51 52java_library( 53 name = "helpers", 54 testonly = 1, 55 srcs = HELPERS, 56 resources = DATA, 57 deps = [ 58 "//lib:assertj-core", 59 "//lib:junit", 60 "//lib:mockito", 61 "//lib:slf4j-simple", 62 "//org.eclipse.jgit:jgit", 63 "//org.eclipse.jgit.junit:junit", 64 ], 65) 66 67java_import( 68 name = "tst_rsrc", 69 jars = [":tst_rsrc_jar"], 70) 71 72genrule2( 73 name = "tst_rsrc_jar", 74 srcs = glob(["tst-rsrc/**"]), 75 outs = ["tst_rsrc.jar"], 76 cmd = "o=$$PWD/$@ && tar cf - $(SRCS) | tar -C $$TMP --strip-components=2 -xf - && cd $$TMP && zip -qr $$o .", 77) 78