Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support compileServiceVariants in daldts command #10057

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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