define([ "require", "dojo/json", "dojo/has", "./fs", "./fileUtils", "./process", "commandLineArgs", "./stringify", "./version", "./messages", "./v1xProfiles", "dojo/text!./help.txt" ], function(require, json, has, fs, fileUtils, process, argv, stringify, version, messages, v1xProfiles, help){ /// // AMD-ID build/argv // // This module parses the command line and returns the result as a hash of from switch-name to switch value // plus the additional property profiles which is a a vector of profile objects build objects, ordered as // provided on the command line. // // Design of relative paths: // // * All relative source paths and relative bc.releaseDir are relative to bc.basePath // * All relative destination paths are relative to bc.releaseDir // * Relative bd.basePath found in a build control script is relative to the directory that contains the script // * Any relative path found on the command line is relative to the current working directory // // For each build control script that is compiled, if bc.basePath is undefined, it is set to the directory that // contains the script. Notice that this feature can be disabled by setting e.g., "basePath==0" in any build control script. eval(require.scopeify("./fileUtils")); var // used to build up the result result = { profiles:[] }, cwd = process.cwd(), // we need to know the dojo path and the path to /util/buildscripts to process v1.x profiles and profiles in the // /util/buildscripts/profiles directory dojoPath = computePath(require.toUrl("dojo/package.json").match(/(.+)\/package\.json$/)[1], cwd), utilBuildscriptsPath = compactPath(catPath(dojoPath, "/../util/buildscripts")), printVersion = 0, printHelp = 0, checkArgs = 0, illegalArgumentValue = function(argumentName, position){ messages.log("inputIllegalCommandlineArg", ["switch", argumentName, "position", position]); }, evalScriptArg= function(arg){ if(arg=="true"){ return true; }else if(arg=="false"){ return false; }else if(arg=="null"){ return null; }else if(isNaN(arg)){ return arg+""; }else{ return Number(arg); } }, readProfile = function( scriptType, filename ){ /// // Load, evaluate and return the result of the contents of the file given by // filename in a scope type given by scriptType as follows: // // When scriptType is "require", contents of filename should be either an application of require to a configuration object or // a bare require object. The contents is evaluated as follows: // `code // (function(){ // var __result = 0, require = function(config){__result=config;}; // // return __result || require; // })(); // // Notice if defines require as a bare object, it will overwrite the provided require, result will be 0, and the bare // object will be returned; otherwise, if contains an application to a configuration object, result will be truthy // and therefore be returned. // // When scriptType is "dojoConfig", contents of filename should include the variable "dojoConfig" which should hold a // a dojo loader configuration: // `code // (function(){ // // return dojoConfig; // })(); // // When scriptType is "profile", contents of filename should be Javascript code that either defines the variable "dependencies" // or the variable "profile". The name dependencies is deprecated; if both names exist, then the value of dependencies is ignored. // The value should be a Javascript object that contains profile properties necessary to effect the desired output. If filename does not // contain a ".js" suffix, then it is assumed to be a profile in the /util/buildscripts/profile directory // `code // (function(selfPath, profile, dependencies){ // return profile || dependencies; // })(, 0, 0); // // For script types "require" and "dojoConfig", if filename gives the filetype ".html" or ".htm", then the file is assumed to be // an html file that contains a