Skip to content

Commit

Permalink
Restructure repository
Browse files Browse the repository at this point in the history
Rather than having `time` be the special-cased top level crate, make it
no different than `time-macros`. Nearly all configuration is in the new
directory.

This removes the reference to the README from `time-macros`, as the
crate should never be relied upon directly. The description is updated
to reflect this.
  • Loading branch information
jhpratt committed Oct 6, 2022
1 parent 29dae79 commit fcbad1d
Show file tree
Hide file tree
Showing 112 changed files with 99 additions and 85 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
| jq -r '${{ matrix.kind.query }} | map("--target " + .) | join(" ")' \
| xargs -d" " \
cargo hack check \
-p time \
--no-dev-deps \
--feature-powerset \
--optional-deps \
Expand All @@ -141,7 +142,7 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Type-check benchmarks
run: cargo check --benches --all-features
run: cargo check -p time --benches --all-features
env:
RUSTFLAGS: --cfg bench

Expand Down Expand Up @@ -185,7 +186,7 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --all-features
run: cargo test -p time --all-features

cross-build:
name: Cross-build
Expand All @@ -209,7 +210,7 @@ jobs:

# We're testing the linking, so running `cargo check` is insufficient.
- name: Cross-build tests
run: cargo build --tests --all-features --target x86_64-pc-windows-gnu
run: cargo build -p time --tests --all-features --target x86_64-pc-windows-gnu

fmt:
name: Formatting
Expand Down Expand Up @@ -288,7 +289,7 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Document public API
run: cargo doc --all-features --no-deps -Zrustdoc-map
run: cargo doc -p time --all-features --no-deps -Zrustdoc-map
env:
RUSTDOCFLAGS: --cfg __time_03_docs

Expand All @@ -308,7 +309,7 @@ jobs:
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.master_branch)

- name: Document internal API
run: cargo doc --all-features --no-deps -Zrustdoc-map --document-private-items
run: cargo doc -p time --all-features --no-deps -Zrustdoc-map --document-private-items
env:
RUSTDOCFLAGS: --cfg __time_03_docs --document-hidden-items

Expand Down Expand Up @@ -354,7 +355,7 @@ jobs:
- name: Generate coverage report
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov test --no-report --all-features -- --test-threads=1
cargo llvm-cov test -p time --no-report --all-features -- --test-threads=1
cargo llvm-cov report --lcov > lcov.txt
env:
RUSTFLAGS: --cfg __ui_tests
Expand Down
81 changes: 5 additions & 76 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,82 +1,11 @@
[workspace]
members = ["time-macros"]
default-members = ["time"]
members = [
"time",
"time-macros",
]
resolver = "2"

[package]
name = "time"
version = "0.3.15"
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
edition = "2021"
rust-version = "1.60.0"
repository = "https://github.com/time-rs/time"
homepage = "https://time-rs.github.io"
keywords = ["date", "time", "calendar", "duration"]
categories = ["date-and-time", "no-std", "parser-implementations", "value-formatting"]
readme = "README.md"
license = "MIT OR Apache-2.0"
description = "Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std]."
include = ["src/**/*", "LICENSE-*", "README.md", "!src/tests.rs"]

[lib]
bench = false

[package.metadata.docs.rs]
all-features = true
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "__time_03_docs"]

[features]
default = ["std"]
alloc = ["serde?/alloc"]
formatting = ["dep:itoa", "std", "time-macros?/formatting"]
large-dates = ["time-macros?/large-dates"]
local-offset = ["std"]
macros = ["dep:time-macros"]
parsing = ["time-macros?/parsing"]
quickcheck = ["dep:quickcheck", "alloc"]
rand = ["dep:rand"]
serde = ["dep:serde", "time-macros?/serde"]
serde-human-readable = ["serde", "formatting", "parsing"]
# Deprecated in favor of `serde-human-readable`.
serde-well-known = ["serde-human-readable"]
std = ["alloc"]
wasm-bindgen = ["dep:js-sys"]

# If adding an optional dependency, be sure to use the `dep:` prefix above to avoid an implicit
# feature gate.
[dependencies]
itoa = { version = "1.0.1", optional = true }
quickcheck = { version = "1.0.3", default-features = false, optional = true }
rand = { version = "0.8.4", optional = true, default-features = false }
serde = { version = "1.0.126", optional = true, default-features = false }
time-macros = { version = "=0.2.4", path = "time-macros", optional = true }

[target.'cfg(target_family = "unix")'.dependencies]
libc = "0.2.98"
num_threads = "0.1.2"

[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
js-sys = { version = "0.3.58", optional = true }

[dev-dependencies]
rand = { version = "0.8.4", default-features = false }
serde = { version = "1.0.126", default-features = false, features = ["derive"] }
serde_json = "1.0.68"
serde_test = "1.0.126"
quickcheck_macros = "1.0.0"

[target.'cfg(__ui_tests)'.dev-dependencies]
trybuild = "1.0.68"

[target.'cfg(bench)'.dev-dependencies]
criterion = { version = "0.4.0", default-features = false }

# Significant contributions to the benchmarks provided by Emil Lundberg.
[[bench]]
name = "benchmarks"
harness = false
path = "benchmarks/main.rs"

[profile.dev]
debug = 0

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![codecov](https://codecov.io/gh/time-rs/time/branch/main/graph/badge.svg?token=yt4XSmQNKQ)](https://codecov.io/gh/time-rs/time)

Documentation:

- [latest release](https://docs.rs/time)
- [main branch](https://time-rs.github.io/api/time)
- [book](https://time-rs.github.io/book)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/integration/main.rs → tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@ mod weekday;
#[test]
fn compile_fail() {
let tests = trybuild::TestCases::new();
tests.compile_fail("tests/integration/compile-fail/*.rs");
// Path is relative from `time/Cargo.toml`.
tests.compile_fail("../tests/compile-fail/*.rs");
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions time-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ rust-version = "1.60.0"
repository = "https://github.com/time-rs/time"
keywords = ["date", "time", "calendar", "duration"]
categories = ["date-and-time"]
readme = "../README.md"
license = "MIT OR Apache-2.0"
description = "Procedural macros for the time crate."
description = """
Procedural macros for the time crate.
This crate is an implementation detail and should not be relied upon directly.
"""

[features]
formatting = []
Expand Down
78 changes: 78 additions & 0 deletions time/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[package]
name = "time"
version = "0.3.15"
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
edition = "2021"
rust-version = "1.60.0"
repository = "https://github.com/time-rs/time"
homepage = "https://time-rs.github.io"
keywords = ["date", "time", "calendar", "duration"]
categories = ["date-and-time", "no-std", "parser-implementations", "value-formatting"]
readme = "../README.md"
license = "MIT OR Apache-2.0"
description = "Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std]."
include = ["src/**/*", "LICENSE-*", "README.md", "!src/tests.rs"]

[lib]
bench = false

[package.metadata.docs.rs]
all-features = true
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "__time_03_docs"]

[features]
default = ["std"]
alloc = ["serde?/alloc"]
formatting = ["dep:itoa", "std", "time-macros?/formatting"]
large-dates = ["time-macros?/large-dates"]
local-offset = ["std"]
macros = ["dep:time-macros"]
parsing = ["time-macros?/parsing"]
quickcheck = ["dep:quickcheck", "alloc"]
rand = ["dep:rand"]
serde = ["dep:serde", "time-macros?/serde"]
serde-human-readable = ["serde", "formatting", "parsing"]
# Deprecated in favor of `serde-human-readable`.
serde-well-known = ["serde-human-readable"]
std = ["alloc"]
wasm-bindgen = ["dep:js-sys"]

# If adding an optional dependency, be sure to use the `dep:` prefix above to avoid an implicit
# feature gate.
[dependencies]
itoa = { version = "1.0.1", optional = true }
quickcheck = { version = "1.0.3", default-features = false, optional = true }
rand = { version = "0.8.4", optional = true, default-features = false }
serde = { version = "1.0.126", optional = true, default-features = false }
time-macros = { version = "=0.2.4", path = "../time-macros", optional = true }

[target.'cfg(target_family = "unix")'.dependencies]
libc = "0.2.98"
num_threads = "0.1.2"

[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
js-sys = { version = "0.3.58", optional = true }

[dev-dependencies]
rand = { version = "0.8.4", default-features = false }
serde = { version = "1.0.126", default-features = false, features = ["derive"] }
serde_json = "1.0.68"
serde_test = "1.0.126"
quickcheck_macros = "1.0.0"

[target.'cfg(__ui_tests)'.dev-dependencies]
trybuild = "1.0.68"

[target.'cfg(bench)'.dev-dependencies]
criterion = { version = "0.4.0", default-features = false }

# Significant contributions to the benchmarks provided by Emil Lundberg.
[[bench]]
name = "benchmarks"
harness = false
path = "../benchmarks/main.rs"

[[test]]
name = "tests"
path = "../tests/main.rs"
1 change: 1 addition & 0 deletions time/LICENSE-Apache
1 change: 1 addition & 0 deletions time/LICENSE-MIT
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit fcbad1d

Please sign in to comment.