Git Product home page Git Product logo

Comments (8)

folliehiyuki avatar folliehiyuki commented on August 15, 2024 1

Thanks for the work! I'll try building the latest tag this weekend alongside the Rust lib and give you the feedback when I'm done testing stuff.

from kcl-go.

folliehiyuki avatar folliehiyuki commented on August 15, 2024 1

Sorry for the delay! I've briefly tested the latest CLI version, and the variables seem to work correctly.

AlpineLinux is going through a major Python version bump, so I'm not able to build the Rust lib to test things thoroughly (at least for a week or so), but this issue can be closed. I'll open another issue on the main repo if a problem comes up.

from kcl-go.

Peefy avatar Peefy commented on August 15, 2024

A very good suggestion, do we need another issue to track the Alpine version of building the KCL Rust library?

I will try to implement it next week, but until then, PRs are very welcome. ❤️

from kcl-go.

Peefy avatar Peefy commented on August 15, 2024

I opened a PR to preliminarily implement it, is this the way you want it?

#259

from kcl-go.

folliehiyuki avatar folliehiyuki commented on August 15, 2024

Sorry for my misleading suggestion! What I meant by setting at build time is is to use -ldflags of go build command with -X option to inject the values of internal variables, which only supports string type.

Maybe something like this, I don't know:

var (
	LibHome                  string
	DisableInstallArtifact   string
	DisableUseArtifactInPath string
)

# then check whether the above variables are empty string, or already set by runtime env KCL_*

Minor comments:

libPath := filepath.Join(root, "bin", fullLibName)
if !utils.FileExists(libPath) {
libPath = filepath.Join(root, "lib", fullLibName)
}
and
if env.GetDisableUseArtifactInPath() {
// Must use the artifact installed by kcl-go
// Get the install lib path.
g_KclvmRoot = findInstalledArtifactRoot()
} else {
// Get kclvm root path in PATH
g_KclvmRoot = findKclvmRoot()
}
feel kind of forceful, but they cover the common cases, so I don't mind.

Also, I think DisableUseArtifactInPath isn't really useful. Would downloading artifacts into the same directory as kcl for both MacOS and Linux make it simpler, and more consistent? Then we only need to require kclvm_cli is inside PATH.

from kcl-go.

Peefy avatar Peefy commented on August 15, 2024

I see. I will open another PR to handle variable injection for the build time. The PR is here #267

from kcl-go.

folliehiyuki avatar folliehiyuki commented on August 15, 2024

Sorry for another complaint! The new PR doesn't work. disableInstallArtifact and disableArtifactInPath are boolean, while -X flag only supports variables of string type (-ldflags "-X kcl-lang.io/kcl-go/pkg/env.disableArtifactInPath=true" won't affect the value). I can set libHome normally though, as it's ... string 😄

from kcl-go.

Peefy avatar Peefy commented on August 15, 2024

Sorry, I forgot to set them as string fields. #270

from kcl-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.