Skip to content

Commit

Permalink
Update for Rust 1.38.0 and add release instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Sep 30, 2019
1 parent b09a067 commit 680a066
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
**/*.rs.bk
**/*.rs.bk
dist/
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,25 @@ SUBCOMMANDS:

## Development

Rust 1.38.0 or newer is recommended.
Commands assume you are using [Git Bash](https://git-scm.com) on Windows:

* Run tests (avoid concurrency since the integration tests make real services):
* `cargo test -- --test-threads 1`
* Add targets:
* 32-bit: `rustup target add i686-pc-windows-msvc`
* 64-bit: `rustup target add x86_64-pc-windows-msvc`
* Build for release:
* 32-bit: `cargo build --release --target i686-pc-windows-msvc`
* 64-bit: `cargo build --release --target x86_64-pc-windows-msvc`
* Install tool for generating license bundle:
* `cargo install cargo-lichking`
* Prepare release:
```
export VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
rm -rf dist
mkdir dist
cargo build --release --target i686-pc-windows-msvc
cargo build --release --target x86_64-pc-windows-msvc
cp target/i686-pc-windows-msvc/release/shawl.exe dist/shawl-v$VERSION-win32.exe
cp target/x86_64-pc-windows-msvc/release/shawl.exe dist/shawl-v$VERSION-win64.exe
cargo lichking bundle --file dist/shawl-v$VERSION-licenses.txt
sed -i -E 's/\\\\\?\\C:\\Users\\[^\\]+/~/g' dist/shawl-v$VERSION-licenses.txt
```
4 changes: 2 additions & 2 deletions src/bin/shawl-child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Cli {
exit: Option<i32>,
}

fn prepare_logging() -> Result<(), Box<std::error::Error>> {
fn prepare_logging() -> Result<(), Box<dyn std::error::Error>> {
let mut log_file = std::env::current_exe()?;
log_file.pop();
log_file.push("shawl-child.log");
Expand Down Expand Up @@ -46,7 +46,7 @@ fn prepare_logging() -> Result<(), Box<std::error::Error>> {
Ok(())
}

fn main() -> Result<(), Box<std::error::Error>> {
fn main() -> Result<(), Box<dyn std::error::Error>> {
prepare_logging()?;
info!("********** LAUNCH **********");
let cli = Cli::from_args();
Expand Down
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ struct Cli {
sub: Subcommand,
}

fn prepare_logging(console: bool) -> Result<(), Box<std::error::Error>> {
fn prepare_logging(console: bool) -> Result<(), Box<dyn std::error::Error>> {
let mut log_file = std::env::current_exe()?;
log_file.pop();
log_file.push("shawl.log");

let mut loggers: Vec<Box<simplelog::SharedLogger>> = vec![simplelog::WriteLogger::new(
let mut loggers: Vec<Box<dyn simplelog::SharedLogger>> = vec![simplelog::WriteLogger::new(
simplelog::LevelFilter::Debug,
simplelog::ConfigBuilder::new()
.set_time_format_str("%Y-%m-%d %H:%M:%S")
Expand Down Expand Up @@ -209,7 +209,7 @@ fn construct_shawl_run_args(name: &String, opts: &CommonOpts) -> Vec<String> {
}

#[cfg(windows)]
fn main() -> Result<(), Box<std::error::Error>> {
fn main() -> Result<(), Box<dyn std::error::Error>> {
let cli = Cli::from_args();
let console = match cli.sub {
Subcommand::Run { .. } => false,
Expand Down Expand Up @@ -252,7 +252,9 @@ enum ProcessStatus {
Terminated,
}

fn check_process(child: &mut std::process::Child) -> Result<ProcessStatus, Box<std::error::Error>> {
fn check_process(
child: &mut std::process::Child,
) -> Result<ProcessStatus, Box<dyn std::error::Error>> {
match child.try_wait() {
Ok(None) => Ok(ProcessStatus::Running),
Ok(Some(status)) => match status.code() {
Expand Down

0 comments on commit 680a066

Please sign in to comment.