mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-29 13:03:09 +03:00
feat(tauri.js) expose target arg to tauri build
(#490)
This commit is contained in:
parent
57c89ebcdc
commit
ba2f4b55fd
@ -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
|
||||
}
|
||||
})
|
||||
|
@ -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()
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user