Skip to content

Commit 8454e25

Browse files
authored
[objective_c] feat: Add minimum OS version flags to build script (dart-lang#3016)
1 parent 0a37fd3 commit 8454e25

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

‎pkgs/objective_c/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 9.2.5
2+
- Fix a [bug](https://github.com/dart-lang/native/issues/3011) by adding
3+
minimum OS version flags to the build script.
4+
15
## 9.2.4
26

37
- Fix a [bug](https://github.com/dart-lang/native/issues/2990) build hook path

‎pkgs/objective_c/hook/build.dart‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ void main(List<String> args) async {
6969
}
7070

7171
final sysroot = sdkPath(codeConfig);
72-
final cFlags = <String>['-isysroot', sysroot, '-target', target];
72+
final minVersion = minOSVersion(codeConfig);
73+
final cFlags = <String>[
74+
'-isysroot',
75+
sysroot,
76+
'-target',
77+
target,
78+
minVersion,
79+
];
7380
final mFlags = [...cFlags, ...objCFlags];
7481
final linkFlags = cFlags;
7582

@@ -174,6 +181,16 @@ String firstLineOfStdout(String cmd, List<String> args) {
174181
.first;
175182
}
176183

184+
String minOSVersion(CodeConfig codeConfig) {
185+
if (codeConfig.targetOS == OS.iOS) {
186+
final targetVersion = codeConfig.iOS.targetVersion;
187+
return '-mios-version-min=$targetVersion';
188+
}
189+
assert(codeConfig.targetOS == OS.macOS);
190+
final targetVersion = codeConfig.macOS.targetVersion;
191+
return '-mmacos-version-min=$targetVersion';
192+
}
193+
177194
String toTargetTriple(CodeConfig codeConfig) {
178195
final architecture = codeConfig.targetArchitecture;
179196
if (codeConfig.targetOS == OS.iOS) {

‎pkgs/objective_c/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
name: objective_c
66
description: 'A library to access Objective C from Flutter that acts as a support library for package:ffigen.'
7-
version: 9.2.4
7+
version: 9.2.5-wip
88
repository: https://github.com/dart-lang/native/tree/main/pkgs/objective_c
99
issue_tracker: https://github.com/dart-lang/native/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aobjective_c
1010

0 commit comments

Comments
 (0)