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

[et] Adds a .bat entrypoint for Windows #50784

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions bin/et.bat
Original file line number Diff line number Diff line change
@@ -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!
1 change: 0 additions & 1 deletion tools/engine_tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion tools/engine_tool/lib/src/commands/command_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
40 changes: 40 additions & 0 deletions tools/engine_tool/test/entry_point_test.dart
Original file line number Diff line number Diff line change
@@ -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));
});
}