Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 35D59187F2 for ; Mon, 15 Jun 2015 06:30:53 +0000 (UTC) Received: (qmail 41835 invoked by uid 500); 15 Jun 2015 06:30:37 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 41792 invoked by uid 500); 15 Jun 2015 06:30:37 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 41135 invoked by uid 99); 15 Jun 2015 06:30:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2015 06:30:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 97CDBDFF90; Mon, 15 Jun 2015 06:30:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Mon, 15 Jun 2015 06:31:22 -0000 Message-Id: In-Reply-To: <61f970aa8a47448a9b2548b1b297fecb@git.apache.org> References: <61f970aa8a47448a9b2548b1b297fecb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [48/48] git commit: [flex-utilities] [refs/heads/develop] - move mavenizer under flex-maven-tools move mavenizer under flex-maven-tools Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/657a7def Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/657a7def Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/657a7def Branch: refs/heads/develop Commit: 657a7defe05d65ba290cfecffcf9fdd1602da2ad Parents: bfa34a4 Author: Alex Harui Authored: Sun Jun 14 23:19:49 2015 -0700 Committer: Alex Harui Committed: Sun Jun 14 23:19:49 2015 -0700 ---------------------------------------------------------------------- flex-maven-tools/mavenizer/LICENSE | 203 +++++ flex-maven-tools/mavenizer/NOTICE | 5 + flex-maven-tools/mavenizer/README.txt | 222 ++++++ flex-maven-tools/mavenizer/RELEASE_NOTES | 19 + flex-maven-tools/mavenizer/cli/pom.xml | 107 +++ .../converter/core/SdkConverterCLI.java | 394 ++++++++++ .../mavenizer/converters/air/pom.xml | 41 ++ .../utilities/converter/air/AirConverter.java | 266 +++++++ .../mavenizer/converters/base/pom.xml | 51 ++ .../flex/utilities/converter/BaseConverter.java | 426 +++++++++++ .../flex/utilities/converter/Converter.java | 28 + .../exceptions/ConverterException.java | 32 + .../converter/model/MavenArtifact.java | 168 +++++ .../src/main/resources/templates/default.ftl | 41 ++ .../base/src/main/resources/templates/pom.ftl | 55 ++ .../mavenizer/converters/flash/pom.xml | 46 ++ .../converter/flash/FlashConverter.java | 286 ++++++++ .../mavenizer/converters/flex/pom.xml | 64 ++ .../utilities/converter/flex/FlexConverter.java | 735 +++++++++++++++++++ .../mavenizer/converters/fontkit/pom.xml | 41 ++ .../converter/fontkit/FontkitConverter.java | 74 ++ flex-maven-tools/mavenizer/converters/pom.xml | 45 ++ .../mavenizer/converters/wrapper/pom.xml | 41 ++ .../converter/wrapper/WrapperConverter.java | 93 +++ .../mavenizer/deployers/aether/pom.xml | 125 ++++ .../deployer/aether/AetherDeployer.java | 248 +++++++ .../mavenizer/deployers/maven/pom.xml | 67 ++ .../converter/deployer/maven/MavenDeployer.java | 185 +++++ flex-maven-tools/mavenizer/deployers/pom.xml | 38 + .../mavenizer/maven-extension/pom.xml | 118 +++ .../converter/mavenextension/FlexEventSpy.java | 241 ++++++ flex-maven-tools/mavenizer/pom.xml | 80 ++ .../mavenizer/retrievers/base/pom.xml | 69 ++ .../converter/retrievers/BaseRetriever.java | 116 +++ .../converter/retrievers/Retriever.java | 32 + .../exceptions/RetrieverException.java | 32 + .../retrievers/types/PlatformType.java | 49 ++ .../converter/retrievers/types/SdkType.java | 30 + .../converter/retrievers/utils/ProgressBar.java | 47 ++ .../retrievers/types/PlatformTypeTest.java | 69 ++ .../mavenizer/retrievers/download/pom.xml | 53 ++ .../retrievers/download/DownloadRetriever.java | 459 ++++++++++++ .../retrievers/download/SystemIdHelper.java | 35 + .../src/main/resources/message.properties | 25 + flex-maven-tools/mavenizer/retrievers/pom.xml | 38 + mavenizer/LICENSE | 203 ----- mavenizer/NOTICE | 5 - mavenizer/README.txt | 222 ------ mavenizer/RELEASE_NOTES | 19 - mavenizer/cli/pom.xml | 107 --- .../converter/core/SdkConverterCLI.java | 394 ---------- mavenizer/converters/air/pom.xml | 41 -- .../utilities/converter/air/AirConverter.java | 266 ------- mavenizer/converters/base/pom.xml | 51 -- .../flex/utilities/converter/BaseConverter.java | 426 ----------- .../flex/utilities/converter/Converter.java | 28 - .../exceptions/ConverterException.java | 32 - .../converter/model/MavenArtifact.java | 168 ----- .../src/main/resources/templates/default.ftl | 41 -- .../base/src/main/resources/templates/pom.ftl | 55 -- mavenizer/converters/flash/pom.xml | 46 -- .../converter/flash/FlashConverter.java | 286 -------- mavenizer/converters/flex/pom.xml | 64 -- .../utilities/converter/flex/FlexConverter.java | 735 ------------------- mavenizer/converters/fontkit/pom.xml | 41 -- .../converter/fontkit/FontkitConverter.java | 74 -- mavenizer/converters/pom.xml | 45 -- mavenizer/converters/wrapper/pom.xml | 41 -- .../converter/wrapper/WrapperConverter.java | 93 --- mavenizer/deployers/aether/pom.xml | 125 ---- .../deployer/aether/AetherDeployer.java | 248 ------- mavenizer/deployers/maven/pom.xml | 67 -- .../converter/deployer/maven/MavenDeployer.java | 185 ----- mavenizer/deployers/pom.xml | 38 - mavenizer/maven-extension/pom.xml | 118 --- .../converter/mavenextension/FlexEventSpy.java | 241 ------ mavenizer/pom.xml | 80 -- mavenizer/retrievers/base/pom.xml | 69 -- .../converter/retrievers/BaseRetriever.java | 116 --- .../converter/retrievers/Retriever.java | 32 - .../exceptions/RetrieverException.java | 32 - .../retrievers/types/PlatformType.java | 49 -- .../converter/retrievers/types/SdkType.java | 30 - .../converter/retrievers/utils/ProgressBar.java | 47 -- .../retrievers/types/PlatformTypeTest.java | 69 -- mavenizer/retrievers/download/pom.xml | 53 -- .../retrievers/download/DownloadRetriever.java | 459 ------------ .../retrievers/download/SystemIdHelper.java | 35 - .../src/main/resources/message.properties | 25 - mavenizer/retrievers/pom.xml | 38 - 90 files changed, 5639 insertions(+), 5639 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/LICENSE ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/LICENSE b/flex-maven-tools/mavenizer/LICENSE new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/flex-maven-tools/mavenizer/LICENSE @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/NOTICE ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/NOTICE b/flex-maven-tools/mavenizer/NOTICE new file mode 100644 index 0000000..d1becf0 --- /dev/null +++ b/flex-maven-tools/mavenizer/NOTICE @@ -0,0 +1,5 @@ +Apache Flex Mavenizer +Copyright 2015 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/README.txt ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/README.txt b/flex-maven-tools/mavenizer/README.txt new file mode 100644 index 0000000..7f84e76 --- /dev/null +++ b/flex-maven-tools/mavenizer/README.txt @@ -0,0 +1,222 @@ +Apache Flex SDK Converter +========================= + The Mavenizer tool is used to convert the Apache and Adobe Flex SDKs and Air + SDKs into Maven artifacts. Automatically creating the Directories, pom-files, + copying and moving the resources to the correct destinations. + + These artifacts can be used in Maven builds using the Flexmojos plugin + (Starting with version 6.x). + + The Apache Flex SDK Converter comes with all the means to download, convert + and deploy a mavenized form of an Apache Flex SDK. + + The Converter does not simply copy all java libraries to the destination; it checks + if the given artifact has already been deployed to maven central or by deploying an + other FDK previously. For this check you do need an internet connection to do the + conversion, otherwise it will probably take forever. + + Internally it consists of 3 components: + - One Retriever + - DownloadRetriever: For downloading binary artifacts + - Four Converters + - One for producing the Apache Flex SDK artifacts + - One for producing the Adobe Flash artifacts + - One for producing the Adobe Air artifacts + - One for producing the Adobe Fontkit artifacts + - Two Deployers + - One using Aether with no requirement to Maven (Faster, but less configurable) + - One using a local Maven installation (A lot slower, but fully configurable) + + + +Getting the latest sources via git +================================== + + Getting the source code is the recommended way to get the Apache Flex SDK + Converter. + + You can always checkout the latest source via git using the following + command: + + git clone https://git-wip-us.apache.org/repos/asf/flex-utilities.git flex-utilities + cd flex-utilities/mavenizer + git checkout develop + +Building the Apache Flex SDK Converter +====================================== + + The Apache Flex SDK Converter is a relatively simple project. It requires some + build tools which must be installed prior to building the compiler and it depends + on some external software which are downloaded as part of the build process. + Some of these have different licenses. See the Software Dependencies section + for more information on the external software dependencies. + +Install Prerequisites +--------------------- + + Before building the Apache Flex Compiler you must install the following software + and set the corresponding environment variables using absolute file paths. + Relative file paths will result in build errors. + + ================================================================================== + SOFTWARE ENVIRONMENT VARIABLE (absolute paths) + ================================================================================== + + Java SDK 1.6 or greater (*1) JAVA_HOME + + Maven 3.1.0 or greater (*1) MAVEN_HOME + + ================================================================================== + + *1) The bin directories for MAVEN_HOME and JAVA_HOME should be added to your + PATH. + + On Windows, set PATH to + + PATH=%PATH%;%MAVEN_HOME%\bin;%JAVA_HOME%\bin + + On the Mac (bash), set PATH to + + export PATH="$PATH:$MAVEN_HOME/bin:$JAVA_HOME/bin" + + On Linux make sure you path include MAVEN_HOME and JAVA_HOME. + +Software Dependencies +--------------------- + + The Apache Flex SDK Converter uses third-party code that will be downloaded as + part of the build. + + The Apache Version 2.0 license is in the LICENSE file. + + The following dependencies have licenses which are, or are compatible with, + the Apache Version 2.0 license. You will not be prompted to acknowledge the + download. Most of the jars are installed in your maven local repository and + are included in the assembly jars. + +TODO: Add them all here ... + +Building the Source in the Source Distribution +---------------------------------------------- + + The project is built with Apache Maven so for a reference to Maven commands + please have a look at the Maven documentation. + + When you have all the prerequisites in place and the environment variables + set (see Install Prerequisites above) use + + cd + mvn install + + to download the thirdparty dependencies and build the binary from the source. + + To clean the build, of everything other than the downloaded third-party + dependencies use + + mvn clean + + The packages can be found in the "target" subdirectories. + + The particularly interesting one is the Standalone Command Line Interface: + - cli/target/apache-flex-sdk-converter-1.0.0-SNAPSHOT.jar + + + +Using the Apache Flex SDK Converter +=================================== + + The CLI (Command Line Interface) allows the Apache Flex SDK Converter + to be executed from the command-line. Assuming the Java executable is + available on the current systems path, it can be called using: + + cd /cli/target + java -jar apache-flex-sdk-converter-1.0.0-SNAPSHOT.jar + + If executed without any command, it will output a list of commands and + available properties. + + In general it is able to perform 4 different commands: + + - help Prints a list of all commands and options available. + - list Lists all versions and platforms available for download + - download Downloads selected versions and assembles an FDK + - convert Converts a previously installed (using the installer) or + assembled (using download command) FDK into a mavenized form. + - deploy Uploads previously created maven artifacts to a remote repository. + +Some typical usage scenarios +---------------------------- + + - Create a mavenized version of a previously installed FDK (Using the installer): + "... -fdkDir -mavenDir convert" + + - Download and create an FDK (Flex 4.14.1 with playerglobal 17.0 and 16.0 + AIR SDK 17.0 for Windows and Mac and the fontkit libs): + "... -fdkDir -flexVersion 4.14.1 -flashVersions 17.0,16.0 \ + -airVersion 17.0 -platform WINDOWS,MAC -fontkit download" + + - Download and convert an FDK (FDK assembled in temp directory using Air for + current systems platform only): + "... -flexVersion 4.14.1 -flashVersions 17.0 -airVersion 17.0 -fontkit \ + -mavenDir download convert" + + - Deploy a bunch of maven artifacts to a remote maven repository: + "... -mavenDir -repoUrl \ + -repoUsername -repoPassword deploy" + + - "The works": Download, Convert and Deploy using only temp directories: + "... -flexVersion 4.14.1 -flashVersions 17.0 -airVersion 17.0 -fontkit \ + -repoUrl -repoUsername -repoPassword \ + download convert deploy" + + +Thanks for using Apache Flex. Enjoy! + + The Apache Flex Project + + + + + + +///////////////////////////////////////////////////////////////////////////////////////// +Some information (HOWTO) to go with the deployer artifacts +///////////////////////////////////////////////////////////////////////////////////////// + +The deployers are separate modules. Currently two implementations exist. +1. The Maven deployer (located in deployers/maven/target/maven-deployer-1.0.0-full.jar) +2. The Aether deployer (located in deployers/aether/target/aether-deployer-1.0.0-full.jar) + +The Maven-Deployer expects Maven to be installed on your system and issues a set of +commandline commands in order to deploy the artifacts. This is the safest approach if you +haven any special settings that need to be handled in order to deploy the artifacts. + +The Aether-Deplyoer uses the Maven-Internal aether libraries to deploy the artifacts from +within the running JVM. This makes this approach a lot faster than the Maven-Deployer. + +///////////////////////////////////////// +Usage for the Maven Deployer: +///////////////////////////////////////// + +java -cp {home}/deployers/maven/target/maven-deployer-1.0.0-full.jar "directory" "repositoryId" "url" "mvn" + +The Maven-Deployer needs 4 ordered parameters separated by spaces: + 1- directory: The path to the directory to deploy. + 2- repositoryId: Server Id to map on the under section of settings.xml. + 3- url: URL where the artifacts will be deployed. + 4- mvn: The path to the mvn.bat / mvn.sh. + +///////////////////////////////////////// +Usage for the Maven Deployer: +///////////////////////////////////////// + +java -cp {home}/deployers/aether/target/maven-aether-1.0.0-full.jar "directory" "url" ["username" "password] + +The Aether-Deployer needs 2 ordered parameters separated by spaces: + 1- directory: The path to the directory to deploy. + 2- url: URL where the artifacts will be deployed. +Optionally you can provide the username and password that is used for deploying artifacts. + 3- username: The username needed to log-in to the remote repository. + 4- password: The password needed to log-in to the remote repository. + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/RELEASE_NOTES ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/RELEASE_NOTES b/flex-maven-tools/mavenizer/RELEASE_NOTES new file mode 100644 index 0000000..d51fd96 --- /dev/null +++ b/flex-maven-tools/mavenizer/RELEASE_NOTES @@ -0,0 +1,19 @@ +Apache Flex Mavenizer 1.0.0 +=========================== + +Apache Flex Mavenizer 1.0.0 is the first release of a tool allowing, automating +the conversion of Apache Flex FDKs into Maven artifacts that can be used by +FlexMojos to build Apache Flex application using Maven. + +Known Issues +_____________ + +Currently None. + + +Please report new issues to our bug tracker at: + + https://issues.apache.org/jira/browse/FLEX + + The Apache Flex Project + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/cli/pom.xml ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/cli/pom.xml b/flex-maven-tools/mavenizer/cli/pom.xml new file mode 100644 index 0000000..511ac31 --- /dev/null +++ b/flex-maven-tools/mavenizer/cli/pom.xml @@ -0,0 +1,107 @@ + + + + 4.0.0 + + + org.apache.flex.utilities.converter + apache-flex-sdk-converter + 1.0.0-SNAPSHOT + + + cli + 1.0.0-SNAPSHOT + jar + + + + + maven-assembly-plugin + 2.4 + + + + true + true + org.apache.flex.utilities.converter.core.SdkConverterCLI + + + ${project.version} + + + + jar-with-dependencies + + apache-flex-sdk-converter-${project.version} + false + + + + package + + single + + + + + + + + + + org.apache.flex.utilities.converter + download-retriever + 1.0.0-SNAPSHOT + + + org.apache.flex.utilities.converter + flex-converter + 1.0.0-SNAPSHOT + + + org.apache.flex.utilities.converter + aether-deployer + 1.0.0-SNAPSHOT + + + + org.apache.maven + maven-artifact + 3.2.3 + + + + commons-cli + commons-cli + 1.2 + + + org.apache.commons + commons-lang3 + 3.3.2 + + + org.slf4j + slf4j-simple + 1.7.7 + + + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/cli/src/main/java/org/apache/flex/utilities/converter/core/SdkConverterCLI.java ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/cli/src/main/java/org/apache/flex/utilities/converter/core/SdkConverterCLI.java b/flex-maven-tools/mavenizer/cli/src/main/java/org/apache/flex/utilities/converter/core/SdkConverterCLI.java new file mode 100644 index 0000000..918dd70 --- /dev/null +++ b/flex-maven-tools/mavenizer/cli/src/main/java/org/apache/flex/utilities/converter/core/SdkConverterCLI.java @@ -0,0 +1,394 @@ +package org.apache.flex.utilities.converter.core; + +import org.apache.commons.cli.*; +import org.apache.commons.io.FileUtils; +import org.apache.flex.utilities.converter.air.AirConverter; +import org.apache.flex.utilities.converter.deployer.aether.AetherDeployer; +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 org.apache.flex.utilities.converter.wrapper.WrapperConverter; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; + +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * Created by christoferdutz on 07.04.15. + */ +public class SdkConverterCLI { + + public static final String COMMAND_HELP = "help"; + public static final String COMMAND_LIST = "list"; + public static final String COMMAND_DOWNLOAD = "download"; + public static final String COMMAND_CONVERT = "convert"; + public static final String COMMAND_DEPLOY = "deploy"; + + public static final String OPTION_FLEX_VERSION = "flexVersion"; + public static final String OPTION_FLASH_VERSIONS = "flashVersions"; + public static final String OPTION_AIT_VERSION = "airVersion"; + public static final String OPTION_FONTKIT = "fontkit"; + public static final String OPTION_PLATFORMS = "platforms"; + + public static final String OPTION_FDK_DIR = "fdkDir"; + public static final String OPTION_MAVEN_DIR = "mavenDir"; + + public static final String OPTION_REPO_URL = "repoUrl"; + public static final String OPTION_REPO_USERNAME = "repoUsername"; + public static final String OPTION_REPO_PASSWORD = "repoPassword"; + + + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + Options options = new Options(); + options.addOption(OptionBuilder.withArgName("version").hasArg(). + withDescription("(Optional and Only valid for download) Version of the " + + "FDK which should be downloaded."). + isRequired(false). + create(OPTION_FLEX_VERSION)); + options.addOption(OptionBuilder.withArgName("version(s)").hasArg(). + withValueSeparator(','). + withDescription("(Optional and Only valid for download) Version(s) of the " + + "Adobe Flash SDK which should be downloaded. Multiple versions can " + + "be separated by \",\"."). + isRequired(false). + create(OPTION_FLASH_VERSIONS)); + options.addOption(OptionBuilder.withArgName("version").hasArg(). + withDescription("(Optional and Only valid for download) Version of the " + + "Adobe Air SDK which should be downloaded."). + isRequired(false). + create(OPTION_AIT_VERSION)); + options.addOption(OptionBuilder. + withDescription("(Optional and Only valid for download) If provided, the " + + "Converter will also download the Fontkit libraries needed for font " + + "encoding."). + isRequired(false). + create(OPTION_FONTKIT)); + options.addOption(OptionBuilder.withArgName("platform(s)").hasArg(). + withValueSeparator(','). + withDescription("(Optional and Only valid for download) Platform the artifacts " + + "should be downloaded for. If omitted the platform this process is run " + + "on will be used. Valid options are: \"WINDOWS\", \"MAC\" and \"LNX\". " + + "Multiple versions can be separated by \",\"."). + isRequired(false). + create(OPTION_PLATFORMS)); + options.addOption(OptionBuilder.withArgName("dir").hasArg(). + withDescription("(Optional) Directory that the FDK will be located in. " + + "If omitted, a temporary directory will be used."). + isRequired(false). + create(OPTION_FDK_DIR)); + options.addOption(OptionBuilder.withArgName("dir").hasArg(). + withDescription("(Optional) Directory that the mavenized artifacts will be located in. " + + "If omitted, a temporary directory will be used."). + isRequired(false). + create(OPTION_MAVEN_DIR)); + options.addOption(OptionBuilder.withArgName("url").hasArg(). + withDescription("(Optional and only valid for deploy) Url of the remote Maven " + + "repository that the generated Maven artifacts should be deployed to."). + isRequired(false). + create(OPTION_REPO_URL)); + options.addOption(OptionBuilder.withArgName("username").hasArg(). + withDescription("(Optional and only valid for deploy) Username used to authenticate " + + "on the remote Maven repository that the generated Maven artifacts should be " + + "deployed to."). + isRequired(false). + create(OPTION_REPO_USERNAME)); + options.addOption(OptionBuilder.withArgName("password").hasArg(). + withDescription("(Optional and only valid for deploy) Password used to authenticate " + + "on the remote Maven repository that the generated Maven artifacts should be " + + "deployed to."). + isRequired(false). + create(OPTION_REPO_PASSWORD)); + + CommandLineParser parser = new BasicParser(); + try { + CommandLine cmd = parser.parse(options, args); + if(cmd.getArgList().isEmpty() || cmd.getArgList().contains(COMMAND_HELP)) { + printHelp(options); + System.exit(0); + } + + // Find out the desired platform(s). + List platforms = new ArrayList(); + String platformParam = cmd.getOptionValue(OPTION_PLATFORMS); + if((platformParam != null) && !platformParam.isEmpty()) { + String[] platformNames = platformParam.split(","); + for(String platformName : platformNames) { + platforms.add(PlatformType.valueOf(platformName)); + } + } + + if(platforms.isEmpty()) { + try { + platforms.add(PlatformType.getCurrent()); + } catch (Exception e) { + System.err.println("Unsupported OS type. Provide manually using 'platform' parameter."); + System.exit(1); + } + } + + ///////////////////////////////////////////////////////// + // Validate sensible combinations of commands. + ///////////////////////////////////////////////////////// + + // Check that all commands are valid. + for(String command : (List) cmd.getArgList()) { + if(!COMMAND_LIST.equals(command) && !COMMAND_DOWNLOAD.equals(command) && + !COMMAND_CONVERT.equals(command) && !COMMAND_DEPLOY.equals(command)) { + System.err.println("Unsupported command '" + command + "'."); + System.exit(1); + } + } + + // Downloading and deploying without converting doesn't make sense. + if(cmd.getArgList().contains(COMMAND_DOWNLOAD) && !cmd.getArgList().contains(COMMAND_CONVERT) && + cmd.getArgList().contains(COMMAND_DEPLOY)) { + System.err.println("Downloading and deploying without conversion doesn't make much sense."); + System.exit(1); + } + + // If Downloading and not converting, the fdkDir parameter has to be provided as + // otherwise the download result would reside in some strange temp directory. + if(cmd.getArgList().contains(COMMAND_DOWNLOAD) && !cmd.getArgList().contains(COMMAND_CONVERT) + && !cmd.hasOption(OPTION_FDK_DIR)) { + System.err.println("Parameter 'fdkDir' required for task 'download' without conversion."); + System.exit(1); + } + + // If Converting and not deploying, the mavenDir parameter has to be provided as + // otherwise the converted FDK would reside in some strange temp directory. + if(cmd.getArgList().contains(COMMAND_CONVERT) && !cmd.getArgList().contains(COMMAND_DEPLOY) + && !cmd.hasOption(OPTION_MAVEN_DIR)) { + System.err.println("Parameter 'mavenDir' required for task 'convert' without deployment."); + System.exit(1); + } + + // Downloading nothing doesn't really make sense. On the bad side it even causes + // problems with the converter without any fdkDir parameter, therefore we abort here. + if(cmd.getArgList().contains(COMMAND_DOWNLOAD) && !cmd.hasOption(OPTION_FLEX_VERSION) && + !cmd.hasOption(OPTION_FLASH_VERSIONS) && !cmd.hasOption(OPTION_AIT_VERSION) && + !cmd.hasOption(OPTION_FONTKIT)) { + System.err.println("At least one of the parameters 'flexVersion', 'flashVersions', 'airVersion' or " + + "'fontkit' required for task 'download'."); + System.exit(1); + } + + // Find out where to download or convert from. + File fdkDir = cmd.hasOption(OPTION_FDK_DIR) ? + new File(cmd.getOptionValue(OPTION_FDK_DIR)) : getTempDir("FLEX-DOWNLOAD-"); + + // Find out where to convert to or deploy from. + File mavenDir = cmd.hasOption(OPTION_MAVEN_DIR) ? + new File(cmd.getOptionValue(OPTION_MAVEN_DIR)) : getTempDir("FLEX-MAVEN-"); + + //////////////////////////////////////////////////////////////////////////// + // Exectute operations + //////////////////////////////////////////////////////////////////////////// + + // Output a list of all available downloads. + if(cmd.getArgList().contains(COMMAND_LIST)) { + System.out.println("-----------------------------------------------"); + System.out.println("- Available downloads"); + System.out.println("-----------------------------------------------"); + + DownloadRetriever retriever = new DownloadRetriever(); + System.out.println("Apache Flex:"); + List versions = new ArrayList( + retriever.getAvailableVersions(SdkType.FLEX).keySet()); + Collections.sort(versions); + for(DefaultArtifactVersion version : versions) { + System.out.println(" - " + version.toString()); + } + System.out.println(); + + System.out.println("Adobe Flash:"); + versions = new ArrayList( + retriever.getAvailableVersions(SdkType.FLASH).keySet()); + Collections.sort(versions); + for(DefaultArtifactVersion version : versions) { + System.out.println(" - " + version.toString()); + } + System.out.println(); + + System.out.println("Adobe AIR:"); + Map> versionData = + retriever.getAvailableVersions(SdkType.AIR); + versions = new ArrayList(versionData.keySet()); + Collections.sort(versions); + for(DefaultArtifactVersion version : versions) { + StringBuilder sb = new StringBuilder(); + sb.append(" - ").append(version.toString()).append(" ("); + boolean firstOption = true; + for(PlatformType platformType : versionData.get(version)) { + if(!firstOption) { + sb.append(", "); + } + sb.append(platformType.name()); + firstOption = false; + } + sb.append(")"); + System.out.println(sb.toString()); + } + } + + // Handle the downloading of atifacts. + if(cmd.getArgList().contains(COMMAND_DOWNLOAD)) { + System.out.println("-----------------------------------------------"); + System.out.println("- Downloading"); + System.out.println("-----------------------------------------------"); + + DownloadRetriever retriever = new DownloadRetriever(); + + String flexVersion = cmd.getOptionValue(OPTION_FLEX_VERSION, null); + if(flexVersion != null) { + System.out.println("- Downloading Flex SDK version: " + flexVersion + + " to directory: " + fdkDir.getAbsolutePath()); + File fdkDownloadDirectory = retriever.retrieve(SdkType.FLEX, flexVersion); + // Unpack the archive to the FDK directory. + mergeDirectories(fdkDownloadDirectory, fdkDir); + + // Add the swfobject files. + File swfObjectDirectory = retriever.retrieve(SdkType.SWFOBJECT); + mergeDirectories(swfObjectDirectory, fdkDir); + } + + String flashVersions = cmd.getOptionValue(OPTION_FLASH_VERSIONS, ""); + if(!flashVersions.isEmpty()) { + for(String flashVersion : flashVersions.split(",")) { + System.out.println("- Downloading Flash SDK version: " + flashVersion + + " to directory: " + fdkDir.getAbsolutePath()); + File flashDownloadDiretory = retriever.retrieve(SdkType.FLASH, flashVersion); + // Integrate the download into the FDK directory. + mergeDirectories(flashDownloadDiretory, fdkDir); + } + } + + String airVersion = cmd.getOptionValue(OPTION_AIT_VERSION, ""); + if(!airVersion.isEmpty()) { + for(PlatformType platformType : platforms) { + System.out.println("- Downloading Air SDK version: " + airVersion + + " and platform " + platformType.name() + + " to directory: " + fdkDir.getAbsolutePath()); + File airDownloadDirectory = retriever.retrieve(SdkType.AIR, airVersion, platformType); + // Integrate the download into the FDK directory. + mergeDirectories(airDownloadDirectory, fdkDir); + } + } + + if(cmd.hasOption(OPTION_FONTKIT)) { + System.out.println("- Downloading Flex Fontkit libraries" + + " to directory: " + fdkDir.getAbsolutePath()); + File fontkitDownloadDirectory = retriever.retrieve(SdkType.FONTKIT); + // Integrate the download into the FDK directory. + mergeDirectories(fontkitDownloadDirectory, fdkDir); + } + + System.out.println("Finished downloads."); + } + + // Handle the conversion. + if(cmd.getArgList().contains(COMMAND_CONVERT)) { + System.out.println("-----------------------------------------------"); + System.out.println("- Conversion"); + System.out.println("-----------------------------------------------"); + + System.out.println("- Converting Flex SDK from " + fdkDir.getAbsolutePath() + + " to " + mavenDir.getAbsolutePath()); + FlexConverter flexConverter = new FlexConverter(fdkDir, mavenDir); + flexConverter.convert(); + + System.out.println("- Converting Flash SDKs from " + fdkDir.getAbsolutePath() + + " to " + mavenDir.getAbsolutePath()); + FlashConverter flashConverter = new FlashConverter(fdkDir, mavenDir); + flashConverter.convert(); + + System.out.println("- Converting Air SDK from " + fdkDir.getAbsolutePath() + + " to " + mavenDir.getAbsolutePath()); + AirConverter airConverter = new AirConverter(fdkDir, mavenDir); + airConverter.convert(); + + System.out.println("- Converting Fontkit libraries from " + fdkDir.getAbsolutePath() + + " to " + mavenDir.getAbsolutePath()); + FontkitConverter fontkitConverter = new FontkitConverter(fdkDir, mavenDir); + fontkitConverter.convert(); + + System.out.println("- Converting Wrappers from " + fdkDir.getAbsolutePath() + + " to " + mavenDir.getAbsolutePath()); + WrapperConverter wrapperConverter = new WrapperConverter(fdkDir, mavenDir); + wrapperConverter.convert(); + + System.out.println("Finished conversion."); + } + + // Handle the deployment. + if(cmd.getArgList().contains(COMMAND_DEPLOY)) { + System.out.println("-----------------------------------------------"); + System.out.println("- Deployment"); + System.out.println("-----------------------------------------------"); + + if(!cmd.hasOption(OPTION_REPO_URL)) { + System.err.println("Parameter 'repoUrl' required for task 'deploy'."); + System.exit(1); + } + + String repoUrl = cmd.getOptionValue(OPTION_REPO_URL); + String repoUsername = cmd.getOptionValue(OPTION_REPO_USERNAME, null); + String repoPassword = cmd.getOptionValue(OPTION_REPO_PASSWORD, null); + + System.out.println("- Deploying libraries to " + repoUrl + " from " + mavenDir.getAbsolutePath()); + + AetherDeployer deployer = new AetherDeployer(mavenDir, repoUrl, repoUsername, repoPassword); + deployer.deploy(); + + System.out.println("Finished deploying."); + } + System.out.println("-----------------------------------------------"); + } catch (ParseException e) { + System.err.println("Parsing failed. Reason: " + e.getMessage()); + printHelp(options); + } + } + + protected static void printHelp(Options options) { + String headerText = "Commands: \n" + + "If the parameters 'fdkDir' and 'mavenDir' are not specified, the Converter creates two temporary " + + "directories in your systems temp directory and uses these for the follwoing commands.\n" + + " - list:\nList all available versions and platforms (for download)\n" + + " - download:\nDownload the selected versions of FDK parts specified by 'flexVersion', " + + "'flashVersions', 'airVersion' and 'fontkit' and creates an FDK in the directory specified by " + + "'fdkDir'. If 'airVersion' is specified, the 'platforms' parameter specifies the platforms for which " + + "the given AIR SDK should be downloaded, if not specified the current systems platform is used. \n" + + " - convert:\nConvert the FDK located in 'fdkDir' into a mavenized form at 'mavenDir'.\n" + + " - deploy:\nDeploy the maven artifacts located in 'mavenDir', to the remote maven repository " + + "specified with 'repoUrl'. If the 'repoUsername' and 'repoPassword' parameters are specified, use " + + "these credentials for authenticating at the remote system.\n" + + "Options:"; + + HelpFormatter helpFormatter = new HelpFormatter(); + helpFormatter.printHelp("java -jar apache-flex-sdk-converter.jar [list] [-fdkDir ] " + + "[-mavenDir ] [[-flexVersion ] [-flashVersions ] " + + "[-airVersion [-platforms ]] [-fontkit] download] [convert] " + + "[-repoUrl [-repoUsername -repoPassword ] deploy]", + headerText, options, ""); + } + + protected static File getTempDir(String prefix) throws IOException { + File tempFile = File.createTempFile(prefix, ".TMP"); + tempFile.delete(); + File tempDir = new File(tempFile.getParentFile(), + tempFile.getName().substring(0, tempFile.getName().length() - 4)); + if(!tempDir.exists()) { + tempDir.mkdirs(); + } + return tempDir; + } + + protected static void mergeDirectories(File sourceDir, File targetDir) throws IOException { + FileUtils.copyDirectory(sourceDir, targetDir); + } + +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/converters/air/pom.xml ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/converters/air/pom.xml b/flex-maven-tools/mavenizer/converters/air/pom.xml new file mode 100644 index 0000000..88d61aa --- /dev/null +++ b/flex-maven-tools/mavenizer/converters/air/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + + + org.apache.flex.utilities.converter + converters + 1.0.0-SNAPSHOT + + + air-converter + 1.0.0-SNAPSHOT + jar + + + + org.apache.flex.utilities.converter + base-converter + 1.0.0-SNAPSHOT + + + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/converters/air/src/main/java/org/apache/flex/utilities/converter/air/AirConverter.java ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/converters/air/src/main/java/org/apache/flex/utilities/converter/air/AirConverter.java b/flex-maven-tools/mavenizer/converters/air/src/main/java/org/apache/flex/utilities/converter/air/AirConverter.java new file mode 100644 index 0000000..d1dbbfc --- /dev/null +++ b/flex-maven-tools/mavenizer/converters/air/src/main/java/org/apache/flex/utilities/converter/air/AirConverter.java @@ -0,0 +1,266 @@ +/* + * 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.flex.utilities.converter.air; + +import org.apache.flex.utilities.converter.BaseConverter; +import org.apache.flex.utilities.converter.Converter; +import org.apache.flex.utilities.converter.exceptions.ConverterException; +import org.apache.flex.utilities.converter.model.MavenArtifact; + +import java.io.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Created by cdutz on 22.04.2014. + */ +public class AirConverter extends BaseConverter implements Converter { + + protected String airSdkVersion; + + /** + * @param rootSourceDirectory Path to the root of the original AIR SDK. + * @param rootTargetDirectory Path to the root of the directory where the Maven artifacts should be generated to. + * @throws ConverterException + */ + public AirConverter(File rootSourceDirectory, File rootTargetDirectory) throws ConverterException { + super(rootSourceDirectory, rootTargetDirectory); + + // Get the version of the current air sdk. + this.airSdkVersion = getAirVersion(rootSourceDirectory); + } + + /** + * Entry point for generating the Maven artifacts for an AIR SDK. + * + * @throws ConverterException + */ + @Override + protected void processDirectory() throws ConverterException { + if((airSdkVersion == null) || !rootSourceDirectory.exists() || !rootSourceDirectory.isDirectory()) { + System.out.println("Skipping AIR SDK generation."); + return; + } + + generateCompilerArtifacts(); + generateRuntimeArtifacts(); + generateFrameworkArtifacts(); + } + + /** + * This method generates those artifacts that resemble the compiler part of the AIR SDK. + * + * @throws ConverterException + */ + protected void generateCompilerArtifacts() throws ConverterException { + // Create the root artifact. + final MavenArtifact compiler = new MavenArtifact(); + compiler.setGroupId("com.adobe.air"); + compiler.setArtifactId("compiler"); + compiler.setVersion(airSdkVersion); + compiler.setPackaging("pom"); + + // Create a list of all libs that should belong to the AIR SDK compiler. + final File directory = new File(rootSourceDirectory, "lib"); + if(!directory.exists() || !directory.isDirectory()) { + throw new ConverterException("Compiler directory does not exist."); + } + final List files = new ArrayList(); + files.addAll(Arrays.asList(directory.listFiles(new AirCompilerFilter()))); + + // Generate artifacts for every jar in the input directories. + for(final File sourceFile : files) { + final MavenArtifact artifact = resolveArtifact(sourceFile, "com.adobe.air.compiler", airSdkVersion); + compiler.addDependency(artifact); + } + + // Write this artifact to file. + writeArtifact(compiler); + } + + /** + * This method generates those artifacts that resemble the runtime part of the AIR SDK. + * + * @throws ConverterException + */ + protected void generateRuntimeArtifacts() throws ConverterException { + // Create the root artifact. + final MavenArtifact runtime = new MavenArtifact(); + runtime.setGroupId("com.adobe.air"); + runtime.setArtifactId("runtime"); + runtime.setVersion(airSdkVersion); + runtime.setPackaging("pom"); + + // Create a list of all libs that should belong to the AIR SDK runtime. + final File directory = new File(rootSourceDirectory, "bin"); + if(!directory.exists() || !directory.isDirectory()) { + throw new ConverterException("Runtime directory does not exist."); + } + final List files = new ArrayList(); + files.addAll(Arrays.asList(directory.listFiles(new AirRuntimeFilter()))); + + // Generate artifacts for every jar in the input directories (Actually this is only one file). + for(final File sourceFile : files) { + final MavenArtifact artifact = resolveArtifact(sourceFile, "com.adobe.air.runtime", airSdkVersion); + runtime.addDependency(artifact); + } + + // Zip up the AIR runtime directory. + final MavenArtifact airRuntimeArtifact = generateAirRuntimeArtifact(rootSourceDirectory); + if(airRuntimeArtifact != null) { + runtime.addDependency(airRuntimeArtifact); + } + + // Write this artifact to file. + writeArtifact(runtime); + } + + /** + * This method generates those artifacts that resemble the framework part of the AIR SDK. + * + * @throws ConverterException + */ + protected void generateFrameworkArtifacts() throws ConverterException { + // Create the root artifact. + final MavenArtifact framework = new MavenArtifact(); + framework.setGroupId("com.adobe.air"); + framework.setArtifactId("framework"); + framework.setVersion(airSdkVersion); + framework.setPackaging("pom"); + + // Create a list of all libs that should belong to the AIR SDK framework. + final File directory = + new File(rootSourceDirectory, "frameworks" + File.separator + "libs" + File.separator + "air"); + if(!directory.exists() || !directory.isDirectory()) { + throw new ConverterException("Framework directory does not exist."); + } + final List files = new ArrayList(); + files.addAll(Arrays.asList(directory.listFiles(new AirFrameworkFilter()))); + + // Generate artifacts for every jar in the input directories. + for(final File sourceFile : files) { + final MavenArtifact artifact = resolveArtifact(sourceFile, "com.adobe.air.framework", airSdkVersion); + framework.addDependency(artifact); + } + + // Write this artifact to file. + writeArtifact(framework); + } + + /////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Utility methods + // + /////////////////////////////////////////////////////////////////////////////////////////////////// + + protected MavenArtifact generateAirRuntimeArtifact(File rootDirectory) throws ConverterException { + final MavenArtifact airRuntimeArtifact = new MavenArtifact(); + airRuntimeArtifact.setGroupId("com.adobe.air.runtime"); + airRuntimeArtifact.setArtifactId("air-runtime"); + airRuntimeArtifact.setVersion(airSdkVersion); + airRuntimeArtifact.setPackaging("zip"); + + final File runtimeRoot = new File(rootDirectory, "runtimes.air".replace(".", File.separator)); + final File[] platforms = runtimeRoot.listFiles(); + if(platforms != null) { + for (final File platform : platforms) { + if (!platform.isDirectory()) { + continue; + } + final String platformName = platform.getName(); + try { + final File zip = File.createTempFile("AirRuntime-" + platformName + "-" + airSdkVersion, "zip"); + generateZip(platform.listFiles(), zip); + airRuntimeArtifact.addBinaryArtifact(platformName, zip); + } catch (IOException e) { + throw new ConverterException("Error creating runtime zip.", e); + } + } + } else { + return null; + } + + writeArtifact(airRuntimeArtifact); + return airRuntimeArtifact; + } + + /** + * Get the version of an AIR SDK from the content of the SDK directory. + * + * @return version string for the current AIR SDK + */ + protected String getAirVersion(File rootDirectory) throws ConverterException { + // All AIR SDKs contain a text file "AIR SDK Readme.txt" which contains a + // Version string in the first line. Newer SDKs contain an additional "airsdk.xml" + // which would be easier to parse, but as all SDKs contain the text-file, we'll + // stick to that for now. + + final File sdkDescriptor = new File(rootDirectory, "AIR SDK Readme.txt"); + + // If the descriptor is not present, return null as this FDK directory doesn't + // seem to contain a AIR SDK. + if(!sdkDescriptor.exists() || !sdkDescriptor.isFile()) { + return null; + } + + DataInputStream in = null; + try { + final FileInputStream descriptorInputStream = new FileInputStream(sdkDescriptor); + in = new DataInputStream(descriptorInputStream); + final BufferedReader br = new BufferedReader(new InputStreamReader(in)); + final String strLine = br.readLine(); + return strLine.substring("Adobe AIR ".length(), strLine.indexOf(" ", "Adobe AIR ".length())); + } catch (Exception e) { + throw new ConverterException("Error getting AIR version.", e); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException ioe) { + // Ignore. + } + } + } + } + + public static class AirCompilerFilter implements FilenameFilter { + public boolean accept(File dir, String name) { + return name.equals("adt.jar"); + } + } + + public static class AirRuntimeFilter implements FilenameFilter { + public boolean accept(File dir, String name) { + return name.equalsIgnoreCase("adl.exe"); + } + } + + public static class AirFrameworkFilter implements FilenameFilter { + public boolean accept(File dir, String name) { + return name.equals("aircore.swc") || name.equals("airglobal.swc") || + name.equals("applicationupdater.swc") || name.equals("applicationupdater_ui.swc") || + name.equals("servicemonitor.swc"); + } + } + + public static void main(String[] args) throws Exception { + AirConverter converter = new AirConverter(new File(args[0]), new File(args[1])); + converter.convert(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/657a7def/flex-maven-tools/mavenizer/converters/base/pom.xml ---------------------------------------------------------------------- diff --git a/flex-maven-tools/mavenizer/converters/base/pom.xml b/flex-maven-tools/mavenizer/converters/base/pom.xml new file mode 100644 index 0000000..5a1b89c --- /dev/null +++ b/flex-maven-tools/mavenizer/converters/base/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + + org.apache.flex.utilities.converter + converters + 1.0.0-SNAPSHOT + + + base-converter + 1.0.0-SNAPSHOT + jar + + + + com.sun.jersey + jersey-client + 1.12 + + + org.codehaus.jettison + jettison + 1.3.1 + + + org.freemarker + freemarker + 2.3.22 + + + +