diff --git a/cli/cli.ts b/cli/cli.ts index 98fc295b056c..5ba851aea3bf 100644 --- a/cli/cli.ts +++ b/cli/cli.ts @@ -3030,6 +3030,7 @@ class SnippetHost implements pxt.Host { class Host implements pxt.Host { fileOverrides: Map = {} + queue = new pxt.Util.PromiseQueue(); resolve(module: pxt.Package, filename: string) { //pxt.debug(`resolving ${module.level}:${module.id} -- ${filename} in ${path.resolve(".")}`) @@ -3165,10 +3166,22 @@ class Host if (useCompileServiceDocker) { return build.compileWithLocalCompileService(extInfo); } + return this.queue.enqueue("getHexInfoAsync", async () => { + const prevVariant = pxt.appTargetVariant; - setBuildEngine() - return build.buildHexAsync(build.thisBuild, mainPkg, extInfo, forceBuild) - .then(() => build.thisBuild.patchHexInfo(extInfo)) + if (extInfo.appVariant && extInfo.appVariant !== prevVariant) { + pxt.setAppTargetVariant(extInfo.appVariant, { temporary: true }); + } + setBuildEngine() + await build.buildHexAsync(build.thisBuild, mainPkg, extInfo, forceBuild) + const res = build.thisBuild.patchHexInfo(extInfo); + + if (extInfo.appVariant && extInfo.appVariant !== prevVariant) { + pxt.setAppTargetVariant(prevVariant); + } + + return res; + }); } cacheStoreAsync(id: string, val: string): Promise { diff --git a/cli/prepYotta.ts b/cli/prepYotta.ts index 43775ac04155..5309d10d9b52 100644 --- a/cli/prepYotta.ts +++ b/cli/prepYotta.ts @@ -7,8 +7,8 @@ const os = require("os"); const path = require("path"); const fs = require("fs"); -const token = process.env["GH_ACCESS_TOKEN"]; -if (process.env["GH_ACCESS_TOKEN"]) { +const token = process.env["GITHUB_ACCESS_TOKEN"]; +if (process.env["GITHUB_ACCESS_TOKEN"]) { console.log("Writing .netrc and .yotta/config.json") const home = os.homedir(); diff --git a/pxtlib/package.ts b/pxtlib/package.ts index 0c2b303b48df..6a0d2d0d85e5 100644 --- a/pxtlib/package.ts +++ b/pxtlib/package.ts @@ -1187,6 +1187,8 @@ namespace pxt { } } + einfo.appVariant = variant; + const inf = target.isNative ? await this.host().getHexInfoAsync(einfo) : null einfo = U.flatClone(einfo)