Skip to content

Commit

Permalink
Restructure repository to contain the rc crate
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Aug 19, 2018
1 parent 4659203 commit 2498516
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 17 deletions.
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
Expand Up @@ -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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
36 changes: 27 additions & 9 deletions build-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
13 changes: 13 additions & 0 deletions set-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

PROJECT_ROOT=`git rev-parse --show-toplevel`
PREVIOUS_CWD=`pwd`

VERSION="$1"
cd $PROJECT_ROOT

# bump versions together
perl -pi -e "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml rc/Cargo.toml

# reset env
cd $PREVIOUS_CWD

0 comments on commit 2498516

Please sign in to comment.