Skip to content

Commit eff7d08

Browse files
committed
nits
1 parent 812c750 commit eff7d08

9 files changed

Lines changed: 94 additions & 30 deletions

File tree

packages/pigeon/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## 26.4.0
22

33
* [swift] [kotlin] Adds support for FFI and JNI.
4-
* Expose missing PigeonOptions and language-specific configurations as command-line arguments.
4+
* Exposes missing PigeonOptions and language-specific configurations as command-line arguments.
55

66
## 26.3.4
77

packages/pigeon/pigeons/ni_tests.dart

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,32 +1413,6 @@ abstract class NIHostIntegrationCoreApi {
14131413
bool callFlutterNoopOnBackgroundThread();
14141414
}
14151415

1416-
/// An API that can be implemented for minimal, compile-only tests.
1417-
//
1418-
// This is also here to test that multiple host APIs can be generated
1419-
// successfully in all languages (e.g., in Java where it requires having a
1420-
// wrapper class).
1421-
// @HostApi()
1422-
// abstract class NIHostTrivialApi {
1423-
// void noop();
1424-
// }
1425-
1426-
/// A simple API implemented in some unit tests.
1427-
//
1428-
// This is separate from NIHostIntegrationCoreApi to avoid having to update a
1429-
// lot of unit tests every time we add something to the integration test API.
1430-
// TODO(stuartmorgan): Restructure the unit tests to reduce the number of
1431-
// different APIs we define.
1432-
// @HostApi()
1433-
// abstract class NIHostSmallApi {
1434-
// @async
1435-
// @ObjCSelector('echoString:')
1436-
// String echo(String aString);
1437-
1438-
// @async
1439-
// void voidVoid();
1440-
// }
1441-
14421416
/// The core interface that the Dart platform_test code implements for host
14431417
/// integration tests to call into.
14441418
@FlutterApi()

packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/ni_tests.gen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11489,6 +11489,7 @@ class NIHostIntegrationCoreApi {
1148911489
return pigeonVar_replyValue! as NIAllNullableTypes;
1149011490
}
1149111491

11492+
/// Returns passed in arguments of multiple types.
1149211493
Future<NIAllNullableTypesWithoutRecursion>
1149311494
sendMultipleNullableTypesWithoutRecursion(
1149411495
bool? aNullableBool,

packages/pigeon/platform_tests/shared_test_plugin_code/lib/src/generated/ni_tests.gen.ffi.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22773,7 +22773,7 @@ extension NIHostIntegrationCoreApiSetup$Methods
2277322773
);
2277422774
}
2277522775

22776-
/// sendMultipleNullableTypesWithoutRecursionWithANullableBool:aNullableInt:aNullableString:wrappedError:
22776+
/// Returns passed in arguments of multiple types.
2277722777
///
2277822778
/// iOS: introduced 13.0.0
2277922779
/// macOS: introduced 10.15.0

packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/NiTests.gen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ abstract class NIHostIntegrationCoreApi {
11301130
aNullableInt: Long?,
11311131
aNullableString: String?
11321132
): NIAllNullableTypes
1133-
1133+
/** Returns passed in arguments of multiple types. */
11341134
abstract fun sendMultipleNullableTypesWithoutRecursion(
11351135
aNullableBool: Boolean?,
11361136
aNullableInt: Long?,
@@ -2101,7 +2101,7 @@ class NIHostIntegrationCoreApiRegistrar : NIHostIntegrationCoreApi() {
21012101
}
21022102
error("NIHostIntegrationCoreApi has not been set")
21032103
}
2104-
2104+
/** Returns passed in arguments of multiple types. */
21052105
override fun sendMultipleNullableTypesWithoutRecursion(
21062106
aNullableBool: Boolean?,
21072107
aNullableInt: Long?,

packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin/NiTests.gen.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,7 @@ protocol NIHostIntegrationCoreApi {
20512051
func sendMultipleNullableTypes(
20522052
aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?
20532053
) throws -> NIAllNullableTypes
2054+
/// Returns passed in arguments of multiple types.
20542055
func sendMultipleNullableTypesWithoutRecursion(
20552056
aBool aNullableBool: Bool?, anInt aNullableInt: Int64?, aString aNullableString: String?
20562057
) throws -> NIAllNullableTypesWithoutRecursion
@@ -3117,6 +3118,7 @@ protocol NIHostIntegrationCoreApi {
31173118
}
31183119
return nil
31193120
}
3121+
/// Returns passed in arguments of multiple types.
31203122
@objc func sendMultipleNullableTypesWithoutRecursion(
31213123
aNullableBool: NSNumber?, aNullableInt: NSNumber?, aNullableString: NSString?,
31223124
wrappedError: NiTestsError

packages/pigeon/platform_tests/test_plugin/darwin/test_plugin/Sources/test_plugin_objc/test_plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ SWIFT_AVAILABILITY(macos, introduced = 10.15)
14791479
wrappedError:
14801480
(NiTestsError* _Nonnull)wrappedError
14811481
SWIFT_WARN_UNUSED_RESULT;
1482+
/// Returns passed in arguments of multiple types.
14821483
- (NIAllNullableTypesWithoutRecursionBridge* _Nullable)
14831484
sendMultipleNullableTypesWithoutRecursionWithANullableBool:
14841485
(NSNumber* _Nullable)aNullableBool

packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle.kts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,89 @@ android {
4040
flutter {
4141
source = "../.."
4242
}
43+
// Gradle stub for listing dependencies in JNIgen. If found in
44+
// android/build.gradle.kts, please delete the following task.
45+
tasks.register<DefaultTask>("getReleaseCompileClasspath") {
46+
// Tell Gradle to complete the configuration phase of all subprojects (eg
47+
// Flutter plugins) before continuing configuration of this project.
48+
allprojects {
49+
if (this != rootProject) {
50+
evaluationDependsOn(path)
51+
}
52+
}
53+
54+
// Fetch all the dependencies and extract the JARs.
55+
allprojects {
56+
val config = configurations.findByName("releaseCompileClasspath") ?: return@allprojects
57+
try {
58+
// Find all JARs.
59+
val jarView = config.incoming.artifactView {
60+
attributes {
61+
attribute(org.gradle.api.attributes.Attribute.of("artifactType", String::class.java), "jar")
62+
}
63+
lenient(true)
64+
}
65+
inputs.files(jarView.files)
66+
67+
// Also find all JARs stored in AARs.
68+
val aarView = config.incoming.artifactView {
69+
attributes {
70+
attribute(org.gradle.api.attributes.Attribute.of("artifactType", String::class.java), "android-classes-jar")
71+
}
72+
lenient(true)
73+
}
74+
inputs.files(aarView.files)
75+
} catch (e: Exception) {}
76+
}
77+
78+
// Find all the JARs and print their paths.
79+
doLast {
80+
try {
81+
val cp = mutableListOf<File>()
82+
83+
// JNIgen uses the first version of a class it finds, so the order we list
84+
// the JARs in is important.
85+
val mainProject = allprojects.find { project ->
86+
project.plugins.hasPlugin("com.android.application")
87+
} ?: project
88+
89+
// Start with the android bootClasspath. This contains things like java.*
90+
// and android.*.
91+
val android = mainProject.extensions.findByName("android") as? com.android.build.gradle.BaseExtension
92+
android?.bootClasspath?.let { file -> cp.addAll(file) }
93+
94+
// Next, add the main project's JARs, followed by all the other project's
95+
// JARs.
96+
val projects = (listOf(mainProject) + allprojects).distinct()
97+
projects.forEach { project ->
98+
val config = project.configurations.findByName("releaseCompileClasspath") ?: return@forEach
99+
try {
100+
// Add all JARs.
101+
cp.addAll(config.incoming.artifactView {
102+
attributes {
103+
attribute(org.gradle.api.attributes.Attribute.of("artifactType", String::class.java), "jar")
104+
}
105+
lenient(true)
106+
}.files)
107+
108+
// Add all JARs that were contained in AARs.
109+
cp.addAll(config.incoming.artifactView {
110+
attributes {
111+
attribute(org.gradle.api.attributes.Attribute.of("artifactType", String::class.java), "android-classes-jar")
112+
}
113+
lenient(true)
114+
}.files)
115+
} catch (e: Exception) {}
116+
}
117+
118+
// Dedupe and print the absolute paths to all the JARs.
119+
cp.map { file -> file.absolutePath }.distinct().forEach {
120+
path -> println(path)
121+
}
122+
} catch (e: Exception) {
123+
System.err.println("Gradle stub cannot find JAR libraries.")
124+
throw e
125+
}
126+
}
127+
System.err.println("If you are seeing this error in `flutter build` output, it is likely that JNIgen left some stubs in the build.gradle file. Please restore that file from your version control system or manually remove the stub functions named getReleaseCompileClasspath and / or getSources.")
128+
}

0 commit comments

Comments
 (0)