yumemi-inc / flutter-mobile-project-template

MIT License
36 stars 7 forks source link

[GH-257] Android Application ID と iOS Bundle ID を別々にリネームできるようにする #258

Closed daichikuwa0618 closed 4 months ago

daichikuwa0618 commented 4 months ago

概要

resolve #257

設定をまとめたファイルを作ってパースさせる案もあったが、一回限りのスクリプトに割くには見合っていないということで最小限の変更で対応。

203 の対応時にあらためて検討されたい。

レビュー観点

レビューレベル

レビュー優先度

確認したこと

参考: 修正前の実行後
```diff diff --git a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt b/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt deleted file mode 100644 index ccc7325..0000000 --- a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package jp.co.yumemi.flutter_app - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() diff --git a/apps/app/flavor/dev.json b/apps/app/flavor/dev.json index 5ba9ec3..bf98f95 100644 --- a/apps/app/flavor/dev.json +++ b/apps/app/flavor/dev.json @@ -1,6 +1,6 @@ { "flavor": "dev", "appName": "dev-Template", - "appId": "jp.co.yumemi.template", + "appId": "com.example.rename", "appIdSuffix": ".dev" } diff --git a/apps/app/flavor/prd.json b/apps/app/flavor/prd.json index c6dcb85..2929e00 100644 --- a/apps/app/flavor/prd.json +++ b/apps/app/flavor/prd.json @@ -1,6 +1,6 @@ { "flavor": "prd", "appName": "Template", - "appId": "jp.co.yumemi.template", + "appId": "com.example.rename", "appIdSuffix": "" } diff --git a/apps/app/flavor/stg.json b/apps/app/flavor/stg.json index 0e7698c..d3722da 100644 --- a/apps/app/flavor/stg.json +++ b/apps/app/flavor/stg.json @@ -1,6 +1,6 @@ { "flavor": "stg", "appName": "stg-Template", - "appId": "jp.co.yumemi.template", + "appId": "com.example.rename", "appIdSuffix": ".stg" } ```

修正後の実行後差分

cd tools
sh rename-application-id.sh com.example.android.rename com.example.ios.rename
diff --git a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt b/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt
deleted file mode 100644
index ccc7325..0000000
--- a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package jp.co.yumemi.flutter_app
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity()
diff --git a/apps/app/flavor/dev.json b/apps/app/flavor/dev.json
index a1c7dae..42c02b6 100644
--- a/apps/app/flavor/dev.json
+++ b/apps/app/flavor/dev.json
@@ -1,7 +1,7 @@
 {
     "flavor": "dev",
     "appName": "dev-Template",
-    "appIdAndroid": "jp.co.yumemi.template",
-    "appIdIos": "jp.co.yumemi.template",
+    "appIdAndroid": "com.example.android.rename",
+    "appIdIos": "com.example.ios.rename",
     "appIdSuffix": ".dev"
 }
diff --git a/apps/app/flavor/prd.json b/apps/app/flavor/prd.json
index 189021c..3d18465 100644
--- a/apps/app/flavor/prd.json
+++ b/apps/app/flavor/prd.json
@@ -1,7 +1,7 @@
 {
     "flavor": "prd",
     "appName": "Template",
-    "appIdAndroid": "jp.co.yumemi.template",
-    "appIdIos": "jp.co.yumemi.template",
+    "appIdAndroid": "com.example.android.rename",
+    "appIdIos": "com.example.ios.rename",
     "appIdSuffix": ""
 }
diff --git a/apps/app/flavor/stg.json b/apps/app/flavor/stg.json
index 00f0eea..d4a2a7c 100644
--- a/apps/app/flavor/stg.json
+++ b/apps/app/flavor/stg.json
@@ -1,7 +1,7 @@
 {
     "flavor": "stg",
     "appName": "stg-Template",
-    "appIdAndroid": "jp.co.yumemi.template",
-    "appIdIos": "jp.co.yumemi.template",
+    "appIdAndroid": "com.example.android.rename",
+    "appIdIos": "com.example.ios.rename",
     "appIdSuffix": ".stg"
 }

動作確認手順

cd tools
sh rename-application-id.sh com.example.android.rename com.example.ios.rename

備考

github-actions[bot] commented 4 months ago

Ready for review :rocket:

daichikuwa0618 commented 4 months ago

@K9i-0 さんに Slack にて指摘してもらった点:

  1. 既存の Doc の日本語がおかしい部分がある
  2. jp 始まりの ID に replace しようとすると新しい MainActivity.kt も削除されてしまう
    • path の全てに一致させないで、 jp 配下すべて削除していたため

でした。

1 については bf4d290733ce0cfd962713d375ed95ba50ecb3be に混ぜて修正しました (分けると良くわからないまとまりになりそうだったので)。 2 については 0f63f12c8767e3ce99a827c8fa7dd25a14f47c7d にて修正しました。Step 3 と 4 を入れ替えて、先に削除 → 追加という手順に変更しています。 動作確認として、 jp 始まりの ID に replace したときの before / after の diff です。

diff before
```diff diff --git a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt b/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt deleted file mode 100644 index ccc7325..0000000 --- a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package jp.co.yumemi.flutter_app - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() diff --git a/apps/app/flavor/dev.json b/apps/app/flavor/dev.json index 5ba9ec3..6b06e89 100644 --- a/apps/app/flavor/dev.json +++ b/apps/app/flavor/dev.json @@ -1,6 +1,6 @@ { "flavor": "dev", "appName": "dev-Template", - "appId": "jp.co.yumemi.template", + "appId": "jp.example.replaced", "appIdSuffix": ".dev" } diff --git a/apps/app/flavor/prd.json b/apps/app/flavor/prd.json index c6dcb85..6b0ff02 100644 --- a/apps/app/flavor/prd.json +++ b/apps/app/flavor/prd.json @@ -1,6 +1,6 @@ { "flavor": "prd", "appName": "Template", - "appId": "jp.co.yumemi.template", + "appId": "jp.example.replaced", "appIdSuffix": "" } diff --git a/apps/app/flavor/stg.json b/apps/app/flavor/stg.json index 0e7698c..857f27b 100644 --- a/apps/app/flavor/stg.json +++ b/apps/app/flavor/stg.json @@ -1,6 +1,6 @@ { "flavor": "stg", "appName": "stg-Template", - "appId": "jp.co.yumemi.template", + "appId": "jp.example.replaced", "appIdSuffix": ".stg" } ```
diff after
```diff diff --git a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt b/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt deleted file mode 100644 index ccc7325..0000000 --- a/apps/app/android/app/src/main/kotlin/jp/co/yumemi/flutter_app/MainActivity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package jp.co.yumemi.flutter_app - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() diff --git a/apps/app/android/app/src/main/kotlin/jp/example/and/MainActivity.kt b/apps/app/android/app/src/main/kotlin/jp/example/and/MainActivity.kt index e69de29..a719307 100644 --- a/apps/app/android/app/src/main/kotlin/jp/example/and/MainActivity.kt +++ b/apps/app/android/app/src/main/kotlin/jp/example/and/MainActivity.kt @@ -0,0 +1,5 @@ +package jp.example.and + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/apps/app/flavor/dev.json b/apps/app/flavor/dev.json index a1c7dae..c87ba18 100644 --- a/apps/app/flavor/dev.json +++ b/apps/app/flavor/dev.json @@ -1,7 +1,7 @@ { "flavor": "dev", "appName": "dev-Template", - "appIdAndroid": "jp.co.yumemi.template", - "appIdIos": "jp.co.yumemi.template", + "appIdAndroid": "jp.example.and", + "appIdIos": "jp.example.ios", "appIdSuffix": ".dev" } diff --git a/apps/app/flavor/prd.json b/apps/app/flavor/prd.json index 189021c..0809680 100644 --- a/apps/app/flavor/prd.json +++ b/apps/app/flavor/prd.json @@ -1,7 +1,7 @@ { "flavor": "prd", "appName": "Template", - "appIdAndroid": "jp.co.yumemi.template", - "appIdIos": "jp.co.yumemi.template", + "appIdAndroid": "jp.example.and", + "appIdIos": "jp.example.ios", "appIdSuffix": "" } diff --git a/apps/app/flavor/stg.json b/apps/app/flavor/stg.json index 00f0eea..b0743a9 100644 --- a/apps/app/flavor/stg.json +++ b/apps/app/flavor/stg.json @@ -1,7 +1,7 @@ { "flavor": "stg", "appName": "stg-Template", - "appIdAndroid": "jp.co.yumemi.template", - "appIdIos": "jp.co.yumemi.template", + "appIdAndroid": "jp.example.and", + "appIdIos": "jp.example.ios", "appIdSuffix": ".stg" } ```