Skip to content

Use snapshot's .d file as source inputs in Gradle build. - #8756

Merged
jakobr-google merged 2 commits into
flutter:masterfrom
jakobr-google:dependorama
Mar 14, 2017
Merged

jakobr-google merged 2 commits into
flutter:masterfrom
jakobr-google:dependorama

Conversation

@jakobr-google

Copy link
Copy Markdown
Contributor

If we don't yet have a .d file (first build), fall back to using the
.dart files in the current directory. This enables us to detect changes
in dependent source files (Flutter framework, packages outside the
source directory, etc.), and re-generate the snapshots as needed.

Unfortunately, Gradle requires knowing the source files before executing
the task, and can't update them after building, so Gradle considers the
second build to be out-of-date (because it has more input files than the
first build). Sub-sequent builds have the correct dependency
information, and will be skipped if the source files haven't changed.

Also added a dependency on gen_snapshot. The snapshot ABI isn't stable,
so we need to re-generate the snapshots when we roll the Dart SDK
dependency.

Fixes #8315
Fixes #8687
Fixes #8607

If we don't yet have a .d file (first build), fall back to using the
.dart files in the current directory. This enables us to detect changes
in dependent source files (Flutter framework, packages outside the
source directory, etc.), and re-generate the snapshots as needed.

Unfortunately, Gradle requires knowing the source files before executing
the task, and can't update them after building, so Gradle considers the
second build to be out-of-date (because it has more input files than the
first build). Sub-sequent builds have the correct dependency
information, and will be skipped if the source files haven't changed.

Also added a dependency on gen_snapshot. The snapshot ABI isn't stable,
so we need to re-generate the snapshots when we roll the Dart SDK
dependency.

Fixes flutter#8315
Fixes flutter#8687
Fixes flutter#8607

@mravn-google mravn-google left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dependenciesFile = project.file("${intermediateDir}/snapshot_blob.bin.d")
}
FileCollection sources = readDependencies(dependenciesFile)
if (sources != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment describing the situations sources == null and sources !=null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

try {
// Dependencies file has Makefile syntax:
// <target> <files>: <source> <files> <separated> <by> <space>
String depText = dependenciesFile.text

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a dependency files have comments? Like lines of the form
# TODO(mravn): remove dependencies on bigwig

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's technically in 'Makefile' format, which does allow comments. However, gen_snapshot only emits one line containing 'target: sources'.

@jakobr-google
jakobr-google merged commit 9c6ffc8 into flutter:master Mar 14, 2017
@jakobr-google
jakobr-google deleted the dependorama branch March 14, 2017 11:49
@eseidelGoogle

Copy link
Copy Markdown
Contributor

FYI @jason-simmons @abarth

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

4 participants