本文整理汇总了TypeScript中builder-util.archFromString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript archFromString函数的具体用法?TypeScript archFromString怎么用?TypeScript archFromString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了archFromString函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: processTargets
function processTargets(platform: Platform, types: Array<string>) {
function commonArch(currentIfNotSpecified: boolean): Array<Arch> {
if (platform === Platform.MAC) {
return args.x64 || currentIfNotSpecified ? [Arch.x64] : []
}
const result = Array<Arch>()
if (args.x64) {
result.push(Arch.x64)
}
if (args.armv7l) {
result.push(Arch.armv7l)
}
if (args.arm64) {
result.push(Arch.arm64)
}
if (args.ia32) {
result.push(Arch.ia32)
}
return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result
}
if (args.platform != null) {
throw new InvalidConfigurationError(`--platform cannot be used if --${platform.buildConfigurationKey} is passed`)
}
if (args.arch != null) {
throw new InvalidConfigurationError(`--arch cannot be used if --${platform.buildConfigurationKey} is passed`)
}
let archToType = targets.get(platform)
if (archToType == null) {
archToType = new Map<Arch, Array<string>>()
targets.set(platform, archToType)
}
if (types.length === 0) {
const defaultTargetValue = args.dir ? [DIR_TARGET] : []
for (const arch of commonArch(args.dir === true)) {
archToType.set(arch, defaultTargetValue)
}
return
}
for (const type of types) {
const suffixPos = type.lastIndexOf(":")
if (suffixPos > 0) {
addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos))
}
else {
for (const arch of commonArch(true)) {
addValue(archToType, arch, type)
}
}
}
}
示例2: commonArch
function commonArch(currentIfNotSpecified: boolean): Array<Arch> {
if (platform === Platform.MAC) {
return args.x64 || currentIfNotSpecified ? [Arch.x64] : []
}
const result = Array<Arch>()
if (args.x64) {
result.push(Arch.x64)
}
if (args.armv7l) {
result.push(Arch.armv7l)
}
if (args.ia32) {
result.push(Arch.ia32)
}
return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result
}
示例3: createTargets
export function createTargets(platforms: Array<Platform>, type?: string | null, arch?: string | null): Map<Platform, Map<Arch, Array<string>>> {
const targets = new Map<Platform, Map<Arch, Array<string>>>()
for (const platform of platforms) {
const archs = platform === Platform.MAC ? [Arch.x64] : (arch === "all" ? [Arch.x64, Arch.ia32] : [archFromString(arch == null ? process.arch : arch)])
const archToType = new Map<Arch, Array<string>>()
targets.set(platform, archToType)
for (const arch of archs) {
archToType.set(arch, type == null ? [] : [type])
}
}
return targets
}