Skip to content

Commit

Permalink
RATIS-1840. Avoid including build timestamp in artifacts (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai committed Jul 2, 2024
1 parent 32745c3 commit d101678
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/post-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions dev-support/checks/repro.sh
Original file line number Diff line number Diff line change
@@ -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 $?
55 changes: 37 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
20 changes: 20 additions & 0 deletions src/main/resources/ratis-version.properties
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit d101678

Please sign in to comment.