Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Passing options to backend and adding --verbose flag (#1531)
Browse files Browse the repository at this point in the history
ref #1525
  • Loading branch information
mwu-tow authored Apr 29, 2021
1 parent 71c3b39 commit a5c5762
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
- [Window management buttons.][1511]. The IDE now has components for
"fullscreen" nad "close" buttons. They will be available only when running IDE
in a cloud environment.
- [Customizable backend options][1531]. When invoking Enso IDE through command
line interface, it is possible to give `--` argument separator. All arguments
following the separator will be passed to the backend.
- [Added `--verbose` parameter][1531]. If `--verbose` is given as command line
argument, the IDE and the backend will produce more detailed logs.

<br/>![Bug Fixes](/docs/assets/tags/bug_fixes.svg)

Expand All @@ -23,6 +28,7 @@ you can find their release notes
[here](https://github.com/enso-org/enso/blob/main/RELEASES.md).

[1511]: https://github.com/enso-org/ide/pull/1511
[1531]: https://github.com/enso-org/ide/pull/1531

<br/>

Expand Down
7 changes: 4 additions & 3 deletions build/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ commands.start.rust = async function(argv) {
commands.start.js = async function (argv) {
await installJsDeps()
console.log(`Building JS target.` + argv)
const args = targetArgs.concat([
`--backend-path ${paths.get_project_manager_path(paths.dist.bin)}`,
])
// The backend path is being prepended here, as appending would be incorrect.
// That is because `targetArgs` might include `-- …` and appended args could
// end up being passed to the spawned backend process.
const args = ['--backend-path', paths.get_project_manager_path(paths.dist.bin)].concat(targetArgs)
if (argv.dev) { args.push('--dev') }
await cmd.with_cwd(paths.js.root, async () => {
await run('npm', ['run', 'start', '--'].concat(args))
Expand Down
23 changes: 20 additions & 3 deletions src/js/lib/client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ const execFile = util.promisify(child_process.execFile);
let usage = `
${pkg.build.productName} ${rootCfg.version} command line interface.
Usage: ${pkg.build.productName} [options]
Usage: ${pkg.build.productName} [options] [--] [backend args]...
`

let epilogue = `
Arguments that follow the two dashes (\`--\`) will be passed to the backend process. They are used\
if IDE spawns backend, i.e. if '--backend false' has not been set.`

let optParser = yargs
.scriptName("")
.usage(usage)
.epilogue(epilogue)
.help()
.version(false)
.parserConfiguration({'populate--':true})
Expand Down Expand Up @@ -116,6 +121,13 @@ optParser.options('backend-path', {

let debugOptionsGroup = 'Debug Options:'

optParser.options('verbose', {
group : debugOptionsGroup,
describe : `Increase logs verbosity. Affects both IDE and the backend.`,
default : false,
type : `boolean`
})

optParser.options('entry-point', {
group : debugOptionsGroup,
describe : 'Run an alternative entry point (e.g. one of the debug scenes)',
Expand Down Expand Up @@ -401,8 +413,12 @@ function spawnProjectManager(args) {

function runBackend() {
if(args.backend !== false) {
console.log("Starting the backend process.")
return spawnProjectManager()
let opts = args['--'] ? args['--'] : []
if(args.verbose === true) {
opts.push('-vv')
}
console.log("Starting the backend process with the following options:", opts)
return spawnProjectManager(opts)
}
}

Expand Down Expand Up @@ -504,6 +520,7 @@ function createWindow() {
crash_report_host : args.crashReportHost,
no_data_gathering : args.noDataGathering,
node_labels : args.nodeLabels,
verbose : args.verbose,
}

if (args.project) { urlCfg.project = args.project }
Expand Down
1 change: 1 addition & 0 deletions src/rust/ide/lib/args/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ ensogl::read_args! {
crash_report_host : String,
no_data_gathering : bool,
is_in_cloud : bool,
verbose : bool,
}
}

0 comments on commit a5c5762

Please sign in to comment.