-
Notifications
You must be signed in to change notification settings - Fork 13
Convert Gradle script plugin for generating UniFfi bindings into a composite build. #72
Convert Gradle script plugin for generating UniFfi bindings into a composite build. #72
Conversation
Very neat. Will review later today but I think this is a great step forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. 🔥 I really enjoy digging into Gradle, and I had not really looked into how to make our plugins into their own standalone projects. Thanks for showing us how it's done!
My only comment slash small nit is that I think we should keep the style consistent and apply 4 spaces for the indents in the build.gradle.kts
and the settings.gradle.kts
files. Otherwise this is good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK cc20cf6
Looks good!
@kirillzh I can't seem to push the small fix for the indentation to your branch. Do you mind adding it yourself? I'll merge this right after. It's basically just using 4 spaces indent for the |
@thunderbiscuit, reformatted |
The CI is failing with this error: Compiling bdk-ffi-bindgen v0.2.0 (/home/runner/work/bdk-kotlin/bdk-kotlin/bdk-ffi/bdk-ffi-bindgen)
error: linker `aarch64-linux-android21-clang` not found
|
= note: No such file or directory (os error 2)
error: could not compile `bdk-ffi-bindgen` due to previous error
warning: build failed, waiting for other jobs to finish...
> Task :android:buildAndroidAarch64Binary FAILED
error: could not compile `bdk-ffi` due to previous error I will investigate tomorrow. |
Potentially coming from GitHub migrating the NDK to version 25 (see announcement here: actions/runner-images#5930). |
I managed to fix the CI. Will open the PR tomorrow, and then we can finally merge this thing! |
This time around the error is * Where:
Build file '/home/runner/work/bdk-kotlin/bdk-kotlin/plugins/build.gradle.kts' line: 1
* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '2.1.7'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:2.1.7')
Searched in the following repositories:
Gradle Central Plugin Repository |
Not sure where the decision to pull this particular version of the plugin is made... do you mind trying to set the version explicitly? plugins {
id("java-gradle-plugin")
`kotlin-dsl` version "2.4.1"
// id("org.gradle.kotlin.kotlin-dsl") version "2.4.1"
} Although version |
plugins/settings.gradle.kts
Outdated
repositories { | ||
mavenCentral() | ||
google() | ||
gradlePluginPortal() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '2.1.7'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:2.1.7')
Searched in the following repositories:
Gradle Central Plugin Repository
@thunderbiscuit, adding gradlePluginPortal()
repository here should fix the problem, though not entirely sure why 😅
Usually, plugins
adds Gradle plugin repository implicitly so adding this explicitly should not be necessary 🤔 🤷🏻♂️
By default, the plugins {} DSL resolves plugins from the public Gradle Plugin Portal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, looks like Gradle plugin repository was down yesterday, so gradlePluginPortal()
is in fact not necessary here, removing gradlePluginPortal()
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReAck 989b733
Looks ready, @thunderbiscuit or I will merge tomorrow if no objections
Description
buildSrc
has a major drawback of invalidating entire project's cache after a chance in thebuildSrc
itself. This is a probably not a big issue for the project of this size, but a way to fix this is to implement plugin as a standalone, composite build, which also happens to be a more idiomatic way of implementing plugins.Notes to the reviewers
These are the rough steps that I took for converting the plugin:
plugins
Gradle module for the pluginUniFfiJvmPlugin
andUniFfiAndroidPlugin
Gradle plugin classes, copy-and-pasting existing script plugin implementationsorg.bitcoindevkit.plugins.generate-jvm-bindings
andorg.bitcoindevkit.plugins.generate-android-bindings
buildSrc
All Submissions: