summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-12-08 21:23:38 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-12-08 21:23:38 +0000
commit53f2798549b1ffc2f2809f61c6c3b6b7af3f9c73 (patch)
tree43843728c7dd2d8a8559637d34afd9400ecd2688
parent160b27e6b051d89f94e3bbddb2d101c4883af831 (diff)
downloadgentoo-utils-53f2798549b1ffc2f2809f61c6c3b6b7af3f9c73.tar.gz
add rustfmt target
-rw-r--r--check_commands.txt2
-rw-r--r--meson.build14
-rw-r--r--src/atom/meson.build1
-rw-r--r--src/meson.build5
-rw-r--r--src/repo/ebuild/meson.build1
-rw-r--r--src/repo/meson.build3
-rw-r--r--src/useflag/meson.build1
7 files changed, 26 insertions, 1 deletions
diff --git a/check_commands.txt b/check_commands.txt
index 0104962..95127a2 100644
--- a/check_commands.txt
+++ b/check_commands.txt
@@ -1,5 +1,5 @@
/usr/bin/meson format --recursive --check-only
-rustfmt --edition 2024 --check $(find src -type f -name '*.rs')
+ninja rustfmt -C build
ninja rustdoc -C build
ninja clippy -C build
meson test -v unittests doctests '*repo*' '*porthole*' -C build
diff --git a/meson.build b/meson.build
index 8e712dd..389720b 100644
--- a/meson.build
+++ b/meson.build
@@ -5,9 +5,15 @@ project(
default_options: {'rust_std': '2024', 'rust_nightly': 'enabled'},
)
+rustfmt = find_program('rustfmt')
+
rust = import('rust')
fs = import('fs')
+sources = []
+
+subdir('src')
+
mon = dependency('mon-0.1-rs')
get = dependency('get-0.1-rs')
itertools = dependency('itertools-0.14-rs')
@@ -20,6 +26,14 @@ gentoo_utils = static_library(
link_with: [thiserror],
)
+custom_target(
+ 'rustfmt',
+ input: sources,
+ output: 'rustfmt',
+ command: [rustfmt, '--edition=2024', '--check', '@INPUT@'],
+ build_always_stale: true,
+)
+
if get_option('tests').enabled()
rust.test('unittests', gentoo_utils)
subdir('tests')
diff --git a/src/atom/meson.build b/src/atom/meson.build
new file mode 100644
index 0000000..a7331a8
--- /dev/null
+++ b/src/atom/meson.build
@@ -0,0 +1 @@
+sources += files('mod.rs', 'parsers.rs')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..33a09de
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,5 @@
+sources += files('lib.rs')
+
+subdir('atom')
+subdir('repo')
+subdir('useflag')
diff --git a/src/repo/ebuild/meson.build b/src/repo/ebuild/meson.build
new file mode 100644
index 0000000..a7331a8
--- /dev/null
+++ b/src/repo/ebuild/meson.build
@@ -0,0 +1 @@
+sources += files('mod.rs', 'parsers.rs')
diff --git a/src/repo/meson.build b/src/repo/meson.build
new file mode 100644
index 0000000..c1be7a7
--- /dev/null
+++ b/src/repo/meson.build
@@ -0,0 +1,3 @@
+sources += files('mod.rs')
+
+subdir('ebuild')
diff --git a/src/useflag/meson.build b/src/useflag/meson.build
new file mode 100644
index 0000000..a7331a8
--- /dev/null
+++ b/src/useflag/meson.build
@@ -0,0 +1 @@
+sources += files('mod.rs', 'parsers.rs')