Skip to content

Commit 1a930f8

Browse files
committed
tools/prost-build: update edition, remove clap
Clap is a big dependency, but we have very simple needs. We remove it to reduce the compile time.
1 parent e283074 commit 1a930f8

File tree

4 files changed

+10
-176
lines changed

4 files changed

+10
-176
lines changed

messages/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ add_custom_command(
3333
# Using prost-build the normal way as part of build.rs does not work due to a cargo bug:
3434
# https://github.com/danburkert/prost/issues/344#issuecomment-650721245
3535
COMMAND
36-
${PROST_BUILD} --messages-dir=${CMAKE_CURRENT_SOURCE_DIR} --out-dir=${CMAKE_SOURCE_DIR}/src/rust/bitbox02-rust/src/
36+
${PROST_BUILD} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/rust/bitbox02-rust/src/
3737
)
3838

3939
add_custom_target(

tools/prost-build/Cargo.lock

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

tools/prost-build/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
name = "prost-build"
1717
version = "0.1.0"
1818
authors = ["Shift Crypto AG <[email protected]>"]
19-
edition = "2018"
19+
edition = "2021"
2020
license = "Apache-2.0"
2121

22-
[dependencies]
23-
clap = "3.0.0-beta.1"
24-
2522
[dependencies.prost-build]
2623
# keep version in sync with src/rust/bitbox02-rust/Cargo.toml
2724
version = "0.7.0"

tools/prost-build/src/main.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use clap::Clap;
16-
17-
#[derive(Clap)]
18-
struct Opts {
19-
#[clap(long)]
20-
messages_dir: String,
21-
#[clap(long)]
22-
out_dir: String,
23-
}
15+
use std::env;
2416

2517
fn main() {
26-
let opts: Opts = Opts::parse();
18+
let args: Vec<String> = env::args().collect();
19+
let messages_dir = &args[1];
20+
let out_dir = &args[2];
2721
let mut config = prost_build::Config::new();
28-
config.out_dir(opts.out_dir);
22+
config.out_dir(out_dir);
2923
config
30-
.compile_protos(&["hww.proto", "backup.proto"], &[&opts.messages_dir])
24+
.compile_protos(&["hww.proto", "backup.proto"], &[messages_dir])
3125
.unwrap();
3226
}

0 commit comments

Comments
 (0)