Commit d5b30f68 authored by Jason Simmons's avatar Jason Simmons

Expose the engine-src-path flag in the Gradle plugin

parent 9cce0833
......@@ -18,6 +18,7 @@ import org.gradle.api.tasks.TaskAction
class FlutterPlugin implements Plugin<Project> {
private File sdkDir
private File engineSrcDir
@Override
void apply(Project project) {
......@@ -42,6 +43,14 @@ class FlutterPlugin implements Plugin<Project> {
throw new GradleException("flutter.sdk must point to the Flutter SDK directory")
}
String engineSrcPath = properties.getProperty("flutter.engineSrcPath")
if (engineSrcPath != null) {
engineSrcDir = project.file(engineSrcPath)
if (!engineSrcDir.isDirectory()) {
throw new GradleException("flutter.engineSrcPath must be a Flutter engine source directory")
}
}
project.extensions.create("flutter", FlutterExtension)
project.dependencies.add("compile", flutterEngine)
project.afterEvaluate this.&addFlutterTask
......@@ -56,6 +65,7 @@ class FlutterPlugin implements Plugin<Project> {
sdkDir this.sdkDir
sourceDir project.file(project.flutter.source)
intermediateDir project.file("${project.buildDir}/${AndroidProject.FD_INTERMEDIATES}/flutter")
engineSrcDir this.engineSrcDir
}
project.android.applicationVariants.all { variant ->
......@@ -83,6 +93,8 @@ class FlutterTask extends DefaultTask {
@OutputDirectory
File intermediateDir
File engineSrcDir
String getFlxPath() {
return "${intermediateDir}/app.flx"
}
......@@ -97,6 +109,9 @@ class FlutterTask extends DefaultTask {
project.exec {
executable "${sdkDir}/bin/flutter"
workingDir sourceDir
if (engineSrcDir != null) {
args "--engine-src-path", engineSrcDir
}
args "build", "flx"
args "-o", flxPath
args "--snapshot", "${intermediateDir}/snapshot_blob.bin"
......
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