Merge pull request #327390 from YvanDaSilva/kcl-update

update kcl to version v0.9.3
This commit is contained in:
Aleksana 2024-07-26 10:43:58 +08:00 committed by GitHub
commit cda06cf6a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 896 additions and 295 deletions

View File

@ -1,44 +1,59 @@
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, kclvm_cli
, kclvm
, makeWrapper
, installShellFiles
, darwin
,
}:
buildGoModule rec {
pname = "kcl";
version = "0.8.9";
version = "0.9.3";
src = fetchFromGitHub {
owner = "kcl-lang";
repo = "cli";
rev = "v${version}";
hash = "sha256-slU3n7YCV5VfvXArzlcITb9epdu/gyXlAWq9KLjGdJA=";
hash = "sha256-QUVTRlzG8hT+iQx5dSycbRDAyeknjwGOWynCRw3oxlo=";
};
vendorHash = "sha256-Xv8Tfq9Kb1xGFCWZQwBFDX9xZW9j99td/DUb7jBtkpE=";
vendorHash = "sha256-AP1MOlnoTnD7luNR+1QtAdMiJL8tEEwJocT+9wBRgAo=";
# By default, libs and bins are stripped. KCL will crash on darwin if they are.
dontStrip = stdenv.isDarwin;
ldflags = [
"-w -s"
"-X=kcl-lang.io/cli/pkg/version.version=v${version}"
];
nativeBuildInputs = [ makeWrapper installShellFiles ];
buildInputs = [ kclvm kclvm_cli ];
nativeBuildInputs = [ makeWrapper installShellFiles ] ++ (
lib.optionals stdenv.isDarwin [ darwin.cctools ]
);
buildInputs = [ kclvm kclvm_cli ] ++ (
lib.optional stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.SystemConfiguration
]
);
subPackages = [ "cmd/kcl" ];
# env vars https://github.com/kcl-lang/kcl-go/blob/main/pkg/env/env.go#L29
postFixup = ''
wrapProgram $out/bin/kcl \
--set PATH ${lib.makeBinPath [kclvm_cli]} \
--set KCL_LIB_HOME ${lib.makeLibraryPath [kclvm]} \
--set KCL_GO_DISABLE_INSTALL_ARTIFACT false \
--prefix PATH : "${lib.makeBinPath [kclvm kclvm_cli]}" \
--prefix KCL_LIB_HOME : "${lib.makeLibraryPath [kclvm]}" \
--prefix KCL_GO_DISABLE_INSTALL_ARTIFACT : false
'';
postInstall = ''
export HOME=$(mktemp -d)
installShellCompletion --cmd kcl \
--bash <($out/bin/kcl completion bash) \
--fish <($out/bin/kcl completion fish) \
@ -49,7 +64,7 @@ buildGoModule rec {
description = "A command line interface for KCL programming language";
homepage = "https://github.com/kcl-lang/cli";
license = licenses.asl20;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ selfuryon peefy ];
mainProgram = "kcl";
};

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,46 @@
diff --git a/api/build.rs b/api/build.rs
index 617c1b9a..20d728e3 100644
diff --git a/kclvm/api/build.rs b/kclvm/api/build.rs
index 7d1c39b7..0104bb6f 100644
--- a/api/build.rs
+++ b/api/build.rs
@@ -5,10 +5,10 @@ use prost_wkt_build::{FileDescriptorSet, Message};
@@ -5,12 +5,12 @@ use prost_wkt_build::{FileDescriptorSet, Message};
/// According to the file kclvm/spec/gpyrpc/gpyrpc.proto, automatically generate
/// the corresponding rust source file to the directory src/model
fn main() {
- std::env::set_var(
- "PROTOC",
- protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
- );
+ // std::env::set_var(
+ // "PROTOC",
+ // protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
+ // );
- if env::var("PROTOC").is_err() {
- env::set_var(
- "PROTOC",
- protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
- );
- }
+ //if env::var("PROTOC").is_err() {
+ // env::set_var(
+ // "PROTOC",
+ // protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
+ // );
+ //}
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
let descriptor_file = out.join("kclvm_service_descriptor.bin");
diff --git b/third-party/prost-wkt/wkt-types/build.rs a/third-party/prost-wkt/wkt-types/build.rs
index e49222d5..a933ddf4 100644
diff --git a/kclvm/third-party/prost-wkt/wkt-types/build.rs b/kclvm/third-party/prost-wkt/wkt-types/build.rs
index 620c759a..7f77e1b1 100644
--- a/third-party/prost-wkt/wkt-types/build.rs
+++ b/third-party/prost-wkt/wkt-types/build.rs
@@ -13,10 +13,10 @@ use regex::Regex;
@@ -13,12 +13,12 @@ use regex::Regex;
fn main() {
//hack: set protoc_bin_vendored::protoc_bin_path() to PROTOC
- std::env::set_var(
- "PROTOC",
- protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
- );
+ // std::env::set_var(
+ // "PROTOC",
+ // protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
+ // );
- if env::var("PROTOC").is_err() {
- env::set_var(
- "PROTOC",
- protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
- );
- }
+ //if env::var("PROTOC").is_err() {
+ // env::set_var(
+ // "PROTOC",
+ // protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
+ // );
+ //}
let dir = PathBuf::from(env::var("OUT_DIR").unwrap());
process_prost_pbtime(&dir);

View File

@ -1,19 +1,22 @@
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, protobuf
, pkg-config
, darwin
, rustc
,
}:
rustPlatform.buildRustPackage rec {
pname = "kclvm";
version = "0.8.7";
version = "0.9.3";
src = fetchFromGitHub {
owner = "kcl-lang";
repo = "kcl";
rev = "v${version}";
hash = "sha256-ieGpuNkzT6AODZYUcEanb7Jpb+PXclnQ9KkdmlehK0o=";
hash = "sha256-nk5oJRTBRj0LE2URJqno8AoZ+/342C2tEt8d6k2MAc8=";
};
sourceRoot = "source/kclvm";
@ -21,9 +24,22 @@ rustPlatform.buildRustPackage rec {
lockFile = ./Cargo.lock;
outputHashes = {
"inkwell-0.2.0" = "sha256-JxSlhShb3JPhsXK8nGFi2uGPp8XqZUSiqniLBrhr+sM=";
"protoc-bin-vendored-3.1.0" = "sha256-RRqpPMJygpKGG5NYzD93iy4htpVqFhYMmfPgbRtpUqg=";
};
};
buildInputs = [ rustc ] ++ lib.optionals stdenv.isDarwin [
darwin.cctools
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.SystemConfiguration
];
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -id $out/lib/libkclvm_cli_cdylib.dylib $out/lib/libkclvm_cli_cdylib.dylib
'';
nativeBuildInputs = [ pkg-config protobuf ];
patches = [ ./enable_protoc_env.patch ];
@ -35,7 +51,7 @@ rustPlatform.buildRustPackage rec {
description = "A high-performance implementation of KCL written in Rust that uses LLVM as the compiler backend";
homepage = "https://github.com/kcl-lang/kcl";
license = licenses.asl20;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ selfuryon peefy ];
};
}

View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "kclvm_cli"
version = "0.8.7"

View File

@ -7,4 +7,4 @@
+
+[[package]]
+name = "kclvm_cli"
+version = "0.8.7"
+version = "0.9.3"

View File

@ -1,30 +1,41 @@
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, kclvm
, darwin
, rustc
,
}:
rustPlatform.buildRustPackage rec {
pname = "kclvm_cli";
version = "0.8.7";
version = "0.9.3";
src = fetchFromGitHub {
owner = "kcl-lang";
repo = "kcl";
rev = "v${version}";
hash = "sha256-ieGpuNkzT6AODZYUcEanb7Jpb+PXclnQ9KkdmlehK0o=";
hash = "sha256-nk5oJRTBRj0LE2URJqno8AoZ+/342C2tEt8d6k2MAc8=";
};
sourceRoot = "source/cli";
cargoLock.lockFile = ./Cargo.lock;
cargoHash = "sha256-LZUE2J/UYepl5BGf4T4eWKIZfN3mVJtMDLtm0uUmvI8=";
cargoPatches = [ ./cargo_lock.patch ];
buildInputs = [ kclvm ];
buildInputs = [ kclvm rustc ] ++ (
lib.optionals stdenv.isDarwin [
darwin.cctools
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.SystemConfiguration
]
);
meta = with lib; {
description = "A high-performance implementation of KCL written in Rust that uses LLVM as the compiler backend";
homepage = "https://github.com/kcl-lang/kcl";
license = licenses.asl20;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ selfuryon peefy ];
mainProgram = "kclvm_cli";
};