Skip to content

Commit 2c75b1d

Browse files
refactor: build scripts
1 parent 6b3705c commit 2c75b1d

11 files changed

Lines changed: 147 additions & 17 deletions

File tree

src/4-Build/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Build Scripts
2+
3+
This directory contains build scripts organized by functionality in the `scripts` folder:
4+
5+
```
6+
scripts/
7+
├── compile/ # Compilation scripts
8+
├── lint/ # Code linting scripts
9+
├── packages/ # Package management scripts
10+
└── tests/ # Test runner scripts
11+
```
12+
13+
Each directory contains scripts in multiple formats for cross-platform compatibility:
14+
- `.bat` - Windows batch files
15+
- `.ps1` - PowerShell scripts (cross-platform)
16+
- `.sh` - Shell scripts (Unix-based systems)
17+
18+
## Running Scripts on Windows
19+
20+
### Batch Files (.bat)
21+
- Simply double-click the `.bat` file in the appropriate directory
22+
- Or run from command prompt: `scripts\category\ScriptName.bat`
23+
Example: `scripts\compile\Compile.bat`
24+
25+
### PowerShell Scripts (.ps1)
26+
1. Right-click method:
27+
- Right-click on the `.ps1` file in the appropriate directory
28+
- Select "Run with PowerShell"
29+
30+
2. Command line method:
31+
- Open PowerShell
32+
- Navigate to this directory
33+
- Run: `.\scripts\category\ScriptName.ps1`
34+
Example: `.\scripts\compile\Compile.ps1`
35+
36+
If you get a security error, you may need to allow script execution:
37+
```powershell
38+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
39+
```
40+
41+
### Shell Scripts (.sh)
42+
To run `.sh` files on Windows, you need one of these installed:
43+
1. Git Bash (recommended, comes with Git for Windows):
44+
```bash
45+
./scripts/category/ScriptName.sh
46+
```
47+
Example: `./scripts/compile/Compile.sh`
48+
49+
2. Windows Subsystem for Linux (WSL):
50+
```bash
51+
bash scripts/category/ScriptName.sh
52+
```
53+
54+
## Running Scripts on macOS/Linux
55+
56+
### Shell Scripts (.sh)
57+
1. Open terminal
58+
2. Navigate to this directory
59+
3. Make scripts executable (one-time setup):
60+
```bash
61+
chmod +x scripts/**/*.sh
62+
```
63+
4. Run the script:
64+
```bash
65+
./scripts/category/ScriptName.sh
66+
```
67+
Example: `./scripts/compile/Compile.sh`
68+
69+
### PowerShell Scripts (.ps1)
70+
1. Install PowerShell if not already installed
71+
2. Open terminal
72+
3. Navigate to this directory
73+
4. Run:
74+
```bash
75+
pwsh scripts/category/ScriptName.ps1
76+
```
77+
Example: `pwsh scripts/compile/Compile.ps1`
78+
79+
## Available Scripts
80+
81+
### Compile
82+
- Location: `scripts/compile/`
83+
- Purpose: Compiles the project
84+
- Files: `Compile.bat`, `Compile.ps1`, `Compile.sh`
85+
86+
### Lint
87+
- Location: `scripts/lint/`
88+
- Purpose: Runs code linting
89+
- Files: `Lint.bat`, `Lint.ps1`, `Lint.sh`
90+
91+
### Tests
92+
- Location: `scripts/tests/`
93+
- Purpose: Runs unit tests
94+
- Files: `RunUnitTests.bat`, `RunUnitTests.ps1`, `RunUnitTests.sh`
95+
96+
### Packages
97+
- Location: `scripts/packages/`
98+
- Purpose: Updates CodeBlock.DevKit NuGet packages
99+
- Files: `UpdateDevKitPackages.bat`, `UpdateDevKitPackages.ps1`, `UpdateDevKitPackages.sh`

src/4-Build/UpdateDevKitPackages.bat

Lines changed: 0 additions & 11 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo off
2-
cd /d "%~dp0"
2+
cd /d "%~dp0..\.."
33

44
echo Running: nuke Compile
55
nuke Compile
66

7-
pause
7+
pause
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Set-Location -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
2+
3+
Write-Host "Running: nuke Compile"
4+
nuke Compile
5+
6+
if ($Host.Name -eq "ConsoleHost") {
7+
Write-Host "Press any key to continue..."
8+
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
cd "$(dirname "$(dirname "$(dirname "$0")")")"
3+
4+
echo "Running: nuke Compile"
5+
nuke Compile
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo off
2-
cd /d "%~dp0"
2+
cd /d "%~dp0..\.."
33

44
echo Running: nuke Lint
55
nuke Lint
66

7-
pause
7+
pause

src/4-Build/scripts/lint/Lint.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Set-Location -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
2+
3+
Write-Host "Running: nuke Lint"
4+
nuke Lint
5+
6+
if ($Host.Name -eq "ConsoleHost") {
7+
Write-Host "Press any key to continue..."
8+
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
9+
}

src/4-Build/scripts/lint/Lint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
cd "$(dirname "$(dirname "$(dirname "$0")")")"
3+
4+
echo "Running: nuke Lint"
5+
nuke Lint
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo off
2-
cd /d "%~dp0"
2+
cd /d "%~dp0..\.."
33

44
echo Running: nuke RunUnitTests
55
nuke RunUnitTests
66

7-
pause
7+
pause
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Set-Location -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
2+
3+
Write-Host "Running: nuke RunUnitTests"
4+
nuke RunUnitTests
5+
6+
if ($Host.Name -eq "ConsoleHost") {
7+
Write-Host "Press any key to continue..."
8+
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
9+
}

0 commit comments

Comments
 (0)