Skip to content

Commit

Permalink
tools: Start introducing build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Oct 19, 2024
1 parent 74d2981 commit 65df6c8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dora-frontend/src/program_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ impl<'a> ProgramParser<'a> {
assert!(result.is_none());
}
}

if !self.packages.contains_key("stdlib") {
let path = std::env::current_exe().expect("illegal path");
let path = path.as_path();

for ancestor in path.ancestors() {
let stdlib_path = ancestor.join("stdlib/stdlib.dora");

if stdlib_path.exists() {
self.packages.insert("stdlib".into(), stdlib_path);
break;
}
}
}
}

fn add_all_packages(&mut self) {
Expand Down
20 changes: 20 additions & 0 deletions tools/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

PROFILE=release

cargo build -p dora --profile $PROFILE
cargo build -p dora-language-server --profile $PROFILE

INSTALL_DIR=$HOME/.dora
INSTALL_DIR_BIN=$INSTALL_DIR/bin

# Remove old install
rm -rf $INSTALL_DIR

mkdir -p $INSTALL_DIR
mkdir -p $INSTALL_DIR_BIN

cp target/$PROFILE/dora $INSTALL_DIR_BIN
cp target/$PROFILE/dora-language-server $INSTALL_DIR_BIN

cp -R dora-frontend/stdlib $INSTALL_DIR

0 comments on commit 65df6c8

Please sign in to comment.