Netlify shouldn't build the editor

...and anyway it can't, because it's missing the
xcb-shape and xcb-xfixes libraries.
This commit is contained in:
Richard Feldman 2021-06-06 01:12:11 -04:00
parent 3684488629
commit d7b64b000d
2 changed files with 16 additions and 5 deletions

View file

@ -15,11 +15,12 @@ test = false
bench = false bench = false
[features] [features]
default = ["target-x86", "llvm"] default = ["target-x86", "llvm", "editor"]
# This is a separate feature because when we generate docs on Netlify, # This is a separate feature because when we generate docs on Netlify,
# it doesn't have LLVM installed. (Also, it doesn't need to do code gen.) # it doesn't have LLVM installed. (Also, it doesn't need to do code gen.)
llvm = ["inkwell", "roc_gen", "roc_build/llvm"] llvm = ["inkwell", "roc_gen", "roc_build/llvm"]
editor = ["roc_editor"]
target-x86 = [] target-x86 = []
@ -53,7 +54,7 @@ roc_gen = { path = "../compiler/gen", optional = true }
roc_build = { path = "../compiler/build", default-features = false } roc_build = { path = "../compiler/build", default-features = false }
roc_fmt = { path = "../compiler/fmt" } roc_fmt = { path = "../compiler/fmt" }
roc_reporting = { path = "../compiler/reporting" } roc_reporting = { path = "../compiler/reporting" }
roc_editor = { path = "../editor" } roc_editor = { path = "../editor", optional = true }
# TODO switch to clap 3.0.0 once it's out. Tried adding clap = "~3.0.0-beta.1" and cargo wouldn't accept it # TODO switch to clap 3.0.0 once it's out. Tried adding clap = "~3.0.0-beta.1" and cargo wouldn't accept it
clap = { git = "https://github.com/rtfeldman/clap", branch = "master" } clap = { git = "https://github.com/rtfeldman/clap", branch = "master" }
const_format = "0.2.8" const_format = "0.2.8"

View file

@ -19,7 +19,7 @@ fn main() -> io::Result<()> {
let exit_code = match matches.subcommand_name() { let exit_code = match matches.subcommand_name() {
None => { None => {
roc_editor::launch(&[])?; launch_editor(&[])?;
// rustc couldn't infer the error type here // rustc couldn't infer the error type here
Result::<i32, io::Error>::Ok(0) Result::<i32, io::Error>::Ok(0)
@ -52,14 +52,14 @@ fn main() -> io::Result<()> {
.values_of_os(DIRECTORY_OR_FILES) .values_of_os(DIRECTORY_OR_FILES)
{ {
None => { None => {
roc_editor::launch(&[])?; launch_editor(&[])?;
} }
Some(values) => { Some(values) => {
let paths = values let paths = values
.map(|os_str| Path::new(os_str)) .map(|os_str| Path::new(os_str))
.collect::<Vec<&Path>>(); .collect::<Vec<&Path>>();
roc_editor::launch(&paths)?; launch_editor(&paths)?;
} }
} }
@ -86,3 +86,13 @@ fn main() -> io::Result<()> {
std::process::exit(exit_code); std::process::exit(exit_code);
} }
#[cfg(feature = "editor")]
fn launch_editor(filepaths: &[&Path]) -> io::Result<()> {
roc_editor::launch(filepaths)
}
#[cfg(not(feature = "editor"))]
fn launch_editor(_filepaths: &[&Path]) -> io::Result<()> {
panic!("Cannot launch the editor because this build of roc did not include `feature = \"editor\"`!");
}