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

Restructure repository to contain the rc crate as well #39

Merged
merged 2 commits into from
Aug 30, 2018
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
dist/
**/*.rs.bk
Cargo.lock
/im-rc
26 changes: 18 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -6,13 +6,23 @@ rust:
cache:
directories:
- /home/travis/.cargo
- /home/travis/target

env:
- CRATE=im
- CRATE=im-rc

install:
- rustup toolchain add nightly
- rustup component add --toolchain nightly clippy-preview; true
script:
- cargo +nightly clippy -- -D warnings
- cargo test
- cargo clean
- IM_TEST_RC=1 cargo test
- mkdir -p .cargo && echo '[build]' > .cargo/config && echo 'target-dir = "/home/travis/target"' >> .cargo/config
- ./build-releases.sh
- cd im-rc; cargo test --tests

script: cd dist/latest/$CRATE; cargo test

matrix:
include:
- env: CLIPPY=1
rust: nightly
install:
- rustup toolchain add nightly
- rustup component add --toolchain nightly clippy-preview; true
script: cargo +nightly clippy -- -D warnings
37 changes: 37 additions & 0 deletions Cargo.toml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "CRATE"
version = "VERSION"
authors = ["Bodil Stokke <bodil@bodil.org>"]
license = "MPL-2.0+"
description = "DESCRIPTION"
repository = "https://github.com/bodil/im-rs"
documentation = "http://immutable.rs/"
homepage = "http://immutable.rs/"
readme = "BASE/README.md"
categories = ["data-structures"]
keywords = ["immutable", "persistent", "hamt", "b-tree", "rrb-tree"]
build = "BASE/build.rs"

[lib]
path = "BASE/src/lib.rs"

[badges]
travis-ci = { repository = "bodil/im-rs" }

[build-dependencies]
rustc_version = "0.2"

[dependencies]
quickcheck = { version = "0.6", optional = true }
proptest = { version = "0.8", optional = true }
serde = { version = "1.0", optional = true }
rayon = { version = "1.0", optional = true }

[dev-dependencies]
quickcheck = "0.6"
proptest = "0.8"
serde = "1.0"
serde_json = "1.0"
rayon = "1.0"
rand = "0.5"
pretty_assertions = "0.5"
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
update-toml: Cargo.toml rc/Cargo.toml
.PHONY: update-toml

build-releases: build-releases.sh update-toml
./build-releases.sh
.PHONY: build-releases

release: build-releases
cd dist/latest/im && cargo publish
cd dist/latest/im-rc && cargo publish
.PHONY: release

Cargo.toml: Cargo.toml.in VERSION Makefile
m4 -D BASE=. -D "VERSION=$$(< VERSION)" -D CRATE=im -D DESCRIPTION="Immutable collection datatypes" $< > $@

rc/Cargo.toml: Cargo.toml.in VERSION Makefile
m4 -D BASE=.. -D "VERSION=$$(< VERSION)" -D CRATE=im-rc -D DESCRIPTION="Immutable collection datatypes (the fast but not thread safe version)" $< > $@
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@

Blazing fast immutable collection datatypes for Rust.

Comes in two versions: [`im`](https://crates.io/crates/im) (thread safe) and
[`im-rc`](https://crates.io/crates/im-rc) (fast but not thread safe).

## Documentation

* [API docs](https://docs.rs/im/)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11.0.2
36 changes: 27 additions & 9 deletions build-releases.sh
Original file line number Diff line number Diff line change
@@ -3,18 +3,36 @@
PROJECT_ROOT=`git rev-parse --show-toplevel`
PREVIOUS_CWD=`pwd`

VERSION="$1"

# If no version is given use the same
if [ "x$VERSION" == x ]; then
VERSION=$(perl -ne 'if (/^version = \"(.*)\"/) { print $1 . "\n" }' Cargo.toml)
fi

cd $PROJECT_ROOT

# get version from im
VERSION=`sed -n 's/^version *= *"\(.*\)"/\1/p' Cargo.toml`
# create a release folder
rm -rf "dist/$VERSION"
mkdir -p "dist/$VERSION"
cd "dist/$VERSION"

# create variations
for VARIATION in im im-rc; do
mkdir $VARIATION
cp -a ../../src ../../build.rs ../../README.md $VARIATION
if [ "$VARIATION" == "im-rc" ]; then
cp -a ../../rc/Cargo.toml $VARIATION
find "$VARIATION" -name '*.rs' -exec perl -pi -e "s/\bextern crate im\b/extern crate im_rc as im/g" "{}" \;
else
cp -a ../../Cargo.toml $VARIATION
fi
perl -pi -e "s/^version = \".*\"/version = \"$VERSION\"/" $VARIATION/Cargo.toml
perl -pi -e "s/\"..\//\"/g" $VARIATION/Cargo.toml
done

# generate im-sync
rm -rf im-rc
mkdir im-rc
cp -a src Cargo.toml build.rs README.md im-rc/
sed -ie 's/^name = "im"/name = "im-rc"/' im-rc/Cargo.toml
sed -ie 's/^description = "\(.*\)"/description = "\1 (the fast but not thread safe version)"/' im-rc/Cargo.toml
sed -ie "s/^version = \".*\"/version = \"$VERSION\"/" im-rc/Cargo.toml
# ln the latest
(cd .. && ln -fs "$VERSION" latest)

# reset env
cd $PREVIOUS_CWD
37 changes: 37 additions & 0 deletions rc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "im-rc"
version = "11.0.1"
authors = ["Bodil Stokke <bodil@bodil.org>"]
license = "MPL-2.0+"
description = "Immutable collection datatypes (the fast but not thread safe version)"
repository = "https://github.com/bodil/im-rs"
documentation = "http://immutable.rs/"
homepage = "http://immutable.rs/"
readme = "../README.md"
categories = ["data-structures"]
keywords = ["immutable", "persistent", "hamt", "b-tree", "rrb-tree"]
build = "../build.rs"

[lib]
path = "../src/lib.rs"

[badges]
travis-ci = { repository = "bodil/im-rs" }

[build-dependencies]
rustc_version = "0.2"
regex = "1.0"
walkdir = "2.2"

[dependencies]
quickcheck = { version = "0.6", optional = true }
proptest = { version = "0.8", optional = true }
serde = { version = "1.0", optional = true }

[dev-dependencies]
quickcheck = "0.6"
proptest = "0.8"
serde = "1.0"
serde_json = "1.0"
rand = "0.5"
pretty_assertions = "0.5"