Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
13d7770c
Commit
13d7770c
authored
Feb 23, 2017
by
Jakob Andersen
Committed by
GitHub
Feb 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix local engine support for Gradle builds. (#8362)
Fixes #6761.
parent
fa043216
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
11 deletions
+32
-11
flutter.gradle
packages/flutter_tools/gradle/flutter.gradle
+21
-8
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+11
-3
No files found.
packages/flutter_tools/gradle/flutter.gradle
View file @
13d7770c
...
...
@@ -31,6 +31,7 @@ class FlutterPlugin implements Plugin<Project> {
private
File
flutterRoot
private
File
flutterExecutable
private
String
localEngine
private
String
localEngineSrcPath
private
Properties
localProperties
private
String
resolveProperty
(
Project
project
,
String
name
,
String
defaultValue
)
{
...
...
@@ -41,7 +42,7 @@ class FlutterPlugin implements Plugin<Project> {
localProperties
.
load
(
localPropertiesFile
.
newDataInputStream
())
}
}
String
result
;
String
result
if
(
project
.
hasProperty
(
name
))
{
result
=
project
.
property
(
name
)
}
...
...
@@ -75,12 +76,20 @@ class FlutterPlugin implements Plugin<Project> {
String
flutterExecutableName
=
Os
.
isFamily
(
Os
.
FAMILY_WINDOWS
)
?
"flutter.bat"
:
"flutter"
flutterExecutable
=
Paths
.
get
(
flutterRoot
.
absolutePath
,
"bin"
,
flutterExecutableName
).
toFile
();
String
flutterJarPath
=
localProperties
.
getProperty
(
"flutter.jar"
)
if
(
flutterJarPath
!=
null
)
{
File
flutterJar
=
project
.
file
(
flutterJarPath
)
if
(
project
.
hasProperty
(
'localEngineOut'
))
{
String
engineOutPath
=
project
.
property
(
'localEngineOut'
)
File
engineOut
=
project
.
file
(
engineOutPath
)
if
(!
engineOut
.
isDirectory
())
{
throw
new
GradleException
(
'localEngineOut must point to a local engine build'
)
}
File
flutterJar
=
Paths
.
get
(
engineOut
.
absolutePath
,
"flutter.jar"
).
toFile
()
if
(!
flutterJar
.
isFile
())
{
throw
new
GradleException
(
"flutter.jar must point to a Flutter engine JAR"
)
throw
new
GradleException
(
'Local engine build does not contain flutter.jar'
)
}
localEngine
=
engineOut
.
name
localEngineSrcPath
=
engineOut
.
parentFile
.
parent
project
.
dependencies
{
compile
project
.
files
(
flutterJar
)
}
...
...
@@ -119,8 +128,6 @@ class FlutterPlugin implements Plugin<Project> {
}
}
localEngine
=
localProperties
.
getProperty
(
"flutter.localEngine"
)
project
.
extensions
.
create
(
"flutter"
,
FlutterExtension
)
project
.
afterEvaluate
this
.&
addFlutterTask
}
...
...
@@ -135,7 +142,9 @@ class FlutterPlugin implements Plugin<Project> {
target
=
'lib/main.dart'
}
project
.
compileDebugJavaWithJavac
.
dependsOn
project
.
flutterBuildX86Jar
if
(
project
.
tasks
.
findByName
(
'flutterBuildX86Jar'
))
{
project
.
compileDebugJavaWithJavac
.
dependsOn
project
.
flutterBuildX86Jar
}
project
.
android
.
applicationVariants
.
all
{
variant
->
if
(![
"debug"
,
"profile"
,
"release"
].
contains
(
variant
.
name
))
{
...
...
@@ -147,6 +156,7 @@ class FlutterPlugin implements Plugin<Project> {
flutterExecutable
this
.
flutterExecutable
buildMode
variant
.
name
localEngine
this
.
localEngine
localEngineSrcPath
this
.
localEngineSrcPath
targetPath
target
sourceDir
project
.
file
(
project
.
flutter
.
source
)
intermediateDir
project
.
file
(
"${project.buildDir}/${AndroidProject.FD_INTERMEDIATES}/flutter/${variant.name}"
)
...
...
@@ -173,6 +183,7 @@ class FlutterTask extends DefaultTask {
File
flutterExecutable
String
buildMode
String
localEngine
String
localEngineSrcPath
String
targetPath
File
sourceDir
...
...
@@ -211,6 +222,7 @@ class FlutterTask extends DefaultTask {
workingDir
sourceDir
if
(
localEngine
!=
null
)
{
args
"--local-engine"
,
localEngine
args
"--local-engine-src-path"
,
localEngineSrcPath
}
args
"build"
,
"aot"
args
"--target"
,
targetPath
...
...
@@ -225,6 +237,7 @@ class FlutterTask extends DefaultTask {
workingDir
sourceDir
if
(
localEngine
!=
null
)
{
args
"--local-engine"
,
localEngine
args
"--local-engine-src-path"
,
localEngineSrcPath
}
args
"build"
,
"flx"
args
"--target"
,
targetPath
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
13d7770c
...
...
@@ -11,6 +11,7 @@ import '../base/os.dart';
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/utils.dart'
;
import
'../artifacts.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../globals.dart'
;
...
...
@@ -158,9 +159,16 @@ Future<Null> buildGradleProjectV2(String gradle, String buildModeName) async {
// Run 'gradle assemble<BuildMode>'.
Status
status
=
logger
.
startProgress
(
'Running
\'
gradle
$assembleTask
\'
...'
,
expectSlowOperation:
true
);
String
gradlePath
=
fs
.
file
(
gradle
).
absolute
.
path
;
List
<
String
>
command
=
logger
.
isVerbose
?
<
String
>[
gradlePath
,
assembleTask
]
:
<
String
>[
gradlePath
,
'-q'
,
assembleTask
];
List
<
String
>
command
=
<
String
>[
gradlePath
];
if
(!
logger
.
isVerbose
)
{
command
.
add
(
'-q'
);
}
if
(
artifacts
is
LocalEngineArtifacts
)
{
LocalEngineArtifacts
localEngineArtifacts
=
artifacts
;
printTrace
(
'Using local engine:
${localEngineArtifacts.engineOutPath}
'
);
command
.
add
(
'-PlocalEngineOut=
${localEngineArtifacts.engineOutPath}
'
);
}
command
.
add
(
assembleTask
);
int
exitcode
=
await
runCommandAndStreamOutput
(
command
,
workingDirectory:
'android'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment