feat(tauri.js) expose target arg to tauri build (#490)

This commit is contained in:
Lucas Fernandes Nogueira 2020-03-06 12:22:38 -03:00 committed by GitHub
parent 57c89ebcdc
commit ba2f4b55fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -3,7 +3,8 @@ const parseArgs = require('minimist')
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help',
d: 'debug'
d: 'debug',
t: 'target'
},
boolean: ['h', 'd']
})
@ -16,10 +17,17 @@ if (argv.help) {
$ tauri build
Options
--help, -h Displays this message
--debug, -d Builds with the debug flag
--target, -t Comma-separated list of target triples to build against
`)
process.exit(0)
}
const build = require('../dist/api/build')
build({ ctx: { debug: argv.debug } })
build({
ctx: {
debug: argv.debug,
target: argv.target
}
})

View File

@ -135,8 +135,8 @@ class Runner {
.concat(target ? ['--target', target] : [])
})
if (cfg.ctx.debug || !cfg.ctx.targetName) {
// on debug mode or if no target specified,
if (!cfg.ctx.target) {
// if no target specified,
// build only for the current platform
await buildFn()
} else {
@ -251,7 +251,7 @@ class Runner {
extraArgs?: string[]
dev?: boolean
}): Promise<void> {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
this.pid = spawn(
'cargo',
@ -264,6 +264,7 @@ class Runner {
warn()
warn('⚠️ [FAIL] Cargo CLI has failed')
warn()
reject()
process.exit(1)
}
@ -276,10 +277,10 @@ class Runner {
warn()
process.exit(0)
}
resolve()
}
)
resolve()
})
}