Skip to content

Commit fcdf416

Browse files
committed
Merge #202
202: More small fixes r=behnam a=behnam
2 parents 988fe90 + 44727cd commit fcdf416

File tree

54 files changed

+786
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+786
-265
lines changed

apps/cli/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ readme = "README.md"
1111

1212

1313
[dependencies]
14-
unic-ucd = { path = "../../unic/ucd/", version = "0.6.0" }
15-
unic-char-property = { path = "../../unic/char/property/", version = "0.6.0" }
14+
unic = { path = "../../unic/", version = "0.6.0" }
1615

1716
clap = "2.29"
1817
lazy_static = "1.0"

apps/cli/src/bin/unic-inspector.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
#[macro_use]
1212
extern crate clap;
13+
1314
#[macro_use]
1415
extern crate prettytable;
1516

16-
extern crate unic_char_property;
17+
extern crate unic;
1718
extern crate unic_cli;
18-
extern crate unic_ucd;
1919

2020
use clap::Arg;
2121
use prettytable::format::TableFormat;
2222
use prettytable::Table;
2323

24-
use unic_char_property::EnumeratedCharProperty;
25-
use unic_ucd::{GeneralCategory, Name};
24+
use unic::char::property::EnumeratedCharProperty;
25+
use unic::ucd::{GeneralCategory, Name};
2626

2727
fn main() {
2828
let app = app_from_crate!()

apps/cli/src/bin/unic-versions.rs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Copyright 2017 The UNIC Project Developers.
2+
//
3+
// See the COPYRIGHT file at the top-level directory of this distribution.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![forbid(unsafe_code)]
12+
13+
//! Command-line tool to list versions of UNIC components.
14+
15+
extern crate unic;
16+
17+
macro_rules! print_component_desc {
18+
( $component:tt ) => (
19+
println!("Component: {}", unic::$component::PKG_DESCRIPTION);
20+
);
21+
}
22+
23+
macro_rules! print_component_name_version {
24+
( $component:tt ) => (
25+
println!(
26+
"Package: {} ({})",
27+
unic::$component::PKG_NAME,
28+
unic::$component::PKG_VERSION
29+
);
30+
);
31+
}
32+
33+
macro_rules! print_unicode_version {
34+
( $component:tt ) => (
35+
println!(
36+
"Unicode Version: {}.{}.{}",
37+
unic::$component::UNICODE_VERSION.major,
38+
unic::$component::UNICODE_VERSION.minor,
39+
unic::$component::UNICODE_VERSION.micro
40+
);
41+
);
42+
}
43+
44+
macro_rules! print_emoji_version {
45+
( $component:tt ) => (
46+
println!(
47+
"Emoji Version: {}.{}.{}",
48+
unic::$component::EMOJI_VERSION.major,
49+
unic::$component::EMOJI_VERSION.minor,
50+
unic::$component::EMOJI_VERSION.micro
51+
);
52+
);
53+
}
54+
55+
macro_rules! print_component_info {
56+
( $component:tt ) => (
57+
print_component_desc!($component);
58+
print_component_name_version!($component);
59+
println!();
60+
);
61+
}
62+
63+
macro_rules! print_component_info_with_unicode_version {
64+
( $component:tt ) => (
65+
print_component_desc!($component);
66+
print_component_name_version!($component);
67+
print_unicode_version!($component);
68+
println!();
69+
);
70+
}
71+
72+
macro_rules! print_component_info_with_emoji_version {
73+
( $component:tt ) => (
74+
print_component_desc!($component);
75+
print_component_name_version!($component);
76+
print_emoji_version!($component);
77+
println!();
78+
);
79+
}
80+
81+
fn main() {
82+
println!("UNIC: Unicode and Internationalization Crates for Rust");
83+
println!("Package: unic ({})", unic::PKG_VERSION);
84+
println!();
85+
86+
print_component_info!(char);
87+
88+
print_component_info_with_unicode_version!(ucd);
89+
print_component_info_with_unicode_version!(bidi);
90+
print_component_info_with_unicode_version!(normal);
91+
print_component_info_with_unicode_version!(idna);
92+
93+
print_component_info_with_emoji_version!(emoji);
94+
}

etc/check-components.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2017 The UNIC Project Developers.
4+
#
5+
# See the COPYRIGHT file at the top-level directory of this distribution.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
# Since `cargo publish --all` does not exist yet, we use this dumb alternative
14+
# solution for now.
15+
#
16+
# Main downside of this approch is that there are separate `target/`
17+
# directories used for each component, increasing the test and publish process
18+
# time.
19+
20+
set -e
21+
22+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23+
. "$DIR/common.sh"
24+
25+
26+
# Steps
27+
28+
# Package all components
29+
for component in $COMPONENTS; do
30+
pkg_file="$component/src/pkg_info.rs"
31+
if [ ! -f "$pkg_file" ]
32+
then
33+
echo "Missing pkg_file: $component"
34+
fi
35+
done

etc/common.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set -e
1515

1616
# List of components, in order of dependency
1717
export COMPONENTS="
18+
unic/common
19+
1820
unic/char/property
1921
unic/char/range
2022
unic/char

unic/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ exclude = []
1414

1515
[features]
1616
default = []
17-
unstable = [] # Rust nightly features
17+
unstable = ["unic-common/unstable"] # Rust nightly features
1818
bench_it = ["unic-bidi/bench_it"]
1919
serde = ["unic-bidi/serde"]
2020

2121
[dependencies]
2222
unic-bidi = { path = "bidi/", version = "0.6.0" }
2323
unic-char = { path = "char/", version = "0.6.0", features = ["std"] }
24+
unic-common = { path = "common/", version = "0.6.0" }
2425
unic-emoji = { path = "emoji/", version = "0.6.0" }
2526
unic-idna = { path = "idna/", version = "0.6.0" }
2627
unic-normal = { path = "normal/", version = "0.6.0" }

unic/bidi/src/lib.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,23 @@ extern crate serde;
7777
#[cfg(all(feature = "serde", test))]
7878
extern crate serde_test;
7979

80+
pub use unic_ucd_bidi::UNICODE_VERSION;
81+
pub use unic_ucd_bidi::{bidi_class, BidiClass, BidiClassCategory};
82+
83+
mod pkg_info;
84+
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
85+
8086
pub mod format_chars;
87+
8188
pub mod level;
89+
pub use level::Level;
8290

8391
mod bidi_info;
84-
mod explicit;
85-
mod implicit;
86-
mod prepare;
87-
88-
pub use unic_ucd_bidi::UNICODE_VERSION;
89-
pub use unic_ucd_bidi::{bidi_class, BidiClass, BidiClassCategory};
90-
9192
pub use bidi_info::{BidiInfo, ParagraphInfo};
92-
pub use level::Level;
93-
pub use prepare::LevelRun;
9493

95-
/// UNIC component version.
96-
pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
94+
mod explicit;
9795

98-
/// UNIC component name.
99-
pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");
96+
mod implicit;
10097

101-
/// UNIC component description.
102-
pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
98+
mod prepare;
99+
pub use prepare::LevelRun;

unic/bidi/src/pkg_info.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2017 The UNIC Project Developers.
2+
//
3+
// See the COPYRIGHT file at the top-level directory of this distribution.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Package information
12+
13+
/// UNIC component version.
14+
pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
15+
16+
/// UNIC component name.
17+
pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");
18+
19+
/// UNIC component description.
20+
pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");

unic/char/property/src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,26 @@
2828
#[macro_use]
2929
extern crate unic_char_range;
3030

31-
// pub because is used in macros, called from macro call-site.
32-
pub mod tables;
33-
34-
mod macros;
3531
mod pkg_info;
36-
mod property;
37-
mod range_types;
32+
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
3833

34+
mod property;
3935
pub use self::property::{CharProperty, PartialCharProperty, TotalCharProperty};
40-
pub use self::range_types::{
36+
37+
mod range_types;
38+
pub use range_types::{
4139
BinaryCharProperty,
4240
CustomCharProperty,
4341
EnumeratedCharProperty,
4442
NumericCharProperty,
4543
NumericCharPropertyValue,
4644
};
4745

46+
mod macros;
47+
48+
// pub because is used in macros, called from macro call-site.
49+
pub mod tables;
50+
4851
// Used in macros
4952
#[doc(hidden)]
5053
pub use core::{fmt as __fmt, str as __str};
51-
52-
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};

unic/char/range/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,21 @@
5252
#[cfg(feature = "std")]
5353
extern crate core;
5454

55-
mod iter;
56-
mod macros;
5755
mod pkg_info;
56+
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
57+
58+
mod iter;
59+
pub use iter::CharIter;
60+
5861
mod range;
62+
pub use range::CharRange;
63+
64+
mod macros;
65+
5966
mod step;
6067

6168
#[cfg(feature = "fused")]
6269
mod iter_fused;
6370

6471
#[cfg(feature = "trusted-len")]
6572
mod iter_trusted_len;
66-
67-
pub use range::CharRange;
68-
pub use iter::CharIter;
69-
70-
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};

0 commit comments

Comments
 (0)