Skip to content

Commit

Permalink
don't run local builds in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Sep 11, 2024
1 parent f2f9870 commit feaeafb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
19 changes: 16 additions & 3 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3030,6 +3030,7 @@ class SnippetHost implements pxt.Host {
class Host
implements pxt.Host {
fileOverrides: Map<string> = {}
queue = new pxt.Util.PromiseQueue();

resolve(module: pxt.Package, filename: string) {
//pxt.debug(`resolving ${module.level}:${module.id} -- ${filename} in ${path.resolve(".")}`)
Expand Down Expand Up @@ -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<void> {
Expand Down
4 changes: 2 additions & 2 deletions cli/prepYotta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 2 additions & 0 deletions pxtlib/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,8 @@ namespace pxt {
}
}

einfo.appVariant = variant;

const inf = target.isNative ? await this.host().getHexInfoAsync(einfo) : null

einfo = U.flatClone(einfo)
Expand Down

0 comments on commit feaeafb

Please sign in to comment.