-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathhook_config.dart
149 lines (131 loc) · 4.94 KB
/
hook_config.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. 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:convert';
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:crypto/crypto.dart';
import 'package:pub_semver/pub_semver.dart';
import '../json_utils.dart';
import '../model/hook.dart';
import '../model/metadata.dart';
import '../model/target.dart';
import '../utils/map.dart';
import 'architecture.dart';
import 'asset.dart';
import 'build_config.dart';
import 'build_mode.dart';
import 'ios_sdk.dart';
import 'link_config.dart';
import 'link_mode_preference.dart';
import 'os.dart';
part '../model/hook_config.dart';
/// The shared properties of a [LinkConfig] and a [BuildConfig].
///
/// This abstraction makes it easier to design APIs intended for both kinds of
/// build hooks, building and linking.
abstract class HookConfig {
/// The directory in which output and intermediate artifacts that are unique
/// to this configuration can be placed.
///
/// This directory is unique per hook and per configuration.
///
/// The contents of this directory will not be modified by anything else than
/// the hook itself.
///
/// The invoker of the the hook will ensure concurrent invocations wait on
/// each other.
Uri get outputDirectory;
/// The directory in which shared output and intermediate artifacts can be
/// placed.
///
/// This directory is unique per hook.
///
/// The contents of this directory will not be modified by anything else than
/// the hook itself.
///
/// The invoker of the the hook will ensure concurrent invocations wait on
/// each other.
Uri get outputDirectoryShared;
/// The name of the package the assets are built for.
String get packageName;
/// The root of the package the assets are built for.
///
/// Often a package's assets are built because a package is a dependency of
/// another. For this it is convenient to know the packageRoot.
Uri get packageRoot;
/// The architecture being compiled for.
///
/// Not specified (`null`) during a [dryRun].
Architecture? get targetArchitecture;
/// The operating system being compiled for.
OS get targetOS;
/// When compiling for iOS, whether to target device or simulator.
///
/// Only available if [targetOS] is [OS.iOS]. Will throw a [StateError] if
/// accessed otherwise.
///
/// Not available during a [dryRun]. Will throw a [StateError] if accessed
/// during a [dryRun].
IOSSdk? get targetIOSSdk;
/// When compiling for iOS, the lowest iOS version that the compiled code
/// will be compatible with.
///
/// Only available if [targetOS] is [OS.iOS]. Will throw a [StateError] if
/// accessed otherwise.
///
/// Not available during a [dryRun]. Will throw a [StateError] if accessed
/// during a [dryRun].
///
/// Corresponds to `-mios-version-min=<value>` for the Apple clang compiler.
int? get targetIOSVersion;
/// When compiling for MacOS, the lowest MacOS version that the compiled code
/// will be compatible with.
///
/// Only available if [targetOS] is [OS.macOS]. Will throw a [StateError] if
/// accessed otherwise.
///
/// Not available during a [dryRun]. Will throw a [StateError] if accessed
/// during a [dryRun].
///
/// Corresponds to `-mmacosx-version-min=<value>` for the Apple clang
/// compiler.
int? get targetMacOSVersion;
/// When compiling for Android, the minimum Android SDK API version to that
/// the compiled code will be compatible with.
///
/// Required when [targetOS] equals [OS.android].
///
/// Not available during a [dryRun]. Will throw a [StateError] if accessed
/// during a [dryRun].
///
/// For more information about the Android API version, refer to
/// [`minSdkVersion`](https://developer.android.com/ndk/guides/sdk-versions#minsdkversion)
/// in the Android documentation.
int? get targetAndroidNdkApi;
/// The configuration for invoking the C compiler.
///
/// Not available during a [dryRun]. Will throw a [StateError] if accessed
/// during a [dryRun].
CCompilerConfig get cCompiler;
/// Whether this run is a dry-run, which doesn't build anything.
///
/// A dry-run only reports information about which assets a build would
/// create, but doesn't actually create files.
bool get dryRun;
/// The [BuildMode] that the code should be compiled in.
///
/// Currently [BuildMode.debug] and [BuildMode.release] are the only modes.
///
/// Not available during a [dryRun]. Will throw a [StateError] if accessed
/// during a [dryRun].
BuildMode get buildMode;
/// The asset types that the invoker of this hook supports.
///
/// Currently known values:
/// * [NativeCodeAsset.type]
/// * [DataAsset.type]
Iterable<String> get supportedAssetTypes;
/// The preferred [LinkMode] method for [NativeCodeAsset]s.
LinkModePreference get linkModePreference;
}