Skip to content

[jni] Upgrade package:jni's ffigen #1954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 30, 2025
Merged

[jni] Upgrade package:jni's ffigen #1954

merged 10 commits into from
Jan 30, 2025

Conversation

HosseinYousefi
Copy link
Member

Cherry-picked from #1884

@HosseinYousefi HosseinYousefi changed the title Upgrade package:jni's ffigen [jni] Upgrade package:jni's ffigen Jan 30, 2025
Copy link

github-actions bot commented Jan 30, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
jni Breaking 0.13.0 0.14.0-wip 0.14.0 ✔️
API leaks ⚠️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
jni _ReferenceType
_opaque_pthread_mutex_t
_opaque_pthread_cond_t
_Dart_FinalizableHandle

This check can be disabled by tagging the PR with skip-leaking-check.

License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@coveralls
Copy link

coveralls commented Jan 30, 2025

Coverage Status

coverage: 87.372% (+0.002%) from 87.37%
when pulling b35df7c on upgrade-jni-ffigen
into fbeafe0 on main.

Copy link
Collaborator

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the pub workspace, JNIgen will always depend on the same commit, so I believe it should be a path dependency. (And we should run some sanity check on the FFIgen workflow to see that we didn't break JNIgen.)

Thanks @HosseinYousefi! 🙏

@HosseinYousefi
Copy link
Member Author

HosseinYousefi commented Jan 30, 2025

In the pub workspace, JNIgen will always depend on the same commit, so I believe it should be a path dependency.

I think I had jni as a path dev-dependency of jnigen (to use in tests) and @mosuem changed it to be a normal dependency (and added the jni path dependency as an override instead). I don't remember why this was needed but I wanted to tag him here as well.

@mosuem
Copy link
Member

mosuem commented Jan 30, 2025

In the pub workspace, JNIgen will always depend on the same commit, so I believe it should be a path dependency.

I think I had jni as a path dev-dependency of jnigen (to use in tests) and @mosuem changed it to be a normal dependency (and added the jni path dependency as an override instead). I don't remember why this was needed but I wanted to tag him here as well.

Yes, this is so that people (or in the case which triggered that, tool) which get a package from pub.dev can run it. Otherwise it is not possible to compare the API of older packages to that of the current one, as the older versions will not compile. (Workarounds through git checkouts at certain tags might be possible, but ugly)

@HosseinYousefi
Copy link
Member Author

In the pub workspace, JNIgen will always depend on the same commit, so I believe it should be a path dependency.

I think I had jni as a path dev-dependency of jnigen (to use in tests) and @mosuem changed it to be a normal dependency (and added the jni path dependency as an override instead). I don't remember why this was needed but I wanted to tag him here as well.

Yes, this is so that people (or in the case which triggered that, tool) which get a package from pub.dev can run it. Otherwise it is not possible to compare the API of older packages to that of the current one, as the older versions will not compile. (Workarounds through git checkouts at certain tags might be possible, but ugly)

A dev dependency should technically not stop compilation, however there are currently no way to only fetch deps (dart-lang/pub#2036)

Any tool could modify the pubspec to remove dev deps altogether before running though.

@github-actions github-actions bot added type-infra A repository infrastructure change or enhancement and removed package:ffigen package:ffi labels Jan 30, 2025
@mosuem
Copy link
Member

mosuem commented Jan 30, 2025

Any tool could modify the pubspec to remove dev deps altogether before running though.

Or we can have a valid pubspec to begin with ;)

@HosseinYousefi
Copy link
Member Author

Any tool could modify the pubspec to remove dev deps altogether before running though.

Or we can have a valid pubspec to begin with ;)

It IS a valid pubspec :) dev-deps will not be included in the runtime of the package.

@HosseinYousefi
Copy link
Member Author

The failed test is not due to the current change. Merging...

@HosseinYousefi HosseinYousefi merged commit cf5b631 into main Jan 30, 2025
33 of 34 checks passed
@HosseinYousefi HosseinYousefi deleted the upgrade-jni-ffigen branch January 30, 2025 16:39
@dcharkes
Copy link
Collaborator

In the pub workspace, JNIgen will always depend on the same commit, so I believe it should be a path dependency.

I think I had jni as a path dev-dependency of jnigen (to use in tests) and @mosuem changed it to be a normal dependency (and added the jni path dependency as an override instead). I don't remember why this was needed but I wanted to tag him here as well.

Yes, this is so that people (or in the case which triggered that, tool) which get a package from pub.dev can run it. Otherwise it is not possible to compare the API of older packages to that of the current one, as the older versions will not compile. (Workarounds through git checkouts at certain tags might be possible, but ugly)

Ah, when we flip to a pub workspace, this should actually be solved right. (We need to flip the path dependencies to published dependencies in the native_xxx packages as well in order to be able to publish. Then within the workspace it should work as a path dependency, but if you simply pub-get JNIgen you'd pull in the FFIgen from pub. So this is something we can only do once we actually convert this repo to a workspace. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:jni skip-changelog-check type-infra A repository infrastructure change or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants