File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed
Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change 88import sys
99
1010
11+ TEST_OPTIONS_INJECTION = (
12+ " testOptions {\n "
13+ " unitTests.includeAndroidResources = true\n "
14+ " unitTests.all {\n "
15+ " systemProperty 'http.agent', 'CodenameOneUiTest'\n "
16+ " }\n "
17+ " }\n \n "
18+ )
19+
20+
1121def ensure_test_options (content : str ) -> str :
12- if "unitTests.includeAndroidResources " in content :
22+ if "systemProperty 'http.agent' " in content :
1323 return content
1424
25+ legacy_block = (
26+ " testOptions {\n "
27+ " unitTests.includeAndroidResources = true\n "
28+ " }\n \n "
29+ )
30+
31+ if legacy_block in content :
32+ return content .replace (legacy_block , TEST_OPTIONS_INJECTION )
33+
1534 pattern = re .compile (r"(android\s*\{\s*\r?\n)" )
1635 match = pattern .search (content )
1736 if not match :
1837 raise SystemExit ("Unable to locate android block in Gradle file" )
1938
20- injection = (
21- " testOptions {\n "
22- " unitTests.includeAndroidResources = true\n "
23- " }\n \n "
24- )
2539 start , end = match .span (1 )
26- return content [:end ] + injection + content [end :]
40+ return content [:end ] + TEST_OPTIONS_INJECTION + content [end :]
2741
2842
2943def ensure_dependencies (content : str ) -> str :
You can’t perform that action at this time.
0 commit comments