• Chris Bracken's avatar
    Include kernel_compile.d in Gradle depfiles (#17175) · 75290649
    Chris Bracken authored
    This updates the Android build to declare the kernel compile depfile as
    an output and its contents as inputs when running with --preview-dart-2
    (the default mode).
    
    The 'flutter build aot' command behaves differently depending on whether
    it's running in Dart 1 or Dart 2 mode:
    
    * Dart 1: the entrypoint Dart file (typically main.dart) is passed
      directly to gen_snapshot, which then emits snapshot.d, whose contents
      list the transitive closure of Dart dependencies (input files) for the
      snapshot. snapshot.d is a declared output, its contents (plus
      gen_snapshot itself) constitute the set of input files to the Gradle
      build action.
    
    * Dart 2: then entrypoint Dart file (typically main.dart) is first
      compiled with the Dart kernel frontend. This emits kernel_compile.d,
      whose contents list the transitive closure of Dart dependencies (input
      files) for the kernel 'dill' output file. This 'dill' file is then
      passed to gen_snapshot, which emits snapshot.d, whose contents are
      empty. As of this change, both snapshot.d and kernel_compile.d are
      declared outputs, and their contents (plus gen_snapshot and the
      frontend compiler themselves) constitute the set of input files to the
      Gradle build action.
    
    This fixes a bug wherein profile/release AOT outputs were not
    invalidated due to snapshot.d being empty, and kernel_compile.d being
    ignored. This was introduced during recent refactoring of the AOT build
    code, wherein the kernel compile and gen_snapshot actions were changed
    to emit independent depfiles (previously one stomped -- or failed to --
    on the other's output).
    75290649
flutter.gradle 20.6 KB