WasmEdge icon indicating copy to clipboard operation
WasmEdge copied to clipboard

[Java SDK] Implementation of Java SDK

Open kenvifire opened this issue 2 years ago • 8 comments

This feature is still working in progress. Tasks:

  • [x] Set up wasmedge-jni project
  • [x] Set up wasmedge-java project
  • [ ] Wrap c apis
    • [ ] WasmEdge Basics
      • [x] Version
      • [x] Logging Settings
      • [x] Value Types
      • [x] Strings
      • [x] Results
      • [ ] Contexts
        • [x] ConfigureContext
        • [x] FunctionTypeContext
        • [x] ASTModuleContext
        • [x] ExecutorContext
        • [x] ExportTypeContext
        • [x] GlobalTypeContext
        • [x] ImportTypeCOntext
        • [x] LoaderContext
        • [x] MemoryTypeContext
        • [x] LoaderContext
        • [x] StoreContext
        • [x] StatisticsContext.
        • [x] TableTypeContext
        • [x] ValidatorContext
    • [ ] WasmEdge VM
      • [x] VM Creation
      • [ ] Preregistrations
      • [x] Host Module Registrations
      • [x] Wasm Registration and Executions
      • [x] Instance Tracing
    • [ ] WasmEdge Runtime
      • [x] Loader
      • [x] Validator
      • [x] Executor
      • [x] AST Module
      • [x] Store
      • [x] Instances
      • [ ] Host Functions
    • [ ] AOT compiler
      • [x] Compiler options
  • [ ] Documentation
    • [x] Readme, build and install instructions
    • [ ] Java API docs
    • [ ] Step by step examples

kenvifire avatar Sep 23 '21 15:09 kenvifire

Codecov Report

Merging #435 (dc371ce) into master (e33ec84) will increase coverage by 1.34%. The diff coverage is n/a.

:exclamation: Current head dc371ce differs from pull request most recent head 0f4dd4f. Consider uploading reports for the commit 0f4dd4f to get more accurate results

@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
+ Coverage   80.51%   81.85%   +1.34%     
==========================================
  Files         131      122       -9     
  Lines       18590    16977    -1613     
  Branches     3911     3718     -193     
==========================================
- Hits        14968    13897    -1071     
+ Misses       2640     2141     -499     
+ Partials      982      939      -43     
Impacted Files Coverage Δ
tools/wasmedge/wasmedger.cpp 36.65% <0.00%> (-63.35%) :arrow_down:
tools/wasmedge/wasmedgec.cpp 50.40% <0.00%> (-49.61%) :arrow_down:
plugins/wasmedge_process/processfunc.cpp 46.27% <0.00%> (-18.16%) :arrow_down:
include/loader/loader.h 90.76% <0.00%> (-9.24%) :arrow_down:
include/runtime/hostfunc.h 72.09% <0.00%> (-6.98%) :arrow_down:
include/runtime/instance/memory.h 83.33% <0.00%> (-6.77%) :arrow_down:
include/runtime/stackmgr.h 78.33% <0.00%> (-5.28%) :arrow_down:
lib/common/log.cpp 75.00% <0.00%> (-5.00%) :arrow_down:
include/common/statistics.h 81.11% <0.00%> (-2.23%) :arrow_down:
lib/host/wasi/wasifunc.cpp 47.97% <0.00%> (-1.44%) :arrow_down:
... and 54 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Sep 23 '21 15:09 codecov[bot]

Great. Thanks! Do we have an example that shows how to run a Wasm program from Java such as these?

https://github.com/WasmEdge/WasmEdge/blob/master/docs/run.md

juntao avatar Sep 24 '21 02:09 juntao

Great. Thanks! Do we have an example that shows how to run a Wasm program from Java such as these?

https://github.com/WasmEdge/WasmEdge/blob/master/docs/run.md

This PR is a basic setup for Java SDK. And it only contains the getVersion feature. I don't think it can run a Wasm program at the current stage.

hydai avatar Sep 24 '21 04:09 hydai

@juntao @hydai This PR is still WIP. I'll let you guys know once it's completed done.

kenvifire avatar Sep 27 '21 01:09 kenvifire

@juntao @hydai Most part are done, please help review this MR. I'll continue working on the rest part.

kenvifire avatar May 23 '22 23:05 kenvifire

Cool, is there a preview in the Maven repository? I can't wait to try it.

hangedfish avatar Aug 01 '22 08:08 hangedfish

@hydai Sure, I can do it. Can you provide an example for reference?

kenvifire avatar Aug 10 '22 13:08 kenvifire

This is the rust binding workflow: https://github.com/WasmEdge/WasmEdge/blob/master/.github/workflows/bindings-rust.yml Basically, it will contain the building process and the testing process at least in the Linux environment.

hydai avatar Aug 10 '22 18:08 hydai

@hydai Updated API to the latest and also added CI workflow following your suggestion. Can you please take a look?

kenvifire avatar Oct 16 '22 09:10 kenvifire

Hi @kenvifire I found there are some warnings in https://github.com/WasmEdge/WasmEdge/actions/runs/3258891835/jobs/5351315117#step:8:1

These warnings may be big issues if the users build it with -Werror, could you please fix them?

hydai avatar Oct 17 '22 06:10 hydai

@hydai fixed warnings.

kenvifire avatar Oct 18 '22 23:10 kenvifire

Hi @kenvifire I and @dannypsnl will start to review the remaining implementations. It will take some time, but I think we can finish it this week.

hydai avatar Oct 19 '22 14:10 hydai

@kenvifire You would need to signoff every commit, maybe an alias git command to commit -s would help.

dannypsnl avatar Oct 24 '22 06:10 dannypsnl

@dannypsnl Can we merge this PR first? So that we can have others working on this feature at the same time.

kenvifire avatar Oct 24 '22 23:10 kenvifire

@hydai I've got one approval, what's the next step for merging this pull request?

kenvifire avatar Oct 25 '22 01:10 kenvifire

Thank you @kenvifire Nice work.

hydai avatar Oct 25 '22 05:10 hydai

Thank you @kenvifire

Nice work.

Cheers! By the easy, I'm still working on other features, ci and some code refactoring. Is there any way I can track my work? Or can I just create some issues to track them?

kenvifire avatar Oct 28 '22 06:10 kenvifire

Hi @kenvifire It would be better to have an issue recording your milestones.

hydai avatar Oct 28 '22 07:10 hydai

Hi @kenvifire It would be better to have an issue recording your milestones.

Created an issue: https://github.com/WasmEdge/WasmEdge/issues/2025. Can you please assign it to me? Thanks.

kenvifire avatar Oct 28 '22 13:10 kenvifire