This is an automated email from the ASF dual-hosted git repository. szetszwo pushed a commit to branch branch-3.1.1_review in repository https://gitbox.apache.org/repos/asf/ratis.git
commit cfb95777fc908f266c880c0fe2a2ad1d2cae750e Author: Doroszlai, Attila <[email protected]> AuthorDate: Tue Jul 2 16:27:30 2024 +0200 RATIS-1840. Avoid including build timestamp in artifacts (#1114) --- .github/workflows/post-commit.yml | 2 ++ dev-support/checks/repro.sh | 31 ++++++++++++++++ pom.xml | 55 +++++++++++++++++++---------- src/main/resources/ratis-version.properties | 20 +++++++++++ 4 files changed, 90 insertions(+), 18 deletions(-) diff --git a/.github/workflows/post-commit.yml b/.github/workflows/post-commit.yml index 4a0905754..5fee9462a 100644 --- a/.github/workflows/post-commit.yml +++ b/.github/workflows/post-commit.yml @@ -92,6 +92,8 @@ jobs: java-version: ${{ matrix.java }} - name: Run a full build run: ./dev-support/checks/build.sh -Djavac.version=${{ matrix.java }} + - name: Test reproducibility + run: ./dev-support/checks/repro.sh -Djavac.version=${{ matrix.java }} rat: name: rat runs-on: ubuntu-20.04 diff --git a/dev-support/checks/repro.sh b/dev-support/checks/repro.sh new file mode 100755 index 000000000..c87443ef2 --- /dev/null +++ b/dev-support/checks/repro.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd "$DIR/../.." || exit 1 + +source "${DIR}/../find_maven.sh" + +: ${WITH_COVERAGE:="false"} + +MAVEN_OPTIONS='-V -B -Dmaven.javadoc.skip=true -DskipTests --no-transfer-progress' + +if [[ "${WITH_COVERAGE}" != "true" ]]; then + MAVEN_OPTIONS="${MAVEN_OPTIONS} -Djacoco.skip" +fi + +export MAVEN_OPTS="-Xmx4096m" +${MVN} ${MAVEN_OPTIONS} clean verify artifact:compare "$@" +exit $? diff --git a/pom.xml b/pom.xml index e52c34267..50712b3b9 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ <maven-pdf-plugin.version>1.6.1</maven-pdf-plugin.version> <maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version> <wagon-ssh.version>3.5.3</wagon-ssh.version> + <hadoop-maven-plugins.version>3.4.0</hadoop-maven-plugins.version> <!-- org.codehaus.mojo --> @@ -455,6 +456,11 @@ <pluginManagement> <plugins> + <plugin> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-maven-plugins</artifactId> + <version>${hadoop-maven-plugins.version}</version> + </plugin> <plugin> <groupId>org.xolstice.maven.plugins</groupId> <artifactId>protobuf-maven-plugin</artifactId> @@ -786,6 +792,24 @@ <inherited>true</inherited> <extensions>true</extensions> </plugin> + <plugin> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-maven-plugins</artifactId> + <executions> + <execution> + <id>version-info</id> + <phase>generate-resources</phase> + <goals> + <goal>version-info</goal> + </goals> + <configuration> + <source> + <directory>${project.basedir}</directory> + </source> + </configuration> + </execution> + </executions> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> @@ -807,24 +831,6 @@ <includeReports>false</includeReports> </configuration> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>buildnumber-maven-plugin</artifactId> - <version>1.4</version> - <executions> - <execution> - <phase>generate-resources</phase> - <goals> - <goal>create-metadata</goal> - </goals> - <configuration> - <outputDirectory>target/classes</outputDirectory> - <outputName>ratis-version.properties</outputName> - <revisionOnScmFailure>Unknown</revisionOnScmFailure> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> @@ -870,6 +876,19 @@ </executions> </plugin> </plugins> + <resources> + <resource> + <directory>${project.basedir}/src/main/resources</directory> + <filtering>false</filtering> + </resource> + <resource> + <directory>${project.basedir}/../src/main/resources</directory> + <includes> + <include>ratis-version.properties</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> </build> <profiles> diff --git a/src/main/resources/ratis-version.properties b/src/main/resources/ratis-version.properties new file mode 100644 index 000000000..f34dc73dc --- /dev/null +++ b/src/main/resources/ratis-version.properties @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +name=${project.name} +version=${project.version} +revision=${version-info.scm.commit}
