1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! `cargo rahti native …` — handing over to the optional packaging tool.
//!
//! Native packaging lives in a separate executable, `cargo-rahti-native`, and
//! that separation is the whole of what makes it optional: `cargo-rahti` is
//! what every Rahti project uses, and nothing here depends on Tauri, on an
//! Android SDK, or on `rahti-native`. This file is a `Command` spawn.
//!
//! ## Why the delegation exists at all
//!
//! Cargo already dispatches `cargo rahti-native …` to the installed binary on
//! its own — a `cargo-<name>` executable on `PATH` becomes `cargo <name>`, no
//! cooperation needed. So this adds nothing cargo cannot do.
//!
//! What it adds is the answer to a person who types the obvious thing.
//! `cargo rahti new` and `cargo rahti upgrade` exist, so `cargo rahti native`
//! is what somebody tries, and without this they get "`native` is not a
//! cargo-rahti command" — which is true and tells them nothing. With it they
//! get the tool, or the one line that installs it.
//!
//! ## What it will not do
//!
//! Install anything. A tool that reacted to a missing dependency by fetching
//! and running one is a tool that decides what runs on somebody's machine.
//! The message names the command; the person runs it.
use PathBuf;
use ;
/// The executable this forwards to.
pub const HELPER: &str = "cargo-rahti-native";
/// Run `cargo-rahti-native native <args>`, and exit with whatever it exits
/// with.
///
/// The leading `native` is kept rather than stripped: the helper accepts it
/// among the words cargo's own dispatch would have put there, so one argument
/// vector serves both routes in.
/// What to print when the helper is not installed.
///
/// Separated from the spawning so the wording can be tested, because the
/// wording is the entire value of this file.
/// Where to find the helper.
///
/// Beside this executable first, then `PATH`.
///
/// The sibling case is not a convenience: `cargo install` puts both binaries
/// in the same directory, and a workspace checkout puts both in the same
/// `target/debug`. Looking there first means a person testing a local build of
/// one gets the local build of the other, rather than whichever version they
/// happen to have installed globally.