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

Commit 9734785

Browse files
authored
[et] Adds a .bat entrypoint for Windows (#50784)
For flutter/flutter#132807
1 parent 22a709c commit 9734785

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
lines changed

bin/et.bat

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@ECHO off
2+
REM Copyright 2013 The Flutter Authors. All rights reserved.
3+
REM Use of this source code is governed by a BSD-style license that can be
4+
REM found in the LICENSE file.
5+
6+
REM ---------------------------------- NOTE ----------------------------------
7+
REM
8+
REM Please keep the logic in this file consistent with the logic in the
9+
REM `et` script in the same directory to ensure that it continues to
10+
REM work across all platforms!
11+
REM
12+
REM --------------------------------------------------------------------------
13+
14+
SETLOCAL ENABLEDELAYEDEXPANSION
15+
16+
FOR %%i IN ("%~dp0..\..") DO SET SRC_DIR=%%~fi
17+
18+
REM Test if Git is available on the Host
19+
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
20+
21+
SET repo_dir=%SRC_DIR%\flutter
22+
SET engine_tool_dir=%repo_dir%\tools\engine_tool
23+
24+
REM Determine which platform we are on and use the right prebuilt Dart SDK
25+
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
26+
SET dart_sdk_path=%SRC_DIR%\flutter\prebuilts\windows-x64\dart-sdk
27+
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
28+
SET dart_sdk_path=%SRC_DIR%\flutter\prebuilts\windows-arm64\dart-sdk
29+
) ELSE (
30+
ECHO "Windows x86 (32-bit) is not supported" && EXIT /B 1
31+
)
32+
33+
SET dart=%dart_sdk_path%\bin\dart.exe
34+
35+
cd "%engine_tool_dir%"
36+
37+
REM Do not use the CALL command in the next line to execute Dart. CALL causes
38+
REM Windows to re-read the line from disk after the CALL command has finished
39+
REM regardless of the ampersand chain.
40+
"%dart%" --disable-dart-dev bin\et.dart %* & exit /B !ERRORLEVEL!

tools/engine_tool/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ There are currently many missing features. Some overall goals are listed in the
2323
GitHub issue [here](https://github.com/flutter/flutter/issues/132807). Some
2424
desirable new features would do the following:
2525

26-
* Support Windows hosts.
2726
* Add a `doctor` command.
2827
* Update the engine checkout so that engine developers no longer have to remeber
2928
to run `gclient sync -D`.

tools/engine_tool/lib/src/commands/command_runner.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class ToolCommandRunner extends CommandRunner<int> {
4141
@override
4242
Future<int> run(Iterable<String> args) async {
4343
try{
44-
return await runCommand(parse(args)) ?? 1;
44+
return await runCommand(parse(args)) ?? 0;
4545
} on FormatException catch (e) {
4646
environment.logger.error(e);
4747
return 1;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:io' as io;
6+
7+
import 'package:engine_repo_tools/engine_repo_tools.dart';
8+
import 'package:litetest/litetest.dart';
9+
import 'package:path/path.dart' as path;
10+
import 'package:platform/platform.dart';
11+
import 'package:process_runner/process_runner.dart';
12+
13+
void main() {
14+
final Engine engine;
15+
try {
16+
engine = Engine.findWithin();
17+
} catch (e) {
18+
io.stderr.writeln(e);
19+
io.exitCode = 1;
20+
return;
21+
}
22+
23+
test('The entry points under bin/ work', () async {
24+
const Platform platform = LocalPlatform();
25+
final ProcessRunner runner = ProcessRunner();
26+
final String exe = platform.isWindows ? '.bat' : '';
27+
final String entrypointPath = path.join(
28+
engine.flutterDir.path, 'bin', 'et$exe',
29+
);
30+
final ProcessRunnerResult processResult = await runner.runProcess(
31+
<String>[entrypointPath, 'help'],
32+
failOk: true,
33+
);
34+
if (processResult.exitCode != 0) {
35+
io.stdout.writeln(processResult.stdout);
36+
io.stderr.writeln(processResult.stderr);
37+
}
38+
expect(processResult.exitCode, equals(0));
39+
});
40+
}

0 commit comments

Comments
 (0)