Skip to content

Commit

Permalink
Merge pull request #27 from georgejecook/feat/adds-more-options-for-v…
Browse files Browse the repository at this point in the history
…alidation-xml-gen

Feat/adds more options for validation xml gen
  • Loading branch information
georgejecook authored Jan 5, 2022
2 parents d1c679a + d4cce0b commit 9d0d1e4
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 115 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [0.13.2](https://github.com/georgejecook/maestro-roku-bsc-plugin/compare/0.13.1...0.13.2)
## [0.13.3](https://github.com/georgejecook/maestro-roku-bsc-plugin/compare/0.13.2...0.13.3)

### Merged

- Fix/fix crash on chekcing functions [`#24`](https://github.com/georgejecook/maestro-roku-bsc-plugin/pull/24)

### Commits

- version bump [`350efaa`](https://github.com/georgejecook/maestro-roku-bsc-plugin/commit/350efaa123247f49286e693032e4f6a1c852f4dd)
- fix: fixes crash when changing types of functions [`67f1f94`](https://github.com/georgejecook/maestro-roku-bsc-plugin/commit/67f1f949357ce83684ab6bb5bf69eedc24e0af0d)

## [0.13.2](https://github.com/georgejecook/maestro-roku-bsc-plugin/compare/0.13.1...0.13.2) - 2021-10-29

### Merged

Expand Down
17 changes: 9 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maestro-roku-bsc-plugin",
"version": "0.13.2",
"version": "0.13.3",
"description": "Visual studio plugin for maestro brightscript development",
"files": [
"dist/**/!(*.spec.*)*",
Expand Down Expand Up @@ -36,6 +36,7 @@
"mocha": "^8.1.3",
"nyc": "^15.1.0",
"sax": "^1.2.4",
"source-map-support": "^0.5.21",
"typescript": "^4.1.3"
},
"preferGlobal": true,
Expand Down
128 changes: 67 additions & 61 deletions scripts/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
// eslint-disable-next-line

let zapp = {
'rootDir': '/home/george/hope/applicaster/4/zapp-roku-app/src',
'rootDir': '/home/george/hope/applicaster/zapp-roku-app/src',
'stagingFolderPath': 'build',
'retainStagingFolder': true,
'createPackage': false,
Expand All @@ -13,6 +13,8 @@ let zapp = {
'source/**/*.*',
'components/**/*.*',
'images/**/*.*',
'!**/*.md',
'!asset-bundle/__MACOSX',
{
'src': '../external/plugins-src/**/*.*',
'dest': ''
Expand All @@ -28,46 +30,20 @@ let zapp = {
{
'src': '../external/private-oc-src/**/*.*',
'dest': ''
},
{
'src': '!../external/plugins-src/**/*.spec.bs',
'dest': ''
},
{
'src': '!../external/plugins-core-src/**/*.spec.*',
'dest': ''
},
{
'src': '!../external/private-emmys-src/**/*.spec.*',
'dest': ''
},
{
'src': '!../external/private-oc-src/**/*.spec.*',
'dest': ''
},
'!**/*.spec.bs'
}
],
'diagnosticFilters': [
{
'src': '**/roku_modules/**/*.*',
'codes': [
1107,
1009,
1001,
1067
]
'codes': [1107, 1009, 1001, 1067]
},
{
'src': '**/Whitelist.xml',
'codes': [
1067
]
'codes': [1067]
},
{
'src': 'components/maestro/generated/**/*.*',
'codes': [
1001
]
'codes': [1001]
},
1013,
{
Expand All @@ -84,41 +60,68 @@ let zapp = {
},
{
'src': '**/RALETrackerTask.*'
},
{
'src': '../external/plugins-src/source/google_analytics_roku/*.*'
},
{
'src': 'source/lib/rokuPromise.bs'
},
{
'src': '../external/plugins-src/components/google_analytics_roku/*.*'
},
{
'src': '**/roku_modules/**/*.*'
},
{
'src': '**/*spec.bs',
'codes': ['LINT3011']
}
],
'plugins': [
'/home/george/hope/open-source/maestro/maestro-roku-bsc-plugin/dist/plugin.js',
'/home/george/hope/open-source/rooibos/bsc-plugin/dist/plugin.js'
'/home/george/hope/open-source/rooibos/bsc-plugin/dist/plugin.js',
'/home/george/hope/open-source/maestro/roku-log-bsc-plugin/dist/plugin.js'
],
'ignore': ['maestro-roku-bsc-plugin'],
'rokuLog': {
'strip': false,
'insertPkgPath': true,
'removeComments': true
},
'rooibos': {
'isRecordingCodeCoverage': false,
'testsFilePattern': null
'tags': ['!integration', '!deprecated', '!fixme'],
'showOnlyFailures': true,
'catchCrashes': true,
'lineWidth': 70,
'failFast': false
},
'maestro': {
'buildForIDE': false,
'excludeFilters': [
'**/roku_modules/**/*',
'**/rooibos/**/*',
'**/RALETrackerTask.xml'
],
'nodeClasses': {
'buildForIDE': false,
'generateTestUtils': true
},
'excludeFilters': ['**/roku_modules/**/*', '**/rooibos-roku/**/*'],
'buildTimeImports': {
'IAuthProvider': [
'pkg:/source/zapp_oauth_plugin/ZappOAuthPlugin.bs'
],
'IEntitlementsProvider': [
'pkg:/source/simple_entitlements_roku/SimpleEntitlementsPlugin.bs'
],
'IAuthProvider': [],
'IEntitlementsProvider': [],
'IBookmarksProvider': [],
'IPlayerAnalytics': [],
'IAnalytics': []
'IAnalytics': [],
'IBootstrapPlugin': []
},
'mvvm': {
'insertXmlBindingsEarly': false,
'createCodeBehindFilesWhenNeeded': false,
'insertCreateVMMethod': false,
'callCreateVMMethodInInit': false,
'callCreateNodeVarsInInit': true
},
'reflection': {
'generateReflectionFunctions': true,
'excludeFilters': ['**/roku_modules/**/*', '**/*.spec.bs']
}
},
'rokuLog': {
'strip': false,
'insertPkgPath': true,
'removeComments': true
},
'sourceMap': true
}
};
let z41 = {
'rootDir': '/home/george/hope/applicaster/4-1/zapp-roku-app/src',
Expand Down Expand Up @@ -581,7 +584,13 @@ let nba = {
}
],
'maestro': {
'excludeFilters': ['**/roku_modules/**/*', '**/rooibos-roku/**/*'],
'excludeFilters': [
'**/roku_modules/**/*',
'**/rooibos-roku/**/*',
'**/bitmovinAnalytics/**/*.*',
'**/bitmovinPlayer/**/*.*',
'**/mediakind/**/*.*'
],
'buildForIDE': true
},
'rooibos': {
Expand All @@ -594,20 +603,17 @@ let nba = {
'removeComments': true
},
'logLevel': 'error',
'retainStagingFolder': true,
'transpileOptions': {
'removeParameterTypes': true
}
'retainStagingFolder': true
};


let programBuilder = new ProgramBuilder();
programBuilder.run(
// swv
// zapp
// maestro
maestro
// corco
nba
// nba
// z41
// maestroSample
// maestroList
Expand Down
5 changes: 5 additions & 0 deletions src/lib/files/MaestroConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface MaestroConfig {
stripParamTypes?: boolean;
paramStripExceptions?: string;
applyStrictToAllClasses?: boolean;
processXMLFiles?: boolean;
mvvm?: {
insertXmlBindingsEarly?: boolean;
createCodeBehindFilesWhenNeeded?: boolean;
Expand All @@ -33,6 +34,10 @@ export interface MaestroConfig {
generateReflectionFunctions?: boolean; //if true will generate the functions required to lookup classes by name
excludeFilters?: string[]; // will exclude certain files from reflection
};
extraValidation?: {
doExtraValidation?: boolean; //if true will do additional maestro validation
excludeFilters?: string[]; // will exclude certain files from extra validation
};
}

let docsLink = `\nPlease read the docs for usage details https://github.com/georgejecook/maestro/blob/master/docs/index.md#maestro-cli`;
Expand Down
57 changes: 56 additions & 1 deletion src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('MaestroPlugin', () => {
program.plugins = new PluginInterface([plugin], program.logger);
program.createSourceScope(); //ensure source scope is created
plugin.maestroConfig = {
extraValidation: {},
addFrameworkFiles: false,
mvvm: {},
nodeClasses: {}
Expand Down Expand Up @@ -458,13 +459,46 @@ describe('MaestroPlugin', () => {
`);
expect(a).to.equal(b);

});
it('does not manipulate xml files when xml processing is disabled', async () => {
plugin.maestroConfig.processXMLFiles = false;
plugin.afterProgramCreate(program);
program.addOrReplaceFile('components/comp.xml', `
<component name="mv_BaseScreen" extends="mv_BaseView" vm="Myclass">
<interface>
</interface>
<children>
<Label id="test" text="{{field}}" />
</children>
</component>`);
program.validate();
expect(program.getDiagnostics()).to.be.empty;
await builder.transpile();
console.log(builder.getDiagnostics());
expect(builder.getDiagnostics()).to.be.empty;

let a = getContents('components/comp.xml');
//note - we still remove illegal vm attribute
let b = trimLeading(`<component name="mv_BaseScreen" extends="mv_BaseView">
<interface>
</interface>
<script type="text/brightscript" uri="pkg:/source/bslib.brs" />
<children>
<Label id="test" text="{{field}}" />
</children>
</component>
`);
expect(a).to.equal(b);

});
it('can turnoff default default ignored folders ', async () => {
plugin.maestroConfig = {
extraValidation: {},
addFrameworkFiles: false,
excludeFilters: [],
mvvm: {},
nodeClasses: {}
nodeClasses: {},
processXMLFiles: true
};
plugin.importProcessor.config = plugin.maestroConfig;

Expand Down Expand Up @@ -498,6 +532,7 @@ describe('MaestroPlugin', () => {
});
it('does not manipulate files in specified folders ', async () => {
plugin.maestroConfig = {
extraValidation: {},
addFrameworkFiles: false,
excludeFilters: ['**/ignored/**/*.*'],
mvvm: {},
Expand Down Expand Up @@ -855,6 +890,26 @@ describe('MaestroPlugin', () => {
await builder.transpile();
expect(builder.getDiagnostics().filter((d) => d.severity === DiagnosticSeverity.Error)).to.be.not.empty;

});
it('does not produce diagnostics for missing observer function when extra validation is enabled', async () => {
plugin.maestroConfig.extraValidation.doExtraValidation = false;
plugin.afterProgramCreate(program);
program.addOrReplaceFile('source/comp.bs', `
@node("Comp", "Group")
class Comp
@observer("onTitleChange")
public title = ""
public content = ""
function new()
end function
end class
`);
program.validate();
await builder.transpile();
expect(builder.getDiagnostics().filter((d) => d.severity === DiagnosticSeverity.Error)).to.be.empty;

});
it('gives diagnostics for wrong observer function params', async () => {
plugin.afterProgramCreate(program);
Expand Down
Loading

0 comments on commit 9d0d1e4

Please sign in to comment.