Skip to content

Commit ff5f814

Browse files
committed
Replace build script with private crate
Closes GH-34. Closes GH-35.
1 parent 60410a4 commit ff5f814

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
with:
1212
toolchain: stable
1313
components: rustfmt, clippy
14+
- run: cargo run --manifest-path generate/Cargo.toml
1415
- run: cargo fmt --check && cargo clippy --examples --tests --benches
1516
- run: cargo test
1617
coverage:
@@ -20,5 +21,6 @@ jobs:
2021
- uses: actions-rs/toolchain@v1
2122
with:
2223
toolchain: stable
24+
- run: cargo run --manifest-path generate/Cargo.toml
2325
- run: cargo install cargo-tarpaulin && cargo tarpaulin --out Xml
2426
- uses: codecov/codecov-action@v3

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ harness = false
2121
log = "0.4"
2222
unicode-id = { version = "0.3", features = ["no_std"] }
2323

24-
2524
[dev-dependencies]
2625
env_logger = "0.10"
2726
criterion = "0.4"
@@ -33,7 +32,5 @@ swc_core = { version = "0.43.30", features = [
3332
"common",
3433
] }
3534

36-
[build-dependencies]
37-
regex = "1"
38-
reqwest = "0.11"
39-
tokio = { version = "1", features = ["full"] }
35+
[workspace]
36+
members = ["generate"]

generate/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "markdown-generate"
3+
version = "0.0.0"
4+
authors = ["Titus Wormer <[email protected]>"]
5+
edition = "2018"
6+
publish = false
7+
8+
[dependencies]
9+
regex = "1"
10+
reqwest = "0.11"
11+
tokio = { version = "1", features = ["full"] }

build.rs renamed to generate/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// To regenerate, run the following from the repository root:
2+
//
3+
// ```sh
4+
// cargo run --manifest-path generate/Cargo.toml
5+
// ```
6+
17
use regex::Regex;
28
use std::fs;
39

@@ -63,7 +69,7 @@ async fn commonmark() {
6369
let doc = format!(
6470
"//! `CommonMark` test suite.
6571
66-
// > 👉 **Important**: this module is generated by `build.rs`.
72+
// > 👉 **Important**: this module is generated by `generate/src/main.rs`.
6773
// > It is generate from the latest CommonMark website.
6874
6975
use markdown::{{to_html_with_options, CompileOptions, Options}};
@@ -130,7 +136,7 @@ async fn punctuation() {
130136
131137
/// List of characters that are considered punctuation.
132138
///
133-
/// > 👉 **Important**: this module is generated by `build.rs`.
139+
/// > 👉 **Important**: this module is generated by `generate/src/main.rs`.
134140
/// > It is generate from the latest Unicode data.
135141
///
136142
/// Rust does not contain an `is_punctuation` method on `char`, while it does

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ Fuzz testing is used to check for things that might fall through coverage.
241241

242242
The following bash scripts are useful when working on this project:
243243

244+
* generate code (latest CM tests and Unicode info):
245+
```sh
246+
cargo run --manifest-path generate/Cargo.toml
247+
```
244248
* run examples:
245249
```sh
246250
RUST_BACKTRACE=1 RUST_LOG=debug cargo run --example lib

src/util/unicode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
/// List of characters that are considered punctuation.
44
///
5-
/// > 👉 **Important**: this module is generated by `build.rs`.
5+
/// > 👉 **Important**: this module is generated by `generate/src/main.rs`.
66
/// > It is generate from the latest Unicode data.
77
///
88
/// Rust does not contain an `is_punctuation` method on `char`, while it does

tests/commonmark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! `CommonMark` test suite.
22
3-
// > 👉 **Important**: this module is generated by `build.rs`.
3+
// > 👉 **Important**: this module is generated by `generate/src/main.rs`.
44
// > It is generate from the latest CommonMark website.
55

66
use markdown::{to_html_with_options, CompileOptions, Options};

0 commit comments

Comments
 (0)