Skip to content

niklaswimmer/iroh-ffi-android-build

Repository files navigation

Android Build for Iroh-FFI

This project publishes Gradle build logic that can be used to build the Iroh-FFI library and Kotlin bindings for Android as part of your normal Gradle build process. This allows you to run ./gradlew build and have Gradle automatically build the Iroh-FFI native library using cargo-ndk and generate the appropiate Kotlin bindings for use in Android projects.

This project in an intermediate solution, until we have a solution for publishing Iroh-FFI libraries upstream. Best case scenario is if this project becomes obselete.

Usage

You basically have two options, you can either copy the full repository and use includeBuild in your root Gradle project or you can copy just the buildSrc source and integrate them directly into your build system. Note that the build logic does not take care of downloading the iroh-ffi repository, it expects to be already present locally (this project contains the Iroh-FFI repository as a submodule, but depending on how you copy this project into yours you may still have to take care of that yourself).

The easiest way to make use of this project is to add it as a Git submodule to your Git repository:

git submodule add https://github.com/niklaswimmer/iroh-ffi-android-build iroh-ffi

You can then modify your root settings.gradle.kts file to include the following line:

includeBuild("iroh-ffi/")

For more information on includeBuild please consult the Gradle documentation.

Lastly, you need to declare a dependency on the iroh-ffi library in your application's build.gradle.kts file:

dependencies {
    implementation("me.nwimmer.unofficial.iroh:iroh:0.28.1")
}

Or, alternatively, in your version catalog file (libs.versions.toml or similar):

[versions]
iroh = "0.28.1"

[libraries]
iroh = { module = "me.nwimmer.unofficial.iroh:iroh", version.ref = "iroh" }

License

All files include a header specifying their copyright and the licenses they are distributed under. Copies of all licenses used by this project are available in the LICENSES folder. This project is compliant with version 3.2 of the REUSE Specification.

What follows is a summary of which license is used where, please note however that the license(s) specified in the source files take precedence in case of any discrepancies.

  • Files provided by Gradle are licensed under Apache-2.0.
  • Most other files are licensed under MIT-0. Note that this includes file which are most likely not copyrightable (such as .gitmodule and other configuration), in line with the recommendation by REUSE I still included license headers for these. Since it is MIT-0, you are not required to keep these headers if you do not want them.
  • Much of the actual build logic is derived work from cargo-mobile's Android Studio template and Bitkey's application's build logic, which are licensed under "MIT OR Apache-2.0" and LicenseRef-Block-MIT-CC respectively. Since "MIT-0 AND MIT" does not make much sense in my eyes, I decided to just go with MIT in those cases. In practice this means that some files of the buildSrc source are licensed under MIT-0, other files under MIT and yet other files under "MIT AND LicenseRef-Block-MIT-CC", depending on the license of the original work.

Please note that the Commons Clause in LicenseRef-Block-MIT-CC is for "Bitkey mobile application and server code" and not for this work. Since this work is only derived from 2-3 files (out of over 48000 at the time of writing) of the "Bitkey mobile application and server code" it hardly counts as substantial and you may therefore use this work just fine in software you intend to sell (side note, I am not a lawyer..). Please also see the Commons Clause FAQ for more information and/or ask your lawyer about the specifics.

Contact

If you have any questions regarding this project, the licensing situation or just want to discuss the implementation, please feel free to open an issue/discussion, contact me via email (included in each source file) or ping me on the Iroh discord (nickname: Nikx).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages