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

Add some enhanced launch settings to support more diverse projects #538

Merged
merged 14 commits into from
Mar 1, 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
52 changes: 26 additions & 26 deletions package-lock.json

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

93 changes: 91 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"node-ssdp": "^4.0.0",
"postman-request": "^2.88.1-postman.32",
"pretty-bytes": "^5.6.0",
"roku-debug": "^0.21.3",
"roku-deploy": "^3.11.2",
"roku-debug": "^0.21.5",
"roku-deploy": "^3.12.0",
"roku-test-automation": "2.0.0-beta.22",
"semver": "^7.1.3",
"source-map": "^0.7.3",
Expand Down Expand Up @@ -745,6 +745,11 @@
"description": "The folder where the the build artifacts are placed (like the staging folder and .zip files of the apps)",
"default": "${workspaceFolder}/out"
},
"stagingDir": {
"type": "string",
"description": "The folder where the vscode will copy all the project files to before creating the zip",
"default": "${workspaceFolder}/out/.roku-deploy-staging"
},
"stopOnEntry": {
"type": "boolean",
"description": "Should the debugger stop on the first line of the program after launch.",
Expand Down Expand Up @@ -867,6 +872,11 @@
"description": "If true, the debugger will read any available sourcemaps and attempt to convert debugger locations into their original source locations.",
"scope": "resource"
},
"emitChannelPublishedEvent": {
"type": "boolean",
"description": "Should the ChannelPublishedEvent be emitted. This is a hack for when certain roku devices become locked up as a result of this event being emitted. You probably don't need to set this",
"default": true
},
"packagePort": {
"type": "number",
"description": "The port used for package-related requests. This is mainly used for things like emulators, or when your roku is behind a firewall with a port-forward.",
Expand All @@ -882,6 +892,38 @@
"deprecationMessage": "Use `fileLogging` option instead",
"description": "A path to a file where all brightscript console output will be written. If null or empty, file logging will be disabled."
},
"packageTask": {
"type": "string",
"description": "Task to run instead of roku-deploy to produce the .zip file that will be uploaded to the Roku."
},
"packagePath": {
"type": "string",
"description": "Path to the .zip that will be uploaded to the Roku"
},
"packageUploadOverrides": {
"type": "object",
"description": "Overrides for values used during the roku-deploy zip upload process, like the route and various form data. You probably don't need to change these...",
"default": {
"route": "plugin_install",
"formData": {}
},
"required": [],
"properties": {
"route": {
"type": "string",
"description": "The route to use for uploading to the Roku device. Defaults to 'plugin_install'",
"default": "plugin_install"
},
"formData": {
"type": "object",
"description": "A dictionary of form fields to be included in the package upload request. Set a value to null to delete from the form",
"additionalProperties": true,
"default": {
"someformfield": "someFormValue"
}
}
}
},
"enableDebugProtocol": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -2098,6 +2140,12 @@
"default": "${workspaceFolder}/out",
"scope": "resource"
},
"brightscript.debug.stagingDir": {
"type": "string",
"description": "The folder where the vscode will copy all the project files to before creating the zip",
"default": "${workspaceFolder}/out/.roku-deploy-staging",
"scope": "resource"
},
"brightscript.debug.stopOnEntry": {
"type": "boolean",
"description": "Should the debugger stop on the first line of the program after launch.",
Expand Down Expand Up @@ -2412,6 +2460,47 @@
}
],
"scope": "resource"
},
"brightscript.debug.emitChannelPublishedEvent": {
"type": "boolean",
"description": "Should the ChannelPublishedEvent be emitted. This is a hack for when certain roku devices become locked up as a result of this event being emitted. You probably don't need to set this",
"default": true,
"scope": "resource"
},
"brightscript.debug.packageTask": {
"type": "string",
"description": "Task to run instead of roku-deploy to produce the .zip file that will be uploaded to the Roku.",
"scope": "resource"
},
"brightscript.debug.packagePath": {
"type": "string",
"description": "Path to the .zip that will be uploaded to the Roku",
"scope": "resource"
},
"brightscript.debug.packageUploadOverrides": {
"type": "object",
"description": "Overrides for values used during the roku-deploy zip upload process, like the route and various form data. You probably don't need to change these...",
"default": {
"route": "plugin_install",
"formData": {}
},
"required": [],
"properties": {
"route": {
"type": "string",
"description": "The route to use for uploading to the Roku device. Defaults to 'plugin_install'",
"default": "plugin_install"
},
"formData": {
"type": "object",
"description": "A dictionary of form fields to be included in the package upload request. Set a value to null to delete from the form",
"additionalProperties": true,
"default": {
"someformfield": "someFormValue"
}
}
},
"scope": "resource"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/DebugConfigurationProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ describe('BrightScriptConfigurationProvider', () => {
let config = await processEnvFile(folder, {
envFile: '${workspaceFolder}/.env',
rootDir: '${env:PASSWORD}',
stagingFolderPath: '${env:PASSWORD}'
stagingDir: '${env:PASSWORD}'
});

expect(config.rootDir).to.equal('password');
expect(config.stagingFolderPath).to.equal('password');
expect(config.stagingDir).to.equal('password');
});

it('does not replace text outside of the ${} syntax', async () => {
Expand Down
18 changes: 17 additions & 1 deletion src/DebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
result = this.processUserWorkspaceSettings(config);

//force a specific stagingDir because sometimes this conflicts with bsconfig.json
result.stagingDir = path.join('${outDir}/.roku-deploy-staging');
result.stagingDir ??= path.join('${outDir}/.roku-deploy-staging');
result.stagingFolderPath = result.stagingDir;

result = await this.sanitizeConfiguration(result, folder);
Expand Down Expand Up @@ -319,6 +319,15 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
config.rendezvousTracking = config.rendezvousTracking === false ? false : true;
config.deleteDevChannelBeforeInstall = config.deleteDevChannelBeforeInstall === true;
config.sceneGraphDebugCommandsPort = config.sceneGraphDebugCommandsPort ? config.sceneGraphDebugCommandsPort : this.configDefaults.sceneGraphDebugCommandsPort;

//if packageTask is defined, make sure there's actually a task with that name defined
if (config.packageTask) {
const targetTask = (await vscode.tasks.fetchTasks()).find(x => x.name === config.packageTask);
if (!targetTask) {
throw new Error(`Cannot find task '${config.packageTask}' for launch option 'packageTask'`);
}
}

if (typeof config.remoteControlMode === 'boolean') {
config.remoteControlMode = {
activateOnSessionStart: config.remoteControlMode,
Expand Down Expand Up @@ -378,6 +387,13 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
config.debugRootDir = this.util.ensureTrailingSlash(config.debugRootDir);
}

if (config.packagePath?.includes('${workspaceFolder}')) {
config.packagePath = path.normalize(config.packagePath.replace('${workspaceFolder}', folderUri.fsPath));
}
if (config.packagePath?.includes('${outDir}')) {
config.packagePath = path.normalize(config.packagePath.replace('${outDir}', config.outDir));
}

if (!config.rootDir) {
console.log('No rootDir specified: defaulting to ${workspaceFolder}');
//use the current workspace folder
Expand Down
Loading
Loading