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 aa4f60ba6..a0a923303 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 @@ -63,7 +63,6 @@ import org.apache.openjpa.lib.util.Localizer.Message; import org.apache.openjpa.lib.util.Options; import org.apache.openjpa.lib.util.Services; import org.apache.openjpa.lib.util.StringUtil; -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; @@ -183,8 +182,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 1dfd63fee..c0eec8305 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 @@ -634,4 +634,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 8517f25c4..d7629f835 100644 --- a/openjpa-lib/pom.xml +++ b/openjpa-lib/pom.xml @@ -82,49 +82,42 @@ org.apache.maven.plugins maven-antrun-plugin - set subversion revision + set git version compile - - - - - - - - # Write the svn info to a temp file - - - + Getting the 'GIT' revision value + + - # Remove all spaces so we can have a proper key - - # Load the property file - - + Revision: ${git.revision} + + Getting the 'PCEnhancer' revision value + + + + openjpa.enhancer.revision=${pcenhancer.git.revision} - - Revision: ${buildNumber} OpenJPA version: ${project.version} - + + + - revision.number=${buildNumber} + + +revision.number=${git.revision} openjpa.version=${project.version} -openjpa.enhancer.revision=${pcenhancer.LastChangedRev} - - +openjpa.enhancer.revision=${pcenhancer.git.revision} + 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 68f0c08b5..000000000 --- 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 402fd5752..000000000 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/util/svn/TestSVNUtils.java +++ /dev/null @@ -1,63 +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 org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class TestSVNUtils { - - @Test - public void testNull() { - assertEquals(-1, SVNUtils.svnInfoToInteger(null)); - } - - @Test - public void testBasic() { - int i = 12345678; - assertEquals(i, SVNUtils.svnInfoToInteger(i + "")); - } - - @Test - public void testGoodTrailingString() { - int i = 12345678; - assertEquals(i, SVNUtils.svnInfoToInteger(i + "m")); - } - - @Test - public void testMixedRevision() { - int i = 12345678; - assertEquals(i, SVNUtils.svnInfoToInteger("55555:" + i)); - } - - @Test - public void testMixedRevisionTrailingString() { - int i = 12345678; - assertEquals(i, SVNUtils.svnInfoToInteger("55555:" + i + "MS")); - } - - @Test - public void testBad() { - int i = 12345678; - assertEquals(-1, SVNUtils.svnInfoToInteger("55555:aa" + i + "ms")); - } - -}