fixed scripts for dynamic path detection
This commit is contained in:
parent
f2b77f38b4
commit
3227497e45
5 changed files with 67 additions and 10 deletions
|
|
@ -12,7 +12,24 @@ Write-Host "🚀 Starting complete build process..." -ForegroundColor Cyan
|
|||
|
||||
# Store original location
|
||||
$originalLocation = Get-Location
|
||||
Set-Location "g:\repos\stock-bot"
|
||||
|
||||
# Find git root directory
|
||||
try {
|
||||
$gitRoot = git rev-parse --show-toplevel 2>$null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Not in git repository"
|
||||
}
|
||||
# Convert Unix-style path to Windows if needed (for WSL/Git Bash compatibility)
|
||||
if ($IsWindows -and $gitRoot -match "^/") {
|
||||
$gitRoot = $gitRoot -replace "/", "\"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error: Not in a git repository. Please run this script from within the stock-bot git repository." -ForegroundColor Red
|
||||
Set-Location $originalLocation
|
||||
exit 1
|
||||
}
|
||||
|
||||
Set-Location $gitRoot
|
||||
|
||||
try {
|
||||
# Step 1: Clean if requested
|
||||
|
|
|
|||
|
|
@ -47,7 +47,15 @@ echo -e "${CYAN}🚀 Starting complete build process...${NC}"
|
|||
|
||||
# Store original location
|
||||
ORIGINAL_DIR=$(pwd)
|
||||
cd "/home/boki/stock-bot"
|
||||
|
||||
# Find git root directory
|
||||
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Not in a git repository. Please run this script from within the stock-bot git repository.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$GIT_ROOT"
|
||||
|
||||
cleanup() {
|
||||
cd "$ORIGINAL_DIR"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,21 @@
|
|||
|
||||
Write-Host "Building and installing new libraries..." -ForegroundColor Cyan
|
||||
|
||||
# Find git root directory
|
||||
try {
|
||||
$gitRoot = git rev-parse --show-toplevel 2>$null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Not in git repository"
|
||||
}
|
||||
# Convert Unix-style path to Windows if needed (for WSL/Git Bash compatibility)
|
||||
if ($IsWindows -and $gitRoot -match "^/") {
|
||||
$gitRoot = $gitRoot -replace "/", "\"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error: Not in a git repository. Please run this script from within the stock-bot git repository." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Build order is important due to dependencies
|
||||
$libs = @(
|
||||
"types", # Base types - no dependencies
|
||||
|
|
@ -27,7 +42,7 @@ $libs = @(
|
|||
|
||||
# Build each library in order
|
||||
foreach ($lib in $libs) {
|
||||
$libPath = "g:\repos\stock-bot\libs\$lib"
|
||||
$libPath = Join-Path $gitRoot "libs\$lib"
|
||||
|
||||
Write-Host "Building $lib..." -ForegroundColor Green
|
||||
Set-Location $libPath
|
||||
|
|
@ -40,4 +55,4 @@ foreach ($lib in $libs) {
|
|||
}
|
||||
|
||||
Write-Host "All libraries built successfully!" -ForegroundColor Green
|
||||
Set-Location g:\repos\stock-bot
|
||||
Set-Location $gitRoot
|
||||
|
|
|
|||
|
|
@ -12,7 +12,15 @@ echo -e "${CYAN}Building and installing new libraries...${NC}"
|
|||
|
||||
# Store original location
|
||||
ORIGINAL_DIR=$(pwd)
|
||||
cd "/home/boki/stock-bot"
|
||||
|
||||
# Find git root directory
|
||||
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Not in a git repository. Please run this script from within the stock-bot git repository.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$GIT_ROOT"
|
||||
|
||||
cleanup() {
|
||||
cd "$ORIGINAL_DIR"
|
||||
|
|
@ -46,7 +54,7 @@ libs=(
|
|||
|
||||
# Build each library in order
|
||||
for lib in "${libs[@]}"; do
|
||||
lib_path="/home/boki/stock-bot/libs/$lib"
|
||||
lib_path="$GIT_ROOT/libs/$lib"
|
||||
|
||||
echo -e "${GREEN}Building $lib...${NC}"
|
||||
cd "$lib_path"
|
||||
|
|
@ -59,4 +67,4 @@ for lib in "${libs[@]}"; do
|
|||
done
|
||||
|
||||
echo -e "${GREEN}All libraries built successfully!${NC}"
|
||||
cd "/home/boki/stock-bot"
|
||||
cd "$GIT_ROOT"
|
||||
|
|
|
|||
|
|
@ -118,12 +118,21 @@ done <<< "$lib_dirs"
|
|||
|
||||
# Check for environment variable dependencies
|
||||
echo -e "${BLUE}Checking for hardcoded paths...${NC}"
|
||||
hardcoded_paths=$(grep -r "g:\\repos\\stock-bot" ./libs 2>/dev/null || true)
|
||||
if [ -n "$hardcoded_paths" ]; then
|
||||
hardcoded_paths_win=$(grep -r "g:\\repos\\stock-bot" ./libs 2>/dev/null || true)
|
||||
hardcoded_paths_unix=$(grep -r "/home/.*/stock-bot" ./libs 2>/dev/null || true)
|
||||
|
||||
if [ -n "$hardcoded_paths_win" ]; then
|
||||
warnings+=("Found hardcoded Windows paths:")
|
||||
while IFS= read -r line; do
|
||||
warnings+=(" - $line")
|
||||
done <<< "$hardcoded_paths"
|
||||
done <<< "$hardcoded_paths_win"
|
||||
fi
|
||||
|
||||
if [ -n "$hardcoded_paths_unix" ]; then
|
||||
warnings+=("Found hardcoded Unix paths:")
|
||||
while IFS= read -r line; do
|
||||
warnings+=(" - $line")
|
||||
done <<< "$hardcoded_paths_unix"
|
||||
fi
|
||||
|
||||
# Summary
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue