fixed Android dotenv.gradle quotes matching (#151)

Fixed the regex - it caused syntax error in generated BuildConfig.java file when quotes were used in the `.env` file. `export VAR1="aa bb cc"` caused
```
/BuildConfig.java:15: error: unclosed string literal
  public static final String VAR1 = "aa bb cc"";
                                              ^
1 error
```
This commit is contained in:
Filip Kinský
2017-09-25 12:03:57 -07:00
committed by Pedro Belo
parent a141d87274
commit 629614bf2c
+1 -1
View File
@@ -46,7 +46,7 @@ def readDotEnv = {
println("Reading env from: $envFile")
try {
new File("$project.rootDir/../$envFile").eachLine { line ->
def matcher = (line =~ /^\s*(?:export\s+|)([\w\d\.\-_]+)\s*=\s*['"]?(.*)?['"]?\s*$/)
def matcher = (line =~ /^\s*(?:export\s+|)([\w\d\.\-_]+)\s*=\s*['"]?(.*?)?['"]?\s*$/)
if (matcher.getCount() == 1 && matcher[0].size() == 3){
env.put(matcher[0][1], matcher[0][2])
}