From c8f03d4e96cc9f52484d13fd8ba4963657230e60 Mon Sep 17 00:00:00 2001 From: Rody Davis Date: Fri, 1 Nov 2024 12:23:09 -0700 Subject: [PATCH] fix onCreate hook --- samples/ads/.idx/dev.nix | 25 ++++++++++++++++++++++++- samples/crossword/.idx/dev.nix | 25 ++++++++++++++++++++++++- samples/multiplayer/.idx/dev.nix | 26 ++++++++++++++++++++++++-- templates/basic/.idx/dev.nix | 25 ++++++++++++++++++++++++- templates/card/.idx/dev.nix | 27 +++++++++++++++++++++++++-- templates/endless_runner/.idx/dev.nix | 25 ++++++++++++++++++++++++- 6 files changed, 145 insertions(+), 8 deletions(-) diff --git a/samples/ads/.idx/dev.nix b/samples/ads/.idx/dev.nix index b09cc04..f92fab1 100644 --- a/samples/ads/.idx/dev.nix +++ b/samples/ads/.idx/dev.nix @@ -22,6 +22,29 @@ workspace = { # Runs when a workspace is first created with this `dev.nix` file onCreate = { + build-flutter = '' + cd /home/user/myapp/android + + ./gradlew \ + --parallel \ + -Pverbose=true \ + -Ptarget-platform=android-x86 \ + -Ptarget=/home/user/myapp/lib/main.dart \ + -Pbase-application-name=android.app.Application \ + -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ + -Pdart-obfuscation=false \ + -Ptrack-widget-creation=true \ + -Ptree-shake-icons=false \ + -Pfilesystem-scheme=org-dartlang-root \ + assembleDebug + + # TODO: Execute web build in debug mode. + # flutter run does this transparently either way + # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 + # flutter build web --profile --dart-define=Dart2jsOptimization=O0 + + adb -s localhost:5555 wait-for-device + ''; installDependencies = "flutter pub get"; }; }; @@ -30,7 +53,7 @@ enable = true; previews = { android = { - command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"]; + command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; manager = "flutter"; }; }; diff --git a/samples/crossword/.idx/dev.nix b/samples/crossword/.idx/dev.nix index b09cc04..f92fab1 100644 --- a/samples/crossword/.idx/dev.nix +++ b/samples/crossword/.idx/dev.nix @@ -22,6 +22,29 @@ workspace = { # Runs when a workspace is first created with this `dev.nix` file onCreate = { + build-flutter = '' + cd /home/user/myapp/android + + ./gradlew \ + --parallel \ + -Pverbose=true \ + -Ptarget-platform=android-x86 \ + -Ptarget=/home/user/myapp/lib/main.dart \ + -Pbase-application-name=android.app.Application \ + -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ + -Pdart-obfuscation=false \ + -Ptrack-widget-creation=true \ + -Ptree-shake-icons=false \ + -Pfilesystem-scheme=org-dartlang-root \ + assembleDebug + + # TODO: Execute web build in debug mode. + # flutter run does this transparently either way + # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 + # flutter build web --profile --dart-define=Dart2jsOptimization=O0 + + adb -s localhost:5555 wait-for-device + ''; installDependencies = "flutter pub get"; }; }; @@ -30,7 +53,7 @@ enable = true; previews = { android = { - command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"]; + command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; manager = "flutter"; }; }; diff --git a/samples/multiplayer/.idx/dev.nix b/samples/multiplayer/.idx/dev.nix index d756807..1b27713 100644 --- a/samples/multiplayer/.idx/dev.nix +++ b/samples/multiplayer/.idx/dev.nix @@ -22,6 +22,29 @@ workspace = { # Runs when a workspace is first created with this `dev.nix` file onCreate = { + build-flutter = '' + cd /home/user/myapp/android + + ./gradlew \ + --parallel \ + -Pverbose=true \ + -Ptarget-platform=android-x86 \ + -Ptarget=/home/user/myapp/lib/main.dart \ + -Pbase-application-name=android.app.Application \ + -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ + -Pdart-obfuscation=false \ + -Ptrack-widget-creation=true \ + -Ptree-shake-icons=false \ + -Pfilesystem-scheme=org-dartlang-root \ + assembleDebug + + # TODO: Execute web build in debug mode. + # flutter run does this transparently either way + # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 + # flutter build web --profile --dart-define=Dart2jsOptimization=O0 + + adb -s localhost:5555 wait-for-device + ''; installDependencies = "flutter pub get"; }; }; @@ -32,10 +55,9 @@ web = { command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"]; manager = "flutter"; - }; android = { - command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"]; + command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; manager = "flutter"; }; }; diff --git a/templates/basic/.idx/dev.nix b/templates/basic/.idx/dev.nix index 1b6437e..1b27713 100644 --- a/templates/basic/.idx/dev.nix +++ b/templates/basic/.idx/dev.nix @@ -22,6 +22,29 @@ workspace = { # Runs when a workspace is first created with this `dev.nix` file onCreate = { + build-flutter = '' + cd /home/user/myapp/android + + ./gradlew \ + --parallel \ + -Pverbose=true \ + -Ptarget-platform=android-x86 \ + -Ptarget=/home/user/myapp/lib/main.dart \ + -Pbase-application-name=android.app.Application \ + -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ + -Pdart-obfuscation=false \ + -Ptrack-widget-creation=true \ + -Ptree-shake-icons=false \ + -Pfilesystem-scheme=org-dartlang-root \ + assembleDebug + + # TODO: Execute web build in debug mode. + # flutter run does this transparently either way + # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 + # flutter build web --profile --dart-define=Dart2jsOptimization=O0 + + adb -s localhost:5555 wait-for-device + ''; installDependencies = "flutter pub get"; }; }; @@ -34,7 +57,7 @@ manager = "flutter"; }; android = { - command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"]; + command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; manager = "flutter"; }; }; diff --git a/templates/card/.idx/dev.nix b/templates/card/.idx/dev.nix index 9511e24..1b27713 100644 --- a/templates/card/.idx/dev.nix +++ b/templates/card/.idx/dev.nix @@ -22,6 +22,29 @@ workspace = { # Runs when a workspace is first created with this `dev.nix` file onCreate = { + build-flutter = '' + cd /home/user/myapp/android + + ./gradlew \ + --parallel \ + -Pverbose=true \ + -Ptarget-platform=android-x86 \ + -Ptarget=/home/user/myapp/lib/main.dart \ + -Pbase-application-name=android.app.Application \ + -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ + -Pdart-obfuscation=false \ + -Ptrack-widget-creation=true \ + -Ptree-shake-icons=false \ + -Pfilesystem-scheme=org-dartlang-root \ + assembleDebug + + # TODO: Execute web build in debug mode. + # flutter run does this transparently either way + # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 + # flutter build web --profile --dart-define=Dart2jsOptimization=O0 + + adb -s localhost:5555 wait-for-device + ''; installDependencies = "flutter pub get"; }; }; @@ -31,10 +54,10 @@ previews = { web = { command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"]; - manager = "flutter"; + manager = "flutter"; }; android = { - command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"]; + command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; manager = "flutter"; }; }; diff --git a/templates/endless_runner/.idx/dev.nix b/templates/endless_runner/.idx/dev.nix index 1b6437e..1b27713 100644 --- a/templates/endless_runner/.idx/dev.nix +++ b/templates/endless_runner/.idx/dev.nix @@ -22,6 +22,29 @@ workspace = { # Runs when a workspace is first created with this `dev.nix` file onCreate = { + build-flutter = '' + cd /home/user/myapp/android + + ./gradlew \ + --parallel \ + -Pverbose=true \ + -Ptarget-platform=android-x86 \ + -Ptarget=/home/user/myapp/lib/main.dart \ + -Pbase-application-name=android.app.Application \ + -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ + -Pdart-obfuscation=false \ + -Ptrack-widget-creation=true \ + -Ptree-shake-icons=false \ + -Pfilesystem-scheme=org-dartlang-root \ + assembleDebug + + # TODO: Execute web build in debug mode. + # flutter run does this transparently either way + # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 + # flutter build web --profile --dart-define=Dart2jsOptimization=O0 + + adb -s localhost:5555 wait-for-device + ''; installDependencies = "flutter pub get"; }; }; @@ -34,7 +57,7 @@ manager = "flutter"; }; android = { - command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"]; + command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; manager = "flutter"; }; };