|
8 | 8 | }) |
9 | 9 | library; |
10 | 10 |
|
| 11 | +import 'dart:convert'; |
11 | 12 | import 'dart:io'; |
12 | 13 |
|
13 | 14 | import 'package:native_assets_cli/native_assets_cli_internal.dart'; |
@@ -35,29 +36,29 @@ void main() async { |
35 | 36 | final testPackageUri = packageUri.resolve('example/build/$name/'); |
36 | 37 | final dartUri = Uri.file(Platform.resolvedExecutable); |
37 | 38 |
|
| 39 | + final config = BuildConfigImpl( |
| 40 | + outputDirectory: tempUri, |
| 41 | + packageName: name, |
| 42 | + packageRoot: testPackageUri, |
| 43 | + targetOS: OSImpl.current, |
| 44 | + version: HookConfigImpl.latestVersion, |
| 45 | + linkModePreference: LinkModePreferenceImpl.dynamic, |
| 46 | + dryRun: dryRun, |
| 47 | + linkingEnabled: false, |
| 48 | + targetArchitecture: dryRun ? null : ArchitectureImpl.current, |
| 49 | + buildMode: dryRun ? null : BuildModeImpl.debug, |
| 50 | + cCompiler: dryRun ? null : cCompiler, |
| 51 | + ); |
| 52 | + |
| 53 | + final buildConfigUri = testTempUri.resolve('build_config.json'); |
| 54 | + await File.fromUri(buildConfigUri) |
| 55 | + .writeAsString(jsonEncode(config.toJson())); |
| 56 | + |
38 | 57 | final processResult = await Process.run( |
39 | 58 | dartUri.toFilePath(), |
40 | 59 | [ |
41 | 60 | 'hook/build.dart', |
42 | | - '-Dout_dir=${tempUri.toFilePath()}', |
43 | | - '-Dpackage_name=$name', |
44 | | - '-Dpackage_root=${testPackageUri.toFilePath()}', |
45 | | - '-Dtarget_os=${OSImpl.current}', |
46 | | - '-Dversion=${HookConfigImpl.latestVersion}', |
47 | | - '-Dlinking_enabled=0', |
48 | | - '-Dlink_mode_preference=dynamic', |
49 | | - '-Ddry_run=$dryRun', |
50 | | - if (!dryRun) ...[ |
51 | | - '-Dtarget_architecture=${ArchitectureImpl.current}', |
52 | | - '-Dbuild_mode=debug', |
53 | | - if (cc != null) '-Dcc=${cc!.toFilePath()}', |
54 | | - if (envScript != null) |
55 | | - '-D${CCompilerConfigImpl.envScriptConfigKeyFull}=' |
56 | | - '${envScript!.toFilePath()}', |
57 | | - if (envScriptArgs != null) |
58 | | - '-D${CCompilerConfigImpl.envScriptArgsConfigKeyFull}=' |
59 | | - '${envScriptArgs!.join(' ')}', |
60 | | - ], |
| 61 | + '--config=${buildConfigUri.toFilePath()}', |
61 | 62 | ], |
62 | 63 | workingDirectory: testPackageUri.toFilePath(), |
63 | 64 | ); |
|
0 commit comments