check command line Judge the target platforms.
if the command line includes platform names, call grunt cordova_register_platform:<platform>.
see '$ cordova compile --help'
1615
function parsePlatforms() {
        var supportPlatforms = [
            { platform: 'android',          regexp: /android/ig         },
            { platform: 'ios',              regexp: /ios/ig             },
            { platform: 'firefoxos',        regexp: /firefoxos/ig       },
            { platform: 'windows8',         regexp: /windows8/ig        },
            { platform: 'browser',          regexp: /browser/ig         },
            { platform: 'amazon-fireos',    regexp: /amazon-fireos/ig   },
            { platform: 'blackberry10',     regexp: /blackberry10/ig    },
            { platform: 'windows',          regexp: /windows/ig         },
            { platform: 'wp8',              regexp: /wp8/ig             },
        ];

        var gruntTasks = [];

        supportPlatforms.forEach(function (checker) {
            if (null != _cmdline.match(checker.regexp)) {
                gruntTasks.push('cordova_register_platform:' + checker.platform);
            }
        });

        return gruntTasks;
    }
1330808
def cli(ctx, lsftdi, lsusb, lsserial, info):
    """"""

    exit_code = 0

    if lsftdi:
        exit_code = System().lsftdi()
    elif lsusb:
        exit_code = System().lsusb()
    elif lsserial:
        exit_code = System().lsserial()
    elif info:
        click.secho('Platform: ', nl=False)
        click.secho(get_systype(), fg='yellow')
    else:
        click.secho(ctx.get_help())

    ctx.exit(exit_code)
684817
def platform_detect():
    """"""
    # Handle Raspberry Pi
    pi = pi_version()
    if pi is not None:
        return RASPBERRY_PI

    # Handle Beaglebone Black
    # TODO: Check the Beaglebone Black /proc/cpuinfo value instead of reading
    # the platform.
    plat = platform.platform()
    if plat.lower().find('armv7l-with-debian') > -1:
        return BEAGLEBONE_BLACK
    elif plat.lower().find('armv7l-with-ubuntu') > -1:
        return BEAGLEBONE_BLACK
    elif plat.lower().find('armv7l-with-glibc2.4') > -1:
        return BEAGLEBONE_BLACK
    elif plat.lower().find('armv7l-with-arch') > -1:
        return BEAGLEBONE_BLACK

    # Couldn't figure out the platform, just return unknown.
    return UNKNOWN
189842
function checkProjectCompilations(project) {
	return waitForCompletion(project)
	.then(() => {
		for (const platform in project.compilations) {
			if (!project.compilations.hasOwnProperty(platform)) {
				continue;
			}
			const compilation = project.compilations[platform];
			if (compilation.isReady()) {
				console.info(compilation.platform + " compilation from " + project.name + " project: " + project.id + " is completed.");
			} else if (compilation.isErred()) {
				console.error(compilation.platform + " compilation from " + project.name + " project: " + project.id + " is erred.");
				console.error("ERROR LOG of the " + compilation.platform + " platform:");
				console.error(compilation.error);
			} else {
				console.error(compilation.platform + " compilation from " + project.name + " project: " + project.id +
					" was ignored. Status: " + compilation.status + ".");
			}
		}
		return undefined;
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
556684
function getPlatformDetailsFromDir(dir, platformIfKnown){
    var libDir = path.resolve(dir);
    var platform;
    var version;

    try {
        var pkg = require(path.join(libDir, 'package'));
        platform = platformFromName(pkg.name);
        version = pkg.version;
    } catch(e) {
        // Older platforms didn't have package.json.
        platform = platformIfKnown || platformFromName(path.basename(dir));
        var verFile = fs.existsSync(path.join(libDir, 'VERSION')) ? path.join(libDir, 'VERSION') :
                      fs.existsSync(path.join(libDir, 'CordovaLib', 'VERSION')) ? path.join(libDir, 'CordovaLib', 'VERSION') : null;
        if (verFile) {
            version = fs.readFileSync(verFile, 'UTF-8').trim();
        }
    }

    // if (!version || !platform || !platforms[platform]) {
    //     return Q.reject(new CordovaError('The provided path does not seem to contain a ' +
    //         'Cordova platform: ' + libDir));
    // }

    return Q({
        libDir: libDir,
        platform: platform || platformIfKnown,
        version: version || '0.0.1'
    });
}
329563
function getPlatVersionsFromFileSystem(projectRoot){
    var platforms_on_fs = cordova_util.listPlatforms(projectRoot);
    var platformVersions = platforms_on_fs.map(function(platform){
        var script = path.join(projectRoot, 'platforms', platform, 'cordova', 'version');
        return Q.ninvoke(child_process, 'exec', script, {}).then(function(result){
            var version = result[0];

            // clean the version we get back from the script
            // This is necessary because the version script uses console.log to pass back
            // the version. Using console.log ends up adding additional line breaks/newlines to the value returned.
            // ToDO: version scripts should be refactored to not use console.log()
            var versionCleaned = version.replace(/\r?\n|\r/g, '');
            return {platform: platform, version: versionCleaned};
        });
    });

    return Q.all(platformVersions);
}
751771
def get_platform():
	""""""
	# Detect
	platform_str = platform.system()
	print 'Platform detected: {}'.format(platform_str)
	# Instantiate
	if platform_str == 'Windows':
		return WindowsPlatform()
	elif platform_str == 'Linux':
		return LinuxPlatform()
	else:
		raise NotImplementedError('This platform is not yet supported')
1209609
function detectPlatform(platform) {
    var name = platform.toLowerCase();
    var prefix = "", suffix = "";

    // Detect NuGet/Squirrel.Windows files
    if (name == 'releases' || hasSuffix(name, '.nupkg')) return platforms.WINDOWS_32;

    // Detect prefix: osx, widnows or linux
    if (_.contains(name, 'win')
        || hasSuffix(name, '.exe')) prefix = platforms.WINDOWS;

    if (_.contains(name, 'linux')
        || _.contains(name, 'ubuntu')
        || hasSuffix(name, '.deb')
        || hasSuffix(name, '.rpm')
        || hasSuffix(name, '.tgz')
        || hasSuffix(name, '.tar.gz')) {

        if (_.contains(name, 'linux_deb') || hasSuffix(name, '.deb')) {
            prefix = platforms.LINUX_DEB;
        }
        else if (_.contains(name, 'linux_rpm') || hasSuffix(name, '.rpm')) {
            prefix = platforms.LINUX_RPM;
        }
        else if (_.contains(name, 'linux') || hasSuffix(name, '.tgz') || hasSuffix(name, '.tar.gz')) {
            prefix = platforms.LINUX;
        }
    }

    if (_.contains(name, 'mac')
        || _.contains(name, 'osx')
        || name.indexOf('darwin') >= 0
        || hasSuffix(name, '.dmg')) prefix = platforms.OSX;

    // Detect suffix: 32 or 64
    if (_.contains(name, '32')
        || _.contains(name, 'ia32')
        || _.contains(name, 'i386')) suffix = '32';
    if (_.contains(name, '64') || _.contains(name, 'x64') || _.contains(name, 'amd64')) suffix = '64';

    suffix = suffix || (prefix == platforms.OSX? '64' : '32');
    return _.compact([prefix, suffix]).join('_');
}
65836
def list_platforms(server_url):
    '''
    
    '''
    config = _get_asam_configuration(server_url)
    if not config:
        return False

    url = config['platform_config_url']

    data = {
        'manual': 'false',
    }

    auth = (
        config['username'],
        config['password']
    )

    try:
        html_content = _make_post_request(url, data, auth, verify=False)
    except Exception as exc:
        err_msg = "Failed to look up existing platforms"
        log.error('%s:\n%s', err_msg, exc)
        return {server_url: err_msg}

    parser = _parse_html_content(html_content)
    platform_list = _get_platforms(parser.data)

    if platform_list:
        return {server_url: platform_list}
    else:
        return {server_url: "No existing platforms found"}
1001765
def verify_builder(builder):
    

    try:
        d = getcallargs(builder, package_names=[], export_target='some_path')
    except TypeError:
        return False
    return d == {'package_names': [], 'export_target': 'some_path'}
1156532
protected function checkPlatformCustom()
    {
        foreach ($this->_customPlatformDetection as $platformName => $customPlatform) {
            $platformNameToLookFor = $customPlatform['platformNameToLookFor'];
            $isMobile = $customPlatform['isMobile'];
            if ($this->containString($this->_agent, $platformNameToLookFor)) {
                $this->setPlatform($platformName);
                if ($isMobile) {
                    $this->setMobile(true);
                }
                return true;
            }
        }

        return false;
    }
852362
def detect_platform(self):
        """"""
        # For Mac and Linux 32bit we do not need the bits appended
        if mozinfo.os == 'mac' or \
                (mozinfo.os == 'linux' and mozinfo.bits == 32):
            return mozinfo.os
        else:
            return "%s%d" % (mozinfo.os, mozinfo.bits)
755603
def prepare_for_build(self):
        '''
        '''
        assert(self.target is not None)
        if hasattr(self.target, '_build_prepared'):
            return

        self.info('Preparing build')

        self.info('Check requirements for {0}'.format(self.targetname))
        self.target.check_requirements()

        self.info('Install platform')
        self.target.install_platform()

        self.info('Check application requirements')
        self.check_application_requirements()

        self.info('Check garden requirements')
        self.check_garden_requirements()

        self.info('Compile platform')
        self.target.compile_platform()

        # flag to prevent multiple build
        self.target._build_prepared = True
1118532
def detect_command(cmdlist):
    ''''''

    for platform, command, args in cmdlist:
        if platform is None or sys.platform == platform:
            path = shutil.which(command)
            if path:
                return ' '.join([path, args])

    return ''
1222378
function checkProjectCompilationWithId(projectId, platform) {
	return fetchProject(projectId)
	.then((project) => {
		return checkProjectCompilation(project, platform);
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
977855
protected function checkPlatform()
    {
        if (!$this->checkPlatformCustom()) { /* Customs rules are always checked first */
            /* Mobile platforms */
            if ($this->containString($this->_agent, array('Windows Phone', 'IEMobile'))) { /* Check Windows Phone (formerly Windows Mobile) before Windows */
                $this->setPlatform(self::PLATFORM_WINDOWS_PHONE);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'Windows CE')) { /* Check Windows CE before Windows */
                $this->setPlatform(self::PLATFORM_WINDOWS_CE);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, array('CPU OS', 'CPU iPhone OS', 'iPhone', 'iPad', 'iPod'))) { /* Check iOS (iPad/iPod/iPhone) before Macintosh */
                $this->setPlatform(self::PLATFORM_IOS);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'Android')) {
                $this->setPlatform(self::PLATFORM_ANDROID);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'BlackBerry', true, false) || $this->containString($this->_agent, array('BB10', 'RIM Tablet OS'))) {
                $this->setPlatform(self::PLATFORM_BLACKBERRY);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'Nokia', true, false)) {
                $this->setPlatform(self::PLATFORM_NOKIA);
                $this->setMobile(true);

            /* Desktop platforms */
            } else if ($this->containString($this->_agent, 'Windows')) {
                $this->setPlatform(self::PLATFORM_WINDOWS);
            } else if ($this->containString($this->_agent, 'Macintosh')) {
                $this->setPlatform(self::PLATFORM_MACINTOSH);
            } else if ($this->containString($this->_agent, 'Linux')) {
                $this->setPlatform(self::PLATFORM_LINUX);
            } else if ($this->containString($this->_agent, 'FreeBSD')) {
                $this->setPlatform(self::PLATFORM_FREEBSD);
            } else if ($this->containString($this->_agent, 'OpenBSD')) {
                $this->setPlatform(self::PLATFORM_OPENBSD);
            } else if ($this->containString($this->_agent, 'NetBSD')) {
                $this->setPlatform(self::PLATFORM_NETBSD);

            /* Discontinued */
            } else if ($this->containString($this->_agent, array('Symbian', 'SymbianOS'))) {
                $this->setPlatform(self::PLATFORM_SYMBIAN);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'OpenSolaris')) {
                $this->setPlatform(self::PLATFORM_OPENSOLARIS);

            /* Generic */
            } else if ($this->containString($this->_agent, 'Win', true, false)) {
                $this->setPlatform(self::PLATFORM_WINDOWS);
            } else if ($this->containString($this->_agent, 'Mac', true, false)) {
                $this->setPlatform(self::PLATFORM_MACINTOSH);
            }
        }

        //Check if it's a 64-bit platform
        if ($this->containString($this->_agent, array('WOW64', 'Win64', 'AMD64', 'x86_64', 'x86-64', 'ia64', 'IRIX64',
                'ppc64', 'sparc64', 'x64;', 'x64_64'))) {
            $this->set64bit(true);
        }

        $this->checkPlatformVersion();
    }
795320
function tryParse(filePath: string, platforms: Set<string>): ?AssetPath {
  const result = parsePlatformFilePath(filePath, platforms);
  const {dirPath, baseName, platform, extension} = result;
  if (extension == null) {
    return null;
  }
  const {rootName, resolution} = parseBaseName(baseName);
  return {
    assetName: path.join(dirPath, `${rootName}.${extension}`),
    name: rootName,
    platform,
    resolution,
    type: extension,
  };
}