From ee56e5fc042a903b03773608ede62731452420ca Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Sat, 30 Sep 2017 10:56:42 +0100 Subject: ChangeIdUtilTest: Remove unused notestCommitDashV This test was never being run. Since it was introduced it was named "notest.." which meant it didn't run with JUnit3, and since it is not annotated @Test it also doesn't run with JUnit4. When compiling with Bazel 0.6.0, error-prone raises an error that the public method is not annotated with @Ignore or @Test. Given that the test has never been run anyway, we can just remove it. Bug: 525415 Change-Id: Ie9a54f89fe42e0c201f547ff54ff1d419ce37864 Signed-off-by: David Pursehouse --- .../tst/org/eclipse/jgit/util/ChangeIdUtilTest.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java index aaeb79c64a..6fed233051 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ChangeIdUtilTest.java @@ -583,23 +583,6 @@ public class ChangeIdUtilTest { SOB1)); } - public void notestCommitDashV() throws Exception { - assertEquals("a\n" + // - "\n" + // - "Change-Id: I7fc3876fee63c766a2063df97fbe04a2dddd8d7c\n" + // - SOB1 + // - SOB2, // - call("a\n" + // - "\n" + // - SOB1 + // - SOB2 + // - "\n" + // - "# on branch master\n" + // - "diff --git a/src b/src\n" + // - "new file mode 100644\n" + // - "index 0000000..c78b7f0\n")); - } - @Test public void testWithEndingURL() throws Exception { assertEquals("a\n" + // -- cgit v1.2.3 From 487571e604d726be7cf5eb00123a1764f44d16c9 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 30 Aug 2018 15:27:20 +0900 Subject: Bazel: Format all build files with buildifier 0.15.0 Change-Id: I8343b723da6e40d5ae7fc45c84f64c31276bd5dc Signed-off-by: David Pursehouse --- lib/BUILD | 6 ++-- org.eclipse.jgit.test/BUILD | 10 +++--- org.eclipse.jgit.test/tests.bzl | 80 ++++++++++++++++++++--------------------- tools/bazlets.bzl | 27 +++++++------- 4 files changed, 61 insertions(+), 62 deletions(-) diff --git a/lib/BUILD b/lib/BUILD index 827e6b6fc6..ffe66a3d89 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -115,9 +115,9 @@ java_library( testonly = 1, visibility = ["//visibility:public"], exports = [ - "@junit//jar", - "@hamcrest_core//jar", - "@hamcrest_library//jar", + "@hamcrest_core//jar", + "@hamcrest_library//jar", + "@junit//jar", ], ) diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD index ae6f24223c..bbda838f00 100644 --- a/org.eclipse.jgit.test/BUILD +++ b/org.eclipse.jgit.test/BUILD @@ -33,7 +33,7 @@ DATA = [ tests(glob( ["tst/**/*.java"], - exclude = HELPERS + DATA + exclude = HELPERS + DATA, )) java_library( @@ -54,8 +54,8 @@ java_import( ) 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',], + name = "tst_rsrc_jar", + srcs = glob(["tst-rsrc/**"]), + outs = ["tst_rsrc.jar"], + cmd = "o=$$PWD/$@ && tar cf - $(SRCS) | tar -C $$TMP --strip-components=2 -xf - && cd $$TMP && zip -qr $$o .", ) diff --git a/org.eclipse.jgit.test/tests.bzl b/org.eclipse.jgit.test/tests.bzl index 9cadc7463a..8ae0065a4c 100644 --- a/org.eclipse.jgit.test/tests.bzl +++ b/org.eclipse.jgit.test/tests.bzl @@ -4,45 +4,45 @@ load( ) 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') + 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', - ] + 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', - '//lib:javaewah', - '//lib:junit', - '//lib:slf4j-api', - '//org.eclipse.jgit:jgit', - '//org.eclipse.jgit.junit:junit', - '//org.eclipse.jgit.lfs:jgit-lfs', - ], - jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"], - ) + junit_tests( + name = name, + tags = labels, + srcs = [src], + deps = additional_deps + [ + ":helpers", + ":tst_rsrc", + "//lib:javaewah", + "//lib:junit", + "//lib:slf4j-api", + "//org.eclipse.jgit:jgit", + "//org.eclipse.jgit.junit:junit", + "//org.eclipse.jgit.lfs:jgit-lfs", + ], + jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"], + ) diff --git a/tools/bazlets.bzl b/tools/bazlets.bzl index e14e488492..f97b72c828 100644 --- a/tools/bazlets.bzl +++ b/tools/bazlets.bzl @@ -1,17 +1,16 @@ NAME = "com_googlesource_gerrit_bazlets" def load_bazlets( - commit, - local_path = None - ): - if not local_path: - native.git_repository( - name = NAME, - remote = "https://gerrit.googlesource.com/bazlets", - commit = commit, - ) - else: - native.local_repository( - name = NAME, - path = local_path, - ) + commit, + local_path = None): + if not local_path: + native.git_repository( + name = NAME, + remote = "https://gerrit.googlesource.com/bazlets", + commit = commit, + ) + else: + native.local_repository( + name = NAME, + path = local_path, + ) -- cgit v1.2.3 From af547cf00d79f1233464aadb76ad381be7f8887f Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 30 Aug 2018 08:48:41 +0900 Subject: Bazel: Use hyphen instead of underscore in external repository names Recent Bazel versions support the hyphen character in external repository names. On the Gerrit project, the repository names were harmonized to consistently use hyphen. As a side effect, it is no longer possible to build jgit from source in the gerrit tree, due to the different repository names. Rename the dependencies to use hyphens, consistent with gerrit. Change-Id: Ideebd858ddd3f0e6f765643001642dfb6c12441f Signed-off-by: David Pursehouse --- WORKSPACE | 30 +++++++++++++++--------------- lib/BUILD | 30 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index efa161b8ad..c5eae1dffb 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -34,43 +34,43 @@ maven_jar( ) maven_jar( - name = "commons_codec", + name = "commons-codec", artifact = "commons-codec:commons-codec:1.4", sha1 = "4216af16d38465bbab0f3dff8efa14204f7a399a", ) maven_jar( - name = "commons_logging", + name = "commons-logging", artifact = "commons-logging:commons-logging:1.1.3", sha1 = "f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f", ) maven_jar( - name = "log_api", + name = "log-api", artifact = "org.slf4j:slf4j-api:1.7.2", sha1 = "0081d61b7f33ebeab314e07de0cc596f8e858d97", ) maven_jar( - name = "slf4j_simple", + name = "slf4j-simple", artifact = "org.slf4j:slf4j-simple:1.7.2", sha1 = "760055906d7353ba4f7ce1b8908bc6b2e91f39fa", ) maven_jar( - name = "servlet_api_3_1", + name = "servlet-api-3_1", artifact = "javax.servlet:javax.servlet-api:3.1.0", sha1 = "3cd63d075497751784b2fa84be59432f4905bf7c", ) maven_jar( - name = "commons_compress", + name = "commons-compress", artifact = "org.apache.commons:commons-compress:1.6", sha1 = "c7d9b580aff9e9f1998361f16578e63e5c064699", ) maven_jar( - name = "tukaani_xz", + name = "tukaani-xz", artifact = "org.tukaani:xz:1.3", sha1 = "66db21c8484120cb6a51b5b3ea47b6f383942bec", ) @@ -88,13 +88,13 @@ maven_jar( ) maven_jar( - name = "hamcrest_library", + name = "hamcrest-library", artifact = "org.hamcrest:hamcrest-library:1.3", sha1 = "4785a3c21320980282f9f33d0d1264a69040538f", ) maven_jar( - name = "hamcrest_core", + name = "hamcrest-core", artifact = "org.hamcrest:hamcrest-core:1.3", sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0", ) @@ -108,42 +108,42 @@ maven_jar( JETTY_VER = "9.3.17.v20170317" maven_jar( - name = "jetty_servlet", + name = "jetty-servlet", artifact = "org.eclipse.jetty:jetty-servlet:" + JETTY_VER, sha1 = "ed6986b0d0ca7b9b0f9015c9efb80442e3043a8e", src_sha1 = "ee6b4784a00a92e5c1b6111033b7ae41ac6052a3", ) maven_jar( - name = "jetty_security", + name = "jetty-security", artifact = "org.eclipse.jetty:jetty-security:" + JETTY_VER, sha1 = "ca52535569445682d42aaa97c7039442719a0507", src_sha1 = "2ff9f4fb18b320fd5a0272a427bacc4d5fe7bc86", ) maven_jar( - name = "jetty_server", + name = "jetty-server", artifact = "org.eclipse.jetty:jetty-server:" + JETTY_VER, sha1 = "194e9a02e6ba249ef4a3f4bd56b4993087992299", src_sha1 = "0c9bd572f530c411592aefb71781ecca0b3719a9", ) maven_jar( - name = "jetty_http", + name = "jetty-http", artifact = "org.eclipse.jetty:jetty-http:" + JETTY_VER, sha1 = "6c02d728e15d4868486254039c867a1ac3e4a52e", src_sha1 = "3c0a2a82792f268631b4fefd77be9f126ec974b1", ) maven_jar( - name = "jetty_io", + name = "jetty-io", artifact = "org.eclipse.jetty:jetty-io:" + JETTY_VER, sha1 = "756a8cd2a1cbfb84a94973b6332dd3eccd47c0cd", src_sha1 = "a9afa99cccb19b441364fa805d027f457cbbb136", ) maven_jar( - name = "jetty_util", + name = "jetty-util", artifact = "org.eclipse.jetty:jetty-util:" + JETTY_VER, sha1 = "b8512ab02819de01f0f5a5c6026163041f579beb", src_sha1 = "96f8e3dcdc3660a5c91f19c46695daa70ac95625", diff --git a/lib/BUILD b/lib/BUILD index ffe66a3d89..346e1fd4e6 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -13,19 +13,19 @@ java_library( "//org.eclipse.jgit.archive:__pkg__", "//org.eclipse.jgit.pgm.test:__pkg__", ], - exports = ["@commons_compress//jar"], + exports = ["@commons-compress//jar"], ) java_library( name = "commons-codec", - exports = ["@commons_codec//jar"], + exports = ["@commons-codec//jar"], ) java_library( name = "commons-logging", testonly = 1, visibility = ["//visibility:public"], - exports = ["@commons_logging//jar"], + exports = ["@commons-logging//jar"], ) java_library( @@ -65,7 +65,7 @@ java_library( name = "jetty-http", # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it. visibility = ["//visibility:public"], - exports = ["@jetty_http//jar"], + exports = ["@jetty-http//jar"], runtime_deps = [":commons-codec"], ) @@ -73,35 +73,35 @@ java_library( name = "jetty-io", # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it. visibility = ["//visibility:public"], - exports = ["@jetty_io//jar"], + exports = ["@jetty-io//jar"], ) java_library( name = "jetty-security", # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it. visibility = ["//visibility:public"], - exports = ["@jetty_security//jar"], + exports = ["@jetty-security//jar"], ) java_library( name = "jetty-server", # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it. visibility = ["//visibility:public"], - exports = ["@jetty_server//jar"], + exports = ["@jetty-server//jar"], ) java_library( name = "jetty-servlet", # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it. visibility = ["//visibility:public"], - exports = ["@jetty_servlet//jar"], + exports = ["@jetty-servlet//jar"], ) java_library( name = "jetty-util", # TODO: This should be testonly but org.eclipse.jgit.pgm depends on it. visibility = ["//visibility:public"], - exports = ["@jetty_util//jar"], + exports = ["@jetty-util//jar"], ) java_library( @@ -115,8 +115,8 @@ java_library( testonly = 1, visibility = ["//visibility:public"], exports = [ - "@hamcrest_core//jar", - "@hamcrest_library//jar", + "@hamcrest-core//jar", + "@hamcrest-library//jar", "@junit//jar", ], ) @@ -132,25 +132,25 @@ java_library( "//org.eclipse.jgit.lfs.server.test:__pkg__", "//org.eclipse.jgit.pgm:__pkg__", ], - exports = ["@servlet_api_3_1//jar"], + exports = ["@servlet-api-3_1//jar"], ) java_library( name = "slf4j-api", visibility = ["//visibility:public"], - exports = ["@log_api//jar"], + exports = ["@log-api//jar"], ) java_library( name = "slf4j-simple", testonly = 1, visibility = ["//visibility:public"], - exports = ["@slf4j_simple//jar"], + exports = ["@slf4j-simple//jar"], ) java_library( name = "xz", testonly = 1, visibility = ["//visibility:public"], - exports = ["@tukaani_xz//jar"], + exports = ["@tukaani-xz//jar"], ) -- cgit v1.2.3