Skip to content

Commit

Permalink
Merge branch 'master' of github.com:georgejecook/rooibos
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook committed Feb 21, 2023
2 parents 4889580 + c2e5b30 commit ac533d7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bsc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@
"ts"
]
}
}
}
12 changes: 9 additions & 3 deletions bsc-plugin/src/lib/rooibos/RooibosSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TestSuiteBuilder } from './TestSuiteBuilder';
import { RawCodeStatement } from './RawCodeStatement';
import type { FileFactory } from './FileFactory';
import type { TestSuite } from './TestSuite';
import { diagnosticErrorNoMainFound as diagnosticWarnNoMainFound } from '../utils/Diagnostics';
import { diagnosticErrorNoMainFound as diagnosticWarnNoMainFound, diagnosticNoStagingDir } from '../utils/Diagnostics';
import undent from 'undent';
import { BrsTranspileState } from 'brighterscript/dist/parser/BrsTranspileState';
import * as fsExtra from 'fs-extra';
Expand Down Expand Up @@ -76,8 +76,14 @@ export class RooibosSession {
}
if (!mainFunction) {
diagnosticWarnNoMainFound(files[0]);
const filePath = path.join(this._builder.options.stagingDir, 'source/rooibosMain.brs');
fsExtra.writeFileSync(filePath, `function main()\n Rooibos_init()\nend function`);
if (!this._builder.options.stagingDir && !this._builder.options.stagingFolderPath) {
console.error('this plugin requires that stagingDir or the deprecated stagingFolderPath bsconfig option is set');
diagnosticNoStagingDir(files[0]);
} else {
const filePath = path.join(this._builder.options.stagingDir ?? this._builder.options.stagingFolderPath, 'source/rooibosMain.brs');
fsExtra.writeFileSync(filePath, `function main()\n Rooibos_init()\nend function`);

}
}
}

Expand Down
9 changes: 9 additions & 0 deletions bsc-plugin/src/lib/utils/Diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,12 @@ export function diagnosticCorruptTestProduced(file: BrsFile, annotation: Annotat
annotation
);
}

export function diagnosticNoStagingDir(file: BscFile) {
addDiagnostic(
file,
2221,
`The bsconfig must define stagingDir, or the deprecated stagingFolderPath options`, 1, 1, 1, 1, DiagnosticSeverity.Error
);
}

2 changes: 1 addition & 1 deletion bsc-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class RooibosPlugin implements CompilerPlugin {
return;
}

console.log('processing ', file.pkgPath);
// console.log('processing ', file.pkgPath);
if (isBrsFile(file)) {
if (this.session.processFile(file)) {
//
Expand Down
4 changes: 4 additions & 0 deletions framework/src/source/Utils.bs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ namespace rooibos.utils
return m._subType
end function

function isSubType(name)
return false
end function

function createObject(nodeType)
node = new rooibos.utils.MockNode("", nodeType)
m.createdNodes.push(node)
Expand Down

0 comments on commit ac533d7

Please sign in to comment.