flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cframp...@apache.org
Subject svn commit: r1409957 [12/12] - in /incubator/flex/utilities/trunk: common/.settings/ common/src/assets/styles/ common/src/org/apache/flex/utilities/common/ common/src/org/apache/flex/utilities/common/controls/ common/src/org/apache/flex/utilities/commo...
Date Thu, 15 Nov 2012 19:56:39 GMT
Modified: incubator/flex/utilities/trunk/mavenizer/src/main/java/flex/FlexRuntimeGenerator.java
URL: http://svn.apache.org/viewvc/incubator/flex/utilities/trunk/mavenizer/src/main/java/flex/FlexRuntimeGenerator.java?rev=1409957&r1=1409956&r2=1409957&view=diff
==============================================================================
--- incubator/flex/utilities/trunk/mavenizer/src/main/java/flex/FlexRuntimeGenerator.java
(original)
+++ incubator/flex/utilities/trunk/mavenizer/src/main/java/flex/FlexRuntimeGenerator.java
Thu Nov 15 19:56:32 2012
@@ -14,191 +14,191 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package flex;
-
-import common.BaseGenerator;
-import common.MavenMetadata;
-import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
-import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
-
-import java.io.*;
-import java.text.NumberFormat;
-import java.util.Locale;
-
-/**
- * Created with IntelliJ IDEA.
- * User: cdutz
- * Date: 14.05.12
- * Time: 22:42
- */
-public class FlexRuntimeGenerator extends BaseGenerator {
-
-    @Override
-    public void process(File sdkSourceDirectory, boolean isApache, File sdkTargetDirectory,
String sdkVersion)
-            throws Exception
-    {
-        processFlashRuntime(sdkSourceDirectory, sdkTargetDirectory);
-    }
-
-    protected void processFlashRuntime(File sdkSourceDirectory, File sdkTargetDirectory)
-            throws Exception
-    {
-        final File runtimeDirectory = new File(sdkSourceDirectory, "runtimes");
-        final File flashPlayerDirectory = new File(runtimeDirectory, "player");
-
-        File[] versions = flashPlayerDirectory.listFiles(new FileFilter() {
-            public boolean accept(File pathname) {
-                return pathname.isDirectory() && !"win".equalsIgnoreCase(pathname.getName())
&&
-                        !"lnx".equalsIgnoreCase(pathname.getName()) && !"mac".equalsIgnoreCase(pathname.getName());
-            }
-        });
-        // The flash-player 9 is installed directly in the player directory.
-        if(new File(flashPlayerDirectory, "win").exists()) {
-            final File[] extendedVersions = new File[versions.length + 1];
-            System.arraycopy(versions, 0, extendedVersions, 0, versions.length);
-            extendedVersions[versions.length] = flashPlayerDirectory;
-            versions = extendedVersions;
-        }
-
-        if(versions != null) {
-            for(final File versionDir : versions) {
-                // If the versionDir is called "player", then this is the home of the flash-player
version 9.
-                final String playerVersionString = "player".equalsIgnoreCase(versionDir.getName())
? "9.0" : versionDir.getName();
-                final double playerVersion = Double.valueOf(playerVersionString);
-                final NumberFormat doubleFormat = NumberFormat.getInstance(Locale.US);
-                doubleFormat.setMinimumFractionDigits(1);
-                doubleFormat.setMaximumFractionDigits(1);
-                final String version = doubleFormat.format(playerVersion);
-
-                final File targetDir = new File(sdkTargetDirectory, "com/adobe/flash/runtime/"
+ version);
-
-                // Deploy Windows binaries.
-                final File windowsDirectory = new File(versionDir, "win");
-                if(windowsDirectory.exists()) {
-                    // Find out if a flash-player binary exists.
-                    File flashPlayerBinary = null;
-                    if(new File(windowsDirectory, "FlashPlayerDebugger.exe").exists()) {
-                        flashPlayerBinary = new File(windowsDirectory, "FlashPlayerDebugger.exe");
-                    } else if(new File(windowsDirectory, "FlashPlayer.exe").exists()) {
-                        flashPlayerBinary = new File(windowsDirectory, "FlashPlayer.exe");
-                    }
-
-                    // If a binary exists, copy it to the target and create a pom for it.
-                    if (flashPlayerBinary != null) {
-                        if(!targetDir.exists()) {
-                            if(!targetDir.mkdirs()) {
-                                throw new RuntimeException("Could not create directory: "
+ targetDir.getAbsolutePath());
-                            }
-                        }
-                        final File targetFile = new File(targetDir, "/runtime-" + version
+ "-win.exe");
-                        copyFile(flashPlayerBinary, targetFile);
-                    }
-                }
-
-                // Deploy Mac binaries.
-                final File macDirectory = new File(versionDir, "mac");
-                if(macDirectory.exists()) {
-                    // Find out if a flash-player binary exists.
-                    File flashPlayerBinary = null;
-                    if(new File(macDirectory, "Flash Player.app.zip").exists()) {
-                        flashPlayerBinary = new File(macDirectory, "Flash Player.app.zip");
-                    } else if(new File(macDirectory, "Flash Player Debugger.app.zip").exists())
{
-                        flashPlayerBinary = new File(macDirectory, "Flash Player Debugger.app.zip");
-                    }
-
-                    // If a binary exists, copy it to the target and create a pom for it.
-                    if (flashPlayerBinary != null) {
-                        if(!targetDir.exists()) {
-                            if(!targetDir.mkdirs()) {
-                                throw new RuntimeException("Could not create directory: "
+ targetDir.getAbsolutePath());
-                            }
-                        }
-                        final File targetFile = new File(targetDir, "/runtime-" + version
+ "-mac.zip");
-                        copyFile(flashPlayerBinary, targetFile);
-                    }
-                }
-
-                // Deploy Linux binaries.
-                final File lnxDirectory = new File(versionDir, "lnx");
-                if(lnxDirectory.exists()) {
-                    // Find out if a flash-player binary exists.
-                    File flashPlayerBinary = null;
-                    if(new File(lnxDirectory, "flashplayer.tar.gz").exists()) {
-                        flashPlayerBinary = new File(lnxDirectory, "flashplayer.tar.gz");
-                    } else if(new File(lnxDirectory, "flashplayerdebugger.tar.gz").exists())
{
-                        flashPlayerBinary = new File(lnxDirectory, "flashplayerdebugger.tar.gz");
-                    }
-
-                    // Decompress the archive.
-                    // First unzip it.
-                    final FileInputStream fin = new FileInputStream(flashPlayerBinary);
-                    final BufferedInputStream in = new BufferedInputStream(fin);
-                    final File tempTarFile = File.createTempFile("flex-sdk-linux-flashplayer-binary-"
+ version, ".tar");
-                    final FileOutputStream out = new FileOutputStream(tempTarFile);
-                    final GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in);
-                    final byte[] buffer = new byte[1024];
-                    int n;
-                    while (-1 != (n = gzIn.read(buffer))) {
-                        out.write(buffer, 0, n);
-                    }
-                    out.close();
-                    gzIn.close();
-
-                    // Then untar it.
-                    File uncompressedBinary = null;
-                    final FileInputStream tarFileInputStream = new FileInputStream(tempTarFile);
-                    final TarArchiveInputStream tarArchiveInputStream = new TarArchiveInputStream(tarFileInputStream);
-                    ArchiveEntry entry;
-                    while((entry = tarArchiveInputStream.getNextEntry()) != null) {
-                        if("flashplayer".equals(entry.getName())) {
-                            uncompressedBinary = File.createTempFile("flex-sdk-linux-flashplayer-binary-"
+ version, ".uexe");
-                            final FileOutputStream uncompressedBinaryOutputStream = new FileOutputStream(uncompressedBinary);
-                            while(-1 != (n = tarArchiveInputStream.read(buffer))) {
-                                uncompressedBinaryOutputStream.write(buffer, 0, n);
-                            }
-                            uncompressedBinaryOutputStream.close();
-                        } else if("flashplayerdebugger".equals(entry.getName())) {
-                            uncompressedBinary = File.createTempFile("flex-sdk-linux-flashplayer-binary-"
+ version, ".uexe");
-                            final FileOutputStream uncompressedBinaryOutputStream = new FileOutputStream(uncompressedBinary);
-                            while(-1 != (n = tarArchiveInputStream.read(buffer))) {
-                                uncompressedBinaryOutputStream.write(buffer, 0, n);
-                            }
-                            uncompressedBinaryOutputStream.close();
-                        }
-                    }
-                    tarFileInputStream.close();
-
-                    // If a binary exists, copy it to the target and create a pom for it.
-                    if (uncompressedBinary != null) {
-                        if(!targetDir.exists()) {
-                            if(!targetDir.mkdirs()) {
-                                throw new RuntimeException("Could not create directory: "
+ targetDir.getAbsolutePath());
-                            }
-                        }
-                        final File targetFile = new File(targetDir, "/runtime-" + version
+ "-linux.uexe");
-                        copyFile(uncompressedBinary, targetFile);
-
-                        // Clean up in the temp directory.
-                        if(!uncompressedBinary.delete()) {
-                            System.out.println("Could not delete: " + uncompressedBinary.getAbsolutePath());
-                        }
-                    }
-
-                    // Clean up in the temp directory.
-                    if(!tempTarFile.delete()) {
-                        System.out.println("Could not delete: " + tempTarFile.getAbsolutePath());
-                    }
-                }
-
-                final MavenMetadata playerArtifact = new MavenMetadata();
-                playerArtifact.setGroupId("com.adobe.flash");
-                playerArtifact.setArtifactId("runtime");
-                playerArtifact.setVersion(version);
-                playerArtifact.setPackaging("exe");
-
-                writeDocument(createPomDocument(playerArtifact), new File(targetDir, "runtime-"
+ version + ".pom"));
-            }
-        }
-    }
-}
+package flex;
+
+import common.BaseGenerator;
+import common.MavenMetadata;
+import org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
+
+import java.io.*;
+import java.text.NumberFormat;
+import java.util.Locale;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: cdutz
+ * Date: 14.05.12
+ * Time: 22:42
+ */
+public class FlexRuntimeGenerator extends BaseGenerator {
+
+    @Override
+    public void process(File sdkSourceDirectory, boolean isApache, File sdkTargetDirectory,
String sdkVersion)
+            throws Exception
+    {
+        processFlashRuntime(sdkSourceDirectory, sdkTargetDirectory);
+    }
+
+    protected void processFlashRuntime(File sdkSourceDirectory, File sdkTargetDirectory)
+            throws Exception
+    {
+        final File runtimeDirectory = new File(sdkSourceDirectory, "runtimes");
+        final File flashPlayerDirectory = new File(runtimeDirectory, "player");
+
+        File[] versions = flashPlayerDirectory.listFiles(new FileFilter() {
+            public boolean accept(File pathname) {
+                return pathname.isDirectory() && !"win".equalsIgnoreCase(pathname.getName())
&&
+                        !"lnx".equalsIgnoreCase(pathname.getName()) && !"mac".equalsIgnoreCase(pathname.getName());
+            }
+        });
+        // The flash-player 9 is installed directly in the player directory.
+        if(new File(flashPlayerDirectory, "win").exists()) {
+            final File[] extendedVersions = new File[versions.length + 1];
+            System.arraycopy(versions, 0, extendedVersions, 0, versions.length);
+            extendedVersions[versions.length] = flashPlayerDirectory;
+            versions = extendedVersions;
+        }
+
+        if(versions != null) {
+            for(final File versionDir : versions) {
+                // If the versionDir is called "player", then this is the home of the flash-player
version 9.
+                final String playerVersionString = "player".equalsIgnoreCase(versionDir.getName())
? "9.0" : versionDir.getName();
+                final double playerVersion = Double.valueOf(playerVersionString);
+                final NumberFormat doubleFormat = NumberFormat.getInstance(Locale.US);
+                doubleFormat.setMinimumFractionDigits(1);
+                doubleFormat.setMaximumFractionDigits(1);
+                final String version = doubleFormat.format(playerVersion);
+
+                final File targetDir = new File(sdkTargetDirectory, "com/adobe/flash/runtime/"
+ version);
+
+                // Deploy Windows binaries.
+                final File windowsDirectory = new File(versionDir, "win");
+                if(windowsDirectory.exists()) {
+                    // Find out if a flash-player binary exists.
+                    File flashPlayerBinary = null;
+                    if(new File(windowsDirectory, "FlashPlayerDebugger.exe").exists()) {
+                        flashPlayerBinary = new File(windowsDirectory, "FlashPlayerDebugger.exe");
+                    } else if(new File(windowsDirectory, "FlashPlayer.exe").exists()) {
+                        flashPlayerBinary = new File(windowsDirectory, "FlashPlayer.exe");
+                    }
+
+                    // If a binary exists, copy it to the target and create a pom for it.
+                    if (flashPlayerBinary != null) {
+                        if(!targetDir.exists()) {
+                            if(!targetDir.mkdirs()) {
+                                throw new RuntimeException("Could not create directory: "
+ targetDir.getAbsolutePath());
+                            }
+                        }
+                        final File targetFile = new File(targetDir, "/runtime-" + version
+ "-win.exe");
+                        copyFile(flashPlayerBinary, targetFile);
+                    }
+                }
+
+                // Deploy Mac binaries.
+                final File macDirectory = new File(versionDir, "mac");
+                if(macDirectory.exists()) {
+                    // Find out if a flash-player binary exists.
+                    File flashPlayerBinary = null;
+                    if(new File(macDirectory, "Flash Player.app.zip").exists()) {
+                        flashPlayerBinary = new File(macDirectory, "Flash Player.app.zip");
+                    } else if(new File(macDirectory, "Flash Player Debugger.app.zip").exists())
{
+                        flashPlayerBinary = new File(macDirectory, "Flash Player Debugger.app.zip");
+                    }
+
+                    // If a binary exists, copy it to the target and create a pom for it.
+                    if (flashPlayerBinary != null) {
+                        if(!targetDir.exists()) {
+                            if(!targetDir.mkdirs()) {
+                                throw new RuntimeException("Could not create directory: "
+ targetDir.getAbsolutePath());
+                            }
+                        }
+                        final File targetFile = new File(targetDir, "/runtime-" + version
+ "-mac.zip");
+                        copyFile(flashPlayerBinary, targetFile);
+                    }
+                }
+
+                // Deploy Linux binaries.
+                final File lnxDirectory = new File(versionDir, "lnx");
+                if(lnxDirectory.exists()) {
+                    // Find out if a flash-player binary exists.
+                    File flashPlayerBinary = null;
+                    if(new File(lnxDirectory, "flashplayer.tar.gz").exists()) {
+                        flashPlayerBinary = new File(lnxDirectory, "flashplayer.tar.gz");
+                    } else if(new File(lnxDirectory, "flashplayerdebugger.tar.gz").exists())
{
+                        flashPlayerBinary = new File(lnxDirectory, "flashplayerdebugger.tar.gz");
+                    }
+
+                    // Decompress the archive.
+                    // First unzip it.
+                    final FileInputStream fin = new FileInputStream(flashPlayerBinary);
+                    final BufferedInputStream in = new BufferedInputStream(fin);
+                    final File tempTarFile = File.createTempFile("flex-sdk-linux-flashplayer-binary-"
+ version, ".tar");
+                    final FileOutputStream out = new FileOutputStream(tempTarFile);
+                    final GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in);
+                    final byte[] buffer = new byte[1024];
+                    int n;
+                    while (-1 != (n = gzIn.read(buffer))) {
+                        out.write(buffer, 0, n);
+                    }
+                    out.close();
+                    gzIn.close();
+
+                    // Then untar it.
+                    File uncompressedBinary = null;
+                    final FileInputStream tarFileInputStream = new FileInputStream(tempTarFile);
+                    final TarArchiveInputStream tarArchiveInputStream = new TarArchiveInputStream(tarFileInputStream);
+                    ArchiveEntry entry;
+                    while((entry = tarArchiveInputStream.getNextEntry()) != null) {
+                        if("flashplayer".equals(entry.getName())) {
+                            uncompressedBinary = File.createTempFile("flex-sdk-linux-flashplayer-binary-"
+ version, ".uexe");
+                            final FileOutputStream uncompressedBinaryOutputStream = new FileOutputStream(uncompressedBinary);
+                            while(-1 != (n = tarArchiveInputStream.read(buffer))) {
+                                uncompressedBinaryOutputStream.write(buffer, 0, n);
+                            }
+                            uncompressedBinaryOutputStream.close();
+                        } else if("flashplayerdebugger".equals(entry.getName())) {
+                            uncompressedBinary = File.createTempFile("flex-sdk-linux-flashplayer-binary-"
+ version, ".uexe");
+                            final FileOutputStream uncompressedBinaryOutputStream = new FileOutputStream(uncompressedBinary);
+                            while(-1 != (n = tarArchiveInputStream.read(buffer))) {
+                                uncompressedBinaryOutputStream.write(buffer, 0, n);
+                            }
+                            uncompressedBinaryOutputStream.close();
+                        }
+                    }
+                    tarFileInputStream.close();
+
+                    // If a binary exists, copy it to the target and create a pom for it.
+                    if (uncompressedBinary != null) {
+                        if(!targetDir.exists()) {
+                            if(!targetDir.mkdirs()) {
+                                throw new RuntimeException("Could not create directory: "
+ targetDir.getAbsolutePath());
+                            }
+                        }
+                        final File targetFile = new File(targetDir, "/runtime-" + version
+ "-linux.uexe");
+                        copyFile(uncompressedBinary, targetFile);
+
+                        // Clean up in the temp directory.
+                        if(!uncompressedBinary.delete()) {
+                            System.out.println("Could not delete: " + uncompressedBinary.getAbsolutePath());
+                        }
+                    }
+
+                    // Clean up in the temp directory.
+                    if(!tempTarFile.delete()) {
+                        System.out.println("Could not delete: " + tempTarFile.getAbsolutePath());
+                    }
+                }
+
+                final MavenMetadata playerArtifact = new MavenMetadata();
+                playerArtifact.setGroupId("com.adobe.flash");
+                playerArtifact.setArtifactId("runtime");
+                playerArtifact.setVersion(version);
+                playerArtifact.setPackaging("exe");
+
+                writeDocument(createPomDocument(playerArtifact), new File(targetDir, "runtime-"
+ version + ".pom"));
+            }
+        }
+    }
+}

Propchange: incubator/flex/utilities/trunk/mavenizer/src/main/java/flex/FlexRuntimeGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/flex/utilities/trunk/mavenizer/src/main/java/flex/FlexRuntimeGenerator.java
            ('svn:executable' removed)



Mime
View raw message