1 #![allow(unreachable_pub)]
5 use crate::install
::{ClientOpt, Malloc, ServerOpt}
;
10 /// Run custom build command.
13 /// Install rust-analyzer server or editor plugin.
15 /// Install only VS Code plugin.
17 /// One of 'code', 'code-exploration', 'code-insiders', 'codium', or 'code-oss'.
18 optional
--code
-bin name
: String
20 /// Install only the language server.
22 /// Use mimalloc allocator for server
24 /// Use jemalloc allocator for server
37 optional
--client
-patch
-version version
: String
39 /// Read a changelog AsciiDoc file and update the GitHub Releases entry in Markdown.
40 cmd publish
-release
-notes
{
41 /// Only run conversion and show the result.
43 /// Target changelog file.
44 required changelog
: String
47 optional measurement_type
: MeasurementType
49 /// Builds a benchmark version of rust-analyzer and puts it into `./target`.
51 required suffix
: String
57 // The following code is generated by `xflags` macro.
58 // Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
61 pub subcommand
: XtaskCmd
,
71 PublishReleaseNotes(PublishReleaseNotes
),
79 pub code_bin
: Option
<String
>,
100 pub client_patch_version
: Option
<String
>,
104 pub struct PublishReleaseNotes
{
105 pub changelog
: String
,
111 pub enum MeasurementType
{
120 impl FromStr
for MeasurementType
{
122 fn from_str(s
: &str) -> Result
<Self, Self::Err
> {
124 "build" => Ok(Self::Build
),
125 "self" => Ok(Self::AnalyzeSelf
),
126 "ripgrep-13.0.0" => Ok(Self::AnalyzeRipgrep
),
127 "webrender-2022" => Ok(Self::AnalyzeWebRender
),
128 "diesel-1.4.8" => Ok(Self::AnalyzeDiesel
),
129 "hyper-0.14.18" => Ok(Self::AnalyzeHyper
),
130 _
=> Err("Invalid option".to_string()),
134 impl AsRef
<str> for MeasurementType
{
135 fn as_ref(&self) -> &str {
137 Self::Build
=> "build",
138 Self::AnalyzeSelf
=> "self",
139 Self::AnalyzeRipgrep
=> "ripgrep-13.0.0",
140 Self::AnalyzeWebRender
=> "webrender-2022",
141 Self::AnalyzeDiesel
=> "diesel-1.4.8",
142 Self::AnalyzeHyper
=> "hyper-0.14.18",
149 pub measurement_type
: Option
<MeasurementType
>,
159 pub fn from_env_or_exit() -> Self {
160 Self::from_env_or_exit_()
164 pub fn from_env() -> xflags
::Result
<Self> {
169 pub fn from_vec(args
: Vec
<std
::ffi
::OsString
>) -> xflags
::Result
<Self> {
170 Self::from_vec_(args
)
176 pub(crate) fn server(&self) -> Option
<ServerOpt
> {
177 if self.client
&& !self.server
{
180 let malloc
= if self.mimalloc
{
182 } else if self.jemalloc
{
187 Some(ServerOpt { malloc }
)
189 pub(crate) fn client(&self) -> Option
<ClientOpt
> {
190 if !self.client
&& self.server
{
193 Some(ClientOpt { code_bin: self.code_bin.clone() }
)