[et] Adds a .bat entrypoint for Windows (flutter/engine#50784)

For https://github.com/flutter/flutter/issues/132807
This commit is contained in:
Zachary Anderson
2024-02-20 18:48:18 +00:00
committed by GitHub
parent 914efefa87
commit 77cbd54c43
4 changed files with 81 additions and 2 deletions

View File

@@ -0,0 +1,40 @@
@ECHO off
REM Copyright 2013 The Flutter Authors. All rights reserved.
REM Use of this source code is governed by a BSD-style license that can be
REM found in the LICENSE file.
REM ---------------------------------- NOTE ----------------------------------
REM
REM Please keep the logic in this file consistent with the logic in the
REM `et` script in the same directory to ensure that it continues to
REM work across all platforms!
REM
REM --------------------------------------------------------------------------
SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%i IN ("%~dp0..\..") DO SET SRC_DIR=%%~fi
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
SET repo_dir=%SRC_DIR%\flutter
SET engine_tool_dir=%repo_dir%\tools\engine_tool
REM Determine which platform we are on and use the right prebuilt Dart SDK
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
SET dart_sdk_path=%SRC_DIR%\flutter\prebuilts\windows-x64\dart-sdk
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
SET dart_sdk_path=%SRC_DIR%\flutter\prebuilts\windows-arm64\dart-sdk
) ELSE (
ECHO "Windows x86 (32-bit) is not supported" && EXIT /B 1
)
SET dart=%dart_sdk_path%\bin\dart.exe
cd "%engine_tool_dir%"
REM Do not use the CALL command in the next line to execute Dart. CALL causes
REM Windows to re-read the line from disk after the CALL command has finished
REM regardless of the ampersand chain.
"%dart%" --disable-dart-dev bin\et.dart %* & exit /B !ERRORLEVEL!

View File

@@ -23,7 +23,6 @@ There are currently many missing features. Some overall goals are listed in the
GitHub issue [here](https://github.com/flutter/flutter/issues/132807). Some
desirable new features would do the following:
* Support Windows hosts.
* Add a `doctor` command.
* Update the engine checkout so that engine developers no longer have to remeber
to run `gclient sync -D`.

View File

@@ -41,7 +41,7 @@ final class ToolCommandRunner extends CommandRunner<int> {
@override
Future<int> run(Iterable<String> args) async {
try{
return await runCommand(parse(args)) ?? 1;
return await runCommand(parse(args)) ?? 0;
} on FormatException catch (e) {
environment.logger.error(e);
return 1;

View File

@@ -0,0 +1,40 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io' as io;
import 'package:engine_repo_tools/engine_repo_tools.dart';
import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as path;
import 'package:platform/platform.dart';
import 'package:process_runner/process_runner.dart';
void main() {
final Engine engine;
try {
engine = Engine.findWithin();
} catch (e) {
io.stderr.writeln(e);
io.exitCode = 1;
return;
}
test('The entry points under bin/ work', () async {
const Platform platform = LocalPlatform();
final ProcessRunner runner = ProcessRunner();
final String exe = platform.isWindows ? '.bat' : '';
final String entrypointPath = path.join(
engine.flutterDir.path, 'bin', 'et$exe',
);
final ProcessRunnerResult processResult = await runner.runProcess(
<String>[entrypointPath, 'help'],
failOk: true,
);
if (processResult.exitCode != 0) {
io.stdout.writeln(processResult.stdout);
io.stderr.writeln(processResult.stderr);
}
expect(processResult.exitCode, equals(0));
});
}