Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3fe06d9

Browse files
committed
add gclient/ninja build logic
1 parent f746242 commit 3fe06d9

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

lib/web_ui/dev/felt.bat

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
@ECHO OFF
66
SETLOCAL
77

8+
:: Make sure gclient and ninja exist. Otherwise felt won't work.
9+
FOR /F "tokens=1-2 delims=:" %%a in ('where gclient') DO SET GCLIENT_PATH=%%b
10+
IF %GCLIENT_PATH%==[] (ECHO "ERROR: gclient is not in your PATH")
11+
12+
FOR /F "tokens=1-2 delims=:" %%a in ('where ninja') DO SET NINJA_PATH=%%b
13+
IF %NINJA_PATH%==[] (ECHO "ERROR: ninja is not in your PATH")
14+
815
:: Starting from this script's path, walk up to engine source directory.
916
SET SCRIPT_DIR=%~dp0
1017
FOR %%a IN ("%SCRIPT_DIR:~0,-1%") DO SET TMP=%%~dpa
@@ -25,9 +32,26 @@ SET FELT_PATH=%DEV_DIR%\felt.dart
2532
SET DART_TOOL_DIR=%WEB_UI_DIR%\.dart_tool
2633
SET SNAPSHOT_PATH=%DART_TOOL_DIR%\felt.snapshot
2734

28-
:: Set revision from using git in Flutter directory.
29-
CD %FLUTTER_DIR%
30-
FOR /F "tokens=1 delims=:" %%a in ('git rev-parse HEAD') DO SET REVISION=%%a
35+
SET needsHostDebugUnoptRebuild=0
36+
for %%x in (%*) do (
37+
if ["%%~x"]==["--clean"] (
38+
ECHO Clean rebuild requested
39+
SET needsHostDebugUnoptRebuild=1
40+
)
41+
)
42+
43+
IF NOT EXIST %OUT_DIR% (SET needsHostDebugUnoptRebuild=1)
44+
IF NOT EXIST %HOST_DEBUG_UNOPT_DIR% (SET needsHostDebugUnoptRebuild=1)
45+
46+
IF %needsHostDebugUnoptRebuild%==1 (
47+
ECHO Building host_debug_unopt
48+
:: Delete old snapshot, if any, because the new Dart SDK may invalidate it.
49+
IF EXIST "%SNAPSHOT_PATH%" (
50+
del %SNAPSHOT_PATH%
51+
)
52+
CALL gclient sync -D
53+
CALL python %GN% --unoptimized --full-dart-sdk
54+
CALL ninja -C %HOST_DEBUG_UNOPT_DIR%)
3155

3256
cd %WEB_UI_DIR%
3357
IF NOT EXIST "%SNAPSHOT_PATH%" (

lib/web_ui/dev/felt.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ CommandRunner runner = CommandRunner<bool>(
2525
..addCommand(TestCommand())
2626
..addCommand(BuildCommand());
2727

28-
void main(List<String> args) async {
28+
void main(List<String> rawArgs) async {
29+
// Remove --clean from the list as that's processed by the wrapper script.
30+
final List<String> args = rawArgs.where((arg) => arg != '--clean').toList();
31+
2932
if (args.isEmpty) {
3033
// The felt tool was invoked with no arguments. Print usage.
3134
runner.printUsage();

0 commit comments

Comments
 (0)