Closed JakeWharton closed 1 week ago
@JakeWharton, thanks for reporting the issue!
With native targets (points 1 and 2), there's a bug related to how we mitigate failures related to Apple targets being unavailable on Linux & Windows.
As a workaround, apiValidation.klib.strictValidation = true
will fail the apiCheck
, but with not a very meaningful message (missing targets need to be included there, in the message I mean).
As of an Android target removal, the task responsible for dump comparison (jvmApiCheck
) traverses a file tree rooted by the api
directory until it finds a file with an appropriate name (for example, redwood-protocol-guest.api
).
So it finds either of {android,jvm}/*.api
files and validates the generated dump against it.
I don't think it was implemented that way intentionally.
For Klibs, the logic of target filtration should be inverted to exclude all unsupported targets (among those defined in a project) instead of leaving all supported targets (which does not include targets removed since the golden dump was created).
As a workaround,
apiValidation.klib.strictValidation = true
will fail theapiCheck
, but with not a very meaningful message (missing targets need to be included there, in the message I mean).
Ah, nice. Thanks! For now I enabled this only on CI where we're always on a Mac. The message is not great, like you said, but it should be extremely rare (and it's probably only me making the changes).
Adding the actual missing targets to the message would be a nice improvement. And I'm not sure whether it's worth the code to disambiguate between targets that are unavailable on the host OS, or those which are available but have been removed, but that also would be nice.
I removed a bunch of multiplatform targets in https://github.com/cashapp/redwood/pull/2070 but made no actual API changes.
There were three types of removals:
In all three cases the
apiCheck
task did not fail despite runningapiDump
producing significant changes to the API files (as seen in https://github.com/cashapp/redwood/pull/2077).Points 1 and 2 are similar, both being cases of the targets in the API file being now incorrect. Point 3 is interesting because the API files in
android/
andjvm/
were now dead and the API file in the root was missing.I would have hoped all three cases to be detected, fail the build, and require an
apiDump
to update the files.