include_flutter.groovy.copy.tmpl 1.03 KB
Newer Older
1 2 3
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5
def scriptFile = getClass().protectionDomain.codeSource.location.toURI()
6 7
def flutterProjectRoot = new File(scriptFile).parentFile.parentFile

8 9
gradle.include ":flutter"
gradle.project(":flutter").projectDir = new File(flutterProjectRoot, ".android/Flutter")
10

11 12
def localPropertiesFile = new File(flutterProjectRoot, ".android/local.properties")
def properties = new Properties()
13

14 15 16
assert localPropertiesFile.exists(), "❗️The Flutter module doesn't have a `$localPropertiesFile` file." +
                                     "\nYou must run `flutter pub get` in `$flutterProjectRoot`."
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
17

18 19 20
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
gradle.apply from: "$flutterSdkPath/packages/flutter_tools/gradle/module_plugin_loader.gradle"