forked from ClassIsland/ClassIsland
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
param($quiet=$true) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
$scriptPath = $MyInvocation.MyCommand.Definition | ||
$classIslandRoot = "$([System.IO.Path]::GetDirectoryName($scriptPath))\..\..\ClassIsland" | ||
|
||
|
||
function SetEnvironmentVariable { | ||
param ( | ||
$Name, | ||
$Value, | ||
$Scope="User" | ||
) | ||
$out = "$Name = $Value" | ||
Write-Host $out -ForegroundColor DarkGray | ||
[Environment]::SetEnvironmentVariable($Name, $Value, $Scope) | ||
} | ||
|
||
Set-Location $classIslandRoot | ||
|
||
|
||
try { | ||
$quietparams = "" | ||
if ($quiet){ | ||
$quietparams = ("-p:WarningLevel=0", "-p:NoWarn=NU1701") | ||
} | ||
dotnet --version | ||
Write-Host "🔧 正在清理…" -ForegroundColor Cyan | ||
|
||
dotnet clean ClassIsland.csproj | ||
Write-Host "🔧 正在构建 ClassIsland,这可能需要 1-6 分钟。" -ForegroundColor Cyan | ||
dotnet build ClassIsland.csproj -c Debug -p:Version=$(git describe --tags --abbrev=0) -p:NuGetVersion=$(git describe --tags --abbrev=0) $quietparams | ||
} | ||
catch { | ||
Write-Host "🔥 构建失败" -ForegroundColor Red | ||
return | ||
} | ||
|
||
|
||
Write-Host "🔧 正在设置开发环境变量…" -ForegroundColor Cyan | ||
|
||
SetEnvironmentVariable("ClassIsland_DebugBinaryFile", [System.IO.Path]::GetFullPath("${classIslandRoot}\bin\Debug\net8.0-windows\ClassIsland.exe")) | ||
SetEnvironmentVariable("ClassIsland_DebugBinaryDirectory", [System.IO.Path]::GetFullPath("${classIslandRoot}/bin\Debug\net8.0-windows\")) | ||
|
||
Write-Host "构建完成" -ForegroundColor Green |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function EnvironmentCheckFailed { | ||
param ( | ||
$item | ||
) | ||
exit | ||
} | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
|
||
Write-Host "欢迎开发 ClassIsland 插件" -ForegroundColor Blue | ||
|
||
|
||
$scriptPath = $MyInvocation.MyCommand.Definition | ||
|
||
cd "$([System.IO.Path]::GetDirectoryName($scriptPath))\..\.." | ||
|
||
# Check environment | ||
Write-Host "🔧 正在检查环境…" -ForegroundColor Cyan | ||
|
||
# TODO: Check env | ||
|
||
|
||
Write-Host "您的开发环境可以开发 ClassIsland 插件。" -ForegroundColor Green | ||
|
||
|
||
# Build ClassIsland | ||
|
||
pwsh -ep Bypass -File ./tools/plugin/build.ps1 |