Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from LightAPIs/build
Browse files Browse the repository at this point in the history
Build
  • Loading branch information
Light authored Sep 10, 2022
2 parents a1dce20 + ff39ac4 commit 73667ac
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ClashSinicizationTool/ClashSinicizationTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Prefer32Bit>false</Prefer32Bit>
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions ClashSinicizationToolBase/ClashSinicizationToolBase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
<NeutralLanguage>zh-CN</NeutralLanguage>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
8 changes: 8 additions & 0 deletions ClashSinicizationToolCLI/ClashSinicizationToolCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
<NeutralLanguage>zh-CN</NeutralLanguage>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<Content Include="Image\logo-cli.ico" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
<ApplicationIcon>Image\upgrade.ico</ApplicationIcon>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<Content Include="Image\upgrade.ico" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ $ErrorActionPreference = 'Stop'
Write-Host 'dotnet SDK info'
dotnet --info

$exe = @('Clash Sinicization Tool.exe', 'CLI.exe', 'Upgrade.exe')
$exe = @('Clash Sinicization Tool.exe', 'Upgrade.exe')
$net_tfm = 'net6.0-windows'
$dllpatcher_tfm = 'net6.0'
$configuration = 'Release'
$output_dir = @("$PSScriptRoot\ClashSinicizationTool\bin\$configuration", "$PSScriptRoot\ClashSinicizationToolCLI\bin\$configuration", "$PSScriptRoot\ClashSinicizationToolUpgrade\bin\$configuration")
$output_dir = @("$PSScriptRoot\ClashSinicizationTool\bin\$configuration", "$PSScriptRoot\ClashSinicizationToolUpgrade\bin\$configuration")
$dllpatcher_dir = "$PSScriptRoot\Build\DotNetDllPathPatcher"
$dllpatcher_exe = "$dllpatcher_dir\bin\$configuration\$dllpatcher_tfm\DotNetDllPathPatcher.exe"
$proj_path = @("$PSScriptRoot\ClashSinicizationTool\ClashSinicizationTool.csproj", "$PSScriptRoot\ClashSinicizationToolCLI\ClashSinicizationToolCLI.csproj", "$PSScriptRoot\ClashSinicizationToolUpgrade\ClashSinicizationToolUpgrade.csproj")
$proj_path = @("$PSScriptRoot\ClashSinicizationTool\ClashSinicizationTool.csproj", "$PSScriptRoot\ClashSinicizationToolUpgrade\ClashSinicizationToolUpgrade.csproj")
$dist_path = "$PSScriptRoot\Dist\$configuration"

$build = $buildtfm -eq 'all' -or $buildtfm -eq 'app'
Expand All @@ -20,7 +20,7 @@ function Build-App
{
Write-Host 'Building .NET App'

for ($i = 0; $i -lt 3; $i++)
for ($i = 0; $i -lt 2; $i++)
{
$outdir = "{0}\$net_tfm" -f $output_dir[$i]
$publishDir = "$outdir\publish"
Expand Down
65 changes: 65 additions & 0 deletions build_cli.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
param([string]$buildtfm = 'all')
$ErrorActionPreference = 'Stop'

Write-Host 'dotnet SDK info'
dotnet --info

$exe = @('CLI.exe')
$net_tfm = 'net6.0-windows'
$dllpatcher_tfm = 'net6.0'
$configuration = 'Release'
$output_dir = @("$PSScriptRoot\ClashSinicizationToolCLI\bin\$configuration")
$dllpatcher_dir = "$PSScriptRoot\Build\DotNetDllPathPatcher"
$dllpatcher_exe = "$dllpatcher_dir\bin\$configuration\$dllpatcher_tfm\DotNetDllPathPatcher.exe"
$proj_path = @("$PSScriptRoot\ClashSinicizationToolCLI\ClashSinicizationToolCLI.csproj")
$dist_path = "$PSScriptRoot\Dist\$configuration"

$build = $buildtfm -eq 'all' -or $buildtfm -eq 'app'

function Build-App
{
Write-Host 'Building .NET App'

for ($i = 0; $i -lt 1; $i++)
{
$outdir = "{0}\$net_tfm" -f $output_dir[$i]
$publishDir = "$outdir\publish"
$exe_path = "$publishDir\{0}" -f $exe[$i]

Remove-Item $publishDir -Recurse -Force -Confirm:$false -ErrorAction Ignore

dotnet publish -c $configuration -f $net_tfm $proj_path[$i]
if ($LASTEXITCODE) { exit $LASTEXITCODE }

& $dllpatcher_exe $exe_path bin
if ($LASTEXITCODE) { exit $LASTEXITCODE }

Copy-Item -Path $publishDir\bin\* -Destination $dist_path\bin -Recurse -Force
Copy-Item $exe_path -Destination $dist_path
}
}

dotnet build -c $configuration -f $dllpatcher_tfm $dllpatcher_dir\DotNetDllPathPatcher.csproj
if ($LASTEXITCODE) { exit $LASTEXITCODE }

if ($build)
{
if (Test-Path $PSScriptRoot\Dist)
{
Remove-Item -Path $PSScriptRoot\Dist -Recurse
}
if (-not (Test-Path $PSScriptRoot\Dist))
{
New-Item -Path $PSScriptRoot -Name Dist -ItemType Directory > $null
}
if (-not (Test-Path $dist_path))
{
New-Item -Path $PSScriptRoot\Dist -Name $configuration -ItemType Directory > $null
}
if (-not (Test-Path $dist_path\bin))
{
New-Item -Path $dist_path -Name bin -ItemType Directory > $null
}
Build-App
Expand-Archive -Path $PSScriptRoot\Node_asar.zip -DestinationPath $dist_path\bin
}

0 comments on commit 73667ac

Please sign in to comment.