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
5af67e15
Commit
5af67e15
authored
Jun 07, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for `target` to gradle build (#4420)
This lets you build something other than `lib/main.dart`.
parent
3ba17136
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
README.md
examples/hello_services/README.md
+11
-3
FlutterPlugin.groovy
...ces/android/buildSrc/src/main/groovy/FlutterPlugin.groovy
+10
-0
No files found.
examples/hello_services/README.md
View file @
5af67e15
...
@@ -15,8 +15,8 @@ Create an `ios/Flutter/Generated.xcconfig` file with this entry:
...
@@ -15,8 +15,8 @@ Create an `ios/Flutter/Generated.xcconfig` file with this entry:
There are a number of other parameters you can control with this file:
There are a number of other parameters you can control with this file:
*
`FLUTTER_APPLICATION_PATH`
: The path t
hat contains your
`pubspec.yaml`
file
*
`FLUTTER_APPLICATION_PATH`
: The path t
o the directory that contains your
relative to your
`xcodeproj`
file.
`pubspec.yaml`
file
relative to your
`xcodeproj`
file.
*
`FLUTTER_BUILD_MODE`
: Whether to build for
`debug`
,
`profile`
, or
`release`
.
*
`FLUTTER_BUILD_MODE`
: Whether to build for
`debug`
,
`profile`
, or
`release`
.
Defaults to
`release`
.
Defaults to
`release`
.
*
`FLUTTER_TARGET`
: The path to your
`main.dart`
relative to your
*
`FLUTTER_TARGET`
: The path to your
`main.dart`
relative to your
...
@@ -47,10 +47,18 @@ There are a number of other parameters you can control with this file:
...
@@ -47,10 +47,18 @@ There are a number of other parameters you can control with this file:
`android-arm-release`
version of
`flutter.jar`
in the
`bin/cache`
directory
`android-arm-release`
version of
`flutter.jar`
in the
`bin/cache`
directory
of the Flutter SDK.
of the Flutter SDK.
See
`android/app/build.gradle`
for project specific settings, including:
*
`source`
: The path to the directory that contains your
`pubspec.yaml`
file
relative to your
`build.gradle`
file.
*
`target`
: The path to your
`main.dart`
relative to your
`pubspec.yaml`
.
Defaults to
`lib/main.dart`
.
### Build
### Build
To build direct
ion with gradle
, use the following commands:
To build direct
ly with
`gradle`
, use the following commands:
*
`cd android`
*
`gradle wrapper`
*
`gradle wrapper`
*
`./gradlew build`
*
`./gradlew build`
...
...
examples/hello_services/android/buildSrc/src/main/groovy/FlutterPlugin.groovy
View file @
5af67e15
...
@@ -87,10 +87,16 @@ class FlutterPlugin implements Plugin<Project> {
...
@@ -87,10 +87,16 @@ class FlutterPlugin implements Plugin<Project> {
throw
new
GradleException
(
"Must provide Flutter source directory"
)
throw
new
GradleException
(
"Must provide Flutter source directory"
)
}
}
String
target
=
project
.
flutter
.
target
;
if
(
target
==
null
)
{
target
=
'lib/main.dart'
}
FlutterTask
flutterTask
=
project
.
tasks
.
create
(
"flutterBuild"
,
FlutterTask
)
{
FlutterTask
flutterTask
=
project
.
tasks
.
create
(
"flutterBuild"
,
FlutterTask
)
{
flutterRoot
this
.
flutterRoot
flutterRoot
this
.
flutterRoot
buildMode
this
.
buildMode
buildMode
this
.
buildMode
localEngine
this
.
localEngine
localEngine
this
.
localEngine
targetPath
target
sourceDir
project
.
file
(
project
.
flutter
.
source
)
sourceDir
project
.
file
(
project
.
flutter
.
source
)
intermediateDir
project
.
file
(
"${project.buildDir}/${AndroidProject.FD_INTERMEDIATES}/flutter"
)
intermediateDir
project
.
file
(
"${project.buildDir}/${AndroidProject.FD_INTERMEDIATES}/flutter"
)
}
}
...
@@ -109,12 +115,14 @@ class FlutterPlugin implements Plugin<Project> {
...
@@ -109,12 +115,14 @@ class FlutterPlugin implements Plugin<Project> {
class
FlutterExtension
{
class
FlutterExtension
{
String
source
String
source
String
target
}
}
class
FlutterTask
extends
DefaultTask
{
class
FlutterTask
extends
DefaultTask
{
File
flutterRoot
File
flutterRoot
String
buildMode
String
buildMode
String
localEngine
String
localEngine
String
targetPath
@InputDirectory
@InputDirectory
File
sourceDir
File
sourceDir
...
@@ -150,6 +158,7 @@ class FlutterTask extends DefaultTask {
...
@@ -150,6 +158,7 @@ class FlutterTask extends DefaultTask {
args
"--local-engine"
,
localEngine
args
"--local-engine"
,
localEngine
}
}
args
"build"
,
"aot"
args
"build"
,
"aot"
args
"--target"
,
targetPath
args
"--target-platform"
,
"android-arm"
args
"--target-platform"
,
"android-arm"
args
"--output-dir"
,
"${intermediateDir}"
args
"--output-dir"
,
"${intermediateDir}"
args
"--${buildMode}"
args
"--${buildMode}"
...
@@ -163,6 +172,7 @@ class FlutterTask extends DefaultTask {
...
@@ -163,6 +172,7 @@ class FlutterTask extends DefaultTask {
args
"--local-engine"
,
localEngine
args
"--local-engine"
,
localEngine
}
}
args
"build"
,
"flx"
args
"build"
,
"flx"
args
"--target"
,
targetPath
args
"--output-file"
,
"${intermediateDir}/app.flx"
args
"--output-file"
,
"${intermediateDir}/app.flx"
if
(
buildMode
!=
"debug"
)
{
if
(
buildMode
!=
"debug"
)
{
args
"--precompiled"
args
"--precompiled"
...
...
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