Skip to content

Commit 95726eb

Browse files
authored
feat(cli): prevent default bundle identifier from building, closes #4041 (#4042)
1 parent 0180dcc commit 95726eb

File tree

8 files changed

+20
-6
lines changed

8 files changed

+20
-6
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Prevent building when the bundle identifier is the default `com.tauri.dev`.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ exclude = [
1919
"examples/api/src-tauri",
2020
"examples/updater/src-tauri",
2121
"examples/resources/src-tauri",
22-
"examples/sidecar/src-tauri",
23-
"examples/isolation/src-tauri"
22+
"examples/sidecar/src-tauri"
2423
]
2524

2625
# default to small, optimized workspace release binaries

examples/isolation/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"bundle": {
2222
"active": true,
2323
"targets": "all",
24-
"identifier": "com.tauri.isolation",
24+
"identifier": "com.tauri.dev",
2525
"icon": [
2626
"../.icons/32x32.png",
2727
"../.icons/128x128.png",

examples/resources/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bundle": {
1212
"active": true,
1313
"targets": "all",
14-
"identifier": "com.tauri.dev",
14+
"identifier": "com.tauri.resources",
1515
"icon": [
1616
"../../.icons/32x32.png",
1717
"../../.icons/128x128.png",

examples/sidecar/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bundle": {
1212
"active": true,
1313
"targets": "all",
14-
"identifier": "com.tauri.dev",
14+
"identifier": "com.tauri.sidecar",
1515
"icon": [
1616
"../../.icons/32x32.png",
1717
"../../.icons/128x128.png",

examples/updater/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"bundle": {
1111
"active": true,
1212
"targets": "all",
13-
"identifier": "com.tauri.dev",
13+
"identifier": "com.tauri.updater",
1414
"icon": [
1515
"../../.icons/32x32.png",
1616
"../../.icons/128x128.png",

tooling/cli/node/test/jest/__tests__/template.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ describe('[CLI] cli.js template', () => {
3939
const manifestFile = readFileSync(manifestPath).toString()
4040
writeFileSync(manifestPath, `workspace = { }\n${manifestFile}`)
4141

42+
const configPath = resolve(tauriFixturePath, 'tauri.conf.json')
43+
const config = readFileSync(configPath).toString()
44+
writeFileSync(configPath, config.replace('com.tauri.dev', 'com.tauri.test'))
45+
4246
await cli.run(['build', '--verbose']).catch(err => {
4347
console.error(err)
4448
throw err

tooling/cli/src/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ pub fn command(options: Options) -> Result<()> {
7070
let config_guard = config.lock().unwrap();
7171
let config_ = config_guard.as_ref().unwrap();
7272

73+
if config_.tauri.bundle.identifier == "com.tauri.dev" {
74+
logger.error("You must change the bundle identifier in `tauri.conf.json > tauri > bundle > identifier`. The default value `com.tauri.dev` is not allowed as it must be unique across applications.");
75+
std::process::exit(1);
76+
}
77+
7378
if let Some(before_build) = &config_.build.before_build_command {
7479
if !before_build.is_empty() {
7580
logger.log(format!("Running `{}`", before_build));

0 commit comments

Comments
 (0)