WycliffeAssociates / jdenticon-kotlin

19 stars 8 forks source link

Going multiplatform #8

Closed ShirinkinArseny closed 3 years ago

ShirinkinArseny commented 3 years ago

Fixes issue #4 (Using lib in Kotlin/JS projects)

What is done for now:

  1. I splitted project to 4 modules:

    • commonMain, common code that shared across platforms
    • commonTest, tests
    • jvmMain, implements sha1 by java's MessageDigest
    • jsMain, implements sha1 by js-sha1 from npm
  2. I updated kotlin-stdlib to 1.4.21, so now we need to use Gradle 6.0 or highter.

  3. I changed project version from 1.0 to 1.1, because we can't test publishing without new version. Is it ok?

Build is working. Gradle's task publishToMavenLocal creates corresponding jars in local maven repo.

Tests are working. Gradle config allows to run them in different environments (gradle tasks: jsLegacyBrowserTest, jsLegacyNodeTest, jvmTest). I inlined svg files into tests code, because can't find other option to read svg content in tests in multiplatform way.

Publishing - needs to be tested. I didn't found the way to publish 3 artifacts at once with the plugin com.novoda.bintray-release, so I used another one, which seems to be official one for jcenter. I have no credentials to publish, so I don't know if it is working or not. The same gradle config worked fine in same conditions on my personal project.

Publishing is done by this command:

gradle -Puser=YOUR_JCENTER_ACCOUNT -Pkey=YOUR_API_KEY bintrayUpload (and then you'll need to confirm new uploaded files at bintray website).

After verifying that publishing is working we can update README:

To use library in JVM environment, depend on artifact 'org.wycliffeassociates:jdenticon-kotlin-jvm:1.1'. To use library in JS environment, depend on artifact 'org.wycliffeassociates:jdenticon-kotlin-js:1.1'. To use library in multiplatform module, depend on artifact 'org.wycliffeassociates:jdenticon-kotlin-kotlinMultiplatform:1.1'.

Can you test publishing? Thanks.

P.S. sorry for .idea/* files added to commits, can't get rid of them :(