vsirotin / si-units

Kotlin function and objects for working with SI units like meter, second, as well as currencies and general units like percent.

Home Page:https://vsirotin.github.io/si-units/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Continue migration to multiplatform

vsirotin opened this issue · comments

Following task still to process after @michalharakal restructured project:

  • Synchronise code (insert last changed, removed by merge)
  • Add JS-Plattform
  • Preparing automatically tests for target platform.
  • Update documentation
  • Prepare short documentation for target platforms
  • To decide about ways for promotion of library variants for different platforms

@vsirotin I have finally solution for the issues with JvmName and JvmField. We need to add into all files using this annotation explicit import calls like this:

import kotlin.jvm.JvmField
import kotlin.jvm.JvmName

I am still not sure about Generators. It is not this the place, where you can add missing imports and generate file again?

https://github.com/vsirotin/si-units/blob/main/kotunil-generators/src/main/kotlin/eu/sirotin/kotunil/generator/GeneratorBaseClasses.kt#L98

I am also working on JS target and JavaScript doesn't allow $ in the identifier name. So all the Dollar currencies produces for JavaScript and iOS following syntax error:
Name contains illegal characters: "$"

@vsirotin I have finally solution for the issues with JvmName and JvmField. We need to add into all files using this annotation explicit import calls like this:

import kotlin.jvm.JvmField
import kotlin.jvm.JvmName

It is a little starnge for me. But I'am curious to see your solution. As I understand, You did't commit it in your branch?

I am still not sure about Generators. It is not this the place, where you can add missing imports and generate file again?

https://github.com/vsirotin/si-units/blob/main/kotunil-generators/src/main/kotlin/eu/sirotin/kotunil/generator/GeneratorBaseClasses.kt#L98

Yes. Please try it and after that simple start main in [kotlin/eu/sirotin/kotunil/generator/Generator.kt]

I am also working on JS target and JavaScript doesn't allow $ in the identifier name. So all the Dollar currencies produces for JavaScript and iOS following syntax error:
Name contains illegal characters: "$"

Can you please deliver the constrained solution with commented wit TODO problem places? Thanks!

I have found solution for JS. There is similar construct as for Jvm, its called @JsName Let me try out first...

@michalharakal Prima! Thanks!

@vsirotin branch feature/multiplatform-js/23 is still a work in progress, pls do not merge.
Plenty of tests are broken, because of my broken implementation of show() method, JS doesn't support format String in the same way as JVM.

BTW, JS is already kind of working ...

Minimal browser js project attached
si-units-js.zip

@michalharakal If many are not working on JS because of DecimalFormatSymbols or similar absence of some functions by JS Platform - it is not big problem. I can solve it.
I'll see your state today evening.

@vsirotin Current state is:

  1. jvm builds and all jvm test run green
  2. some classes are commented out since not valid on js or iOS (marked with TODO)

It vould be cool, if you can implement show and toString so also JS tests runs. Platorm specific code for JS can you find here https://github.com/vsirotin/si-units/blob/feature/multiplatform-js/23/kotunil/src/jsMain/kotlin/eu/sirotin/kotunil/utils/jsFormatString.kt#L8

@michalharakal What are you mean? Would you like to prepare PR or schell I merge your branche?

@vsirotin, pls no merge yet. The goal on this branch is to add js as a next target to the library. jsTest are not running yet, so we would make no improvement by the PR. Let's fix the jsTest first.

If we run ./gradlew jsTest locally, all tests have to be OK. Could you help me with that? I can meanwhile focus on the dokka help files ...

@michalharakal OK. I will try it in branch.

@vsirotin I need your assistance, in order to deploy generated dokka html pages to github pages. This feature has to be activated by repo admin via settings/pages:

Pages settings

Settings

folder and branch definition for pages content

github_pages_setup

Mhmm, something is not right, the documentation is build from a dokka branch and result has been deployed into the docs in site branch, you can see the result here
https://github.com/vsirotin/si-units/tree/site/docs
But Github still shows 404 page on the landing page https://vsirotin.github.io/si-units/
I would wait a while, then we can check settings together ....

Thank you, @michalharakal!
This area is a little new for me. I'll try to understand the information today.

Hallo @michalharakal,
it works in your fork/branch and don't work in main branch.
I don't found your commits in main branch. Should they be done?

@vsirotin Branch site is where the html pages live. No code. Only HTML site. In order, to display this HTML pages you have to tell GitHub, that HTML pages are located in a different branch from main and in which folder. See settings for branch and the folder to tell github where the HTML page is.

github_pages_setup

@michalharakal As I inform you in Slack. Now it works.

@vsirotin it is possible to show a link to the GitHub page HTML documentation page from the project repository page.
Simply select project description setting:
project_description_settings
and that activate usage of github pages
github_pages

Thank you, @michalharakal !
I know this documents but up to now have no time to apply their recommendations :-)

Hallo @michalharakal,
I believe, we can close this issue because some special "sub-issues" of it defined in separate issues.
Thank you very much for your assistance!