Skip to content

Commit 8227c9d

Browse files
authored
fix(cupertino_http): non-apple build (#1927)
1 parent 73b1a4c commit 8227c9d

3 files changed

Lines changed: 30 additions & 23 deletions

File tree

pkgs/cupertino_http/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
## 3.0.1-wip
1+
## 3.0.1
22

3+
* Fix a [bug](https://github.com/dart-lang/http/issues/1925) where native
4+
assets were built on non-Apple platforms.
5+
* Support the latest semver-major versions of the native assets packages.
36
* Fix some code examples.
47
* Remove `README.md` text saying that the package is a Flutter plugin.
58

pkgs/cupertino_http/hook/build.dart

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,31 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'package:code_assets/code_assets.dart';
56
import 'package:hooks/hooks.dart';
67
import 'package:logging/logging.dart';
78
import 'package:native_toolchain_c/native_toolchain_c.dart';
89

910
void main(List<String> args) async {
10-
await build(
11-
args,
12-
(input, output) async =>
13-
CBuilder.library(
14-
name: 'cupertino_http',
15-
assetName: 'src/native_cupertino_bindings.dart',
16-
sources: ['src/native_cupertino_bindings.m'],
17-
language: Language.objectiveC,
18-
flags: ['-fobjc-arc'],
19-
).run(
20-
input: input,
21-
output: output,
22-
logger: Logger('')
23-
..level = Level.ALL
24-
..onRecord.listen((record) {
25-
print('${record.level.name}: ${record.time}: ${record.message}');
26-
}),
27-
),
28-
);
11+
await build(args, (input, output) async {
12+
if (input.config.code.targetOS != OS.iOS &&
13+
input.config.code.targetOS != OS.macOS) {
14+
return;
15+
}
16+
await CBuilder.library(
17+
name: 'cupertino_http',
18+
assetName: 'src/native_cupertino_bindings.dart',
19+
sources: ['src/native_cupertino_bindings.m'],
20+
language: Language.objectiveC,
21+
flags: ['-fobjc-arc'],
22+
).run(
23+
input: input,
24+
output: output,
25+
logger: Logger('')
26+
..level = Level.ALL
27+
..onRecord.listen((record) {
28+
print('${record.level.name}: ${record.time}: ${record.message}');
29+
}),
30+
);
31+
});
2932
}

pkgs/cupertino_http/pubspec.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: cupertino_http
2-
version: 3.0.1-wip
2+
version: 3.0.1
33
description: >-
44
A macOS/iOS Flutter plugin that provides access to the Foundation URL
55
Loading System.
@@ -10,12 +10,13 @@ environment:
1010

1111
dependencies:
1212
async: ^2.5.0
13+
code_assets: ^1.0.0
1314
ffi: ^2.1.0
14-
hooks: ^1.0.2
15+
hooks: ^2.0.0
1516
http: ^1.5.0
1617
http_profile: ^0.1.0
1718
logging: ^1.3.0
18-
native_toolchain_c: ^0.17.6
19+
native_toolchain_c: ^0.19.1
1920
objective_c: ^9.1.0
2021
web_socket: '>=0.1.5 <2.0.0'
2122

0 commit comments

Comments
 (0)