From 3da01bba2e19845a602f3276c1fb0ac91fc6a384 Mon Sep 17 00:00:00 2001 From: marchbold Date: Fri, 24 Feb 2023 14:55:26 +1000 Subject: [PATCH] feat(project): add new project command to facilitate setting build type variations of the app id, and version (resolves #157) --- client/src/com/apm/client/APM.as | 11 +- .../client/commands/packages/ListCommand.as | 71 ++++--- .../client/commands/project/ProjectCommand.as | 185 ++++++++++++++++++ .../project/processes/ProjectGetProcess.as | 119 +++++++++++ .../project/processes/ProjectSetProcess.as | 114 +++++++++++ .../apm/data/project/ApplicationDescriptor.as | 6 +- .../project/ProjectApplicationProperties.as | 25 +++ .../com/apm/data/project/ProjectBuildType.as | 88 ++++++--- .../com/apm/data/project/ProjectDefinition.as | 125 +++++++++--- version.config | 2 +- 10 files changed, 647 insertions(+), 99 deletions(-) create mode 100644 client/src/com/apm/client/commands/project/ProjectCommand.as create mode 100644 client/src/com/apm/client/commands/project/processes/ProjectGetProcess.as create mode 100644 client/src/com/apm/client/commands/project/processes/ProjectSetProcess.as create mode 100644 client/src/com/apm/data/project/ProjectApplicationProperties.as diff --git a/client/src/com/apm/client/APM.as b/client/src/com/apm/client/APM.as index 8ff7908..db63bcf 100644 --- a/client/src/com/apm/client/APM.as +++ b/client/src/com/apm/client/APM.as @@ -35,6 +35,7 @@ package com.apm.client import com.apm.client.commands.project.GenerateAppDescriptorCommand; import com.apm.client.commands.project.GenerateConfigCommand; import com.apm.client.commands.project.InitCommand; + import com.apm.client.commands.project.ProjectCommand; import com.apm.client.commands.project.ProjectConfigCommand; import com.apm.client.config.RunConfig; import com.apm.client.events.CommandEvent; @@ -111,6 +112,7 @@ package com.apm.client // project commands addCommand( InitCommand.NAME, InitCommand ); + addCommand( ProjectCommand.NAME, ProjectCommand ); addCommand( ProjectConfigCommand.NAME, ProjectConfigCommand ); addCommand( GenerateAppDescriptorCommand.NAME, GenerateAppDescriptorCommand ); addCommand( GenerateConfigCommand.NAME, GenerateConfigCommand ); @@ -250,10 +252,13 @@ package com.apm.client { // Check for command var CommandClass:Class = getCommand( arg ); - if (CommandClass == null && i + 1 < arguments.length) + if (i + 1 < arguments.length) { - CommandClass = getCommand( arg + "/" + arguments[ i + 1 ] ) - if (CommandClass != null) i++; + var SubCommandClass:Class = getCommand( arg + "/" + arguments[ i + 1 ] ) + if (SubCommandClass != null) { + CommandClass = SubCommandClass; + i++; + } } if (CommandClass != null) diff --git a/client/src/com/apm/client/commands/packages/ListCommand.as b/client/src/com/apm/client/commands/packages/ListCommand.as index 8bd8b8a..0dce13b 100644 --- a/client/src/com/apm/client/commands/packages/ListCommand.as +++ b/client/src/com/apm/client/commands/packages/ListCommand.as @@ -17,94 +17,93 @@ package com.apm.client.commands.packages import com.apm.client.commands.Command; import com.apm.client.events.CommandEvent; import com.apm.data.project.ProjectDefinition; - + import flash.events.EventDispatcher; - - + public class ListCommand extends EventDispatcher implements Command { - + //////////////////////////////////////////////////////// // CONSTANTS // - + private static const TAG:String = "ListCommand"; - - + + public static const NAME:String = "list"; - - + + //////////////////////////////////////////////////////// // VARIABLES // - + private var _parameters:Array; - + //////////////////////////////////////////////////////// // FUNCTIONALITY // - + public function ListCommand() { super(); } - - + + public function setParameters( parameters:Array ):void { _parameters = parameters; } - - + + public function get name():String { return NAME; } - - + + public function get category():String { return ""; } - - + + public function get requiresNetwork():Boolean { return false; } - - + + public function get requiresProject():Boolean { return true; } - - + + public function get description():String { return "lists dependencies currently added to your project"; } - - + + public function get usage():String { return description + "\n" + "\n" + "apm list list all the dependencies in your project\n" } - - + + public function execute():void { var project:ProjectDefinition = APM.config.projectDefinition; if (project == null) { APM.io.writeLine( "ERROR: project definition not found" ); - dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR )); + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR ) ); return; } - - APM.io.writeLine( project.applicationFilename + "@" + project.version + " " + APM.config.workingDirectory + "" ); + + APM.io.writeLine( project.getApplicationId( APM.config.buildType ) + "@" + project.getVersion( APM.config.buildType ) + " " + APM.config.workingDirectory + "" ); if (project.dependencies.length == 0) { APM.io.writeLine( "└── (empty)" ); @@ -115,13 +114,13 @@ package com.apm.client.commands.packages { APM.io.writeLine( (i == project.dependencies.length - 1 ? "└──" : "├──") + - project.dependencies[ i ].toString() ); + project.dependencies[i].toString() ); } } - dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_OK )); - + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_OK ) ); + } - + } - + } diff --git a/client/src/com/apm/client/commands/project/ProjectCommand.as b/client/src/com/apm/client/commands/project/ProjectCommand.as new file mode 100644 index 0000000..de3cc60 --- /dev/null +++ b/client/src/com/apm/client/commands/project/ProjectCommand.as @@ -0,0 +1,185 @@ +/** + * __ __ __ + * ____/ /_ ____/ /______ _ ___ / /_ + * / __ / / ___/ __/ ___/ / __ `/ __/ + * / /_/ / (__ ) / / / / / /_/ / / + * \__,_/_/____/_/ /_/ /_/\__, /_/ + * / / + * \/ + * http://distriqt.com + * + * @author Michael (https://github.com/marchbold) + * @created 24/2/2023 + */ +package com.apm.client.commands.project +{ + import com.apm.client.APM; + import com.apm.client.commands.Command; + import com.apm.client.commands.project.processes.ProjectGetProcess; + import com.apm.client.commands.project.processes.ProjectSetProcess; + import com.apm.client.events.CommandEvent; + import com.apm.client.logging.Log; + import com.apm.client.processes.ProcessQueue; + + import flash.events.EventDispatcher; + + public class ProjectCommand extends EventDispatcher implements Command + { + + //////////////////////////////////////////////////////// + // CONSTANTS + // + + private static const TAG:String = "ProjectCommand"; + + public static const NAME:String = "project"; + + + //////////////////////////////////////////////////////// + // VARIABLES + // + + private var _parameters:Array; + + + //////////////////////////////////////////////////////// + // FUNCTIONALITY + // + + public function ProjectCommand() + { + super(); + _parameters = []; + } + + + public function setParameters( parameters:Array ):void + { + _parameters = parameters; + } + + + public function get name():String + { + return NAME; + } + + + public function get category():String + { + return ""; + } + + + public function get requiresNetwork():Boolean + { + return false; + } + + + public function get requiresProject():Boolean + { + return true; + } + + + public function get description():String + { + return "controls the project parameters saved in the project definition"; + } + + + public function get usage():String + { + return description + "\n" + + "\n" + + "apm project Prints all project parameters \n" + + "apm project set Sets a project parameter to the specified \n" + + "apm project set Asks for input to set the value for the project parameter \n" + + "apm project get Prints the project parameter value for the parameter \n" + ; + } + + + public function execute():void + { + Log.d( TAG, "execute(): [" + (_parameters.length > 0 ? _parameters.join( " " ) : " ") + "]\n" ); + try + { + var queue:ProcessQueue = new ProcessQueue(); + + if (_parameters.length > 0) + { + var subCommand:String = _parameters[0]; + switch (subCommand) + { + case "set": + { + if (_parameters.length < 2) + { + dispatchEvent( new CommandEvent( CommandEvent.PRINT_USAGE, name ) ); + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR ) ); + return; + } + + queue.addProcess( new ProjectSetProcess( + _parameters.length < 2 ? null : _parameters[1], + _parameters.length < 3 ? null : _parameters.slice( 2 ).join( " " ) + ) ); + + break; + } + + case "get": + { + if (_parameters.length < 2) + { + queue.addProcess( new ProjectGetProcess( null ) ); + } + else + { + queue.addProcess( new ProjectGetProcess( _parameters[1] ) ); + } + break; + } + + default: + { + dispatchEvent( new CommandEvent( CommandEvent.PRINT_USAGE, name ) ); + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR ) ); + return; + } + } + } + else + { + // print all config + queue.addProcess( new ProjectGetProcess( null ) ); + } + + + queue.start( + function ():void + { + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_OK ) ); + }, + function ( error:String ):void + { + APM.io.writeError( NAME, error ); + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR ) ); + } + ); + + } + catch (e:Error) + { + APM.io.error( e ); + dispatchEvent( new CommandEvent( CommandEvent.COMPLETE, APM.CODE_ERROR ) ); + } + } + + + } + + +} diff --git a/client/src/com/apm/client/commands/project/processes/ProjectGetProcess.as b/client/src/com/apm/client/commands/project/processes/ProjectGetProcess.as new file mode 100644 index 0000000..463369a --- /dev/null +++ b/client/src/com/apm/client/commands/project/processes/ProjectGetProcess.as @@ -0,0 +1,119 @@ +/** + * __ __ __ + * ____/ /_ ____/ /______ _ ___ / /_ + * / __ / / ___/ __/ ___/ / __ `/ __/ + * / /_/ / (__ ) / / / / / /_/ / / + * \__,_/_/____/_/ /_/ /_/\__, /_/ + * / / + * \/ + * http://distriqt.com + * + * @author Michael (https://github.com/marchbold) + * @created 24/2/2023 + */ +package com.apm.client.commands.project.processes +{ + import com.apm.client.APM; + import com.apm.client.processes.ProcessBase; + import com.apm.data.project.ProjectDefinition; + import com.apm.data.project.ProjectParameter; + + + public class ProjectGetProcess extends ProcessBase + { + //////////////////////////////////////////////////////// + // CONSTANTS + // + + private static const TAG:String = "ProjectGetProcess"; + + + //////////////////////////////////////////////////////// + // VARIABLES + // + + private var _paramName:String; + + + //////////////////////////////////////////////////////// + // FUNCTIONALITY + // + + public function ProjectGetProcess( paramName:String ) + { + _paramName = paramName; + } + + + override public function start( completeCallback:Function = null, failureCallback:Function = null ):void + { + super.start( completeCallback, failureCallback ); + + var project:ProjectDefinition = APM.config.projectDefinition; + if (project == null) + { + failure( "No project file found" ); + return; + } + + if (_paramName == null) + { + // print all config + APM.io.writeLine( project.getApplicationId( APM.config.buildType ) + "@" + project.getVersion( APM.config.buildType ) + " " + APM.config.workingDirectory + "" ); + + APM.io.writeValue( "identifier", project.getApplicationId( APM.config.buildType ) ); + APM.io.writeValue( "version", project.getVersion( APM.config.buildType ) ); + APM.io.writeValue( "versionLabel", project.getVersionLabel( APM.config.buildType ) ); + + APM.io.writeLine( "" ); + APM.io.writeLine( "configuration" ); + for each (var param:ProjectParameter in APM.config.projectDefinition.getConfiguration( APM.config.buildType )) + { + APM.io.writeValue( param.name, param.value ); + } + + APM.io.writeLine( "" ); + APM.io.writeLine( "dependencies" ); + if (project.dependencies.length == 0) + { + APM.io.writeLine( "└── (empty)" ); + } + else + { + for (var i:int = 0; i < project.dependencies.length; i++) + { + APM.io.writeLine( + (i == project.dependencies.length - 1 ? "└──" : "├──") + + project.dependencies[ i ].toString() ); + } + } + } + else + { + switch (_paramName) + { + case "id": + case "identifier": + APM.io.writeValue( "identifier", project.getApplicationId( APM.config.buildType ) ); + break; + + case "version": + APM.io.writeValue( "version", project.getVersion( APM.config.buildType ) ); + break; + + case "versionLabel": + APM.io.writeValue( "versionLabel", project.getVersionLabel( APM.config.buildType ) ); + break; + + default: + APM.io.writeError( "parameter", "not found" ); + break; + } + } + + complete(); + } + + } + +} diff --git a/client/src/com/apm/client/commands/project/processes/ProjectSetProcess.as b/client/src/com/apm/client/commands/project/processes/ProjectSetProcess.as new file mode 100644 index 0000000..d7ed759 --- /dev/null +++ b/client/src/com/apm/client/commands/project/processes/ProjectSetProcess.as @@ -0,0 +1,114 @@ +/** + * __ __ __ + * ____/ /_ ____/ /______ _ ___ / /_ + * / __ / / ___/ __/ ___/ / __ `/ __/ + * / /_/ / (__ ) / / / / / /_/ / / + * \__,_/_/____/_/ /_/ /_/\__, /_/ + * / / + * \/ + * http://distriqt.com + * + * @author Michael (https://github.com/marchbold) + * @created 24/2/2023 + */ +package com.apm.client.commands.project.processes +{ + import com.apm.client.APM; + import com.apm.client.processes.ProcessBase; + import com.apm.data.packages.PackageDefinitionFile; + import com.apm.data.packages.PackageParameter; + import com.apm.data.project.ProjectDefinition; + import com.apm.data.project.ProjectParameter; + import com.apm.utils.ProjectPackageCache; + + public class ProjectSetProcess extends ProcessBase + { + //////////////////////////////////////////////////////// + // CONSTANTS + // + + private static const TAG:String = "ProjectSetProcess"; + + + //////////////////////////////////////////////////////// + // VARIABLES + // + + + private var _paramName:String; + private var _paramValue:String; + + + //////////////////////////////////////////////////////// + // FUNCTIONALITY + // + + public function ProjectSetProcess( paramName:String, paramValue:String ) + { + _paramName = paramName; + _paramValue = paramValue; + } + + + override public function start( completeCallback:Function = null, failureCallback:Function = null ):void + { + super.start( completeCallback, failureCallback ); + + var project:ProjectDefinition = APM.config.projectDefinition; + if (project == null) + { + failure( "No project file found" ); + return; + } + + if (_paramName == null) + { + failure( "No parameter name specified" ); + return; + } + else if (_paramValue == null) + { + var value:String = APM.io.question( "Set", _paramName ); + setProjectValue( project, _paramName, value ) + } + else + { + setProjectValue( project, _paramName, _paramValue ) + } + + project.save(); + complete(); + } + + + private function setProjectValue( project:ProjectDefinition, name:String, value:String ):void + { + switch (_paramName) + { + case "id": + case "identifier": + { + project.setApplicationId( value, APM.config.buildType ); + break; + } + case "version": + { + project.setVersion( value, APM.config.buildType ); + break; + } + case "versionLabel": + { + project.setVersionLabel( value, APM.config.buildType ); + break; + } + default: + { + APM.io.writeError( name, "Invalid project parameter name" ); + } + } + } + + + } + +} diff --git a/client/src/com/apm/data/project/ApplicationDescriptor.as b/client/src/com/apm/data/project/ApplicationDescriptor.as index c88edc5..ced4abb 100644 --- a/client/src/com/apm/data/project/ApplicationDescriptor.as +++ b/client/src/com/apm/data/project/ApplicationDescriptor.as @@ -147,9 +147,9 @@ package com.apm.data.project } } if (isPropertyValueValid( project.applicationFilename )) _xml.filename = project.applicationFilename; - if (isPropertyValueValid( project.version )) _xml.versionNumber = project.version; - if (isPropertyValueValid( project.versionLabel )) _xml.versionLabel = project.versionLabel; - + if (isPropertyValueValid( project.getVersion( buildType ) )) _xml.versionNumber = project.getVersion( buildType ); + if (isPropertyValueValid( project.getVersionLabel( buildType ) )) _xml.versionLabel = project.getVersionLabel( buildType ); + } } diff --git a/client/src/com/apm/data/project/ProjectApplicationProperties.as b/client/src/com/apm/data/project/ProjectApplicationProperties.as new file mode 100644 index 0000000..6a48da6 --- /dev/null +++ b/client/src/com/apm/data/project/ProjectApplicationProperties.as @@ -0,0 +1,25 @@ +/** + * __ __ __ + * ____/ /_ ____/ /______ _ ___ / /_ + * / __ / / ___/ __/ ___/ / __ `/ __/ + * / /_/ / (__ ) / / / / / /_/ / / + * \__,_/_/____/_/ /_/ /_/\__, /_/ + * / / + * \/ + * https://distriqt.com + * + * @author Michael Archbold (https://github.com/marchbold) + * @created 20/2/2023 + * @copyright distriqt 2023 (https://distriqt.com/copyright/license.txt) + */ +package com.apm.data.project +{ + public interface ProjectApplicationProperties + { + function get applicationId():String; + function get version():String; + function get versionLabel():String; + + } + +} diff --git a/client/src/com/apm/data/project/ProjectBuildType.as b/client/src/com/apm/data/project/ProjectBuildType.as index e8e0eab..66a769e 100644 --- a/client/src/com/apm/data/project/ProjectBuildType.as +++ b/client/src/com/apm/data/project/ProjectBuildType.as @@ -15,51 +15,71 @@ */ package com.apm.data.project { - - public class ProjectBuildType + + public class ProjectBuildType implements ProjectApplicationProperties { //////////////////////////////////////////////////////// // CONSTANTS // - + private static const TAG:String = "ProjectBuildVariant"; - - + + //////////////////////////////////////////////////////// // VARIABLES // - + /** * The name of this build type eg debug */ public var name:String; - public var applicationId:String = null; + private var _applicationId:String = null; + public function get applicationId():String { return _applicationId; } + + public function set applicationId( value:String ):void { _applicationId = value; } + + private var _version:String = null; + public function get version():String { return _version; } + + public function set version( value:String ):void { _version = value; } + + private var _versionLabel:String = null; + public function get versionLabel():String { return _versionLabel; } + + public function set versionLabel( value:String ):void { _versionLabel = value; } - private var _configuration:Vector.; - - + + //////////////////////////////////////////////////////// // FUNCTIONALITY // - + public function ProjectBuildType( name:String ) { this.name = name; _configuration = new []; } - - + + public function fromObject( data:Object ):ProjectBuildType { if (data != null) { - if (data.hasOwnProperty("identifier")) + if (data.hasOwnProperty( "identifier" )) { applicationId = data.identifier; } + if (data.hasOwnProperty( "version" )) + { + version = data.version; + } + if (data.hasOwnProperty( "versionLabel" )) + { + versionLabel = data.versionLabel; + } if (data.hasOwnProperty( "configuration" )) { @@ -67,7 +87,7 @@ package com.apm.data.project for (var key:String in data.configuration) { _configuration.push( - ProjectParameter.fromObject( key, data.configuration[ key ] ) + ProjectParameter.fromObject( key, data.configuration[key] ) ); } _configuration.sort( Array.CASEINSENSITIVE ); @@ -75,8 +95,8 @@ package com.apm.data.project } return this; } - - + + public function toObject():Object { var data:Object = {}; @@ -85,18 +105,26 @@ package com.apm.data.project { data["identifier"] = applicationId; } + if (version != null) + { + data["version"] = version; + } + if (versionLabel != null) + { + data["versionLabel"] = versionLabel; + } var configObject:Object = {}; for each (var param:ProjectParameter in _configuration) { - configObject[ param.name ] = param.toObject( true ); + configObject[param.name] = param.toObject( true ); } - data[ "configuration" ] = configObject; + data["configuration"] = configObject; return data; } - - + + /** * Retrieves the specified configuration parameter * @@ -115,8 +143,8 @@ package com.apm.data.project } return null; } - - + + /** * Sets a value for the configuration parameter * @@ -130,6 +158,16 @@ package com.apm.data.project applicationId = value; return; } + if (key == "version") + { + version = value; + return; + } + if (key == "versionLabel") + { + versionLabel = value; + return; + } if (_configuration == null) _configuration = new []; var param:ProjectParameter = getConfigurationParam( key ); @@ -146,7 +184,7 @@ package com.apm.data.project param.value = value; } } - + } - + } diff --git a/client/src/com/apm/data/project/ProjectDefinition.as b/client/src/com/apm/data/project/ProjectDefinition.as index 3da8869..e679898 100644 --- a/client/src/com/apm/data/project/ProjectDefinition.as +++ b/client/src/com/apm/data/project/ProjectDefinition.as @@ -28,7 +28,7 @@ package com.apm.data.project /** * Handles loading and saving a project definition file */ - public class ProjectDefinition + public class ProjectDefinition implements ProjectApplicationProperties { //////////////////////////////////////////////////////// // CONSTANTS @@ -63,10 +63,10 @@ package com.apm.data.project { _data = {}; - _repositories = new []; - _dependencies = new []; + _repositories = new []; + _dependencies = new []; _configuration = new []; - _buildTypes = new []; + _buildTypes = new []; _deployOptions = {}; } @@ -129,7 +129,7 @@ package com.apm.data.project var data:Object = toObject(); // Ensures the output JSON format is in a familiar order - var keyOrder:Array = [ "identifier", "name", "filename", "version", "versionLabel", "dependencies", "configuration", "buildTypes", "repositories" ]; + var keyOrder:Array = [ "identifier", "name", "filename", "version", "versionLabel", "dependencies", "configuration", "buildTypes", "repositories" ]; var otherKeys:Array = JSONUtils.getMissingKeys( data, keyOrder ); otherKeys.sort(); @@ -141,10 +141,10 @@ package com.apm.data.project { var data:Object = {}; - data["identifier"] = applicationId; - data["name"] = applicationName; - data["filename"] = applicationFilename; - data["version"] = version; + data["identifier"] = applicationId; + data["name"] = applicationName; + data["filename"] = applicationFilename; + data["version"] = version; data["versionLabel"] = versionLabel; var repos:Array = []; @@ -238,7 +238,7 @@ package com.apm.data.project // - public function getApplicationId( buildType:String ):String + public function getApplicationId( buildType:String = null ):String { if (buildType != null) { @@ -255,6 +255,71 @@ package com.apm.data.project } + public function setApplicationId( value:String, buildType:String = null ):void + { + if (buildType != null) + { + var projectBuildType:ProjectBuildType = getBuildType( buildType, true ); + projectBuildType.applicationId = value; + return; + } + applicationId = value; + } + + public function getVersion( buildType:String = null ):String + { + if (buildType != null) + { + var projectBuildType:ProjectBuildType = getBuildType( buildType ); + if (projectBuildType != null) + { + if (projectBuildType.version != null) + { + return projectBuildType.version; + } + } + } + return version; + } + + public function setVersion( value:String, buildType:String = null ):void + { + if (buildType != null) + { + var projectBuildType:ProjectBuildType = getBuildType( buildType, true ); + projectBuildType.version = value; + return; + } + version = value; + } + + public function getVersionLabel( buildType:String = null ):String + { + if (buildType != null) + { + var projectBuildType:ProjectBuildType = getBuildType( buildType ); + if (projectBuildType != null) + { + if (projectBuildType.versionLabel != null) + { + return projectBuildType.versionLabel; + } + } + } + return versionLabel; + } + + public function setVersionLabel( value:String, buildType:String = null ):void + { + if (buildType != null) + { + var projectBuildType:ProjectBuildType = getBuildType( buildType, true ); + projectBuildType.versionLabel = value; + return; + } + versionLabel = value; + } + /** * Retrieves the configuration parameters for the specified build type * @@ -340,17 +405,8 @@ package com.apm.data.project { if (buildType != null && buildType != "null" && buildType.length > 0) { - var projectBuildType:ProjectBuildType = getBuildType( buildType ); - if (projectBuildType == null) - { - projectBuildType = new ProjectBuildType( buildType ); - projectBuildType.setConfigurationParamValue( key, value ); - _buildTypes.push( projectBuildType ); - } - else - { - projectBuildType.setConfigurationParamValue( key, value ); - } + var projectBuildType:ProjectBuildType = getBuildType( buildType, true ); + projectBuildType.setConfigurationParamValue( key, value ); } else { @@ -358,8 +414,8 @@ package com.apm.data.project var param:ProjectParameter = getConfigurationParam( key, null ); if (param == null) { - param = new ProjectParameter(); - param.name = key; + param = new ProjectParameter(); + param.name = key; param.value = value; _configuration.push( param ); _configuration.sort( Array.CASEINSENSITIVE ); @@ -383,10 +439,10 @@ package com.apm.data.project if (param == null) { // New parameter - param = new ProjectParameter(); - param.name = packageParam.name; + param = new ProjectParameter(); + param.name = packageParam.name; param.required = packageParam.required; - param.value = packageParam.defaultValue; + param.value = packageParam.defaultValue; _configuration.push( param ); _configuration.sort( Array.CASEINSENSITIVE ); @@ -408,15 +464,22 @@ package com.apm.data.project // BUILD TYPES // - public function getBuildType( name:String ):ProjectBuildType + public function getBuildType( name:String, create:Boolean = false ):ProjectBuildType { - for each (var buildType:ProjectBuildType in _buildTypes) + var buildType:ProjectBuildType; + for each (buildType in _buildTypes) { if (buildType.name == name) { return buildType; } } + if (create) + { + buildType = new ProjectBuildType( name ); + _buildTypes.push( buildType ); + return buildType; + } return null; } @@ -462,9 +525,9 @@ package com.apm.data.project } var dep:PackageDependency = new PackageDependency(); - dep.identifier = packageVersion.packageDef.identifier; - dep.version = SemVerRange.fromString( packageVersion.version.toString() ); - dep.source = packageVersion.source; + dep.identifier = packageVersion.packageDef.identifier; + dep.version = SemVerRange.fromString( packageVersion.version.toString() ); + dep.source = packageVersion.source; dependencies.push( dep ); diff --git a/version.config b/version.config index 78a5c8b..41c082e 100644 --- a/version.config +++ b/version.config @@ -1,6 +1,6 @@ #Fri, 19 Aug 2022 12:30:31 +1000 version_major=1 -version_minor=3 +version_minor=4 version_build=0 version_preview=