mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Fixes https://github.com/flutter/flutter/issues/130277 This PR does two things: 1. introduce a hidden `flutter build _preview` command, that will build a debug windows desktop app and copy it into the SDK's binary cache. This command is only intended to be run during packaging. 2. introduce a new device type, called `PreviewDevice`, which relies on the prebuilt desktop debug app from step 1, copies it into the target app's assets build folder, and then hot reloads their dart code into it.
49 lines
1.5 KiB
Dart
49 lines
1.5 KiB
Dart
// Copyright 2014 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 'package:flutter_tools/src/base/file_system.dart';
|
|
import 'package:flutter_tools/src/base/logger.dart';
|
|
import 'package:flutter_tools/src/base/os.dart';
|
|
import 'package:flutter_tools/src/base/platform.dart';
|
|
import 'package:process/process.dart';
|
|
|
|
import '../../src/common.dart';
|
|
import '../../src/context.dart';
|
|
|
|
void main() {
|
|
group('OperatingSystemUtils', () {
|
|
late Directory tempDir;
|
|
late FileSystem fileSystem;
|
|
|
|
setUp(() {
|
|
fileSystem = LocalFileSystem.test(signals: FakeSignals());
|
|
tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_tools_os_utils_test.');
|
|
});
|
|
|
|
tearDown(() {
|
|
tryToDelete(tempDir);
|
|
});
|
|
|
|
testWithoutContext('makeExecutable', () async {
|
|
const Platform platform = LocalPlatform();
|
|
final OperatingSystemUtils operatingSystemUtils = OperatingSystemUtils(
|
|
fileSystem: fileSystem,
|
|
logger: BufferLogger.test(),
|
|
platform: platform,
|
|
processManager: const LocalProcessManager(),
|
|
);
|
|
final File file = fileSystem.file(fileSystem.path.join(tempDir.path, 'foo.script'));
|
|
file.writeAsStringSync('hello world');
|
|
operatingSystemUtils.makeExecutable(file);
|
|
|
|
// Skip this test on windows.
|
|
if (!platform.isWindows) {
|
|
final String mode = file.statSync().modeString();
|
|
// rwxr--r--
|
|
expect(mode.substring(0, 3), endsWith('x'));
|
|
}
|
|
});
|
|
});
|
|
}
|