flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From que...@apache.org
Subject [27/50] [abbrv] git commit: [flex-utilities] [refs/heads/as3httpclient-work] - - Fixed a bug making the converter not copy rsls correctly as we stripped the build number from the version (Which was also used for finding the rsls ... which contained the b
Date Sun, 31 May 2015 22:19:09 GMT
- Fixed a bug making the converter not copy rsls correctly as we stripped the build number
from the version (Which was also used for finding the rsls ... which contained the build number
in their versions)


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/05922ef7
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/05922ef7
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/05922ef7

Branch: refs/heads/as3httpclient-work
Commit: 05922ef7ba1dd02a1a61fff092665c0da7d09819
Parents: 29eeb02
Author: Christofer Dutz <christofer.dutz@codecentric.de>
Authored: Mon Apr 20 16:12:39 2015 +0200
Committer: Christofer Dutz <christofer.dutz@codecentric.de>
Committed: Mon Apr 20 16:12:39 2015 +0200

----------------------------------------------------------------------
 .../utilities/converter/flex/FlexConverter.java | 40 ++++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/05922ef7/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
----------------------------------------------------------------------
diff --git a/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
b/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
index 4600b76..6def8a1 100644
--- a/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
+++ b/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
@@ -41,6 +41,7 @@ import java.util.zip.ZipOutputStream;
 public class FlexConverter extends BaseConverter implements Converter {
 
     protected String flexSdkVersion;
+    protected String flexBuild;
 
     /**
      * @param rootSourceDirectory Path to the root of the original Flex SDK.
@@ -52,6 +53,7 @@ public class FlexConverter extends BaseConverter implements Converter {
 
         // Get the version of the current Flex SDK.
         this.flexSdkVersion = getFlexVersion(rootSourceDirectory);
+        this.flexBuild = getFlexBuild(rootSourceDirectory);
     }
 
     /**
@@ -592,8 +594,40 @@ public class FlexConverter extends BaseConverter implements Converter
{
         }
     }
 
+    /**
+     * Get the version of an Flex SDK from the content of the SDK directory.
+     *
+     * @return version string for the current Flex SDK
+     */
+    protected String getFlexBuild(File rootDirectory) throws ConverterException {
+        final File sdkDescriptor = new File(rootDirectory, "flex-sdk-description.xml");
+
+        // If the descriptor is not present, return null as this FDK directory doesn't
+        // seem to contain a Flex SDK.
+        if(!sdkDescriptor.exists()) {
+            return null;
+        }
+
+        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        try {
+            // Parse the document
+            final DocumentBuilder db = dbf.newDocumentBuilder();
+            final Document dom = db.parse(sdkDescriptor);
+
+            // Get name, version and build nodes
+            final Element root = dom.getDocumentElement();
+            return root.getElementsByTagName("build").item(0).getTextContent();
+        } catch (ParserConfigurationException pce) {
+            throw new RuntimeException(pce);
+        } catch (SAXException se) {
+            throw new RuntimeException(se);
+        } catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+    }
+
     protected File getRsl(String artifactId) {
-        final FlexRslFilter filter = new FlexRslFilter(artifactId, flexSdkVersion);
+        final FlexRslFilter filter = new FlexRslFilter(artifactId, flexSdkVersion, flexBuild);
         final File rslDirectory = new File(rootSourceDirectory, "frameworks" + File.separator
+ "rsls");
         final File[] rsls = rslDirectory.listFiles(filter);
         if ((rsls != null) && (rsls.length == 1)) {
@@ -660,8 +694,8 @@ public class FlexConverter extends BaseConverter implements Converter
{
     public static class FlexRslFilter implements FilenameFilter {
         private String fileName;
 
-        public FlexRslFilter(String artifactName, String artifactVersion) {
-            this.fileName = artifactName + "_" + artifactVersion + ".swf";
+        public FlexRslFilter(String artifactName, String artifactVersion, String build) {
+            this.fileName = artifactName + "_" + artifactVersion + "." + build + ".swf";
         }
 
         public boolean accept(File dir, String name) {


Mime
View raw message