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

ci: publish to maven central #42

Merged
merged 11 commits into from
Oct 22, 2024
Merged

Conversation

HashMapsData2Value
Copy link
Contributor

This PR will have us publish the xHD-Wallet-API-kt packages (JVM and Android) to Maven Central.

To get a feel for it, I have done it successfully in my own fork: main...HashMapsData2Value:hmd2v-fork-xHD-Wallet-API-kt:main

https://central.sonatype.com/artifact/io.github.hashmapsdata2value.xhdwalletapi/xhdwalletapi
https://central.sonatype.com/artifact/io.github.hashmapsdata2value.xhdwalletapi/xhdwalletapi-android

I have also successfully been able to import them into https://github.com/algorandfoundation/arc52-android-wallet and https://github.com/algorandfoundation/arc52-jvm-wallet and seen that things compiled properly etc.

In the CI, we we introduce two new steps: ./gradlew publish and ./gradlew publishToMavenCentralPortal. The first one prepares files, generates the docs and sourcejar, signs them and produces checksums. We expose our OSSRH username and password as env_vars as well as the GPG signing key we are using. Only release candidates are actually published, but we can change that.

I've also included the merge from release -> main step using the engineering-ci bot as part of this PR.

The tool we are using is yananhub's Flying Gradle Plugin, mentioned on https://central.sonatype.org/publish/publish-portal-gradle/. Maven Central recently migrated away from https://oss.sonatype.org and they have not yet introduced official Gradle plugins. It handles the producing of the artifacts, the generation of checksums, and the gathering of them in the right place so that they can be zipped up.

Copy link
Member

@PhearZero PhearZero left a comment

Choose a reason for hiding this comment

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

Not sure if I am doing something wrong but on a fresh Android project I get the following:

Process: foundation.algorand.passkey.testxhdwallet, PID: 5798
     java.lang.NoClassDefFoundError: Failed resolution of: Lcom/sun/jna/Native;

Steps to reproduce:

  • Create new project in Android Studio
  • Increase api to level 26 since 24 was default.
  • Add the following to MainActiviy
val seed = Mnemonics.MnemonicCode(
    "salon zoo engage submit smile frost later decide wing sight chaos renew lizard rely canal coral scene hobby scare step bus leaf tobacco slice".toCharArray()
)
val alice = XHDWalletAPIAndroid(seed.toSeed())

Edit: I've added the following to gradle and it still gives a similar JNA error on both emulator and real device:

implementation("io.github.hashmapsdata2value.xhdwalletapi:xhdwalletapi-android:1.1.0-canary.3")
implementation("cash.z.ecc.android:kotlin-bip39:1.0.7")
implementation("commons-codec:commons-codec:1.16.1")
implementation("net.java.dev.jna:jna:5.12.1")
implementation("com.goterl:resource-loader:2.0.2")

Error:

java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-aarch64/libjnidispatch.so) not found in resource path (.)

@PhearZero PhearZero self-requested a review October 22, 2024 12:33
Copy link
Member

@PhearZero PhearZero left a comment

Choose a reason for hiding this comment

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

LGTM

Tested on physical device and emulator.

Note: It requires the aar import of the jna library at v5.14.0

@HashMapsData2Value HashMapsData2Value merged commit adca4f9 into main Oct 22, 2024
1 check passed
@HashMapsData2Value HashMapsData2Value deleted the chore/publish-to-maven-central branch October 22, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants