Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.1.4 #31

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: cargo publish --token $CARGO_REGISTRY_TOKEN
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Typescript:
npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Tests
on: [pull_request]

jobs:
Golang:
golang:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -16,7 +16,7 @@ jobs:
cache: true
- name: Run Tests
run: go test -v ./...
Rust:
rust:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -35,7 +35,7 @@ jobs:
run: cargo check --target wasm32-wasi
- name: Run Tests
run: cargo test
Typescript:
typescript:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -54,3 +54,14 @@ jobs:
run: npm install
- name: Run Tests
run: npm run test
c:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update APT
run: sudo apt-get update -y
- name: Install Valgrind
run: sudo apt-get install valgrind -y
- name: Run Tests
run: make clib_test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ coverage
node_modules

dist/

*.h-e
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v1.1.4] - 2023-10-12

### Fixes

- Fixed a bug where the protoc generators would crash/fail ([#27](https://github.com/loopholelabs/polyglot/issues/27))

## [v1.1.3] - 2023-09-01

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

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

[unreleased]: https://github.com/loopholelabs/scale/compare/v1.1.3...HEAD
[unreleased]: https://github.com/loopholelabs/scale/compare/v1.1.4...HEAD
[v1.1.4]: https://github.com/loopholelabs/scale/compare/v1.1.4
[v1.1.3]: https://github.com/loopholelabs/scale/compare/v1.1.3
[v1.1.2]: https://github.com/loopholelabs/scale/compare/v1.1.2
[v1.1.1]: https://github.com/loopholelabs/scale/compare/v1.1.1
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polyglot_rs"
version = "1.1.3"
version = "1.1.4"
edition = "2021"
description="A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages."
license = "Apache-2.0"
Expand All @@ -26,8 +26,8 @@ byteorder = "1"

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.105"
base64 = "0.21.3"
serde_json = "1.0.107"
base64 = "0.21.4"
num_enum = "0.7.0"

[profile.release]
Expand Down
88 changes: 88 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
VERSION=$(shell cat $(ROOT_DIR)/version/current_version)
VERSION_MAJOR=$(shell echo $(VERSION) | cut -c2)
VERSION_MINOR=$(shell echo $(VERSION) | cut -c4)
VERSION_MICRO=$(shell echo $(VERSION) | cut -c6)
CLIB_SO=libpolyglot
CLIB_SO_DEV=$(CLIB_SO).so
CLIB_SO_MAN=$(CLIB_SO_DEV).$(VERSION_MAJOR)
CLIB_SO_FULL=$(CLIB_SO_DEV).$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)
CLIB_HEADER=polyglot.h
CLIB_SO_DEV_RELEASE=c_bindings/target/release/$(CLIB_SO_DEV)
CLIB_SO_DEV_DEBUG=c_bindings/target/debug/$(CLIB_SO_DEV)
CLIB_PKG_CONFIG=polyglot.pc
PREFIX ?= /usr/local

OS_NAME := $(shell uname -s | tr A-Z a-z)

CPU_BITS = $(shell getconf LONG_BIT)
ifeq ($(CPU_BITS), 32)
LIBDIR ?= $(PREFIX)/lib
else
LIBDIR ?= $(PREFIX)/lib$(CPU_BITS)
endif

INCLUDE_DIR ?= $(PREFIX)/include
PKG_CONFIG_LIBDIR ?= $(LIBDIR)/pkgconfig
MAN_DIR ?= $(PREFIX)/share/man

RELEASE ?=0

.PHONY: clib_debug
clib_debug:
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 -

$(CLIB_SO_DEV_RELEASE):
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 -

$(CLIB_SO_DEV_DEBUG): clib_debug

clib: $(CLIB_HEADER) $(CLIB_SO_DEV_RELEASE) $(CLIB_PKG_CONFIG)

.PHONY: $(CLIB_HEADER)
$(CLIB_HEADER): $(CLIB_HEADER).in
cp $(CLIB_HEADER).in $(CLIB_HEADER)
sed -i -e 's/@_VERSION_MAJOR@/$(VERSION_MAJOR)/' \
$(CLIB_HEADER)
sed -i -e 's/@_VERSION_MINOR@/$(VERSION_MINOR)/' \
$(CLIB_HEADER)
sed -i -e 's/@_VERSION_MICRO@/$(VERSION_MICRO)/' \
$(CLIB_HEADER)

.PHONY: $(CLIB_PKG_CONFIG)
$(CLIB_PKG_CONFIG): $(CLIB_PKG_CONFIG).in
cp $(CLIB_PKG_CONFIG).in $(CLIB_PKG_CONFIG)
sed -i -e 's|@_VERSION_MAJOR@|$(VERSION_MAJOR)|' $(CLIB_PKG_CONFIG)
sed -i -e 's|@_VERSION_MINOR@|$(VERSION_MINOR)|' $(CLIB_PKG_CONFIG)
sed -i -e 's|@_VERSION_MICRO@|$(VERSION_MICRO)|' $(CLIB_PKG_CONFIG)
sed -i -e 's|@PREFIX@|$(PREFIX)|' $(CLIB_PKG_CONFIG)
sed -i -e 's|@LIBDIR@|$(LIBDIR)|' $(CLIB_PKG_CONFIG)
sed -i -e 's|@INCLUDE_DIR@|$(INCLUDE_DIR)|' $(CLIB_PKG_CONFIG)

.PHONY: clib_test
clib_test: $(CLIB_SO_DEV_DEBUG) $(CLIB_HEADER)
$(eval TMPDIR := $(shell mktemp -d))
cp $(CLIB_SO_DEV_DEBUG) $(TMPDIR)/$(CLIB_SO_FULL)
ln -sfv $(TMPDIR)/$(CLIB_SO_FULL) $(TMPDIR)/$(CLIB_SO_MAN)
ln -sfv $(TMPDIR)/$(CLIB_SO_FULL) $(TMPDIR)/$(CLIB_SO_DEV)
cp $(CLIB_HEADER) $(TMPDIR)/$(shell basename $(CLIB_HEADER))
gcc -g -Wall -Wextra -L$(TMPDIR) -I$(TMPDIR) -o $(TMPDIR)/polyglot_test c_bindings/tests/polyglot_test.c -lpolyglot
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
rm -rf $(TMPDIR)

install: clib
mkdir -p $(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
install -p -m755 $(CLIB_SO_DEV_RELEASE) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
ln -sfv $(CLIB_SO_FULL) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MAN)
ln -sfv $(CLIB_SO_FULL) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_DEV)
mkdir -p $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_HEADER))
install -p -v -m644 $(CLIB_HEADER) $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_HEADER))
mkdir -p $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$(shell basename $(CLIB_PKG_CONFIG))
install -p -v -m644 $(CLIB_PKG_CONFIG) $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$(shell basename $(CLIB_PKG_CONFIG))

uninstall:
- rm -rfv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_DEV)
- rm -rfv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MAN)
- rm -rfv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
- rm -rfv $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_HEADER))
- rm -rfv $(DESTDIR)$(INCLUDE_DIR)/$(shell basename $(CLIB_PKG_CONFIG))
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<br/>
<div align="center">
<a href="https://github.com/loopholelabs/polyglot">
<img src="images/logo.png" alt="Logo" width="120" height="130">
<img src="images/logo.png" alt="Logo" height="130">
</a>
<h3 align="center">Polyglot</h3>
<p align="center">
<h4 align="center">
A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages.
</p>
</h4>

[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Discord](https://dcbadge.vercel.app/api/server/JYmFhtdPeu?style=flat)](https://loopholelabs.io/discord)
Expand Down
22 changes: 22 additions & 0 deletions c_bindings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "c_bindings"
version = "1.1.4"
edition = "2021"
description="A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages."
license = "Apache-2.0"
repository = "https://github.com/loopholelabs/polyglot"
readme = "README.md"
keywords = ["polyglot", "serialization", "deserialization", "encoding", "decoding"]

[lib]
path = "lib.rs"
name = "polyglot"
crate-type = ["cdylib"]

[dependencies]
polyglot_rs = { path = "../" }

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
Loading