Skip to content

Commit 37f1e07

Browse files
committed
Update To 3.3.0 and get FFI sample running
1 parent 5b8d25d commit 37f1e07

File tree

8 files changed

+34
-27
lines changed

8 files changed

+34
-27
lines changed

.dart_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This file contains the current Dart version we build against
2-
3.2.6
2+
3.3.0
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: worm_example
1+
name: realtime_example
22
environment:
3-
sdk: ">=3.0.0 <4.0.0"
3+
sdk: ">=3.0.0 <=3.3.0"
44

55
dependencies:
6-
ffi: ^2.0.1
6+
ffi: ^2.1.0

examples/simple_example_ffi/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ target_include_directories(simple_example_ffi PRIVATE
1111

1212
add_custom_command(TARGET simple_example_ffi POST_BUILD
1313
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:simple_example_ffi> $<TARGET_RUNTIME_DLLS:simple_example_ffi>
14+
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:simple_example_ffi> ${PROJECT_SOURCE_DIR}/hello_world_ffi.dart
15+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/.dart_tool $<TARGET_FILE_DIR:simple_example_ffi>/.dart_tool
1416
COMMAND_EXPAND_LISTS
1517
)
1618

examples/simple_example_ffi/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main() {
3434

3535
// Load your main isolate file, also providing the path to a package config if one exists.
3636
// The build makes sure these are coppied to the output directory for running the example
37-
Dart_Isolate isolate = DartDll_LoadScript("hello_world.dart", ".dart_tool/package_config.json");
37+
Dart_Isolate isolate = DartDll_LoadScript("hello_world_ffi.dart", ".dart_tool/package_config.json");
3838
if (isolate == nullptr) {
3939
return -1;
4040
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: simple_example_ffi
22
environment:
3-
sdk: ">=2.17.0 <3.0.0"
3+
sdk: ">=3.0.0 <=3.3.0"
44

55
dependencies:
6-
ffi: ^2.0.1
6+
ffi: ^2.1.0

scripts/build_helpers/bin/build_dart.dart

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ import 'package:path/path.dart' as path;
99
void main(List<String> args) async {
1010
final parser = ArgParser();
1111
parser.addFlag('verbose', abbr: 'v', help: 'enable all debug');
12-
parser.addOption('buildType',
13-
abbr: 't',
14-
help: 'build typ release or debug. all for both',
15-
allowed: ['all', 'debug', 'release']);
12+
parser.addMultiOption(
13+
'target',
14+
abbr: 't',
15+
help: 'Target to build (release or debug)',
16+
allowed: ['debug', 'release', 'all'],
17+
defaultsTo: ['release'],
18+
);
19+
parser.addFlag('help', abbr: 'h');
1620

1721
ArgResults? argResults;
1822
try {
@@ -23,6 +27,11 @@ void main(List<String> args) async {
2327
exit(-1);
2428
}
2529

30+
if (argResults['help'] == true) {
31+
print(parser.usage);
32+
return;
33+
}
34+
2635
Level logLevel = Level.info;
2736
if (argResults['verbose'] == true) {
2837
logLevel = Level.all;
@@ -32,9 +41,12 @@ void main(List<String> args) async {
3241
logLevel: logLevel,
3342
);
3443

35-
String buildType = argResults['buildType'] ?? "all";
44+
var buildTargets = argResults['target'] as List<String>;
45+
if (buildTargets.contains('all')) {
46+
buildTargets = ['debug', 'release'];
47+
}
3648

37-
BuildToolsLogger.shared.d('Build Typ $buildType');
49+
BuildToolsLogger.shared.d('Build Targets $buildTargets');
3850

3951
if (!checkRightDirectory()) {
4052
// Not run from root. Exit.
@@ -48,6 +60,10 @@ void main(List<String> args) async {
4860
'DEPOT_TOOLS_WIN_TOOOLCHAIN not set! Run ./setup_env.ps1 before running this script!');
4961
exit(-1);
5062
}
63+
final gypMsysVersion = Platform.environment['GYP_MSVS_VERSION'];
64+
final gypMsysOverridePath = Platform.environment['GYP_MSVS_OVERRIDE_PATH'];
65+
BuildToolsLogger.shared.d('GYP_MSVS_VERSION $gypMsysVersion');
66+
BuildToolsLogger.shared.d('GYP_MSVS_OVERRIDE_PATH $gypMsysOverridePath');
5167
}
5268

5369
if (!await checkForDepotTools()) {
@@ -66,19 +82,8 @@ void main(List<String> args) async {
6682
exit(-1);
6783
}
6884

69-
if (buildType == "all") {
70-
if (!await _buildDart('release')) {
71-
exit(-1);
72-
}
73-
if (!await _buildDart('debug')) {
74-
exit(-1);
75-
}
76-
} else if (buildType == "release") {
77-
if (!await _buildDart('release')) {
78-
exit(-1);
79-
}
80-
} else if (buildType == "debug") {
81-
if (!await _buildDart('debug')) {
85+
for (var target in buildTargets) {
86+
if (!await _buildDart(target)) {
8287
exit(-1);
8388
}
8489
}

scripts/build_helpers/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 1.0.0
44
publish_to: none
55

66
environment:
7-
sdk: ^3.0.6
7+
sdk: ^3.3.0
88

99
dependencies:
1010
args: ^2.4.2

0 commit comments

Comments
 (0)