Skip to content

Commit 6506663

Browse files
author
Gunter Schmidt
committed
Breaking: Adapting the project structure to the
coreutils structure. This allows more usage of the coreutils macros and is easier for the developers if working in both projects. Each utility can now be opened standalone which makes it also easier to test and benchmark. Since it is a restructure, the commit is containing a lot of files. All files were kept as much as possible and mostly the import locations were changed. Changes: * a workspace was introduced * main.rs is now /bin/diffutils.rs * uumain is now used as start of utility * all utilites have a separate folder under /uu * Exitcodes are now i32 and push to * coreutils only has License files for MIT * args are now read by using uucore::args_os() * context_diff and unified_diff now use TempDir * benches are separated for each utility and have centralized support functions Issues: * The uucore::bin! macro needs to be implemented for all main functions. Currently missing internationalization. * Tests must be run with "cargo test --workspace". * Unclear, if features can be defined globally.
1 parent 9dcca24 commit 6506663

40 files changed

Lines changed: 2110 additions & 722 deletions

Cargo.lock

Lines changed: 355 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 144 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,166 @@
1+
# diffutils (uutils)
2+
# * see the repository LICENSE, README, and CONTRIBUTING files for more information
3+
4+
# spell-checker:ignore (libs) ahash bigdecimal datetime serde gethostid kqueue libselinux mangen memmap uuhelp startswith constness expl unnested logind cfgs interner
5+
16
[package]
27
name = "diffutils"
3-
version = "0.5.0"
4-
edition = "2021"
5-
description = "A CLI app for generating diff files"
6-
license = "MIT OR Apache-2.0"
8+
description = "diffutils ~ GNU diffutils (updated); implemented as universal (cross-platform) utils, written in Rust"
9+
default-run = "diffutils"
710
repository = "https://github.com/uutils/diffutils"
8-
9-
[lib]
10-
name = "diffutilslib"
11-
path = "src/lib.rs"
11+
edition.workspace = true
12+
rust-version.workspace = true
13+
version.workspace = true
14+
authors.workspace = true
15+
license.workspace = true
16+
homepage.workspace = true
17+
keywords.workspace = true
18+
categories.workspace = true
1219

1320
[[bin]]
1421
name = "diffutils"
15-
path = "src/main.rs"
22+
path = "src/bin/diffutils.rs"
1623

17-
[dependencies]
24+
[features]
25+
# default = ["feat_common_core"]
26+
## OS feature shortcodes
27+
# macos = ["feat_os_macos"]
28+
# unix = ["feat_os_unix"]
29+
# windows = ["feat_os_windows"]
30+
#
31+
## (primary platforms) feature sets
32+
# "feat_os_macos" == set of utilities which can be built/run on the MacOS platform
33+
feat_os_macos = [
34+
"feat_os_unix", ## == a modern/usual *nix platform
35+
#
36+
# "feat_require_unix_hostid",
37+
]
38+
# "feat_os_unix" == set of utilities which can be built/run on modern/usual *nix platforms.
39+
feat_os_unix = [
40+
# "feat_Tier1",
41+
# #
42+
# "feat_require_unix",
43+
# "feat_require_unix_hostid",
44+
# "feat_require_unix_utmpx",
45+
]
46+
# "feat_os_windows" == set of utilities which can be built/run on modern/usual windows platforms
47+
feat_os_windows = [
48+
# "feat_Tier1", ## == "feat_os_windows_legacy" + "hostname"
49+
]
50+
#
51+
# TODO How are features centralized in this workspace file?
52+
# # instead of limiting to KiB, MiB, etc, one can write kib, mib, Mb or whatever case.
53+
# feat_allow_case_insensitive_number_units = []
54+
# # Enables a check on options defined in NOT_YET_IMPLEMENTED.
55+
# # If on the parser will return an error message in these cases.
56+
# # This is preferable when running the util as unsupported options
57+
# # are pointed out to the user, but can make tests fail.
58+
# feat_check_not_yet_implemented = []
59+
60+
[workspace]
61+
resolver = "3"
62+
members = [
63+
".",
64+
"src/uu/*",
65+
# "src/uu/stdbuf/src/libstdbuf",
66+
"src/uudiff",
67+
# "src/uucore_procs",
68+
# "tests/uutests",
69+
# "fuzz", # TODO
70+
]
71+
72+
[workspace.package]
73+
authors = ["uutils developers"]
74+
categories = ["command-line-utilities"]
75+
edition = "2021"
76+
rust-version = "1.88.0"
77+
homepage = "https://github.com/uutils/diffutils"
78+
description = "A CLI app for generating diff files"
79+
keywords = ["diffutils", "uutils", "cross-platform", "cli", "utility"]
80+
license = "MIT"
81+
# license = "MIT OR Apache-2.0"
82+
readme = "README.package.md"
83+
version = "0.5.1"
84+
85+
86+
[workspace.dependencies]
87+
assert_cmd = "2.2.0"
88+
const_format = "0.2.35"
1889
chrono = "0.4.38"
19-
diff = "0.1.13"
90+
diff_crate = { package = "diff", version = "0.1.13" }
91+
divan = { version = "4.3.0", package = "codspeed-divan-compat" }
2092
itoa = "1.0.11"
93+
predicates = "3.1.0"
94+
pretty_assertions = "1.4.0"
95+
rand = "0.10.0"
2196
regex = "1.10.4"
2297
same-file = "1.0.6"
98+
tempfile = "3.27.0"
2399
unicode-width = "0.2.0"
100+
uucore = "0.7.0"
101+
uudiff = { package = "uudiff", path = "src/uudiff" }
102+
diff = { package = "uu_diff", path = "src/uu/diff" }
103+
# sdiff = {package = "uu_sdiff", path = "src/uu/sdiff" }
104+
105+
106+
[dependencies]
107+
diff.workspace = true
108+
# sdiff.workspace = true
109+
uucore.workspace = true
110+
uudiff.workspace = true
111+
112+
# * uutils
113+
# uu_test = { optional = true, package = "uu_test", path = "src/uu/test" }
114+
#
115+
cmp = { package = "uu_cmp", path = "src/uu/cmp" }
116+
# diff3 = { package = "uu_diff3", path = "src/uu/diff3" }
117+
# sdiff = {optional = true, package = "uu_sdiff", path = "src/uu/sdiff" }
24118

25119
[dev-dependencies]
26-
assert_cmd = "2.0.14"
27-
divan = { version = "4.3.0", package = "codspeed-divan-compat" }
28-
pretty_assertions = "1.4.0"
29-
predicates = "3.1.0"
30-
rand = "0.10.0"
31-
tempfile = "3.26.0"
120+
assert_cmd.workspace = true
121+
predicates.workspace = true
122+
regex.workspace = true
123+
tempfile.workspace = true
32124

33125
[profile.release]
34-
lto = "thin"
126+
lto = true
127+
panic = "abort"
35128
codegen-units = 1
129+
130+
# A release-like profile that is as small as possible.
131+
[profile.release-small]
132+
inherits = "release"
133+
opt-level = "z"
134+
strip = true
135+
136+
[profile.release-fast]
137+
inherits = "release"
36138
panic = "abort"
37139

38-
# alias profile for 'dist'
39-
[profile.dist]
140+
# A release-like profile with debug info for profiling.
141+
# See https://github.com/mstange/samply .
142+
[profile.profiling]
40143
inherits = "release"
144+
panic = "unwind"
145+
debug = true
41146

42-
[[bench]]
43-
name = "bench_diffutils"
44-
path = "benches/bench-diffutils.rs"
45-
harness = false
147+
#
148+
# # The profile that 'dist' will build with
149+
# [profile.dist]
150+
# inherits = "release"
151+
# lto = "thin"
152+
153+
# [lints]
154+
# workspace = true
155+
#
156+
# # This is the linting configuration for all crates.
157+
# # In order to use these, all crates have `[lints] workspace = true` section.
158+
# [workspace.lints.rust]
159+
# # Allow "fuzzing" as a "cfg" condition name and "cygwin" as a value for "target_os"
160+
# # https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html
161+
# unexpected_cfgs = { level = "warn", check-cfg = [
162+
# 'cfg(fuzzing)',
163+
# 'cfg(target_os, values("cygwin"))',
164+
# ] }
165+
# unused_qualifications = "warn"
46166

47-
[features]
48-
# default = ["feat_bench_not_diff"]
49-
# Turn bench for diffutils cmp off
50-
feat_bench_not_cmp = []
51-
# Turn bench for diffutils diff off
52-
feat_bench_not_diff = []

LICENSE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) uutils developers
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LICENSE-MIT

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)