From 97afcb050b182beacd1c6913d8293d6ba0a9989e Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Tue, 17 Oct 2023 14:24:46 +0200 Subject: [PATCH 1/8] Upgrade bazlets to the latest revision Includes: junit.bzl: Suppress default package warning flagged by error prone Change-Id: Id8e8dd7cca7264328c4121ac3da4d9d5e8e407de --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 4787f6192..a9a5e2564 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,7 +3,7 @@ workspace(name = "jgit") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//tools:bazlets.bzl", "load_bazlets") -load_bazlets(commit = "f30a992da9fc855dce819875afb59f9dd6f860cd") +load_bazlets(commit = "f9c119e45d9a241bee720b7fbd6c7fdbc952da5f") load( "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", From 6007371e3a21970dd34ae91ac20460922a15488e Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 6 Oct 2023 01:10:40 +0200 Subject: [PATCH 2/8] Enable Maven reproducible builds - configure Maven to run build reproducibly [1] - use UTC timestamp of checked out commit as build timestamp - add git-describe, git-commit-id, git-commit-id, git-tags, git-remote-origin-url to MANIFEST.MF files - configure cyclonedx-maven-plugin to also use UTC timestamp of checked out commit - for packaging build use tycho-buildtimestamp-jgit [2] to ensure version uses the timestamp of the last commit - SBOMs are not reproducible by design [3] they should have a build timestamp matching the time when the build was executed and a serial number which is a unique UUID per build run. Hence exclude them from comparison [4]. - Use gmavenplus-plugin to format build timestamps. Maven expects build timestamp in ISO-8601 format, to replace the qualifier in versions the timestamp format must be compatible with rules for OSGi version numbers. Didn't find a way to read the properties set by the git-commit-id-maven-plugin from another plugin. Hence use JGit in a groovy script to get the commit time of the current HEAD and provide it in these two formats. TODO: packaging build (features and p2 repository) is not yet binary reproducible since that's not yet supported by Tycho [5], artefacts have reproducible version numbers but file lastModified timestamps are not yet reproducible. Test plan for Maven build: - build using mvn clean install" - verify second build is reproducible: mvn -T1 clean verify artifact:compare verification seems not to be thread-safe, hence run it with a single thread using option -T1 For packaging build (still fails due to non-reproducible file timestamps): - build using mvn -f org.eclipse.jgit.packaging/pom.xml clean install - verify second build is reproducible: mvn -T1 -f org.eclipse.jgit.packaging/pom.xml clean verify artifact:compare [1] https://maven.apache.org/guides/mini/guide-reproducible-builds.html [2] https://wiki.eclipse.org/Tycho/Reproducible_Version_Qualifiers [3] https://github.com/CycloneDX/cyclonedx-maven-plugin/issues/84 [4] https://maven.apache.org/plugins/maven-artifact-plugin/compare-mojo.html [5] https://github.com/eclipse-tycho/tycho/issues/233 Change-Id: I0202f55a1b6ae0edd922cfef638beb39d2ce9417 --- org.eclipse.jgit.ant/pom.xml | 2 +- org.eclipse.jgit.archive/pom.xml | 2 +- org.eclipse.jgit.gpg.bc/pom.xml | 2 +- org.eclipse.jgit.http.apache/pom.xml | 2 +- org.eclipse.jgit.http.server/pom.xml | 2 +- org.eclipse.jgit.junit.http/pom.xml | 2 +- org.eclipse.jgit.junit.ssh/pom.xml | 2 +- org.eclipse.jgit.junit/pom.xml | 2 +- org.eclipse.jgit.lfs.server/pom.xml | 2 +- org.eclipse.jgit.lfs/pom.xml | 2 +- org.eclipse.jgit.packaging/pom.xml | 71 +++++++++++- org.eclipse.jgit.pgm/pom.xml | 2 +- org.eclipse.jgit.ssh.apache.agent/pom.xml | 2 +- org.eclipse.jgit.ssh.apache/pom.xml | 2 +- org.eclipse.jgit.ssh.jsch/pom.xml | 2 +- org.eclipse.jgit.ui/pom.xml | 2 +- org.eclipse.jgit/pom.xml | 2 +- pom.xml | 128 +++++++++++++++++++++- 18 files changed, 211 insertions(+), 20 deletions(-) diff --git a/org.eclipse.jgit.ant/pom.xml b/org.eclipse.jgit.ant/pom.xml index 59e7ca610..b6250c616 100644 --- a/org.eclipse.jgit.ant/pom.xml +++ b/org.eclipse.jgit.ant/pom.xml @@ -69,7 +69,7 @@ - + diff --git a/org.eclipse.jgit.archive/pom.xml b/org.eclipse.jgit.archive/pom.xml index 9a9734f03..dbfd6eebd 100644 --- a/org.eclipse.jgit.archive/pom.xml +++ b/org.eclipse.jgit.archive/pom.xml @@ -77,7 +77,7 @@ - + diff --git a/org.eclipse.jgit.gpg.bc/pom.xml b/org.eclipse.jgit.gpg.bc/pom.xml index c81be61c6..41a3d1ffe 100644 --- a/org.eclipse.jgit.gpg.bc/pom.xml +++ b/org.eclipse.jgit.gpg.bc/pom.xml @@ -93,7 +93,7 @@ - + diff --git a/org.eclipse.jgit.http.apache/pom.xml b/org.eclipse.jgit.http.apache/pom.xml index a1c942ce4..5e67eda46 100644 --- a/org.eclipse.jgit.http.apache/pom.xml +++ b/org.eclipse.jgit.http.apache/pom.xml @@ -74,7 +74,7 @@ - + diff --git a/org.eclipse.jgit.http.server/pom.xml b/org.eclipse.jgit.http.server/pom.xml index b54836cf5..d35ea7f53 100644 --- a/org.eclipse.jgit.http.server/pom.xml +++ b/org.eclipse.jgit.http.server/pom.xml @@ -76,7 +76,7 @@ - + diff --git a/org.eclipse.jgit.junit.http/pom.xml b/org.eclipse.jgit.junit.http/pom.xml index 048dc1348..46c88bb00 100644 --- a/org.eclipse.jgit.junit.http/pom.xml +++ b/org.eclipse.jgit.junit.http/pom.xml @@ -87,7 +87,7 @@ - + diff --git a/org.eclipse.jgit.junit.ssh/pom.xml b/org.eclipse.jgit.junit.ssh/pom.xml index 2409ea1ba..0b26edf74 100644 --- a/org.eclipse.jgit.junit.ssh/pom.xml +++ b/org.eclipse.jgit.junit.ssh/pom.xml @@ -101,7 +101,7 @@ - + diff --git a/org.eclipse.jgit.junit/pom.xml b/org.eclipse.jgit.junit/pom.xml index 3bce4808d..091db6b3d 100644 --- a/org.eclipse.jgit.junit/pom.xml +++ b/org.eclipse.jgit.junit/pom.xml @@ -72,7 +72,7 @@ - + diff --git a/org.eclipse.jgit.lfs.server/pom.xml b/org.eclipse.jgit.lfs.server/pom.xml index fcb91be64..8e8aedffd 100644 --- a/org.eclipse.jgit.lfs.server/pom.xml +++ b/org.eclipse.jgit.lfs.server/pom.xml @@ -91,7 +91,7 @@ - + diff --git a/org.eclipse.jgit.lfs/pom.xml b/org.eclipse.jgit.lfs/pom.xml index 888076634..6cddb81bc 100644 --- a/org.eclipse.jgit.lfs/pom.xml +++ b/org.eclipse.jgit.lfs/pom.xml @@ -71,7 +71,7 @@ - + diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml index ba73e9204..715491d47 100644 --- a/org.eclipse.jgit.packaging/pom.xml +++ b/org.eclipse.jgit.packaging/pom.xml @@ -32,6 +32,7 @@ 11 4.0.2 jgit-4.17 + ${git.commit.time} @@ -223,7 +224,6 @@ json cyclonedx ${project.build.directory} - ${project.build.outputTimestamp} false @@ -235,6 +235,26 @@ + + io.github.git-commit-id + git-commit-id-maven-plugin + 6.0.0 + + + get-the-git-infos + + revision + + initialize + + + + false + true + yyyy-MM-dd'T'HH:mm:ss'Z' + UTC + + @@ -255,6 +275,30 @@ ISO-8859-1 + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + JGit ${project.artifactId} + ${project.version} + Eclipse.org - JGit + org.eclipse.jgit + ${jgit-url} + ${git.commit.id.describe} + ${git.commit.id} + ${git.commit.time} + ${git.tags} + ${git.remote.origin.url} + + + + + org.eclipse.tycho target-platform-configuration @@ -318,6 +362,22 @@ org.eclipse.tycho tycho-packaging-plugin ${tycho-version} + + + org.eclipse.tycho + tycho-buildtimestamp-jgit + ${tycho-version} + + + + jgit + + pom.xml + .polyglot.build.properties + target/ + + yyyyMMddHHmm + org.eclipse.tycho @@ -353,6 +413,15 @@ maven-site-plugin 3.12.1 + + org.apache.maven.plugins + maven-artifact-plugin + 3.5.0 + + **/*cyclonedx.json + true + + diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml index de0548d5c..776207f86 100644 --- a/org.eclipse.jgit.pgm/pom.xml +++ b/org.eclipse.jgit.pgm/pom.xml @@ -205,7 +205,7 @@ - + diff --git a/org.eclipse.jgit.ssh.apache.agent/pom.xml b/org.eclipse.jgit.ssh.apache.agent/pom.xml index 5e4763309..ebf23743d 100644 --- a/org.eclipse.jgit.ssh.apache.agent/pom.xml +++ b/org.eclipse.jgit.ssh.apache.agent/pom.xml @@ -89,7 +89,7 @@ - + diff --git a/org.eclipse.jgit.ssh.apache/pom.xml b/org.eclipse.jgit.ssh.apache/pom.xml index f0ea60d5e..4dafa75c6 100644 --- a/org.eclipse.jgit.ssh.apache/pom.xml +++ b/org.eclipse.jgit.ssh.apache/pom.xml @@ -102,7 +102,7 @@ - + diff --git a/org.eclipse.jgit.ssh.jsch/pom.xml b/org.eclipse.jgit.ssh.jsch/pom.xml index 7237099e9..a794f627d 100644 --- a/org.eclipse.jgit.ssh.jsch/pom.xml +++ b/org.eclipse.jgit.ssh.jsch/pom.xml @@ -83,7 +83,7 @@ - + diff --git a/org.eclipse.jgit.ui/pom.xml b/org.eclipse.jgit.ui/pom.xml index 5dd17c6e6..ca19f2bec 100644 --- a/org.eclipse.jgit.ui/pom.xml +++ b/org.eclipse.jgit.ui/pom.xml @@ -70,7 +70,7 @@ - + diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml index 28ba12641..32638d70f 100644 --- a/org.eclipse.jgit/pom.xml +++ b/org.eclipse.jgit/pom.xml @@ -83,7 +83,7 @@ - + diff --git a/pom.xml b/pom.xml index d969e33c8..18fc0f49f 100644 --- a/pom.xml +++ b/pom.xml @@ -113,10 +113,11 @@ UTF-8 UTF-8 - yyyyMMddHHmm 11 ${project.build.directory}/META-INF/MANIFEST.MF + ${commit.time.iso} + 6.7.0.202309050840-r 1.10.14 2.10.0 @@ -191,6 +192,11 @@ Eclipse.org - JGit org.eclipse.jgit ${jgit-url} + ${git.commit.id.describe} + ${git.commit.id} + ${git.commit.time} + ${git.tags} + ${git.remote.origin.url} - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target index bd7d0c6eb..e2939ff99 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target index 6b25a3960..4e1916ad1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target index b0d9b3537..1ffa01420 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target index 078b9c013..0603842cb 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target index bb9b5d202..f3e10bccf 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.22.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.23.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.23.target index f850691d7..162eeff64 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.23.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.23.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.24.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.24.target index 4afba0699..b0c996d0b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.24.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.24.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.25.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.25.target index cf5724cfc..260c50c3e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.25.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.25.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.26.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.26.target index bdb3da26c..8abc1f1a3 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.26.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.26.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.27.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.27.target index 200cdb3bd..6c8b1c041 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.27.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.27.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.28.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.28.target index fe6345a26..bde048c0f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.28.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.28.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.29.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.29.target index 39ba2cb47..d180721ed 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.29.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.29.target @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.30.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.30.target index eba79de8e..c56778797 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.30.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.30.target @@ -1,7 +1,7 @@ - + @@ -79,7 +79,7 @@ org.mockito mockito-core - 5.5.0 + 5.7.0 jar @@ -187,13 +187,13 @@ net.bytebuddy byte-buddy - 1.14.8 + 1.14.9 jar net.bytebuddy byte-buddy-agent - 1.14.8 + 1.14.9 jar diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/maven/dependencies.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/maven/dependencies.tpd index 45be4def8..b5c3b1ae4 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/maven/dependencies.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/maven/dependencies.tpd @@ -87,12 +87,12 @@ maven bytebuddy dependency { groupId = "net.bytebuddy" artifactId = "byte-buddy" - version = "1.14.8" + version = "1.14.9" } dependency { groupId = "net.bytebuddy" artifactId = "byte-buddy-agent" - version = "1.14.8" + version = "1.14.9" } } @@ -210,7 +210,7 @@ maven mockito dependency { groupId = "org.mockito" artifactId = "mockito-core" - version = "5.5.0" + version = "5.7.0" } } diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml index 80b8ac80d..d760128ff 100644 --- a/org.eclipse.jgit.test/pom.xml +++ b/org.eclipse.jgit.test/pom.xml @@ -73,7 +73,6 @@ org.mockito mockito-core - 5.5.0 diff --git a/pom.xml b/pom.xml index 18fc0f49f..c38bdbf8a 100644 --- a/pom.xml +++ b/pom.xml @@ -148,6 +148,7 @@ 2.2 3.24.2 5.13.0 + 1.14.9 jacoco @@ -975,6 +976,26 @@ jna-platform ${jna-version} + + + org.mockito + mockito-core + 5.7.0 + + + + net.bytebuddy + byte-buddy + ${byte-buddy-version} + compile + + + + net.bytebuddy + byte-buddy-agent + ${byte-buddy-version} + compile + From 3ca786d76756a61e655a1c00c67ebb3e01e50151 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 8 Nov 2023 23:36:54 +0100 Subject: [PATCH 4/8] errorprone: remove unnecessary parentheses See https://errorprone.info/bugpattern/UnnecessaryParentheses Change-Id: I204987469d478c9cc887ac66c9ffc84c9977c400 --- .../internal/storage/file/PackObjectSizeIndexLoader.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java index 930e71109..805f24f5e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java @@ -35,15 +35,14 @@ public static PackObjectSizeIndex load(InputStream in) throws IOException { byte[] header = in.readNBytes(4); if (!Arrays.equals(header, PackObjectSizeIndexWriter.HEADER)) { throw new IOException(MessageFormat.format( - JGitText.get().unreadableObjectSizeIndex, - header.length, Arrays.toString(header))); + JGitText.get().unreadableObjectSizeIndex, header.length, + Arrays.toString(header))); } int version = in.readNBytes(1)[0]; if (version != 1) { - throw new IOException((MessageFormat.format( - JGitText.get().unsupportedObjectSizeIndexVersion, - version))); + throw new IOException(MessageFormat.format( + JGitText.get().unsupportedObjectSizeIndexVersion, version)); } return PackObjectSizeIndexV1.parse(in); } From 3652dd437fab47f0d754273f9d7ed60db7dfb7aa Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 8 Nov 2023 23:38:09 +0100 Subject: [PATCH 5/8] Fix boxing warnings Change-Id: Ibb61f63f17e909ee0e6a781c9418f7c1ac2c7cd7 --- .../internal/storage/file/PackObjectSizeIndexLoader.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java index 805f24f5e..dff9fa52c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexLoader.java @@ -35,14 +35,16 @@ public static PackObjectSizeIndex load(InputStream in) throws IOException { byte[] header = in.readNBytes(4); if (!Arrays.equals(header, PackObjectSizeIndexWriter.HEADER)) { throw new IOException(MessageFormat.format( - JGitText.get().unreadableObjectSizeIndex, header.length, + JGitText.get().unreadableObjectSizeIndex, + Integer.valueOf(header.length), Arrays.toString(header))); } int version = in.readNBytes(1)[0]; if (version != 1) { throw new IOException(MessageFormat.format( - JGitText.get().unsupportedObjectSizeIndexVersion, version)); + JGitText.get().unsupportedObjectSizeIndexVersion, + Integer.valueOf(version))); } return PackObjectSizeIndexV1.parse(in); } From 15c6947fd7ffc1f8c9da0b5b93a896c5745461d9 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 8 Nov 2023 23:39:35 +0100 Subject: [PATCH 6/8] Fix warning for empty code blocks Change-Id: Ied394859e8c76bb1a2362d31962ab862b26b279f --- .../internal/storage/commitgraph/CommitGraphWriterTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriterTest.java index de3610563..9f65ee207 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriterTest.java @@ -159,6 +159,7 @@ private static class NonNestedTasksProgressMonitor @Override public void start(int totalTasks) { + // empty } @Override @@ -169,6 +170,7 @@ public void beginTask(String title, int totalWork) { @Override public void update(int completed) { + // empty } @Override @@ -184,6 +186,7 @@ public boolean isCancelled() { @Override public void showDuration(boolean enabled) { + // empty } } From 32f7db784d0cf4a4c5917fda4243e450810affe7 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 8 Nov 2023 23:41:16 +0100 Subject: [PATCH 7/8] Fix hiding field warning Change-Id: I9aced1b711901918667555a4cfff76992024e59c --- .../tst/org/eclipse/jgit/transport/UploadPackTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 09989b7ca..3a1fa2400 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -3037,10 +3037,10 @@ public void testUseWantedRefsAsAdvertisedSetV2_onlyWantedRefs() remote.update("three", three); server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true); - PackStatistics stats = uploadPackV2SetupStats("command=fetch\n", + PackStatistics packStats = uploadPackV2SetupStats("command=fetch\n", PacketLineIn.delimiter(), "want-ref refs/heads/one\n", "want-ref refs/heads/two\n", "done\n", PacketLineIn.end()); - assertEquals("only wanted-refs", 2, stats.getAdvertised()); + assertEquals("only wanted-refs", 2, packStats.getAdvertised()); assertEquals(0, ((RefCallsCountingRepository) server).numRefCalls()); } @@ -3058,10 +3058,10 @@ public void testUseWantedRefsAsAdvertisedSetV2_withWantId() remote.update("three", three); server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true); - PackStatistics stats = uploadPackV2SetupStats("command=fetch\n", + PackStatistics packStats = uploadPackV2SetupStats("command=fetch\n", PacketLineIn.delimiter(), "want-ref refs/heads/one\n", "want " + one.getName() + "\n", "done\n", PacketLineIn.end()); - assertEquals("all refs", 3, stats.getAdvertised()); + assertEquals("all refs", 3, packStats.getAdvertised()); assertEquals(1, ((RefCallsCountingRepository) server).numRefCalls()); } From b761a0fc3eb68bafcde576419f51ef7bf10de663 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 9 Nov 2023 00:06:19 +0100 Subject: [PATCH 8/8] Use try-with-resource to ensure UploadPack is closed Change-Id: I0d10aeac959a49b3bf2e83b0c104699d1d21f5e9 --- .../org/eclipse/jgit/transport/UploadPackTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 3a1fa2400..026492f7b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -3015,12 +3015,13 @@ private PackStatistics uploadPackV2SetupStats(String... inputLines) String version = TransferConfig.ProtocolVersion.V2.version(); server.getConfig().setString(ConfigConstants.CONFIG_PROTOCOL_SECTION, null, ConfigConstants.CONFIG_KEY_VERSION, version); - UploadPack up = new UploadPack(server); - up.setExtraParameters(Sets.of("version=".concat(version))); + try (UploadPack up = new UploadPack(server)) { + up.setExtraParameters(Sets.of("version=".concat(version))); - ByteArrayOutputStream recv = new ByteArrayOutputStream(); - up.upload(send, recv, null); - return up.getStatistics(); + ByteArrayOutputStream recv = new ByteArrayOutputStream(); + up.upload(send, recv, null); + return up.getStatistics(); + } } @Test