You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/09/21 22:15:39 UTC
svn commit: r1173825 - in /felix/trunk/framework: pom.xml
src/main/java/org/apache/felix/framework/Felix.java
src/main/resources/org/apache/felix/
Author: rickhall
Date: Wed Sep 21 20:15:38 2011
New Revision: 1173825
URL: http://svn.apache.org/viewvc?rev=1173825&view=rev
Log:
Committing patch from Karl to make framework version a
compile-time substition. (FELIX-3035)
Removed:
felix/trunk/framework/src/main/resources/org/apache/felix/
Modified:
felix/trunk/framework/pom.xml
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Modified: felix/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/framework/pom.xml?rev=1173825&r1=1173824&r2=1173825&view=diff
==============================================================================
--- felix/trunk/framework/pom.xml (original)
+++ felix/trunk/framework/pom.xml Wed Sep 21 20:15:38 2011
@@ -79,5 +79,32 @@
</configuration>
</plugin>
</plugins>
+ <resources>
+ <!-- Add back in the default resources, since we are overriding resources. -->
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <!-- Copy Felix.java with property substitution enabled to get version. -->
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>org/apache/felix/framework/Felix.java</include>
+ </includes>
+ <filtering>true</filtering>
+ <targetPath>../filtered-sources/java</targetPath>
+ </resource>
+ <!-- Copy other source files with no property substitution. -->
+ <resource>
+ <directory>src/main/java</directory>
+ <excludes>
+ <exclude>org/apache/felix/framework/Felix.java</exclude>
+ </excludes>
+ <filtering>false</filtering>
+ <targetPath>../filtered-sources/java</targetPath>
+ </resource>
+ </resources>
+ <!-- Set the source directory to be the filtered source files. -->
+ <sourceDirectory>target/filtered-sources/java</sourceDirectory>
</build>
</project>
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1173825&r1=1173824&r2=1173825&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Wed Sep 21 20:15:38 2011
@@ -73,6 +73,9 @@ import org.osgi.service.packageadmin.Exp
public class Felix extends BundleImpl implements Framework
{
+ // This value is substituted by maven when building the framework.
+ private static final String m_frameworkVersion = "${pom.version}";
+
// The secure action used to do privileged calls
static final SecureAction m_secureAction = new SecureAction();
@@ -4304,27 +4307,9 @@ public class Felix extends BundleImpl im
**/
private static String getFrameworkVersion()
{
- // The framework version property.
- Properties props = new Properties();
- InputStream in = Felix.class.getResourceAsStream("Felix.properties");
- if (in != null)
- {
- try
- {
- props.load(in);
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
- }
- }
-
// Maven uses a '-' to separate the version qualifier,
// while OSGi uses a '.', so we need to convert to a '.'
- StringBuffer sb =
- new StringBuffer(
- props.getProperty(
- FelixConstants.FELIX_VERSION_PROPERTY, "0.0.0"));
+ StringBuffer sb = new StringBuffer(m_frameworkVersion);
if (sb.toString().indexOf("-") >= 0)
{
sb.setCharAt(sb.toString().indexOf("-"), '.');