Skip to content

Commit d8ec02c

Browse files
committed
fixed the CI Issue
1 parent fa2c381 commit d8ec02c

117 files changed

Lines changed: 70479 additions & 50212 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pkgs/hooks_runner/lib/src/build_runner/build_planner.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ class PackageGraph {
332332
/// compilation. This enum holds static information about these hooks.
333333
enum Hook {
334334
link('link'),
335-
build('build');
335+
build('build')
336+
;
336337

337338
final String _scriptName;
338339

pkgs/jni/bin/setup.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ Future<void> runCommand(
7979

8080
class Options {
8181
Options(ArgResults arg)
82-
: buildPath = arg[_buildPath] as String?,
83-
sources = arg[_srcPath] as List<String>,
84-
packages = arg[_packageName] as List<String>,
85-
cmakeArgs = arg[_cmakeArgs] as List<String>,
86-
verbose = (arg[_verbose] as bool?) ?? false;
82+
: buildPath = arg[_buildPath] as String?,
83+
sources = arg[_srcPath] as List<String>,
84+
packages = arg[_packageName] as List<String>,
85+
cmakeArgs = arg[_cmakeArgs] as List<String>,
86+
verbose = (arg[_verbose] as bool?) ?? false;
8787

8888
String? buildPath;
8989
List<String> sources;
@@ -165,7 +165,8 @@ void main(List<String> arguments) async {
165165
..addMultiOption(
166166
_packageName,
167167
abbr: 'p',
168-
help: 'package for which native'
168+
help:
169+
'package for which native'
169170
'library should be built',
170171
)
171172
..addFlag(_verbose, abbr: 'v', help: 'Enable verbose output')
@@ -208,7 +209,8 @@ void main(List<String> arguments) async {
208209
}
209210

210211
final currentDirUri = Uri.directory('.');
211-
final buildPath = options.buildPath ??
212+
final buildPath =
213+
options.buildPath ??
212214
currentDirUri.resolve(_defaultRelativeBuildPath).toFilePath();
213215
final buildDir = Directory(buildPath);
214216
await buildDir.create(recursive: true);
@@ -230,13 +232,10 @@ void main(List<String> arguments) async {
230232
stderr.writeln('Target newer than source, skipping build.');
231233
} else {
232234
verboseLog('Running gradle task for building jni sources to $buildPath.');
233-
await runCommand(
234-
gradleWExecutable.toFilePath(windows: isWin),
235-
[
236-
'jar',
237-
'-Pjni.targetDir=${buildDir.absolute.uri.toFilePath(windows: isWin)}',
238-
],
239-
await findSources('jni', 'java'));
235+
await runCommand(gradleWExecutable.toFilePath(windows: isWin), [
236+
'jar',
237+
'-Pjni.targetDir=${buildDir.absolute.uri.toFilePath(windows: isWin)}',
238+
], await findSources('jni', 'java'));
240239
}
241240

242241
for (var srcPath in sources) {
@@ -278,16 +277,17 @@ void main(List<String> arguments) async {
278277
cmakeArgs.add(srcDir.absolute.path);
279278
await runCommand('cmake', cmakeArgs, tempDir.path);
280279
await runCommand('cmake', ['--build', '.'], tempDir.path);
281-
final dllDirUri =
282-
Platform.isWindows ? tempDir.uri.resolve('Debug') : tempDir.uri;
280+
final dllDirUri = Platform.isWindows
281+
? tempDir.uri.resolve('Debug')
282+
: tempDir.uri;
283283
final dllDir = Directory.fromUri(dllDirUri);
284284
for (var entry in dllDir.listSync()) {
285285
verboseLog(entry.toString());
286286
final dllSuffix = Platform.isWindows
287287
? 'dll'
288288
: Platform.isMacOS
289-
? 'dylib'
290-
: 'so';
289+
? 'dylib'
290+
: 'so';
291291
if (entry.path.endsWith(dllSuffix)) {
292292
final dllName = entry.uri.pathSegments.last;
293293
final target = buildDir.uri.resolve(dllName);

pkgs/jni/example/integration_test/on_device_jni_test.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ import '../../test/boxed_test.dart' as boxed_test;
1616
import '../../test/load_test.dart' as load_test;
1717
import '../../test/isolate_test.dart' as isolate_test;
1818

19-
void integrationTestRunner(String description, void Function() testCallback,
20-
{Object? skip}) {
21-
testWidgets(description, (_) async => testCallback(),
22-
skip: skip != null && skip != false);
19+
void integrationTestRunner(
20+
String description,
21+
void Function() testCallback, {
22+
Object? skip,
23+
}) {
24+
testWidgets(
25+
description,
26+
(_) async => testCallback(),
27+
skip: skip != null && skip != false,
28+
);
2329
}
2430

2531
void main() {

pkgs/jni/example/lib/main.dart

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import 'package:jni_flutter/jni_flutter.dart';
1111

1212
double randomDouble() {
1313
final math = JClass.forName("java/lang/Math");
14-
final random =
15-
math.staticMethodId("random", "()D").call(math, jdouble.type, []);
14+
final random = math
15+
.staticMethodId("random", "()D")
16+
.call(math, jdouble.type, []);
1617
math.release();
1718
return random;
1819
}
@@ -43,13 +44,15 @@ void quit() {
4344
void showToast(String text) {
4445
final activity = androidActivity(PlatformDispatcher.instance.engineId!);
4546
if (activity == null) return;
46-
final toasterClass =
47-
JClass.forName('com/github/dart_lang/jni_example/Toaster');
47+
final toasterClass = JClass.forName(
48+
'com/github/dart_lang/jni_example/Toaster',
49+
);
4850
final makeText = toasterClass.staticMethodId(
49-
'makeText',
50-
'(Landroid/app/Activity;Landroid/content/Context;'
51-
'Ljava/lang/CharSequence;I)'
52-
'Lcom/github/dart_lang/jni_example/Toaster;');
51+
'makeText',
52+
'(Landroid/app/Activity;Landroid/content/Context;'
53+
'Ljava/lang/CharSequence;I)'
54+
'Lcom/github/dart_lang/jni_example/Toaster;',
55+
);
5356
final applicationContext = androidApplicationContext;
5457
final toaster = makeText(toasterClass, JObject.type, [
5558
activity,
@@ -73,8 +76,10 @@ void main() {
7376
final examples = [
7477
Example("Math.random()", () => randomDouble(), runInitially: false),
7578
if (Platform.isAndroid) ...[
76-
Example("Minutes of usage since reboot",
77-
() => (uptime() / (60 * 1000)).floor()),
79+
Example(
80+
"Minutes of usage since reboot",
81+
() => (uptime() / (60 * 1000)).floor(),
82+
),
7883
Example("Back and forth string conversion", () => backAndForth()),
7984
Example("Device name", () {
8085
final buildClass = JClass.forName("android/os/Build");
@@ -83,30 +88,22 @@ void main() {
8388
.get(buildClass, JString.type)
8489
.toDartString(releaseOriginal: true);
8590
}),
86-
Example(
87-
"Package name",
88-
() {
89-
final activity =
90-
androidActivity(PlatformDispatcher.instance.engineId!);
91-
if (activity == null) return "Activity not available";
92-
final packageName = activity.jClass
93-
.instanceMethodId("getPackageName", "()Ljava/lang/String;")
94-
.call(activity, JString.type, []);
95-
activity.release();
96-
return packageName;
97-
},
98-
),
91+
Example("Package name", () {
92+
final activity = androidActivity(PlatformDispatcher.instance.engineId!);
93+
if (activity == null) return "Activity not available";
94+
final packageName = activity.jClass
95+
.instanceMethodId("getPackageName", "()Ljava/lang/String;")
96+
.call(activity, JString.type, []);
97+
activity.release();
98+
return packageName;
99+
}),
99100
Example(
100101
"Show toast",
101102
() => showToast("Hello from JNI!"),
102103
runInitially: false,
103104
),
104-
Example(
105-
"Quit",
106-
quit,
107-
runInitially: false,
108-
),
109-
]
105+
Example("Quit", quit, runInitially: false),
106+
],
110107
];
111108
runApp(MyApp(examples));
112109
}
@@ -126,9 +123,7 @@ class MyApp extends StatelessWidget {
126123
Widget build(BuildContext context) {
127124
return MaterialApp(
128125
home: Scaffold(
129-
appBar: AppBar(
130-
title: const Text('JNI Examples'),
131-
),
126+
appBar: AppBar(title: const Text('JNI Examples')),
132127
body: ListView.builder(
133128
itemCount: examples.length,
134129
itemBuilder: (context, i) {
@@ -152,7 +147,9 @@ class ExampleCard extends StatefulWidget {
152147
class _ExampleCardState extends State<ExampleCard> {
153148
Widget _pad(Widget w, double h, double v) {
154149
return Padding(
155-
padding: EdgeInsets.symmetric(horizontal: h, vertical: v), child: w);
150+
padding: EdgeInsets.symmetric(horizontal: h, vertical: v),
151+
child: w,
152+
);
156153
}
157154

158155
bool _run = false;
@@ -184,20 +181,29 @@ class _ExampleCardState extends State<ExampleCard> {
184181
resultStyle = const TextStyle(fontFamily: "Monospace", color: Colors.red);
185182
}
186183
return Card(
187-
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
188-
Text(eg.title,
184+
child: Column(
185+
crossAxisAlignment: CrossAxisAlignment.start,
186+
children: [
187+
Text(
188+
eg.title,
189189
softWrap: true,
190-
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
191-
_pad(
192-
Text(result.toString(), softWrap: true, style: resultStyle), 8, 16),
193-
_pad(
190+
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
191+
),
192+
_pad(
193+
Text(result.toString(), softWrap: true, style: resultStyle),
194+
8,
195+
16,
196+
),
197+
_pad(
194198
ElevatedButton(
195199
child: Text(_run ? "Run again" : "Run"),
196200
onPressed: () => setState(() => _run = true),
197201
),
198202
8,
199-
8),
200-
]),
203+
8,
204+
),
205+
],
206+
),
201207
);
202208
}
203209
}

0 commit comments

Comments
 (0)