Skip to content

Commit

Permalink
Merge pull request #176 from airsdk/develop
Browse files Browse the repository at this point in the history
Release v1.5.0
  • Loading branch information
marchbold authored May 12, 2023
2 parents 16d52ee + 981a6e3 commit defa418
Show file tree
Hide file tree
Showing 10 changed files with 371 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ package com.apm.client.commands.packages
var maxIdentifierLength:int = findMaxIdentifierLength( _queryData.packagesToInstall );

var hasUpdatesAvailable:Boolean = false;
for each (var packageData:InstallPackageData in _queryData.packagesToInstall)
for each (var packageToInstall:InstallPackageData in _queryData.packagesToInstall)
{
var cachedPackage:PackageDefinitionFile = ProjectPackageCache.getPackage( packageData.request.packageIdentifier );
var cachedPackageToInstall:PackageDefinitionFile = ProjectPackageCache.getPackage( packageToInstall.request.packageIdentifier );

hasUpdatesAvailable ||= cachedPackage == null ? true : packageData.packageVersion.version.greaterThan(
cachedPackage.version.version );
hasUpdatesAvailable ||= cachedPackageToInstall == null ? true : packageToInstall.packageVersion.version.greaterThan(
cachedPackageToInstall.version.version );
}

if (hasUpdatesAvailable || !printUpdateAvailableOnly)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package com.apm.client.commands.project
{
import airsdk.AIRSDKVersion;

import com.apm.client.APM;
import com.apm.client.commands.Command;
import com.apm.client.commands.project.processes.AndroidManifestMergeProcess;
Expand All @@ -28,45 +28,44 @@ package com.apm.client.commands.project
import com.apm.client.processes.ProcessQueue;
import com.apm.data.project.ApplicationDescriptor;
import com.apm.data.project.ProjectDefinition;

import flash.events.EventDispatcher;
import flash.filesystem.File;



public class GenerateAppDescriptorCommand extends EventDispatcher implements Command
{
////////////////////////////////////////////////////////
// CONSTANTS
//

private static const TAG:String = "GenerateAppDescriptorCommand";


public static const NAME:String = "generate/app-descriptor";


////////////////////////////////////////////////////////
// VARIABLES
//

private var _parameters:Array;
private var _options:Array;
private var _queue:ProcessQueue;


////////////////////////////////////////////////////////
// FUNCTIONALITY
//

public function GenerateAppDescriptorCommand()
{
super();
_parameters = [];
_options = [];
_queue = new ProcessQueue();
}


public function setParameters( parameters:Array ):void
{
if (parameters != null)
Expand All @@ -86,26 +85,26 @@ package com.apm.client.commands.project
}
}
}


public function get name():String
{
return NAME;
}


public function get category():String
{
return "";
}


public function get description():String
{
return "generate an application descriptor with all package required additions";
}


public function get usage():String
{
return description + "\n" +
Expand All @@ -114,34 +113,48 @@ package com.apm.client.commands.project
"apm generate app-descriptor [out.xml] generates an application descriptor updating the specified out.xml file\n" +
"\n" +
"options: \n" +
" --exclude-android excludes generation of the android manifest additions\n" +
" --exclude-ios excludes generation of the iOS info additions and entitlements\n"
" --exclude-android \n" +
" --ios excludes generation of the android manifest additions\n" +
" --exclude-ios \n" +
" --android excludes generation of the iOS info additions and entitlements\n" +
" --strip-comments strip comments from the generated application descriptor\n"
;
}


public function get requiresNetwork():Boolean
{
return false;
}


public function get requiresProject():Boolean
{
return true;
}


public function execute():void
{
Log.d( TAG, "execute(): " + (_parameters.length > 0 ? _parameters.join( "," ) : "...") + "\n" );

var excludeAndroid:Boolean = false;
var excludeIOS:Boolean = false;
var stripComments:Boolean = false;
for each (var option:String in _options)
{
switch (option)
{
case "--ios":
{
excludeAndroid = true;
break;
}
case "--android":
{
excludeIOS = true;
break;
}
case "--exclude-android":
{
excludeAndroid = true;
Expand All @@ -152,9 +165,14 @@ package com.apm.client.commands.project
excludeIOS = true;
break;
}
case "--strip-comments":
{
stripComments = true;
break;
}
}
}

// Get AIR SDK version for app descriptor
var airSDKVersion:AIRSDKVersion = null;
if (APM.config.airDirectory != null)
Expand All @@ -171,17 +189,17 @@ package com.apm.client.commands.project
Log.d( TAG, "AIR DIR doesn't exist: " + APM.config.airDirectory );
}
}

Log.d( TAG, "AIR SDK Version: " + (airSDKVersion == null ? "null" : airSDKVersion.toString()) );
var appDescriptor:ApplicationDescriptor = new ApplicationDescriptor( airSDKVersion );

var appDescriptor:ApplicationDescriptor = new ApplicationDescriptor( airSDKVersion, stripComments );

var outputPath:String = defaultOutputPath();
if (_parameters.length > 0)
{
outputPath = _parameters[ 0 ];
outputPath = _parameters[0];
}

_queue.addProcess( new ValidateProjectParametersProcess() );
_queue.addProcess( new ValidatePackageCacheProcess() );
if (!excludeAndroid)
Expand All @@ -194,7 +212,7 @@ package com.apm.client.commands.project
_queue.addProcess( new IOSEntitlementsMergeProcess( appDescriptor ) );
}
_queue.addProcess( new ApplicationDescriptorGenerationProcess( appDescriptor, outputPath ) );

_queue.start(
function ():void
{
Expand All @@ -206,27 +224,30 @@ package com.apm.client.commands.project
dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR ) );
} );
}


public function defaultOutputPath():String
{
var proj:ProjectDefinition = APM.config.projectDefinition;
if (proj.applicationFilename != null)
var buildType:String = APM.config.buildType;
var filename:String = proj.getApplicationFilename( buildType );
var appName:Object = proj.getApplicationName( buildType );
if (filename != null)
{
return "src/" + proj.applicationFilename + "-app.xml";
return "src/" + filename + "-app.xml";
}
else if (proj.applicationName is String)
else if (appName is String)
{
return "src/" + proj.applicationName.replace( / /g, "" ) + "-app.xml";
return "src/" + appName.replace( / /g, "" ) + "-app.xml";
}
else if (proj.applicationName.hasOwnProperty("en"))
else if (appName.hasOwnProperty( "en" ))
{
return "src/" + proj.applicationName["en"].replace( / /g, "" ) + "-app.xml";
return "src/" + appName["en"].replace( / /g, "" ) + "-app.xml";
}
return "src/MyApplication-app.xml";
}


}

}
Loading

0 comments on commit defa418

Please sign in to comment.