From ddf5412cbbfd289ad81d2ccad2b4fadef7f8ddf5 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Sat, 7 Jun 2014 11:33:55 -0700 Subject: [PATCH] Add a `./bin/aphlict build` workflow. Summary: Currently, it is a bit tricky to build the Aphlict client SWF from the ActionScript source. Provide a `./bin/aphlict build` workflow that simplifies this process. Depends on D9226. Test Plan: Executed the workflow: ``` > ./bin/aphlict build Done. ``` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9338 --- src/__phutil_library_map__.php | 2 + ...bricatorAphlictManagementBuildWorkflow.php | 53 +++++++++++++++++++ .../aphlict/client/build_aphlict_client.sh | 19 ------- support/aphlict/server/aphlict_launcher.php | 1 + 4 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 src/applications/aphlict/management/PhabricatorAphlictManagementBuildWorkflow.php delete mode 100755 support/aphlict/client/build_aphlict_client.sh diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0d6af5f4ce..8f9bf00bac 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1105,6 +1105,7 @@ phutil_register_library_map(array( 'PhabricatorActionView' => 'view/layout/PhabricatorActionView.php', 'PhabricatorAllCapsTranslation' => 'infrastructure/internationalization/translation/PhabricatorAllCapsTranslation.php', 'PhabricatorAnchorView' => 'view/layout/PhabricatorAnchorView.php', + 'PhabricatorAphlictManagementBuildWorkflow' => 'applications/aphlict/management/PhabricatorAphlictManagementBuildWorkflow.php', 'PhabricatorAphlictManagementDebugWorkflow' => 'applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php', 'PhabricatorAphlictManagementRestartWorkflow' => 'applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php', 'PhabricatorAphlictManagementStartWorkflow' => 'applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php', @@ -3877,6 +3878,7 @@ phutil_register_library_map(array( 'PhabricatorActionView' => 'AphrontView', 'PhabricatorAllCapsTranslation' => 'PhabricatorTranslation', 'PhabricatorAnchorView' => 'AphrontView', + 'PhabricatorAphlictManagementBuildWorkflow' => 'PhabricatorAphlictManagementWorkflow', 'PhabricatorAphlictManagementDebugWorkflow' => 'PhabricatorAphlictManagementWorkflow', 'PhabricatorAphlictManagementRestartWorkflow' => 'PhabricatorAphlictManagementWorkflow', 'PhabricatorAphlictManagementStartWorkflow' => 'PhabricatorAphlictManagementWorkflow', diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementBuildWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementBuildWorkflow.php new file mode 100644 index 0000000000..b2665c47a1 --- /dev/null +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementBuildWorkflow.php @@ -0,0 +1,53 @@ +setName('build') + ->setSynopsis(pht('Build the Aphlict client.')) + ->setArguments( + array( + array( + 'name' => 'debug', + 'help' => 'Enable a debug build.', + ), + )); + } + + public function execute(PhutilArgumentParser $args) { + $console = PhutilConsole::getConsole(); + $root = dirname(__FILE__).'/../../../..'; + + if (!Filesystem::binaryExists('mxmlc')) { + $console->writeErr('`mxmlc` is not installed.'); + return 1; + } + + $argv = array( + "-source-path=$root/externals/vegas/src", + '-static-link-runtime-shared-libraries=true', + '-warnings=true', + '-strict=true', + ); + + if ($args->getArg('debug')) { + $argv[] = '-debug=true'; + } + + list ($err, $stdout, $stderr) = exec_manual('mxmlc %Ls -output=%s %s', + $argv, + $root.'/webroot/rsrc/swf/aphlict.swf', + $root.'/support/aphlict/client/src/AphlictClient.as'); + + if ($err) { + $console->writeErr($stderr); + return 1; + } + + $console->writeOut("Done.\n"); + return 0; + } + +} diff --git a/support/aphlict/client/build_aphlict_client.sh b/support/aphlict/client/build_aphlict_client.sh deleted file mode 100755 index 7c9eb01bc6..0000000000 --- a/support/aphlict/client/build_aphlict_client.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -BASEDIR=`dirname $0` -ROOT=`cd $BASEDIR/../../../ && pwd`; - -if [ -z "$MXMLC" ]; then - echo "ERROR: Define environmental variable MXMLC to point to 'mxmlc' binary."; - exit 1; -fi; - -set -e - -$MXMLC \ - -output=$ROOT/webroot/rsrc/swf/aphlict.swf \ - -strict=true \ - -warnings=true \ - -source-path=$ROOT/externals/vegas/src \ - -static-link-runtime-shared-libraries=true \ - $BASEDIR/src/AphlictClient.as diff --git a/support/aphlict/server/aphlict_launcher.php b/support/aphlict/server/aphlict_launcher.php index c64c7feb68..38cf33aa54 100755 --- a/support/aphlict/server/aphlict_launcher.php +++ b/support/aphlict/server/aphlict_launcher.php @@ -22,5 +22,6 @@ $args->parseWorkflows(array( new PhabricatorAphlictManagementStopWorkflow(), new PhabricatorAphlictManagementRestartWorkflow(), new PhabricatorAphlictManagementDebugWorkflow(), + new PhabricatorAphlictManagementBuildWorkflow(), new PhutilHelpArgumentWorkflow(), ));