@@ -8,58 +8,62 @@ import 'package:logger/logger.dart';
88import 'package:path/path.dart' as path;
99
1010void main () {
11- if (! checkRightDirectory ()) {
12- // Not run from root. Exit.
13- exit (- 1 );
14- }
15- // Always verbose
16- BuildToolsLogger .initLogger (logLevel: Level .debug);
17-
18- final dest = Directory ('artifacts' );
19- dest.createSync ();
20- _copyIncludeFiles (dest);
21- _copyLibs (dest);
11+ if (! checkRightDirectory ()) {
12+ // Not run from root. Exit.
13+ exit (- 1 );
14+ }
15+ // Always verbose
16+ BuildToolsLogger .initLogger (logLevel: Level .debug);
17+
18+ final dest = Directory ('artifacts' );
19+ dest.createSync ();
20+ _copyIncludeFiles (dest);
21+ _copyLibs (dest);
2222}
2323
2424void _copyIncludeFiles (Directory dest) {
25- final logger = BuildToolsLogger .shared;
25+ final logger = BuildToolsLogger .shared;
2626
27- final includePath = Directory ('dart-sdk/sdk/runtime/include' );
28- if (! includePath.existsSync ()) {
29- logger.f ("Couldn't find Dart SDK include dir." );
30- exit (- 1 );
31- }
27+ final includePath = Directory ('dart-sdk/sdk/runtime/include' );
28+ if (! includePath.existsSync ()) {
29+ logger.f ("Couldn't find Dart SDK include dir." );
30+ exit (- 1 );
31+ }
3232
33- const dartIncludeFiles = ['dart_api.h' , 'dart_tools_api.h' ];
34- Directory (path.join (dest.path, 'include' )).createSync (recursive: true );
35- for (var dartIncludeFile in dartIncludeFiles) {
36- final file = File (path.join (includePath.path, dartIncludeFile));
37- file.copySync (path.join (dest.path, 'include' , dartIncludeFile));
38- }
33+ const dartIncludeFiles = ['dart_api.h' , 'dart_tools_api.h' ];
34+ Directory (path.join (dest.path, 'include' )).createSync (recursive: true );
35+ for (var dartIncludeFile in dartIncludeFiles) {
36+ final file = File (path.join (includePath.path, dartIncludeFile));
37+ final destPath = path.join (dest.path, 'include' , dartIncludeFile);
38+ logger.i (' ${file .path } => $destPath ' );
39+ file.copySync (destPath);
40+ }
3941
40- final dartDllHeader = File ('src/dart_dll.h' );
41- dartDllHeader.copySync (path.join (dest.path, 'include' , 'dart_dll.h' ));
42+ final dartDllHeader = File ('src/dart_dll.h' );
43+ dartDllHeader.copySync (path.join (dest.path, 'include' , 'dart_dll.h' ));
4244}
4345
4446void _copyLibs (Directory dest) {
45- final logger = BuildToolsLogger .shared;
47+ final logger = BuildToolsLogger .shared;
48+
49+ final builtLibPath = Directory (path.join ('build' , 'src' ));
50+ if (! builtLibPath.existsSync ()) {
51+ logger.f ('Could not find built artifact path' );
52+ }
4653
47- final builtLibPath = Directory ('build/src' );
48- if (! builtLibPath.existsSync ()) {
49- logger.f ('Could not find built artifact path' );
50- }
51-
52- final binDestPath = Directory (path.join (dest.path, 'bin' ));
53- binDestPath.createSync (recursive: true );
54+ final binDestPath = Directory (path.join (dest.path, 'bin' ));
55+ binDestPath.createSync (recursive: true );
5456
55- var copyGlob = Glob ('*.so' );
56- if (Platform .isWindows) {
57- copyGlob = Glob (path.join ('Release' , '*.*' ));
58- } else if (Platform .isMacOS) {
59- copyGlob = Glob ('*.dylib' );
60- }
61- final files = copyGlob.listSync (root: builtLibPath.path);
62- for (var file in files) {
63- (file as File ).copySync (path.join (binDestPath.path, file.basename));
64- }
65- }
57+ var copyGlob = Glob ('*.so' );
58+ if (Platform .isWindows) {
59+ copyGlob = Glob (r'Release/*.*' , caseSensitive: false );
60+ } else if (Platform .isMacOS) {
61+ copyGlob = Glob ('*.dylib' );
62+ }
63+ final files = copyGlob.listSync (root: builtLibPath.path);
64+ for (var file in files) {
65+ final destPath = path.join (binDestPath.path, file.basename);
66+ logger.i (' ${file .path } => $destPath ' );
67+ (file as File ).copySync (destPath);
68+ }
69+ }
0 commit comments