You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/01/26 11:59:49 UTC
svn commit: r903166 - in /tuscany/sca-java-2.x/trunk/modules/core-spi: ./
src/main/java/org/apache/tuscany/sca/runtime/ src/main/resources/org/
src/main/resources/org/apache/ src/main/resources/org/apache/tuscany/
src/main/resources/org/apache/tuscany/...
Author: antelder
Date: Tue Jan 26 10:59:48 2010
New Revision: 903166
URL: http://svn.apache.org/viewvc?rev=903166&view=rev
Log:
First cut at having a programatic way to get the svn revision that a tuscany build is from. This approach seems a little conveluted so if anyone has a better approach please do say, this one uses the Maven buildnumber plugin to set a mvn property with the svn revision, which is then written into a message properties file with the antrun plugin, which is then used initilize a constant in a Version class. Not sure if it even actually works, committing it so i can get a Hudson build and check if it does end up with the correct value
Added:
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Version.java
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/runtime/
tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/runtime/core-spi-messages.properties
tuscany/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/
tuscany/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/VersionTestCase.java
Modified:
tuscany/sca-java-2.x/trunk/modules/core-spi/pom.xml
Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/pom.xml?rev=903166&r1=903165&r2=903166&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/pom.xml Tue Jan 26 10:59:48 2010
@@ -68,4 +68,48 @@
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <version>1.0-beta-4</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <buildNumberPropertyName>sources.version</buildNumberPropertyName>
+ <timestampPropertyName>build.timestamp</timestampPropertyName>
+ <doCheck>true</doCheck>
+ <doUpdate>true</doUpdate>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>process-resources</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <tasks>
+ <filter token="svnRevision" value="${sources.version}"/>
+ <copy toDir="${basedir}/target/classes/org/apache/tuscany/sca/runtime" overwrite="true"
+ filtering="on" file="${basedir}/src/main/resources/org/apache/tuscany/sca/runtime/core-spi-messages.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Version.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Version.java?rev=903166&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Version.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Version.java Tue Jan 26 10:59:48 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import java.util.ResourceBundle;
+
+public class Version {
+
+ public static final String REVISION;
+ static {
+ ResourceBundle rb = ResourceBundle.getBundle("org/apache/tuscany/sca/runtime/core-spi-messages");
+ REVISION = rb.getString("revision");
+ }
+
+ public static String getRevsion() {
+ return REVISION;
+ }
+}
Added: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/runtime/core-spi-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/runtime/core-spi-messages.properties?rev=903166&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/runtime/core-spi-messages.properties (added)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/resources/org/apache/tuscany/sca/runtime/core-spi-messages.properties Tue Jan 26 10:59:48 2010
@@ -0,0 +1,28 @@
+#
+#
+# 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.
+#
+#
+
+#-- Don't edit these. They're updated from the build, see the
+# buildnumber-maven-plugin in this modules pom.xml
+revision=@svnRevision@
+#----------------------
+
+
+
Added: tuscany/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/VersionTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/VersionTestCase.java?rev=903166&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/VersionTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/VersionTestCase.java Tue Jan 26 10:59:48 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import org.junit.Test;
+
+/**
+ */
+public class VersionTestCase {
+
+ @Test
+ public void testRevision() {
+ // Doesn't test much, just that it has been initilized to a number
+ Integer.parseInt(Version.getRevsion());
+ }
+
+}