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

[WIP] Feat : Support Call Kclvm Cli by C API #123

Closed
wants to merge 4 commits into from

Conversation

NeverRaR
Copy link
Contributor

@NeverRaR NeverRaR commented Jul 27, 2022

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

    KCLVM/kclvm/spec
    KCLVM/kclvm/src/lib.rs

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other
Support user to call kclvm_cli by c_api

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

KCLVM/kclvm/src/api_test.rs

6. Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@github-actions
Copy link

github-actions bot commented Jul 27, 2022

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@NeverRaR NeverRaR changed the title Dev/cdylib Feat : Support Call Kclvm Cli by C API Jul 27, 2022
@NeverRaR
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@NeverRaR NeverRaR changed the title Feat : Support Call Kclvm Cli by C API [WIP] Feat : Support Call Kclvm Cli by C API Jul 27, 2022
@Peefy Peefy linked an issue Jul 27, 2022 that may be closed by this pull request
@Peefy Peefy added api Issues or PRs related to kcl rust native APIs and multi-lang APIs feat labels Jul 27, 2022
@Peefy Peefy added this to the v0.4.3 Release milestone Jul 27, 2022
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 2744948016

  • 2 of 5523 (0.04%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-7.6%) to 51.731%

Changes Missing Coverage Covered Lines Changed/Added Lines %
kclvm/spec/src/main.rs 1 3 33.33%
kclvm/spec/src/service/util.rs 0 25 0.0%
kclvm/spec/src/service/service.rs 0 109 0.0%
kclvm/spec/src/service/api.rs 0 153 0.0%
kclvm/spec/src/model/gpyrpc.rs 0 5232 0.0%
Totals Coverage Status
Change from base Build 2743999583: -7.6%
Covered Lines: 22244
Relevant Lines: 42999

💛 - Coveralls

Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

Pls add more comments on pub methods/functions/structs and unit/benchmark tests.

kclvm/src/lib.rs Show resolved Hide resolved
kclvm/spec/src/service/util.rs Outdated Show resolved Hide resolved
kclvm/spec/Cargo.toml Outdated Show resolved Hide resolved
@@ -0,0 +1,25 @@
#pragma once
#ifndef KCLVM_SERVICE_CALL
#define KCLVM_SERVICE_CALL
Copy link
Contributor

Choose a reason for hiding this comment

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

#define __KCLVM_SERVICE_CALL_H__

kclvm/api/src/service/service.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

I suggest to create a new issue and then complete the comments and documentation of kclvm/api/gpyrpc.proto, because this is an important user interface. cc @chai2010

Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

Benchmark and fatigue tests are required to test for memory leaks and performance issues.

Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

U can add --exclude kclvm/api/src/model/gpyrpc.rs file in make codecov and make codecov-lcov at kclvm/makefile

@He1pa He1pa closed this in #131 Jul 29, 2022
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the comments?

}
}

pub fn ping(serv: &mut KclvmService, args: &[u8]) -> *const c_char {
Copy link
Contributor

Choose a reason for hiding this comment

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

more documents on Rust public functions.

.into_raw()
}

pub fn exec_program(serv: &mut KclvmService, args: &[u8]) -> *const c_char {
Copy link
Contributor

Choose a reason for hiding this comment

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

more documents on Rust public functions.

}
}

pub fn exec_program(&self, args: &ExecProgram_Args) -> ExecProgram_Result {
Copy link
Contributor

Choose a reason for hiding this comment

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

exec_program API and CLI implementation and error handling need to be considered uniformly,

@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2022
result.yaml_result = yaml_result;
}
}
result
Copy link
Contributor

Choose a reason for hiding this comment

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

Put error message in result.

Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

Considering the python agent registering cc @chai2010

@@ -35,7 +35,7 @@ do
sslpath=$(brew --prefix openssl@1.1)
fi

if [ x"$(uname -m)" == x"arm64" ]; then
if [ x"$(uname -m)" == x"arm64" ] || [ x"$(uname -m)" == x"x86_64" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

U can rebase main branch to solve this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api Issues or PRs related to kcl rust native APIs and multi-lang APIs feat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature : C API for Kclvm Cli
4 participants