diff --git a/engine/src/flutter/ci/analyze.sh b/engine/src/flutter/ci/analyze.sh index bbacb876353..f04610f07ff 100755 --- a/engine/src/flutter/ci/analyze.sh +++ b/engine/src/flutter/ci/analyze.sh @@ -59,6 +59,7 @@ function analyze() ( ) echo "Analyzing dart:ui library..." +autoninja -C "$SRC_DIR/out/host_debug_unopt" generate_dart_ui analyze \ --options "$FLUTTER_DIR/analysis_options.yaml" \ "$SRC_DIR/out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart" @@ -106,6 +107,8 @@ analyze \ "$FLUTTER_DIR/testing/smoke_test_failure" echo "Analyzing testing/dart..." +"$FLUTTER_DIR/tools/gn" --unoptimized +autoninja -C "$SRC_DIR/out/host_debug_unopt" sky_engine sky_services (cd "$FLUTTER_DIR/testing/dart" && "$PUB" get --offline) analyze \ --packages="$FLUTTER_DIR/testing/dart/.dart_tool/package_config.json" \ diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index c8ee5d0a525..cb3bc7a17e4 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -283,19 +283,89 @@ def RunDartTest(build_dir, test_packages, dart_file, verbose_dart_snapshot, mult def EnsureDebugUnoptSkyPackagesAreBuilt(): variant_out_dir = os.path.join(out_dir, 'host_debug_unopt') - assert os.path.exists(variant_out_dir), "%s doesn't exist. Run GN to generate the directory first" % variant_out_dir + + ninja_command = [ + 'ninja', + '-C', + variant_out_dir, + 'flutter/sky/packages' + ] + + # Attempt running Ninja if the out directory exists. + # We don't want to blow away any custom GN args the caller may have already set. + if os.path.exists(variant_out_dir): + RunCmd(ninja_command, cwd=buildroot_dir) + return + + gn_command = [ + os.path.join(buildroot_dir, 'flutter', 'tools', 'gn'), + '--runtime-mode', + 'debug', + '--unopt', + '--no-lto', + ] + + RunCmd(gn_command, cwd=buildroot_dir) + RunCmd(ninja_command, cwd=buildroot_dir) def EnsureJavaTestsAreBuilt(android_out_dir): """Builds the engine variant and the test jar containing the JUnit tests""" - tmp_out_dir = os.path.join(out_dir, android_out_dir) - assert os.path.exists(tmp_out_dir), "%s doesn't exist. Run GN to generate the directory first" % android_out_dir + ninja_command = [ + 'autoninja', + '-C', + android_out_dir, + 'flutter/shell/platform/android:robolectric_tests' + ] + + # Attempt running Ninja if the out directory exists. + # We don't want to blow away any custom GN args the caller may have already set. + if os.path.exists(android_out_dir): + RunCmd(ninja_command, cwd=buildroot_dir) + return + + assert android_out_dir != "out/android_debug_unopt", "%s doesn't exist. Run GN to generate the directory first" % android_out_dir + + # Otherwise prepare the directory first, then build the test. + gn_command = [ + os.path.join(buildroot_dir, 'flutter', 'tools', 'gn'), + '--android', + '--unoptimized', + '--runtime-mode=debug', + '--no-lto', + ] + RunCmd(gn_command, cwd=buildroot_dir) + RunCmd(ninja_command, cwd=buildroot_dir) def EnsureIosTestsAreBuilt(ios_out_dir): """Builds the engine variant and the test dylib containing the XCTests""" - tmp_out_dir = os.path.join(out_dir, ios_out_dir) - assert os.path.exists(tmp_out_dir), "%s doesn't exist. Run GN to generate the directory first" % ios_out_dir + ninja_command = [ + 'autoninja', + '-C', + ios_out_dir, + 'ios_test_flutter' + ] + + # Attempt running Ninja if the out directory exists. + # We don't want to blow away any custom GN args the caller may have already set. + if os.path.exists(ios_out_dir): + RunCmd(ninja_command, cwd=buildroot_dir) + return + + assert ios_out_dir != "out/ios_debug_sim_unopt", "%s doesn't exist. Run GN to generate the directory first" % ios_out_dir + + # Otherwise prepare the directory first, then build the test. + gn_command = [ + os.path.join(buildroot_dir, 'flutter', 'tools', 'gn'), + '--ios', + '--unoptimized', + '--runtime-mode=debug', + '--no-lto', + '--simulator' + ] + RunCmd(gn_command, cwd=buildroot_dir) + RunCmd(ninja_command, cwd=buildroot_dir) def AssertExpectedJavaVersion():