Skip to content

Commit

Permalink
feat: fork deprecated serde yaml and add more string quoting when ser…
Browse files Browse the repository at this point in the history
…ialize (#1232)

Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy authored Apr 19, 2024
1 parent c2e89d9 commit de289b0
Show file tree
Hide file tree
Showing 41 changed files with 13,986 additions and 6 deletions.
11 changes: 9 additions & 2 deletions kclvm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion kclvm/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ maplit = "1.0.2"
prost = "0.11.8"
prost-types = "0.11.8"
serde_json = "1.0"
serde_yaml = "0.9.32"
serde_yaml = {path = "../third-party/serde_yaml"}
anyhow = "1.0.70"
serde = { version = "1", features = ["derive"] }
indexmap = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion kclvm/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9.32"
serde_yaml = {path = "../third-party/serde_yaml"}
serde_json = "1.0"
indexmap = "1.0"
ahash = "0.7.2"
Expand Down
2 changes: 1 addition & 1 deletion kclvm/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
kclvm_runtime_internal_macros = { path = "./internal_macros" }
serde_json = {package = "serde_json", version = "= 1.0.115"}
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9.32"
serde_yaml = {path = "../third-party/serde_yaml"}

generational-arena = "0.2.9"
base64 = "0.13.0"
Expand Down
6 changes: 6 additions & 0 deletions kclvm/runtime/src/value/val_yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ impl ValueRef {
mod test_value_yaml {
use crate::*;

#[test]
fn test_serde_yaml_on_str() {
let on_str = serde_yaml::to_string("on").unwrap();
assert_eq!(on_str, "'on'\n");
}

#[test]
fn test_value_from_yaml() {
let mut ctx = Context::new();
Expand Down
1 change: 1 addition & 0 deletions kclvm/third-party/serde_yaml/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: dtolnay
111 changes: 111 additions & 0 deletions kclvm/third-party/serde_yaml/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:
schedule: [cron: "40 1 * * *"]

permissions:
contents: read

env:
RUSTFLAGS: -Dwarnings

jobs:
pre_ci:
uses: dtolnay/.github/.github/workflows/pre_ci.yml@master

test:
name: Rust ${{matrix.rust}}
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [nightly, beta, stable, 1.64.0]
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- name: Enable type layout randomization
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
if: matrix.rust == 'nightly'
- run: cargo build
- run: cargo test

doc:
name: Documentation
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/install@cargo-docs-rs
- run: cargo docs-rs

clippy:
name: Clippy
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@clippy
- run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic

miri:
name: Miri
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@miri
- run: cargo miri setup
- run: cargo miri test
env:
MIRIFLAGS: -Zmiri-strict-provenance

minimal:
name: Minimal versions
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo generate-lockfile -Z minimal-versions
- run: cargo check --locked

fuzz:
name: Fuzz
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/install@cargo-fuzz
- run: cargo fuzz check

outdated:
name: Outdated
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/install@cargo-outdated
- run: cargo outdated --workspace --exit-code 1
- run: cargo outdated --manifest-path fuzz/Cargo.toml --exit-code 1
2 changes: 2 additions & 0 deletions kclvm/third-party/serde_yaml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
62 changes: 62 additions & 0 deletions kclvm/third-party/serde_yaml/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

[package]
edition = "2021"
rust-version = "1.64"
name = "serde_yaml"
version = "0.9.34+deprecated"
authors = ["David Tolnay <[email protected]>"]
description = "YAML data format for Serde"
documentation = "https://docs.rs/serde_yaml/"
readme = "README.md"
keywords = [
"yaml",
"serde",
"serialization",
]
categories = [
"encoding",
"parser-implementations",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/serde-yaml"

[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
targets = ["x86_64-unknown-linux-gnu"]

[lib]
doc-scrape-examples = false

[dependencies.indexmap]
version = "2.2.1"

[dependencies.itoa]
version = "1.0"

[dependencies.ryu]
version = "1.0"

[dependencies.serde]
version = "1.0.195"

[dependencies.unsafe-libyaml]
version = "0.2.11"

[dev-dependencies.anyhow]
version = "1.0.79"

[dev-dependencies.indoc]
version = "2.0"

[dev-dependencies.serde_derive]
version = "1.0.195"
Loading

0 comments on commit de289b0

Please sign in to comment.