Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Build in release Mode
- param (
- [switch]$release=$false,
- [switch]$ru=$false,
- [switch]$clean=$false,
- [switch]$clippy=$false
- )
- $BASH_WORK_DIR="/mnt/c/Users/HeapUnderflow/Documents/Projects/music_bot/dmusic"
- $BASH_PATH="/home/byte/.cargo/bin:/home/byte/.pyenv/shims:/home/byte/.pyenv/bin:/home/byte/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin"
- $BCP="cd '$BASH_WORK_DIR' && PATH='$BASH_PATH' "
- $MODE = @{$true="release";$false="debug"}[$release -eq $true]
- Write-Host "!Building in $MODE mode" -ForegroundColor Green
- if ($release) {
- Write-Host "!!release mode" -ForegroundColor Green
- } else {
- Write-Host "!!debug mode" -ForegroundColor Green
- }
- if ($ru) {
- Write-Host "!!run" -ForegroundColor Green
- } else {
- Write-Host "!!no-run" -ForegroundColor Green
- }
- function ReadDiscordToken () {
- return Get-Content -Path ".token"
- }
- $DTOKEN = ReadDiscordToken
- if ($clippy) {
- Write-Host "?Linting Clippy..." -ForegroundColor Yellow
- Write-Host "?Please wait while we generate your custom help message" -ForegroundColor Yellow
- bash -c "$BCP cargo clippy"
- if ($LASTEXITCODE -ne 0) {
- Write-Error -Message "Cargo exited with $($LASTEXITCODE)" -CategoryReason "Clippy Error" -CategoryTargetName "Cargo" -CategoryTargetType "clippy"
- }
- break
- }
- if ($clean) {
- Write-Host "?Cleaning target" -ForegroundColor Yellow
- bash -c "$BCP cargo clean"
- if ($LASTEXITCODE -ne 0) {
- Write-Error -Message "Cargo exited with $($LASTEXITCODE)" -CategoryReason "Cargo Error" -CategoryTargetName "Cargo" -CategoryTargetType "clean"
- }
- }
- Write-Host "?Building target" -ForegroundColor Yellow
- bash -c "$BCP cargo build $(@{$true=`"--$MODE`";$false=`"`"}[$release -eq $true])"
- if ($LASTEXITCODE -ne 0) {
- Write-Error -Message "Cargo exited with $($LASTEXITCODE)" -CategoryReason "Cargo Error" -CategoryTargetName "Cargo" -CategoryTargetType "build"
- Break
- }
- if ($ru) {
- Write-Host "?Running target" -ForegroundColor Yellow
- bash -c "$BCP DISCORD_TOKEN='$($DTOKEN)' cargo run $(@{$true=`"--$MODE`";$false=`"`"}[$release -eq $true])"
- if ($LASTEXITCODE -ne 0) {
- Write-Error -Message "Cargo exited with $($LASTEXITCODE)" -CategoryReason "Cargo Error" -CategoryTargetName "Cargo" -CategoryTargetType "run"
- }
- }
Add Comment
Please, Sign In to add comment