Skip to content

Commit

Permalink
Merge branch 'hculea/add-python-support-in-typeshare' of github.com:h…
Browse files Browse the repository at this point in the history
…culea/typeshare into hculea/add-python-support-in-typeshare
  • Loading branch information
MOmarMiraj committed Jul 31, 2024
2 parents 87f27e2 + 06ad9c5 commit f0f01f2
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ jobs:
toolchain: ${{ matrix.rust }}
- run: rustup run ${{ matrix.rust }} cargo test --all-features


check-deterministic:
name: Ensure Deterministic Output
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
with:
just-version: 1
- uses: kenji-miyake/setup-sd@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
- run: rustup toolchain install ${{ matrix.rust }}
- run: just --justfile tests/justfile determinism


fmt:
name: Rustfmt
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Version 1.10.0-beta

## 1.10.0-beta.7

- Added support for [inline value classes](https://kotlinlang.org/docs/inline-classes.html) in Kotlin - [#182](https://github.com/1Password/typeshare/pull/182)
- Added the ability to specify that a struct should have information redacted - [#170](https://github.com/1Password/typeshare/pull/170)
- What this means is language-specific. In Kotlin, the toString method is overridden
- This was actually added in 1.10.0-beta.4 but went unannounced.
- Made the output deterministic (this broke in 1.10.0-beta.6) - [#185](https://github.com/1Password/typeshare/pull/185)
- Algebraic Enum Variant names are now capitalized appropriately - [#183](https://github.com/1Password/typeshare/pull/183)

## 1.10.0-beta.6

- Added support for skipping fields/variants via the `target_os` argument [#176](https://github.com/1Password/typeshare/pull/176)
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "typeshare-cli"
version = "1.10.0-beta.6"
version = "1.10.0-beta.7"
edition = "2021"
description = "Command Line Tool for generating language files with typeshare"
license = "MIT OR Apache-2.0"
Expand All @@ -22,5 +22,5 @@ once_cell = "1"
rayon = "1.10"
serde = { version = "1", features = ["derive"] }
toml = "0.8"
typeshare-core = { path = "../core", version = "1.10.0-beta.6" }
typeshare-core = { path = "../core", version = "1.10.0-beta.7" }
anyhow = "1"
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "typeshare-core"
version = "1.10.0-beta.6"
version = "1.10.0-beta.7"
license = "MIT OR Apache-2.0"
edition = "2021"
description = "The code generator used by Typeshare's command line tool"
Expand Down
2 changes: 2 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input
out
16 changes: 16 additions & 0 deletions tests/data/determinism-base.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#[typeshare]
pub struct CustomType {}

#[typeshare]
pub struct Types {
pub s: String,
pub static_s: &'static str,
pub int8: i8,
pub float: f32,
pub double: f64,
pub array: Vec<String>,
pub fixed_length_array: [String; 4],
pub dictionary: HashMap<String, i32>,
pub optional_dictionary: Option<HashMap<String, i32>>,
pub custom_type: CustomType,
}
19 changes: 19 additions & 0 deletions tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
determinism_qty := '100'

all: determinism

generate-determinism-files:
#!/bin/sh
mkdir -p input
for i in $(seq 1 {{determinism_qty}}); do
cat data/determinism-base.rs | sd '(struct )(\w+)' "\${1}\${2}$i" > "input/input$i.rs"
done
determinism: clean generate-determinism-files
mkdir -p out
cargo run -p typeshare-cli -- -l typescript -o "out/output1.ts" input
cargo run -p typeshare-cli -- -l typescript -o "out/output2.ts" input
diff -q out/*.ts

clean:
rm -rf out
rm -rf input

0 comments on commit f0f01f2

Please sign in to comment.