This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 0d82c902 YETUS-1161. Switch pom versions to use maven.config (#257)
0d82c902 is described below

commit 0d82c902162163ed282321b569c989bf9673327f
Author: Allen Wittenauer <[email protected]>
AuthorDate: Mon Apr 25 13:40:13 2022 -0700

    YETUS-1161. Switch pom versions to use maven.config (#257)
---
 .gitignore                                         |  1 +
 .mvn/maven.config                                  |  1 +
 .yetus/excludes.txt                                |  1 +
 asf-site-src/pom.xml                               |  2 +-
 .../audience-annotations/pom.xml                   |  2 +-
 audience-annotations-component/pom.xml             |  2 +-
 pom.xml                                            | 29 ++++++++++++++-
 precommit/pom.xml                                  |  2 +-
 precommit/src/main/shell/core.d/01-common.sh       |  8 ++--
 precommit/src/main/shell/test-patch.sh             |  2 +-
 release/initial-patches.sh                         | 43 +++++++++++++---------
 releasedocmaker/pom.xml                            |  2 +-
 shelldocs/pom.xml                                  |  2 +-
 yetus-assemblies/pom.xml                           |  2 +-
 yetus-dist/pom.xml                                 |  2 +-
 yetus-maven-plugin/pom.xml                         |  2 +-
 16 files changed, 69 insertions(+), 34 deletions(-)

diff --git a/.gitignore b/.gitignore
index 58163492..bb8fec29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 .DS_Store
 *.iml
+.flattened-pom.xml
 *.ipr
 *.iws
 *.orig
diff --git a/.mvn/maven.config b/.mvn/maven.config
new file mode 100644
index 00000000..deb9e1d1
--- /dev/null
+++ b/.mvn/maven.config
@@ -0,0 +1 @@
+-Drevision=0.14.0-SNAPSHOT
diff --git a/.yetus/excludes.txt b/.yetus/excludes.txt
index 87ec84c6..8fc1bade 100644
--- a/.yetus/excludes.txt
+++ b/.yetus/excludes.txt
@@ -18,3 +18,4 @@ precommit/src/test/resources/brokenfiles/a.*\.txt
 precommit/src/test/resources/brokenfiles/[2-3]\.txt
 ^precommit/src/test/resources/brokenfiles/4\.txt
 precommit/src/test/resources/brokenfiles/perlcritic.pl
+.mvn/maven.config
diff --git a/asf-site-src/pom.xml b/asf-site-src/pom.xml
index 37849883..b27fca6c 100644
--- a/asf-site-src/pom.xml
+++ b/asf-site-src/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>asf-site</artifactId>
diff --git a/audience-annotations-component/audience-annotations/pom.xml 
b/audience-annotations-component/audience-annotations/pom.xml
index 049c6c26..ed575e67 100644
--- a/audience-annotations-component/audience-annotations/pom.xml
+++ b/audience-annotations-component/audience-annotations/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>../..</relativePath>
   </parent>
   <artifactId>audience-annotations</artifactId>
diff --git a/audience-annotations-component/pom.xml 
b/audience-annotations-component/pom.xml
index aaec25f6..696873eb 100644
--- a/audience-annotations-component/pom.xml
+++ b/audience-annotations-component/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>audience-annotations-component</artifactId>
diff --git a/pom.xml b/pom.xml
index 1745f96b..64222a82 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
   </parent>
   <groupId>org.apache.yetus</groupId>
   <artifactId>yetus-project</artifactId>
-  <version>0.14.0-SNAPSHOT</version>
+  <version>${revision}</version>
   <description>Project-wide definitions for Apache Yetus</description>
   <name>Apache Yetus Project</name>
   <packaging>pom</packaging>
@@ -67,6 +67,7 @@
     <checkstyle.version>9.0</checkstyle.version>
     <commons.io.version>2.11.0</commons.io.version>
     <exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
+    <flatten.version>1.2.7</flatten.version>
     <junit.version>5.8.2</junit.version>
     <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
     <maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
@@ -93,7 +94,6 @@
 
     <pluginManagement>
       <plugins>
-
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>exec-maven-plugin</artifactId>
@@ -194,6 +194,31 @@
 
 
     <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>flatten-maven-plugin</artifactId>
+        <version>${flatten.version}</version>
+        <configuration>
+          <updatePomFile>true</updatePomFile>
+          <flattenMode>resolveCiFriendliesOnly</flattenMode>
+        </configuration>
+        <executions>
+          <execution>
+            <id>flatten</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>flatten</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>flatten.clean</id>
+            <phase>clean</phase>
+            <goals>
+              <goal>clean</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/precommit/pom.xml b/precommit/pom.xml
index e0219094..7a1fc4a7 100644
--- a/precommit/pom.xml
+++ b/precommit/pom.xml
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>precommit</artifactId>
diff --git a/precommit/src/main/shell/core.d/01-common.sh 
b/precommit/src/main/shell/core.d/01-common.sh
index caa5869c..a81668fa 100755
--- a/precommit/src/main/shell/core.d/01-common.sh
+++ b/precommit/src/main/shell/core.d/01-common.sh
@@ -613,7 +613,7 @@ function importplugins
     # shellcheck disable=SC1090
     files+=("${PERSONALITY}")
   else
-    if [[ "${PERSONALITY}" != "${BASEDIR}/.yetus/personality.sh" ]]; then
+    if [[  -n "${PERSONALITY}" && "${PERSONALITY}" != 
"${BASEDIR}/.yetus/personality.sh" ]]; then
       yetus_error "ERROR: ${PERSONALITY} does not exist."
       exit 1
     fi
@@ -764,11 +764,9 @@ function set_yetus_version
   elif [[ -f "${BINDIR}/VERSION" ]]; then
     # dist version file
     VERSION=$(cat "${BINDIR}/VERSION")
-  elif [[ -f "${BINDIR}/../../../pom.xml" ]]; then
+  elif [[ -f "${BINDIR}/../../../../.mvn/maven.config" ]]; then
     # this way we have no dependency on Maven being installed
-    VERSION=$("${GREP}" "<version>" "${BINDIR}/../../../pom.xml" 2>/dev/null \
-      | head -1 \
-      | "${SED}"  -e 's|^ *<version>||' -e 's|</version>.*$||' 2>/dev/null)
+    VERSION=$("${GREP}" "revision" "${BINDIR}/../../../../.mvn/maven.config" 
2>/dev/null | cut -f2 -d= 2>/dev/null)
   fi
 }
 
diff --git a/precommit/src/main/shell/test-patch.sh 
b/precommit/src/main/shell/test-patch.sh
index 952196c3..6890a1fa 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -2241,7 +2241,7 @@ function cleanup_and_exit
     big_console_header "Finished build."
   fi
 
-  if [[ "${DOCKERMODE}" != true ]]; then
+  if [[ "${DOCKERMODE}" != true  && -f "${PATCH_DIR}/pidfile.txt" ]]; then
     rm "${PATCH_DIR}/pidfile.txt"
   fi
 
diff --git a/release/initial-patches.sh b/release/initial-patches.sh
index 31612fc0..beeef9ae 100755
--- a/release/initial-patches.sh
+++ b/release/initial-patches.sh
@@ -27,13 +27,6 @@ if [[ ! -d precommit ]]; then
   exit 1
 fi
 
-SYSTEM=$(uname -s)
-if [[ "${SYSTEM}" == Darwin ]]; then
-  SEDI=("-i" '')
-else
-  SEDI=("-i")
-fi
-
 #shellcheck source=SCRIPTDIR/../precommit/src/main/shell/core.d/00-yetuslib.sh
 . precommit/src/main/shell/core.d/00-yetuslib.sh
 
@@ -82,6 +75,20 @@ option_parse()
   fi
 }
 
+function check_basedir_repo
+{
+  if [[ ! -e "${BASEDIR}/.git" ]]; then
+    yetus_error "ERROR: ${BASEDIR} is not a git repo."
+    cleanup_and_exit 1
+  fi
+
+  GIT_DIR="${BASEDIR}/.git"
+  export GIT_DIR
+
+  GIT_CEILING_DIRECTORIES="${BASEDIR}"
+  export GIT_CEILING_DIRECTORIES
+}
+
 docker_run() {
   docker run -i --rm \
     -v "${PWD}:/src" \
@@ -106,7 +113,7 @@ determine_versions() {
   declare micro
   declare microinc
 
-  OLD_BRANCH_VERSION=$(docker_run mvn -Dmaven.repo.local="${HOME}/.m2" 
help:evaluate -Dexpression=project.version -q -DforceStdout)
+  OLD_BRANCH_VERSION=$(grep revision .mvn/maven.config | cut -f2 -d=)
 
   if [[ ${OLD_BRANCH_VERSION} =~ -SNAPSHOT ]]; then
     if [[ -n "${NEW_BRANCH_VERSION}" ]]; then
@@ -128,17 +135,20 @@ determine_versions() {
 }
 
 update_version() {
-  declare oldversion=${1//\./\\.}
-  declare newversion=$2
+  declare newversion=$1
 
-  # *MOST* systems have sed -i these days
-  while read -r file; do
-    sed "${SEDI[@]}" "s,${oldversion},${newversion},g" "${file}"
-  done < <( find . -name 'pom.xml')
+  if ! grep -q .mvn/maven.config .yetus/excludes.txt; then
+    echo ".mvn/maven.config" >> .yetus/excludes.txt
+  fi
+  mkdir -p "${BASEDIR}/.mvn"
+  echo "-Drevision=${newversion}" > "${BASEDIR}/.mvn/maven.config"
+  git add "${BASEDIR}/.mvn/maven.config"
 }
 
 option_parse "$@"
 
+check_basedir_repo
+
 trap cleanup INT QUIT TRAP ABRT BUS SEGV TERM ERR
 
 set -x
@@ -158,16 +168,15 @@ determine_versions
 
 git checkout -b "${JIRAISSUE}-release"
 
-update_version "${OLD_BRANCH_VERSION}" "${NEW_BRANCH_VERSION}"
+update_version "${NEW_BRANCH_VERSION}"
 
 git commit -a -m "${JIRAISSUE}. Stage version ${NEW_BRANCH_VERSION}"
 
 if [[ -n "${NEW_MAIN_VERSION}" ]]; then
   git checkout --force main
   git checkout -b "${JIRAISSUE}-${STARTING_BRANCH}"
-  update_version "${OLD_BRANCH_VERSION}" "${NEW_MAIN_VERSION}"
+  update_version "${NEW_MAIN_VERSION}"
   git commit -a -m "${JIRAISSUE}. Bump main version to ${NEW_MAIN_VERSION}"
-
 fi
 
 git checkout "${JIRAISSUE}-release"
diff --git a/releasedocmaker/pom.xml b/releasedocmaker/pom.xml
index 8395deb5..141eb088 100644
--- a/releasedocmaker/pom.xml
+++ b/releasedocmaker/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>releasedocmaker</artifactId>
diff --git a/shelldocs/pom.xml b/shelldocs/pom.xml
index 19711e97..0b7ebfef 100644
--- a/shelldocs/pom.xml
+++ b/shelldocs/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>shelldocs</artifactId>
diff --git a/yetus-assemblies/pom.xml b/yetus-assemblies/pom.xml
index 7b20ee7f..32518819 100644
--- a/yetus-assemblies/pom.xml
+++ b/yetus-assemblies/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>yetus-assemblies</artifactId>
diff --git a/yetus-dist/pom.xml b/yetus-dist/pom.xml
index 360660ac..b3d43250 100644
--- a/yetus-dist/pom.xml
+++ b/yetus-dist/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>yetus-dist</artifactId>
diff --git a/yetus-maven-plugin/pom.xml b/yetus-maven-plugin/pom.xml
index 27608602..39b88200 100644
--- a/yetus-maven-plugin/pom.xml
+++ b/yetus-maven-plugin/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.yetus</groupId>
     <artifactId>yetus-project</artifactId>
-    <version>0.14.0-SNAPSHOT</version>
+    <version>${revision}</version>
     <relativePath>..</relativePath>
   </parent>
   <artifactId>yetus-maven-plugin</artifactId>

Reply via email to