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

This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
59 lines
2.0 KiB
Dart
59 lines
2.0 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:file/file.dart';
|
|
import 'package:file/memory.dart';
|
|
import 'package:file_testing/file_testing.dart';
|
|
import 'package:flutter_tools/src/base/template.dart';
|
|
import 'package:flutter_tools/src/flutter_plugins.dart';
|
|
import 'package:flutter_tools/src/isolated/mustache_template.dart';
|
|
import 'package:flutter_tools/src/platform_plugins.dart';
|
|
import 'package:flutter_tools/src/plugins.dart';
|
|
import 'package:flutter_tools/src/project.dart';
|
|
|
|
import '../../src/common.dart';
|
|
|
|
const TemplateRenderer renderer = MustacheTemplateRenderer();
|
|
|
|
void main() {
|
|
testWithoutContext('Win32 injects Win32 plugins', () async {
|
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
|
setUpProject(fileSystem);
|
|
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(
|
|
fileSystem.currentDirectory,
|
|
);
|
|
|
|
await writeWindowsPluginFiles(flutterProject, <Plugin>[
|
|
Plugin(
|
|
name: 'test',
|
|
path: 'foo',
|
|
defaultPackagePlatforms: const <String, String>{},
|
|
pluginDartClassPlatforms: const <String, DartPluginClassAndFilePair>{},
|
|
platforms: const <String, PluginPlatform>{
|
|
WindowsPlugin.kConfigKey: WindowsPlugin(
|
|
name: 'test',
|
|
pluginClass: 'Foo',
|
|
variants: <PluginPlatformVariant>{PluginPlatformVariant.win32},
|
|
),
|
|
},
|
|
dependencies: <String>[],
|
|
isDirectDependency: true,
|
|
isDevDependency: false,
|
|
),
|
|
], renderer);
|
|
|
|
final Directory managed = flutterProject.windows.managedDirectory;
|
|
expect(flutterProject.windows.generatedPluginCmakeFile, exists);
|
|
expect(managed.childFile('generated_plugin_registrant.h'), exists);
|
|
expect(
|
|
managed.childFile('generated_plugin_registrant.cc').readAsStringSync(),
|
|
contains('#include <test/foo.h>'),
|
|
);
|
|
});
|
|
}
|
|
|
|
void setUpProject(FileSystem fileSystem) {
|
|
fileSystem.file('pubspec.yaml').createSync();
|
|
}
|