fix build hook
This commit is contained in:
parent
33239c02c0
commit
5fe22867f8
1 changed files with 22 additions and 5 deletions
|
|
@ -1,17 +1,34 @@
|
|||
import "dart:io";
|
||||
import "package:hooks/hooks.dart";
|
||||
import "package:code_assets/code_assets.dart";
|
||||
import "package:path/path.dart";
|
||||
import "package:ffigen/ffigen.dart";
|
||||
|
||||
Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||
final targetOS = input.config.code.targetOS;
|
||||
String libFileName;
|
||||
switch (targetOS) {
|
||||
case OS.linux:
|
||||
libFileName = "libgomuks.so";
|
||||
break;
|
||||
case OS.macOS:
|
||||
libFileName = "libgomuks.dylib";
|
||||
break;
|
||||
case OS.windows:
|
||||
libFileName = "libgomuks.dll";
|
||||
break;
|
||||
default:
|
||||
throw UnsupportedError("Unsupported OS: $targetOS");
|
||||
}
|
||||
|
||||
final generatedFile = join("src", "third_party", "gomuks.g.dart");
|
||||
output.assets.code.add(
|
||||
CodeAsset(
|
||||
package: "nexus",
|
||||
name: "src/third_party/gomuks.g.dart",
|
||||
name: generatedFile,
|
||||
linkMode: DynamicLoadingBundled(),
|
||||
file: libFile.uri,
|
||||
file: input.packageRoot.resolve(join("build", "gomuks", libFileName)),
|
||||
),
|
||||
);
|
||||
output.dependencies.add(libFile.uri);
|
||||
output.dependencies.add(
|
||||
input.packageRoot.resolve(join("lib", generatedFile)),
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue