From 4beb8c978262a78e0e00438b635598982e489563 Mon Sep 17 00:00:00 2001 From: Stefano Formicola Date: Wed, 24 May 2023 14:59:20 +0000 Subject: [PATCH] feat: add support for Android specific envs Variables whose key start with `ANDROID_` are rewritten without the platform prefix --- android/dotenv.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/dotenv.gradle b/android/dotenv.gradle index 22253756..7be3249f 100644 --- a/android/dotenv.gradle +++ b/android/dotenv.gradle @@ -52,7 +52,8 @@ def loadDotEnv(flavor = getCurrentFlavor()) { def matcher = (line =~ /^\s*(?:export\s+|)([\w\d\.\-_]+)\s*=\s*['"]?(.*?)?['"]?\s*$/) // TODO: Fail Android builds if line doesn't match if (matcher.getCount() == 1 && matcher[0].size() == 3) { - env.put(matcher[0][1], matcher[0][2].replace('"', '\\"')) + def key = matcher[0][1].replaceAll(/^ANDROID_/, '') + env.put(key, matcher[0][2].replace('"', '\\"')) } } } else {