Skip to content

Commit

Permalink
support compileServiceVariants in daldts command (#10057)
Browse files Browse the repository at this point in the history
* support compileServiceVariants in daldts command

* don't forget typings
  • Loading branch information
riknoll authored Jul 30, 2024
1 parent f53bd26 commit 63359a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cli/buildengine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export function buildDalConst(buildEngine: BuildEngine, mainPkg: pxt.MainPackage
const constName = "dal.d.ts";
let constPath = constName;
const config = mainPkg && mainPkg.config;
const corePackage = config && config.dalDTS && config.dalDTS.corePackage;
const corePackage = config?.dalDTS?.corePackage;
if (corePackage)
constPath = path.join(corePackage, constName);
let vals: Map<string> = {}
Expand Down
27 changes: 15 additions & 12 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4778,18 +4778,21 @@ async function buildDalDTSAsync(c: commandParser.ParsedCommand) {

if (fs.existsSync("pxtarget.json")) {
pxt.log(`generating dal.d.ts for packages`)
return rebundleAsync()
.then(() => forEachBundledPkgAsync((f, dir) => {
return f.loadAsync()
.then(() => {
if (f.config.dalDTS && f.config.dalDTS.corePackage) {
console.log(` ${dir}`)
return prepAsync()
.then(() => build.buildDalConst(build.thisBuild, f, true, true));
}
return Promise.resolve();
})
}));
await rebundleAsync();
await forEachBundledPkgAsync(async (f, dir) => {
await f.loadAsync();
if (f.config.dalDTS && f.config.dalDTS.corePackage) {
console.log(` ${dir}`)

if (f.config.dalDTS.compileServiceVariant) {
pxt.setAppTargetVariant(f.config.dalDTS.compileServiceVariant);
setBuildEngine();
}

await prepAsync();
build.buildDalConst(build.thisBuild, f, true, true);
}
})
} else {
ensurePkgDir()
await mainPkg.loadAsync()
Expand Down
1 change: 1 addition & 0 deletions localtypings/pxtpackage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ declare namespace pxt {
corePackage?: string;
includeDirs?: string[];
excludePrefix?: string[];
compileServiceVariant?: string;
};
features?: string[];
hidden?: boolean; // hide package from package selection dialog
Expand Down

0 comments on commit 63359a8

Please sign in to comment.