You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by da...@apache.org on 2019/06/06 19:48:56 UTC
[openjpa] branch 2.2.x updated: Convert build from SVN to GIT (#49)
This is an automated email from the ASF dual-hosted git repository.
dazeydev pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/openjpa.git
The following commit(s) were added to refs/heads/2.2.x by this push:
new fef543b Convert build from SVN to GIT (#49)
fef543b is described below
commit fef543b04cd8d7a2d8d40ba2d6f571df5a45f81c
Author: Will Dazey <da...@gmail.com>
AuthorDate: Thu Jun 6 14:48:52 2019 -0500
Convert build from SVN to GIT (#49)
Signed-off-by: Will Dazey <da...@gmail.com>
---
openjpa-examples/openbooks/build.xml | 2 +-
.../org/apache/openjpa/enhance/PCEnhancer.java | 4 +-
.../org/apache/openjpa/conf/localizer.properties | 2 +-
openjpa-lib/pom.xml | 60 ++++++++-----------
.../org/apache/openjpa/lib/util/svn/SVNUtils.java | 55 ------------------
.../apache/openjpa/lib/util/svn/TestSVNUtils.java | 67 ----------------------
pom.xml | 10 ++--
7 files changed, 32 insertions(+), 168 deletions(-)
diff --git a/openjpa-examples/openbooks/build.xml b/openjpa-examples/openbooks/build.xml
index 5688f19..9e50091 100644
--- a/openjpa-examples/openbooks/build.xml
+++ b/openjpa-examples/openbooks/build.xml
@@ -211,7 +211,7 @@
<!-- accounted for by customizing Java2HTMLConverter accordingly -->
<!-- see the respective target's options to notice the difference -->
<target name="generate-source" depends="check-env" if="antlr.exists">
- <javac srcdir="${src.dir}" destdir="${classes.dir}">
+ <javac fork="true" srcdir="${src.dir}" destdir="${classes.dir}">
<include name="openbook/tools/**/*.java"/>
<exclude name="openbook/tools/**/Test*.java"/>
<classpath refid="code.generation.classpath"/>
diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
index e4b44d7..9eff4f8 100644
--- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
+++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
@@ -62,7 +62,6 @@ import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.lib.util.Options;
import org.apache.openjpa.lib.util.Services;
import org.apache.openjpa.lib.util.Localizer.Message;
-import org.apache.openjpa.lib.util.svn.SVNUtils;
import org.apache.openjpa.meta.AccessCode;
import org.apache.openjpa.meta.ClassMetaData;
import org.apache.openjpa.meta.FieldMetaData;
@@ -181,8 +180,7 @@ public class PCEnhancer {
in.close();
}
}
- String prop = revisionProps.getProperty("openjpa.enhancer.revision");
- rev = SVNUtils.svnInfoToInteger(prop);
+ rev = Integer.parseInt(revisionProps.getProperty("openjpa.enhancer.revision"));
} catch (Exception e) {
}
if (rev > 0) {
diff --git a/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties b/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
index 357b730..417f3f9 100644
--- a/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
+++ b/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
@@ -767,4 +767,4 @@ invalid-config-object: Invalid object provided in configuration property \
"{0}". Expected type was "{1}".
version-id: version id
-openjpa-revision: Apache svn revision
+openjpa-revision: Apache git revision
diff --git a/openjpa-lib/pom.xml b/openjpa-lib/pom.xml
index b3e4c39..c3d88fd 100644
--- a/openjpa-lib/pom.xml
+++ b/openjpa-lib/pom.xml
@@ -84,55 +84,43 @@
<build>
<plugins>
<!--
- get the svn revision number and set it in the
- subversion.revision setting - disabled for now
- since we need to be able to build from sources
- zip (when there is no .svn/ metadata)
+ get the git revision number and set it in the git.revision setting - disabled for now
+ since we need to be able to build from sources zip (when there is no .git/config)
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
- <executions>
+ <executions>
<execution>
- <id>set subversion revision</id>
+ <id>set git version</id>
<phase>compile</phase>
<configuration>
- <tasks>
- <property name="tmpdir" value="${java.io.tmpdir}/openjpamvntmp" />
- <condition property="outdir" value="${project.build.outputDirectory}">
- <available type="dir" file="${project.build.outputDirectory}" />
- </condition>
-
- <property name="outdir" value="${tmpdir}" />
-
- <property name="svnversion.executable" value="svnversion" />
- <exec outputproperty="subversion.revision" failonerror="false" failifexecutionfails="false" executable="${svnversion.executable}">
- <arg line="-c ${basedir}/.." />
+ <target>
+ <echo>Getting the 'GIT' revision value</echo>
+ <exec outputproperty="git.revision" failonerror="false" failifexecutionfails="false" executable="git">
+ <arg line="rev-parse --short HEAD" />
</exec>
- # Write the svn info to a temp file
- <echo file="pcenhancer.revision.file" />
- <exec output="pcenhancer.revision.file" failonerror="false" failifexecutionfails="false" executable="svn" append="false">
- <arg line="info ../openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java" />
+ <echo>Revision: ${git.revision}</echo>
+
+ <echo>Getting the 'PCEnhancer' revision value</echo>
+ <exec outputproperty="pcenhancer.git.revision" failonerror="false" failifexecutionfails="false" executable="git" append="false">
+ <arg line="rev-parse --short HEAD:./../openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java" />
</exec>
+ <echo>openjpa.enhancer.revision=${pcenhancer.git.revision}</echo>
- # Remove all spaces so we can have a proper key
- <replace file="pcenhancer.revision.file" token=" " value="" />
- # Load the property file
- <property prefix="pcenhancer" file="pcenhancer.revision.file" />
- <delete file="pcenhancer.revision.file" />
-
- <property name="subversion.revision" value="unknown" />
- <property name="pcenhancer.LastChangedRev" value="-1" />
- <echo>Revision: ${subversion.revision}</echo>
<echo>OpenJPA version: ${project.version}</echo>
-
+
+ <condition property="outdir" value="${project.build.outputDirectory}" else="${java.io.tmpdir}/openjpamvntmp">
+ <available type="dir" file="${project.build.outputDirectory}" />
+ </condition>
+
<mkdir dir="${outdir}/META-INF" />
- <echo file="${outdir}/META-INF/org.apache.openjpa.revision.properties">revision.number=${subversion.revision}
+ <echo file="${outdir}/META-INF/org.apache.openjpa.revision.properties">
+revision.number=${git.revision}
openjpa.version=${project.version}
-openjpa.enhancer.revision=${pcenhancer.LastChangedRev}
-</echo>
- <delete dir="${tmpdir}" />
- </tasks>
+openjpa.enhancer.revision=${pcenhancer.git.revision}
+ </echo>
+ </target>
</configuration>
<goals>
<goal>run</goal>
diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/svn/SVNUtils.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/svn/SVNUtils.java
deleted file mode 100644
index b110847..0000000
--- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/svn/SVNUtils.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-package org.apache.openjpa.lib.util.svn;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-public class SVNUtils {
- static final Pattern fullRevisionPattern = Pattern.compile("(([0-9]*:)?)[0-9]+(([MSms]+)?)");
- static final Pattern revisionPattern = Pattern.compile("[0-9]+");
-
- /**
- * A public worker method that takes the output from running the svnversion command and parses the trailing integer
- * version out.
- *
- * For example: 959691:959709M would return 959709
- *
- * @param svninfo
- * @return The formatted int version, or -1 if svninfo is null or unparsable.
- */
- public static int svnInfoToInteger(String svninfo) {
- if (svninfo == null || fullRevisionPattern.matcher(svninfo).matches() == false) {
- return -1;
- }
- // We only want to look after ":"
- int index = svninfo.indexOf(":");
- if(index != -1){
- svninfo = svninfo.substring(index+1);
- }
-
- Matcher matcher = revisionPattern.matcher(svninfo);
- if(matcher.find()){
- return Integer.parseInt(matcher.group());
- }
-
- return -1;
- }
-}
diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/svn/TestSVNUtils.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/svn/TestSVNUtils.java
deleted file mode 100644
index 8645f72..0000000
--- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/svn/TestSVNUtils.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-package org.apache.openjpa.lib.util.svn;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-public class TestSVNUtils extends TestCase {
- public TestSVNUtils(String s) {
- super(s);
- }
-
- public void testNull() {
- assertEquals(-1, SVNUtils.svnInfoToInteger(null));
- }
-
- public void testBasic() {
- int i = 12345678;
- assertEquals(i, SVNUtils.svnInfoToInteger(i + ""));
- }
-
- public void testGoodTrailingString() {
- int i = 12345678;
- assertEquals(i, SVNUtils.svnInfoToInteger(i + "m"));
- }
-
- public void testMixedRevision() {
- int i = 12345678;
- assertEquals(i, SVNUtils.svnInfoToInteger("55555:" + i));
- }
-
- public void testMixedRevisionTrailingString() {
- int i = 12345678;
- assertEquals(i, SVNUtils.svnInfoToInteger("55555:" + i + "MS"));
- }
-
- public void testBad() {
- int i = 12345678;
- assertEquals(-1, SVNUtils.svnInfoToInteger("55555:aa" + i + "ms"));
- }
-
- public static Test suite() {
- return new TestSuite(TestSVNUtils.class);
- }
-
- public static void main(String[] args) {
- TestRunner.run(suite());
- }
-}
diff --git a/pom.xml b/pom.xml
index c21c14d..eb97e64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,9 +151,9 @@
</distributionManagement>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/openjpa/branches/2.2.x</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/openjpa/branches/2.2.x</developerConnection>
- <url>http://svn.apache.org/repos/asf/openjpa/branches/2.2.x</url>
+ <connection>scm:git:https://gitbox.apache.org/repos/asf/openjpa.git</connection>
+ <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/openjpa.git</developerConnection>
+ <url>https://gitbox.apache.org/repos/asf/openjpa.git</url>
</scm>
<modules>
@@ -749,7 +749,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-4</version>
+ <version>1.4</version>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<revisionOnScmFailure>offline</revisionOnScmFailure>
@@ -800,7 +800,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
- <version>1.3</version>
+ <version>1.8</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>