craft icon indicating copy to clipboard operation
craft copied to clipboard

feat: maven kotlin multiplatform support

Open buenaflor opened this issue 3 years ago • 4 comments

This introduces some additions to be able to support a Kotlin Multiplatform publish.

Additional artifacts include: *.klib, *-all.jar, *-metadata.jar, *.module.

Example artifacts of Kermit:

  • ios artifacts: https://repo1.maven.org/maven2/co/touchlab/kermit-sentry-iosarm64/1.2.0-M2/
  • root artifacts: https://repo1.maven.org/maven2/co/touchlab/kermit-sentry/1.2.0-M2/

For context: for a KMP publish all platforms need to be published and the root artifact contains metadata, see: https://github.com/getsentry/sentry-kotlin-multiplatform/pull/37#issuecomment-1219123937

The generated gpg command example: root artifact:

"-Dfile=/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-mSNdRu/sentry-kotlin-multiplatform-0.0.1/sentry-kotlin-multiplatform-0.0.1.jar" 
"-Dfiles=/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-mSNdRu/sentry-kotlin-multiplatform-0.0.1/sentry-kotlin-multiplatform-0.0.1-javadoc.jar,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-mSNdRu/sentry-kotlin-multiplatform-0.0.1/sentry-kotlin-multiplatform-0.0.1-sources.jar,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-mSNdRu/sentry-kotlin-multiplatform-0.0.1/sentry-kotlin-multiplatform-0.0.1-all.jar,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-mSNdRu/sentry-kotlin-multiplatform-0.0.1/sentry-kotlin-multiplatform-0.0.1.module" 
"-Dclassifiers=javadoc,sources,all,module" 
"-Dtypes=jar,jar,jar,module" 
...

ios artifact:

"-Dfile=/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosArm64-0.0.1.klib" 
"-Dfiles=/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosArm64-0.0.1-javadoc.jar,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosArm64-0.0.1-sources.jar/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosarm64-0.0.1-cinterop-Sentry.NSException.klib,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosarm64-0.0.1-cinterop-Sentry.Scope.klib,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosarm64-0.0.1-cinterop-Sentry.klib,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosArm64-0.0.1-metadata.jar,/var/folders/j2/r3dsjfkx4pj5n0v8jjlb6lv80000gn/T/craft-QEa8yL/sentry-kotlin-multiplatform-iosArm64-0.0.1/sentry-kotlin-multiplatform-iosArm64-0.0.1.module" 
"-Dclassifiers=javadoc,sources,cinterop,cinterop,cinterop,metadata,module"
"-Dtypes=jar,jar,klib,klib,klib,jar,module"
...

buenaflor avatar Sep 01 '22 13:09 buenaflor

@buenaflor did you try to call gpg:sign-and-deploy-file manually with all those params and check the temporary ~/.m2/repository/io/sentry folder if it's correct? It's also worth checking if the new files are also signed, because all the files need to be, you can see that each file has a .asc, .sha, .md5 extension, so the klib, module etc all need to be signed as well but I believe the command does it automatically, I'd double-check tho.

marandaneto avatar Sep 08 '22 10:09 marandaneto

@iker-barriocanal what do you think is still missing for this PR? just tests from your latest comment or some other comments need to be addressed?

romtsn avatar Sep 26 '22 06:09 romtsn

@romtsn I think only tests are missing (verifying the temporary folder as Manoel suggests may be one of them). That said, I'm not blocking the PR. I don't know if @asottile-sentry has other thoughts too.

iker-barriocanal avatar Sep 27 '22 08:09 iker-barriocanal

Making it a draft since it's not fully tested yet.

marandaneto avatar Sep 27 '22 09:09 marandaneto

I added a fix so that the published artifacts are correct and signed. I generated the artifacts manually & locally by calling the gpg publish commands as they were produced by craft during dry runs (I only had to change the output url and the path to the distribution folder). Then tested it on sample kmp apps with multiple platforms (android, cocoa, jvm desktop) by adding it as a dependency throughmavenLocal.

Example output of a specific file:

sentry-kotlin-multiplatform-iossimulatorarm64-0.0.1-cinterop-Sentry.PrivateSentrySDKOnly.klib
sentry-kotlin-multiplatform-iossimulatorarm64-0.0.1-cinterop-Sentry.PrivateSentrySDKOnly.klib.asc
sentry-kotlin-multiplatform-iossimulatorarm64-0.0.1-cinterop-Sentry.PrivateSentrySDKOnly.klib.md5
sentry-kotlin-multiplatform-iossimulatorarm64-0.0.1-cinterop-Sentry.PrivateSentrySDKOnly.klib.sha1

I attached a file with all the generated gpg publish commands for doing it locally for the latest KMP build: kmp local publish via gpg sign deploy.txt

buenaflor avatar Mar 08 '23 16:03 buenaflor

LGTM from my side but I'd let the owners of this repo approve it.

marandaneto avatar Mar 09 '23 07:03 marandaneto