From 54a35d632e7d5ee8ff0129864a929899fce48e5e Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 3 Sep 2020 12:22:02 -0400 Subject: [PATCH] other: Windows compilation stuff (#222) Some Windows compilation/deploy stuff. Mostly just a catch-all for some chores. --- .cargo/config.toml | 4 +- .github/ISSUE_TEMPLATE/bug_report.md | 4 +- .travis.yml | 75 ++++++++++--------- .vscode/settings.json | 1 + .../windows/choco/bottom.nuspec.template | 4 + 5 files changed, 49 insertions(+), 39 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 7a79ed3a..811ae258 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,8 @@ [target.x86_64-pc-windows-msvc] -rustflags = ["-Ctarget-feature=+crt-static"] +rustflags = ["-C", "target-feature=+crt-static"] [target.i686-pc-windows-msvc] -rustflags = ["-Ctarget-feature=+crt-static"] +rustflags = ["-C", "target-feature=+crt-static"] [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 94247421..38aadecd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -29,7 +29,7 @@ _If relevant, please provide information on:_ **System Info:** -_Information about your system specifically (in case I have to replicate your system via VM):_ +_Information about your system specifically (sometimes this matters...):_ - _Total RAM:_ @@ -39,6 +39,8 @@ _Information about your system specifically (in case I have to replicate your sy **bottom version (use `btm -V`):** +**Rust version (if building yourself):** + ## Additional context _If anything hasn't been covered by the above categories, state it down here:_ diff --git a/.travis.yml b/.travis.yml index 2b8aeb88..85c77ec7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: rust -cache: cargo notifications: email: on_success: never @@ -37,10 +36,12 @@ matrix: env: TARGET=x86_64-unknown-linux-musl arch: amd64 rust: stable - - os: linux - env: TARGET=x86_64-unknown-linux-musl + + # Windows GNU + - os: windows + env: TARGET=x86_64-pc-windows-gnu arch: amd64 - rust: beta + rust: stable # ARM stuff (skip beta for now, see https://github.com/rust-lang/rust/issues/62896) - os: linux @@ -75,17 +76,18 @@ branches: - master - /^\d+\.\d+(\.\d+)?(-\S*)?$/ +cache: cargo + before_install: - export RUST_BACKTRACE=1 - | - if [[ $TRAVIS_OS_NAME == "windows" ]]; then - if [[ -n $TRAVIS_TAG ]]; then - powershell Install-WindowsFeature Net-Framework-Core; - choco install -y wixtoolset; - export PATH=$PATH:"/c/Program Files (x86)/WiX Toolset v3.11/bin"; - choco install zip; - rustup target add i686-pc-windows-msvc; - fi + if [[ $TRAVIS_OS_NAME == "windows" && -n $TRAVIS_TAG ]]; then + echo "Pre-installing deploy dependencies for Windows..."; + powershell Install-WindowsFeature Net-Framework-Core; + choco install -y wixtoolset; + export PATH=$PATH:"/c/Program Files (x86)/WiX Toolset v3.11/bin"; + choco install zip; + rustup target add i686-pc-windows-msvc; fi before_script: @@ -117,9 +119,8 @@ before_deploy: - | echo "Building release..." if [[ $TRAVIS_OS_NAME == "windows" ]]; then - echo "Building Windows 64-bit..."; - cargo build --release --target x86_64-pc-windows-msvc; + cargo build --release --target $TARGET; local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname) cp -r $target_dir completions mv "./target/x86_64-pc-windows-msvc/release/btm" "btm.exe"; @@ -128,31 +129,33 @@ before_deploy: rm "btm.exe" rm -r "completions" - echo "Building Windows 32-bit..."; - cargo clean; - cargo build --release --target i686-pc-windows-msvc; - local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname) - cp -r $target_dir completions - mv "./target/i686-pc-windows-msvc/release/btm" "btm.exe"; - strip "btm.exe" - zip -r bottom_i686-pc-windows-msvc.zip "btm.exe" "completions"; - rm "btm.exe" - rm -r "completions" + if [[ $TARGET == "x86_64-pc-windows-msvc" ]]; then + echo "Building Windows 32-bit..."; + cargo clean; + cargo build --release --target i686-pc-windows-msvc; + local target_dir=$(ls target/release/build/bottom-*/out/rg.bash | head -n1 | xargs dirname) + cp -r $target_dir completions + mv "./target/i686-pc-windows-msvc/release/btm" "btm.exe"; + strip "btm.exe" + zip -r bottom_i686-pc-windows-msvc.zip "btm.exe" "completions"; + rm "btm.exe" + rm -r "completions" - echo "Building choco template..."; - python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $TRAVIS_TAG "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/"; - cd "./deployment/windows/choco/" - zip -r choco.zip "bottom.nuspec" "tools/"; - cd "../../../"; - mv "./deployment/windows/choco/choco.zip" "./choco.zip" + echo "Building choco template..."; + python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $TRAVIS_TAG "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/"; + cd "./deployment/windows/choco/" + zip -r choco.zip "bottom.nuspec" "tools/"; + cd "../../../"; + mv "./deployment/windows/choco/choco.zip" "./choco.zip" - echo "Building msi file..."; - cargo install cargo-wix; - cargo wix init; - cargo wix; + echo "Building msi file..."; + cargo install cargo-wix; + cargo wix init; + cargo wix; - echo "Building winget template..."; - python "./deployment/packager.py" $TRAVIS_TAG "./deployment/windows/winget/winget.yaml.template" "$TRAVIS_TAG.yaml" "SHA256" "./bottom_x86_64_installer.msi"; + echo "Building winget template..."; + python "./deployment/packager.py" $TRAVIS_TAG "./deployment/windows/winget/winget.yaml.template" "$TRAVIS_TAG.yaml" "SHA256" "./bottom_x86_64_installer.msi"; + fi echo "Done Windows pre-deploy!"; else diff --git a/.vscode/settings.json b/.vscode/settings.json index 531704fb..8653ef8a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,6 +30,7 @@ "Ungrouped", "WASD", "Wojnarowski", + "aarch", "andys", "armhf", "armv", diff --git a/deployment/windows/choco/bottom.nuspec.template b/deployment/windows/choco/bottom.nuspec.template index 0dda79db..18db1f95 100644 --- a/deployment/windows/choco/bottom.nuspec.template +++ b/deployment/windows/choco/bottom.nuspec.template @@ -41,6 +41,10 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe To use, run `btm` in a terminal. For more [documentation and usage](https://github.com/ClementTsang/bottom/blob/master/README.md), see the [official repo](https://github.com/ClementTsang/bottom). + + + **Note** + This currently depends on Visual C++ Redistributable for Visual Studio 2015 https://chocolatey.org/packages/vcredist2015. https://github.com/ClementTsang/bottom/releases/tag/$version/