Skip to content

Commit 9b9a3d0

Browse files
authored
Merge pull request #31 from loopholelabs/staging
Release v0.1.4
2 parents ed3407b + 8bb7f39 commit 9b9a3d0

24 files changed

+1627
-18
lines changed

.github/workflows/releases.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: cargo publish --token $CARGO_REGISTRY_TOKEN
2323
env:
2424
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
25-
Typescript:
25+
npm:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout

.github/workflows/tests.yaml

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Tests
33
on: [pull_request]
44

55
jobs:
6-
Golang:
6+
golang:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
@@ -16,7 +16,7 @@ jobs:
1616
cache: true
1717
- name: Run Tests
1818
run: go test -v ./...
19-
Rust:
19+
rust:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
@@ -35,7 +35,7 @@ jobs:
3535
run: cargo check --target wasm32-wasi
3636
- name: Run Tests
3737
run: cargo test
38-
Typescript:
38+
typescript:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- name: Checkout
@@ -54,3 +54,14 @@ jobs:
5454
run: npm install
5555
- name: Run Tests
5656
run: npm run test
57+
c:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v3
62+
- name: Update APT
63+
run: sudo apt-get update -y
64+
- name: Install Valgrind
65+
run: sudo apt-get install valgrind -y
66+
- name: Run Tests
67+
run: make clib_test

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ coverage
2525
node_modules
2626

2727
dist/
28+
29+
*.h-e

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [v1.1.4] - 2023-10-12
11+
12+
### Fixes
13+
14+
- Fixed a bug where the protoc generators would crash/fail ([#27](https://github.com/loopholelabs/polyglot/issues/27))
15+
1016
## [v1.1.3] - 2023-09-01
1117

1218
### Features
@@ -39,7 +45,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3945

4046
- Merging Typescript, Golang, and Rust implementations into a single repository
4147

42-
[unreleased]: https://github.com/loopholelabs/scale/compare/v1.1.3...HEAD
48+
[unreleased]: https://github.com/loopholelabs/scale/compare/v1.1.4...HEAD
49+
[v1.1.4]: https://github.com/loopholelabs/scale/compare/v1.1.4
4350
[v1.1.3]: https://github.com/loopholelabs/scale/compare/v1.1.3
4451
[v1.1.2]: https://github.com/loopholelabs/scale/compare/v1.1.2
4552
[v1.1.1]: https://github.com/loopholelabs/scale/compare/v1.1.1

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polyglot_rs"
3-
version = "1.1.3"
3+
version = "1.1.4"
44
edition = "2021"
55
description="A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages."
66
license = "Apache-2.0"
@@ -26,8 +26,8 @@ byteorder = "1"
2626

2727
[dev-dependencies]
2828
serde = { version = "1.0", features = ["derive"] }
29-
serde_json = "1.0.105"
30-
base64 = "0.21.3"
29+
serde_json = "1.0.107"
30+
base64 = "0.21.4"
3131
num_enum = "0.7.0"
3232

3333
[profile.release]

Makefile

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2+
VERSION=$(shell cat $(ROOT_DIR)/version/current_version)
3+
VERSION_MAJOR=$(shell echo $(VERSION) | cut -c2)
4+
VERSION_MINOR=$(shell echo $(VERSION) | cut -c4)
5+
VERSION_MICRO=$(shell echo $(VERSION) | cut -c6)
6+
CLIB_SO=libpolyglot
7+
CLIB_SO_DEV=$(CLIB_SO).so
8+
CLIB_SO_MAN=$(CLIB_SO_DEV).$(VERSION_MAJOR)
9+
CLIB_SO_FULL=$(CLIB_SO_DEV).$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)
10+
CLIB_HEADER=polyglot.h
11+
CLIB_SO_DEV_RELEASE=c_bindings/target/release/$(CLIB_SO_DEV)
12+
CLIB_SO_DEV_DEBUG=c_bindings/target/debug/$(CLIB_SO_DEV)
13+
CLIB_PKG_CONFIG=polyglot.pc
14+
PREFIX ?= /usr/local
15+
16+
OS_NAME := $(shell uname -s | tr A-Z a-z)
17+
18+
CPU_BITS = $(shell getconf LONG_BIT)
19+
ifeq ($(CPU_BITS), 32)
20+
LIBDIR ?= $(PREFIX)/lib
21+
else
22+
LIBDIR ?= $(PREFIX)/lib$(CPU_BITS)
23+
endif
24+
25+
INCLUDE_DIR ?= $(PREFIX)/include
26+
PKG_CONFIG_LIBDIR ?= $(LIBDIR)/pkgconfig
27+
MAN_DIR ?= $(PREFIX)/share/man
28+
29+
RELEASE ?=0
30+
31+
.PHONY: clib_debug
32+
clib_debug:
33+
cd c_bindings && cargo build --all && ([ -f ./target/debug/$(CLIB_SO).dylib ] && (echo "DYLIB exists, copying" && cp ./target/debug/$(CLIB_SO).dylib ./target/debug/$(CLIB_SO_DEV)) || echo "DYLIB does not exist, ignoring") && ln -sfv target/debug/$(CLIB_SO_DEV) target/debug/$(CLIB_SO_FULL) && ln -sfv target/debug/$(CLIB_SO_DEV) target/debug/$(CLIB_SO_MAN) && cd -
34+
35+
$(CLIB_SO_DEV_RELEASE):
36+
cd c_bindings && cargo build --all --release && ([ -f ./target/release/$(CLIB_SO).dylib ] && (echo "DYLIB exists, copying" && cp ./target/release/$(CLIB_SO).dylib ./target/release/$(CLIB_SO_DEV)) || echo "DYLIB does not exist, ignoring") && cd -
37+
38+
$(CLIB_SO_DEV_DEBUG): clib_debug
39+
40+
clib: $(CLIB_HEADER) $(CLIB_SO_DEV_RELEASE) $(CLIB_PKG_CONFIG)
41+
42+
.PHONY: $(CLIB_HEADER)
43+
$(CLIB_HEADER): $(CLIB_HEADER).in
44+
cp $(CLIB_HEADER).in $(CLIB_HEADER)
45+
sed -i -e 's/@_VERSION_MAJOR@/$(VERSION_MAJOR)/' \
46+
$(CLIB_HEADER)
47+
sed -i -e 's/@_VERSION_MINOR@/$(VERSION_MINOR)/' \
48+
$(CLIB_HEADER)
49+
sed -i -e 's/@_VERSION_MICRO@/$(VERSION_MICRO)/' \
50+
$(CLIB_HEADER)
51+
52+
.PHONY: $(CLIB_PKG_CONFIG)
53+
$(CLIB_PKG_CONFIG): $(CLIB_PKG_CONFIG).in
54+
cp $(CLIB_PKG_CONFIG).in $(CLIB_PKG_CONFIG)
55+
sed -i -e 's|@_VERSION_MAJOR@|$(VERSION_MAJOR)|' $(CLIB_PKG_CONFIG)
56+
sed -i -e 's|@_VERSION_MINOR@|$(VERSION_MINOR)|' $(CLIB_PKG_CONFIG)
57+
sed -i -e 's|@_VERSION_MICRO@|$(VERSION_MICRO)|' $(CLIB_PKG_CONFIG)
58+
sed -i -e 's|@PREFIX@|$(PREFIX)|' $(CLIB_PKG_CONFIG)
59+
sed -i -e 's|@LIBDIR@|$(LIBDIR)|' $(CLIB_PKG_CONFIG)
60+
sed -i -e 's|@INCLUDE_DIR@|$(INCLUDE_DIR)|' $(CLIB_PKG_CONFIG)
61+
62+
.PHONY: clib_test
63+
clib_test: $(CLIB_SO_DEV_DEBUG) $(CLIB_HEADER)
64+
$(eval TMPDIR := $(shell mktemp -d))
65+
cp $(CLIB_SO_DEV_DEBUG) $(TMPDIR)/$(CLIB_SO_FULL)
66+
ln -sfv $(TMPDIR)/$(CLIB_SO_FULL) $(TMPDIR)/$(CLIB_SO_MAN)
67+
ln -sfv $(TMPDIR)/$(CLIB_SO_FULL) $(TMPDIR)/$(CLIB_SO_DEV)
68+
cp $(CLIB_HEADER) $(TMPDIR)/$(shell basename $(CLIB_HEADER))
69+
gcc -g -Wall -Wextra -L$(TMPDIR) -I$(TMPDIR) -o $(TMPDIR)/polyglot_test c_bindings/tests/polyglot_test.c -lpolyglot
70+
if [ $(OS_NAME) = "darwin" ]; then (echo "Using Leaks on Darwin" && LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(TMPDIR) leaks --atExit -- $(TMPDIR)/polyglot_test); else (echo "Using Valgrind on Unix" && LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(TMPDIR) valgrind --trace-children=yes --leak-check=full --error-exitcode=1 $(TMPDIR)/polyglot_test); fi
71+
rm -rf $(TMPDIR)
72+
73+
install: clib
74+
mkdir -p $(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
75+
install -p -m755 $(CLIB_SO_DEV_RELEASE) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
76+
ln -sfv $(CLIB_SO_FULL) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MAN)
77+
ln -sfv $(CLIB_SO_FULL) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_DEV)
78+
mkdir -p $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_HEADER))
79+
install -p -v -m644 $(CLIB_HEADER) $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_HEADER))
80+
mkdir -p $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$(shell basename $(CLIB_PKG_CONFIG))
81+
install -p -v -m644 $(CLIB_PKG_CONFIG) $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$(shell basename $(CLIB_PKG_CONFIG))
82+
83+
uninstall:
84+
- rm -rfv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_DEV)
85+
- rm -rfv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MAN)
86+
- rm -rfv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
87+
- rm -rfv $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_HEADER))
88+
- rm -rfv $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_PKG_CONFIG))

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<br/>
22
<div align="center">
33
<a href="https://github.com/loopholelabs/polyglot">
4-
<img src="images/logo.png" alt="Logo" width="120" height="130">
4+
<img src="images/logo.png" alt="Logo" height="130">
55
</a>
66
<h3 align="center">Polyglot</h3>
7-
<p align="center">
7+
<h4 align="center">
88
A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages.
9-
</p>
9+
</h4>
1010

1111
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0)
1212
[![Discord](https://dcbadge.vercel.app/api/server/JYmFhtdPeu?style=flat)](https://loopholelabs.io/discord)

c_bindings/Cargo.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "c_bindings"
3+
version = "1.1.4"
4+
edition = "2021"
5+
description="A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages."
6+
license = "Apache-2.0"
7+
repository = "https://github.com/loopholelabs/polyglot"
8+
readme = "README.md"
9+
keywords = ["polyglot", "serialization", "deserialization", "encoding", "decoding"]
10+
11+
[lib]
12+
path = "lib.rs"
13+
name = "polyglot"
14+
crate-type = ["cdylib"]
15+
16+
[dependencies]
17+
polyglot_rs = { path = "../" }
18+
19+
[profile.release]
20+
opt-level = 3
21+
lto = true
22+
codegen-units = 1

0 commit comments

Comments
 (0)