Skip to content
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

[jnigen] standardize on using gradle to build all artifacts versus a mix of Maven and Gradle #1948

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

jwill
Copy link

@jwill jwill commented Jan 28, 2025

  • Uses gradle to build the APISummarizer (instead of Maven)
  • In runtime, builds a temporary Gradle build.gradle.kts file to download the dependencies in the maven_downloads section of jnigen.yaml (instead of Maven)
  • Adds a mechanism to locate a gradle wrapper executable to bootstrap gradle.
  • Gradle wrapper can provide the same functionality as Maven

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

jwill added 17 commits January 21, 2025 19:44
Adds ktor plugin to supply fatjars for ApiSummarizer builds
Housekeeping in ApiSummarizer build.gradle.kts
Remove dead code from build.gradle.kts for summarizer.
Dynamically creates a gradle project on the fly allowing the maven dependency to be removed when fully implemented.
Added function to create gradle dependency for given library
Change jarDir to absolute path
Dead code cleanup.
Making refs to ApiSummarizer work in pub-cache, I think.
Searches multiple locations for gradlew executable
Bump Java version to 11 from 8
Copy link

github-actions bot commented Jan 29, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
jni None 0.14.0 0.14.1 0.14.0 ✔️
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

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

Copy link
Member

@HosseinYousefi HosseinYousefi left a comment

Choose a reason for hiding this comment

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

Thank you @jwill!

Could you please completely remove MavenTools. Also package:jni uses Maven to build some dependencies for Dart-standalone. While we're at it, we could remove that one and completely get rid of any maven dependencies (The pom.xml is in jni/java. We use it in jni/bin/setup.dart).

Then let's add the changes to both CHANGELOGs and update the readme to reflect that maven is no longer a requirement.

The config can be changed not to use the word "maven" to describe downloading the dependencies, but that's a breaking change that I can do myself in a separate PR, so let's not worry about it now.

pkgs/jnigen/lib/src/summary/summary.dart Outdated Show resolved Hide resolved
pkgs/jnigen/lib/src/tools/gradle_tools.dart Outdated Show resolved Hide resolved
pkgs/jnigen/lib/src/tools/gradle_tools.dart Outdated Show resolved Hide resolved
pkgs/jnigen/java/build.gradle.kts Outdated Show resolved Hide resolved
pkgs/jnigen/lib/src/tools/build_summarizer.dart Outdated Show resolved Hide resolved
jwill added 4 commits January 29, 2025 12:45
Move MavenDependency class definition to gradle_tools.dart
Removed unused BuildSummarizer pom.xml
Updated jnigen/CHANGELOG.md
Updated jnigen/README.md
Bump jnigen version.
Remove unneeded pom.xml
@jwill
Copy link
Author

jwill commented Jan 30, 2025

The config can be changed not to use the word "maven" to describe downloading the dependencies, but that's a breaking change that I can do myself in a separate PR, so let's not worry about it now.

It's still using maven repositories so for continuity, it's probably ok to leave the name maven in the config file for clarity. The finalized system won't be using the maven executable but it will be interacting with maven repositories

@HosseinYousefi
Copy link
Member

Unfortunately the GitHub CI needs my approval to run. Can we add all users of Flutter and Dart orgs to ones who can run CI themselves? @mit-mit

That said, the tests seem to be failing. Please run dart format to fix the analyze_jnigen test as well.

@jwill
Copy link
Author

jwill commented Jan 30, 2025

Unfortunately the GitHub CI needs my approval to run. Can we add all users of Flutter and Dart orgs to ones who can run CI themselves? @mit-mit

That said, the tests seem to be failing. Please run dart format to fix the analyze_jnigen test as well.

Having CI kickoff perms would definitely help preventable problems like this one where a file excluded by .gitignore caused it to fail.

@HosseinYousefi
Copy link
Member

I can approve the CI every time you add a change, so feel free to commit the fix whenever you find time.

@HosseinYousefi
Copy link
Member

HosseinYousefi commented Feb 3, 2025

Resolved the conflicts to run the CI.

Update: There are still some analysis problems that will mostly go away with dart format/dart fixing everything.

@jwill jwill requested a review from HosseinYousefi February 5, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants