You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2015/04/07 15:19:10 UTC

git commit: [flex-utilities] [refs/heads/develop] - - Fixed a bug in the pom templates causing an empty line in the first line - Changed the structure of the fontkit to have the flex-fontkit artifact as root with dependencies to afe, aglj40 and rideau -

Repository: flex-utilities
Updated Branches:
  refs/heads/develop 88930af0b -> 0bd96f936


- Fixed a bug in the pom templates causing an empty line in the first line
- Changed the structure of the fontkit to have the flex-fontkit artifact as root with dependencies to afe, aglj40 and rideau
- Made the downloader download flash artifacts in a structure that the flex converter understands
- Implemented one SdkDownloader class in the core module, which downloads, flex, air, flash and fontkit and converts them into a mavenized form.


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

Branch: refs/heads/develop
Commit: 0bd96f93689c94a0b8da41ca04ce0972f32e5684
Parents: 88930af
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Tue Apr 7 15:19:02 2015 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Tue Apr 7 15:19:02 2015 +0200

----------------------------------------------------------------------
 .../src/main/resources/templates/default.vm     | 34 ++++++++-------
 .../base/src/main/resources/templates/pom.vm    | 34 ++++++++-------
 .../converter/fontkit/FontkitConverter.java     | 12 +-----
 .../utilities/converter/core/SdkDownloader.java | 45 ++++++++++++++++++++
 .../retrievers/download/DownloadRetriever.java  | 15 +++++--
 5 files changed, 95 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/0bd96f93/mavenizer/converters/base/src/main/resources/templates/default.vm
----------------------------------------------------------------------
diff --git a/mavenizer/converters/base/src/main/resources/templates/default.vm b/mavenizer/converters/base/src/main/resources/templates/default.vm
index ce9711d..21b453f 100644
--- a/mavenizer/converters/base/src/main/resources/templates/default.vm
+++ b/mavenizer/converters/base/src/main/resources/templates/default.vm
@@ -1,20 +1,22 @@
-#*
- * 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.
- *#
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+  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.
+
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0">
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/0bd96f93/mavenizer/converters/base/src/main/resources/templates/pom.vm
----------------------------------------------------------------------
diff --git a/mavenizer/converters/base/src/main/resources/templates/pom.vm b/mavenizer/converters/base/src/main/resources/templates/pom.vm
index 4b18e12..fc0016b 100644
--- a/mavenizer/converters/base/src/main/resources/templates/pom.vm
+++ b/mavenizer/converters/base/src/main/resources/templates/pom.vm
@@ -1,20 +1,22 @@
-#*
- * 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.
- *#
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+  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.
+
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0">
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/0bd96f93/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
----------------------------------------------------------------------
diff --git a/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java b/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
index bfe27b5..e222db5 100644
--- a/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
+++ b/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
@@ -37,7 +37,8 @@ public class FontkitConverter extends BaseConverter implements Converter {
         fontkit.setGroupId("com.adobe");
         fontkit.setArtifactId("fontkit");
         fontkit.setVersion("1.0");
-        fontkit.setPackaging("pom");
+        fontkit.setPackaging("jar");
+        fontkit.addDefaultBinaryArtifact(flexFontkitJar);
 
         final MavenArtifact afe = new MavenArtifact();
         afe.setGroupId("com.adobe.fontkit");
@@ -63,18 +64,9 @@ public class FontkitConverter extends BaseConverter implements Converter {
         rideau.addDefaultBinaryArtifact(rideauJar);
         fontkit.addDependency(rideau);
 
-        final MavenArtifact flexFontkit = new MavenArtifact();
-        flexFontkit.setGroupId("com.adobe.fontkit");
-        flexFontkit.setArtifactId("flex-fontkit");
-        flexFontkit.setVersion("1.0");
-        flexFontkit.setPackaging("jar");
-        flexFontkit.addDefaultBinaryArtifact(flexFontkitJar);
-        fontkit.addDependency(flexFontkit);
-
         writeArtifact(afe);
         writeArtifact(aglj40);
         writeArtifact(rideau);
-        writeArtifact(flexFontkit);
         writeArtifact(fontkit);
     }
 

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/0bd96f93/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkDownloader.java
----------------------------------------------------------------------
diff --git a/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkDownloader.java b/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkDownloader.java
new file mode 100644
index 0000000..12beb18
--- /dev/null
+++ b/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkDownloader.java
@@ -0,0 +1,45 @@
+package org.apache.flex.utilities.converter.core;
+
+import org.apache.flex.utilities.converter.air.AirConverter;
+import org.apache.flex.utilities.converter.flash.FlashConverter;
+import org.apache.flex.utilities.converter.flex.FlexConverter;
+import org.apache.flex.utilities.converter.fontkit.FontkitConverter;
+import org.apache.flex.utilities.converter.retrievers.download.DownloadRetriever;
+import org.apache.flex.utilities.converter.retrievers.types.PlatformType;
+import org.apache.flex.utilities.converter.retrievers.types.SdkType;
+
+import java.io.File;
+
+/**
+ * Created by christoferdutz on 07.04.15.
+ */
+public class SdkDownloader {
+
+    public static void main(String[] args) throws Exception {
+        File mavenTarget = new File("temp/maven");
+        mavenTarget.mkdirs();
+
+        DownloadRetriever downloadRetriever = new DownloadRetriever();
+
+        // Download and convert Flex
+        File flexDir = downloadRetriever.retrieve(SdkType.FLEX, "4.14.1");
+        FlexConverter flexConverter = new FlexConverter(flexDir, mavenTarget);
+        flexConverter.convert();
+
+        // Download and convert Air
+        File airDir = downloadRetriever.retrieve(SdkType.AIR, "17.0", PlatformType.MAC);
+        AirConverter airConverter = new AirConverter(airDir, mavenTarget);
+        airConverter.convert();
+
+        // Download and convert Flash
+        File flashDir = downloadRetriever.retrieve(SdkType.FLASH, "17.0");
+        FlashConverter flashConverter = new FlashConverter(flashDir, mavenTarget);
+        flashConverter.convert();
+
+        // Download and convert Fontkit
+        File fontkitDir = downloadRetriever.retrieve(SdkType.FONTKIT);
+        FontkitConverter fontkitConverter = new FontkitConverter(fontkitDir, mavenTarget);
+        fontkitConverter.convert();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/0bd96f93/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
----------------------------------------------------------------------
diff --git a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
index 3eb3bbe..e09abfa 100644
--- a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
+++ b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
@@ -16,6 +16,7 @@
  */
 package org.apache.flex.utilities.converter.retrievers.download;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.flex.utilities.converter.retrievers.BaseRetriever;
 import org.apache.flex.utilities.converter.retrievers.exceptions.RetrieverException;
@@ -69,13 +70,14 @@ public class DownloadRetriever extends BaseRetriever {
             }
 
             if(type.equals(SdkType.FONTKIT)) {
-                File tmpTargetFile = File.createTempFile(UUID.randomUUID().toString(), "tmp");
+                File tmpTargetFile = File.createTempFile(UUID.randomUUID().toString(), "");
+                String tempSuffix = tmpTargetFile.getName().substring(tmpTargetFile.getName().lastIndexOf("-"));
                 if(!(tmpTargetFile.delete()))
                 {
                     throw new IOException("Could not delete temp file: " + tmpTargetFile.getAbsolutePath());
                 }
 
-                File targetRootDir = new File(tmpTargetFile.getParentFile(), type.toString());
+                File targetRootDir = new File(tmpTargetFile.getParentFile(), type.toString() + tempSuffix);
                 File targetDir = new File(targetRootDir, "/lib/external/optional");
                 if(!(targetDir.mkdirs()))
                 {
@@ -111,7 +113,14 @@ public class DownloadRetriever extends BaseRetriever {
                 ////////////////////////////////////////////////////////////////////////////////
 
                 if (type.equals(SdkType.FLASH)) {
-                    return targetFile;
+                    final File targetDirectory = new File(targetFile.getParent(),
+                            targetFile.getName().substring(0, targetFile.getName().lastIndexOf(".") - 1));
+                    final File libDestFile = new File(targetDirectory, "frameworks/libs/player/" + version + "/playerglobal.swc");
+                    if(!libDestFile.getParentFile().exists()) {
+                        libDestFile.getParentFile().mkdirs();
+                    }
+                    FileUtils.moveFile(targetFile, libDestFile);
+                    return targetDirectory;
                 } else {
                     System.out.println("Extracting archive to temp directory.");
                     final File targetDirectory = new File(targetFile.getParent(),