From dfb6d66c105470382e208dbdad1c2b7bb12f532b Mon Sep 17 00:00:00 2001 From: Bauke Date: Fri, 12 Jan 2024 13:40:04 +0100 Subject: [PATCH] Set TARGET only when it doesn't already exist. --- Makefile.toml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index 3245cde..0ec37e8 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,3 +1,20 @@ +# Set TARGET using duckscript rather than the usual `env_not_set` way as there's +# currently a potential bug with using decode maps and conditions. +# https://github.com/sagiegurari/cargo-make/issues/1018 +env_scripts = [""" +#!@duckscript + +target = get_env TARGET +if is_empty ${target} + browser = get_env BROWSER + if eq ${browser} "firefox" + set_env TARGET "firefox-desktop" + else + set_env TARGET ${browser} + end +end +"""] + [env] # Set BROWSER="firefox" if not already defined. # All browser targets are defined in `source/types.d.ts` as a global `$browser`. @@ -62,10 +79,16 @@ args = ["install", "--silent"] [tasks.run] clear = true command = "pnpm" -# Set --target explicitly, since web-ext for some reason doesn't use the target -# set in the configuration file. https://github.com/mozilla/web-ext/issues/1862 -env = { TARGET = { source = "${BROWSER}", default_value = "${BROWSER}", mapping = { "firefox" = "firefox-desktop" } } } -args = ["web-ext", "run", "--target=${TARGET}", "--config=build/web-ext-${BROWSER}.json"] +args = [ + "web-ext", + "run", + # Set --target explicitly, since web-ext for some reason doesn't use the target + # set in the configuration file. https://github.com/mozilla/web-ext/issues/1862 + "--target=${TARGET}", + "--config=build/web-ext-${BROWSER}.json", + "--adb-device=${ADB_DEVICE}", + "--firefox-apk=org.mozilla.fenix" +] # Alias for `WATCH=true makers build`. [tasks.watch]