Commit 0de87bab authored by Mikkel Nygaard Ravn's avatar Mikkel Nygaard Ravn Committed by GitHub

Test bugfix: specify JAVA_HOME env (#11773)

parent 79747f49
......@@ -85,16 +85,20 @@ bool _hasMultipleOccurrences(String text, Pattern pattern) {
}
class FlutterProject {
FlutterProject(this.parent, this.name);
FlutterProject(this.parent, this.name, this.javaPath);
Directory parent;
String name;
final Directory parent;
final String name;
final String javaPath;
static Future<FlutterProject> create(Directory directory, String name) async {
await inDirectory(directory, () async {
await flutter('create', options: <String>[name]);
});
return new FlutterProject(directory, name);
final String flutterDoctor = await evalFlutter('doctor');
final RegExp javaPathExtractor = new RegExp(r'Android Studio at (.*)');
final String javaPath = javaPathExtractor.firstMatch(flutterDoctor).group(1) + '/jre';
return new FlutterProject(directory, name, javaPath);
}
String get rootPath => path.join(parent.path, name);
......@@ -157,6 +161,7 @@ android {
'./gradlew',
<String>['app:$task'],
workingDirectory: androidPath,
environment: <String, String>{ 'JAVA_HOME': javaPath }
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment