Skip to content

Commit

Permalink
Merge branch 'master' of github.com:georgejecook/maestro-roku-bsc-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook committed Aug 1, 2022
2 parents 0dec38d + 08fa879 commit 67c64b9
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class MaestroPlugin implements CompilerPlugin {
private mFilesToValidate = new Map<string, BrsFile>();
private dirtyCompFilePaths = new Set<string>();
private dirtyNodeClassPaths = new Set<string>();
private filesThatNeedParsingInBeforeProgramValidate = new Map<string, File>();

private skips = {
'__classname': true,
Expand Down Expand Up @@ -181,27 +182,34 @@ export class MaestroPlugin implements CompilerPlugin {
this.importProcessor.processDynamicImports(file, this.program);
this.reflectionUtil.addFile(file);
if (this.shouldParseFile(file)) {
this.nodeClassUtil.addFile(file, mFile);
if (this.maestroConfig.nodeClasses.buildForIDE) {
for (let nc of [...mFile.nodeClasses.values()]) {
nc.generateCode(this.fileFactory, this.program, this.fileMap, this.maestroConfig.nodeClasses.buildForIDE);
}
if (this.maestroConfig.nodeClasses.generateTestUtils) {
this.nodeClassUtil.generateTestCode(this.program);
}
}
if (mFile.nodeClasses.size > 0) {
this.dirtyNodeClassPaths.add(file.pathAbsolute);
}
this.mFilesToValidate.set(file.pkgPath, file);
} else {
this.filesThatNeedParsingInBeforeProgramValidate.set(mFile.fullPath, mFile);
}

} else {
mFile.loadXmlContents();
}
}

beforeProgramValidate(program: Program) {
for (let [, mFile] of this.filesThatNeedParsingInBeforeProgramValidate) {
let file = mFile.bscFile as BrsFile;
this.nodeClassUtil.addFile(file, mFile);
for (let nc of [...mFile.nodeClasses.values()]) {
nc.generateCode(this.fileFactory, this.program, this.fileMap, this.maestroConfig.nodeClasses.buildForIDE);
}
if (this.maestroConfig.nodeClasses.buildForIDE) {
if (this.maestroConfig.nodeClasses.generateTestUtils) {
this.nodeClassUtil.generateTestCode(this.program);
}
}
if (mFile.nodeClasses.size > 0) {
this.dirtyNodeClassPaths.add(file.pathAbsolute);
}
this.mFilesToValidate.set(file.pkgPath, file);
}
this.filesThatNeedParsingInBeforeProgramValidate.clear();
}

afterFileValidate(file: BscFile) {
// console.log('MAESTRO afv-----', file.pathAbsolute);
if (!this.shouldParseFile(file)) {
Expand Down

0 comments on commit 67c64b9

Please sign in to comment.