|
| 1 | +// Copyright 2014 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 '../base/file_system.dart'; |
| 6 | +import '../web/compiler_config.dart'; |
| 7 | +import './build_system.dart'; |
| 8 | + |
| 9 | +/// Commonly used build [Target]s. |
| 10 | +abstract class BuildTargets { |
| 11 | + const BuildTargets(); |
| 12 | + |
| 13 | + Target get copyFlutterBundle; |
| 14 | + Target get releaseCopyFlutterBundle; |
| 15 | + Target get generateLocalizationsTarget; |
| 16 | + Target get dartPluginRegistrantTarget; |
| 17 | + Target webServiceWorker(FileSystem fileSystem, List<WebCompilerConfig> compileConfigs); |
| 18 | +} |
| 19 | + |
| 20 | +/// BuildTargets that return NoOpTarget for every action. |
| 21 | +class NoOpBuildTargets extends BuildTargets { |
| 22 | + const NoOpBuildTargets(); |
| 23 | + |
| 24 | + @override |
| 25 | + Target get copyFlutterBundle => const _NoOpTarget(); |
| 26 | + |
| 27 | + @override |
| 28 | + Target get releaseCopyFlutterBundle => const _NoOpTarget(); |
| 29 | + |
| 30 | + @override |
| 31 | + Target get generateLocalizationsTarget => const _NoOpTarget(); |
| 32 | + |
| 33 | + @override |
| 34 | + Target get dartPluginRegistrantTarget => const _NoOpTarget(); |
| 35 | + |
| 36 | + @override |
| 37 | + Target webServiceWorker(FileSystem fileSystem, List<WebCompilerConfig> compileConfigs) => const _NoOpTarget(); |
| 38 | +} |
| 39 | + |
| 40 | +/// A [Target] that does nothing. |
| 41 | +class _NoOpTarget extends Target { |
| 42 | + const _NoOpTarget(); |
| 43 | + |
| 44 | + @override |
| 45 | + String get name => 'no_op'; |
| 46 | + |
| 47 | + @override |
| 48 | + List<Source> get inputs => const <Source>[]; |
| 49 | + |
| 50 | + @override |
| 51 | + List<Source> get outputs => const <Source>[]; |
| 52 | + |
| 53 | + @override |
| 54 | + List<Target> get dependencies => const <Target>[]; |
| 55 | + |
| 56 | + @override |
| 57 | + Future<void> build(Environment environment) async {} |
| 58 | +} |
0 commit comments