Skip to content

Commit

Permalink
unicode_names2_generator as build dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone authored and progval committed Mar 3, 2023
1 parent d947e44 commit 8b4bcc5
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 21,956 deletions.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ O(length of name).)

exclude = [
"data/*",
"generator/*",
]

[workspace]
members = [".", "generator"]

[features]
default = []

Expand All @@ -39,3 +41,6 @@ version = ">=0.3, <0.7"
[dev-dependencies]
rand = "0.8.5"
rand_xorshift = "0.3.0"

[build-dependencies]
unicode_names2_generator = { path = "generator" }
16 changes: 16 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use std::{env, path::PathBuf};
use unicode_names2_generator as generator;

fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
{
let mut generated_path = out_dir.clone();
generated_path.push("generated.rs");
generator::generate(Some(&generated_path), None);
}
{
let mut generated_phf_path = out_dir.clone();
generated_phf_path.push("generated_phf.rs");
generator::generate_phf(Some(&generated_phf_path), None, 3, 2);
}
}
124 changes: 0 additions & 124 deletions generator/Cargo.lock

This file was deleted.

3 changes: 1 addition & 2 deletions generator/src/formatting.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::fmt::Debug;
use std::io::prelude::*;
use std::{fmt::Debug, io::prelude::*};

static LINE_LIMIT: usize = 95;

Expand Down
15 changes: 8 additions & 7 deletions generator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use formatting::Context;
use std::collections::{hash_map, HashMap};
use std::fs::{self, File};
use std::io::prelude::*;
use std::io::{self, BufWriter};
use std::iter::repeat;
use std::path::Path;
use std::{char, cmp};
use std::{
char, cmp,
collections::{hash_map, HashMap},
fs::{self, File},
io::{self, prelude::*, BufWriter},
iter::repeat,
path::Path,
};

macro_rules! w {
($ctxt: expr, $($tt: tt)*) => {
Expand Down
3 changes: 1 addition & 2 deletions generator/src/trie.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::hash_map::{self, Entry};
use std::collections::HashMap;
use std::collections::hash_map::{self, Entry, HashMap};

pub struct Trie {
children: HashMap<u8, Trie>,
Expand Down
Loading

0 comments on commit 8b4bcc5

Please sign in to comment.