@@ -71,15 +71,15 @@ class RunCBuilder {
7171 this .defines = const {},
7272 this .pic,
7373 this .std,
74- this .language = Language .c,
74+ this .language = .c,
7575 this .cppLinkStdLib,
7676 required this .optimizationLevel,
7777 }) : outDir = input.outputDirectory,
7878 assert (
7979 [executable, dynamicLibrary, staticLibrary].whereType <Uri >().length ==
8080 1 ,
8181 ) {
82- if (codeConfig.targetOS == OS .windows && cppLinkStdLib != null ) {
82+ if (codeConfig.targetOS == .windows && cppLinkStdLib != null ) {
8383 throw ArgumentError .value (
8484 cppLinkStdLib,
8585 'cppLinkStdLib' ,
@@ -98,12 +98,12 @@ class RunCBuilder {
9898 Future <Uri > archiver () async => (await _resolver.resolveArchiver ()).uri;
9999
100100 Future <Uri > iosSdk (IOSSdk iosSdk, ToolResolvingContext context) async {
101- if (iosSdk == IOSSdk .iPhoneOS) {
101+ if (iosSdk == .iPhoneOS) {
102102 return (await iPhoneOSSdk.defaultResolver! .resolve (
103103 context,
104104 )).where ((i) => i.tool == iPhoneOSSdk).first.uri;
105105 }
106- assert (iosSdk == IOSSdk .iPhoneSimulator);
106+ assert (iosSdk == .iPhoneSimulator);
107107 return (await iPhoneSimulatorSdk.defaultResolver! .resolve (
108108 context,
109109 )).where ((i) => i.tool == iPhoneSimulatorSdk).first.uri;
@@ -141,7 +141,7 @@ class RunCBuilder {
141141 }
142142
143143 final IOSSdk ? targetIosSdk;
144- if (codeConfig.targetOS == OS .iOS) {
144+ if (codeConfig.targetOS == .iOS) {
145145 targetIosSdk = codeConfig.iOS.targetSdk;
146146 } else {
147147 targetIosSdk = null ;
@@ -151,7 +151,7 @@ class RunCBuilder {
151151 // invoking clang. Mimic that behavior here.
152152 // See https://github.com/dart-lang/native/issues/171.
153153 final int ? targetAndroidNdkApi;
154- if (codeConfig.targetOS == OS .android) {
154+ if (codeConfig.targetOS == .android) {
155155 final minimumApi = codeConfig.targetArchitecture == Architecture .riscv64
156156 ? 35
157157 : 21 ;
@@ -160,10 +160,10 @@ class RunCBuilder {
160160 targetAndroidNdkApi = null ;
161161 }
162162
163- final targetIOSVersion = codeConfig.targetOS == OS .iOS
163+ final targetIOSVersion = codeConfig.targetOS == .iOS
164164 ? codeConfig.iOS.targetVersion
165165 : null ;
166- final targetMacOSVersion = codeConfig.targetOS == OS .macOS
166+ final targetMacOSVersion = codeConfig.targetOS == .macOS
167167 ? codeConfig.macOS.targetVersion
168168 : null ;
169169
@@ -231,26 +231,26 @@ class RunCBuilder {
231231 executable: toolInstance.uri,
232232 environment: environment,
233233 arguments: [
234- if (codeConfig.targetOS == OS .android) ...[
234+ if (codeConfig.targetOS == .android) ...[
235235 '--target='
236236 '${androidNdkClangTargetFlags [architecture ]!}'
237237 '${targetAndroidNdkApi !}' ,
238238 '--sysroot=${androidSysroot (toolInstance ).toFilePath ()}' ,
239239 ],
240- if (codeConfig.targetOS == OS .windows)
240+ if (codeConfig.targetOS == .windows)
241241 '--target=${clangWindowsTargetFlags [architecture ]!}' ,
242- if (codeConfig.targetOS == OS .macOS)
242+ if (codeConfig.targetOS == .macOS)
243243 '--target=${appleClangMacosTargetFlags [architecture ]!}' ,
244- if (codeConfig.targetOS == OS .iOS)
244+ if (codeConfig.targetOS == .iOS)
245245 '--target=${appleClangIosTargetFlags [architecture ]![targetIosSdk ]!}' ,
246246 if (targetIOSVersion != null ) '-mios-version-min=$targetIOSVersion ' ,
247247 if (targetMacOSVersion != null )
248248 '-mmacos-version-min=$targetMacOSVersion ' ,
249- if (codeConfig.targetOS == OS .iOS) ...[
249+ if (codeConfig.targetOS == .iOS) ...[
250250 '-isysroot' ,
251251 (await iosSdk (targetIosSdk! , context)).toFilePath (),
252252 ],
253- if (codeConfig.targetOS == OS .macOS) ...[
253+ if (codeConfig.targetOS == .macOS) ...[
254254 '-isysroot' ,
255255 (await macosSdk (context)).toFilePath (),
256256 ],
@@ -260,7 +260,7 @@ class RunCBuilder {
260260 ],
261261 if (pic != null )
262262 if (toolInstance.tool.isClangLike &&
263- codeConfig.targetOS != OS .windows) ...[
263+ codeConfig.targetOS != .windows) ...[
264264 if (pic! ) ...[
265265 if (dynamicLibrary != null ) '-fPIC' ,
266266 // Using PIC for static libraries allows them to be linked into
@@ -291,18 +291,17 @@ class RunCBuilder {
291291 ],
292292 ],
293293 if (std != null ) '-std=$std ' ,
294- if (language == Language .cpp) ...[
294+ if (language == .cpp) ...[
295295 '-x' ,
296296 'c++' ,
297297 '-l' ,
298298 cppLinkStdLib ?? defaultCppLinkStdLib[codeConfig.targetOS]! ,
299299 ],
300- if (optimizationLevel != OptimizationLevel .unspecified)
301- optimizationLevel.clangFlag (),
300+ if (optimizationLevel != .unspecified) optimizationLevel.clangFlag (),
302301 // Support Android 15 page size by default, can be overridden by
303302 // passing [flags].
304- if (codeConfig.targetOS == OS .android) '-Wl,-z,max-page-size=16384' ,
305- if (codeConfig.targetOS == OS .iOS || codeConfig.targetOS == OS .macOS)
303+ if (codeConfig.targetOS == .android) '-Wl,-z,max-page-size=16384' ,
304+ if (codeConfig.targetOS == .iOS || codeConfig.targetOS == .macOS)
306305 '-Wl,-encryptable' ,
307306 ...flags,
308307 for (final MapEntry (key: name, : value) in defines.entries)
@@ -319,7 +318,7 @@ class RunCBuilder {
319318 )
320319 else
321320 ...sourceFiles,
322- if (language == Language .objectiveC) ...[
321+ if (language == .objectiveC) ...[
323322 for (final framework in frameworks) ...['-framework' , framework],
324323 ],
325324 if (executable != null ) ...[
@@ -335,7 +334,7 @@ class RunCBuilder {
335334 outFile! .toFilePath (),
336335 ],
337336 if (executable != null || dynamicLibrary != null ) ...[
338- if (codeConfig.targetOS case OS .android || OS .linux)
337+ if (codeConfig.targetOS case .android || .linux)
339338 // During bundling code assets are all placed in the same directory.
340339 // Setting this rpath allows the binary to find other code assets
341340 // it is linked against.
@@ -364,10 +363,9 @@ class RunCBuilder {
364363 final result = await runProcess (
365364 executable: tool.uri,
366365 arguments: [
367- if (optimizationLevel != OptimizationLevel .unspecified)
368- optimizationLevel.msvcFlag (),
366+ if (optimizationLevel != .unspecified) optimizationLevel.msvcFlag (),
369367 if (std != null ) '/std:$std ' ,
370- if (language == Language .cpp) '/TP' ,
368+ if (language == .cpp) '/TP' ,
371369 ...flags,
372370 for (final MapEntry (key: name, : value) in defines.entries)
373371 if (value == null ) '/D$name ' else '/D$name =$value ' ,
0 commit comments