Skip to content

Commit eb4778e

Browse files
author
Controllerdestiny
committed
添加
1 parent 324cfd6 commit eb4778e

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

.config/submodule_build.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"submodules": [
3+
{
4+
"name": "Yaaiomni",
5+
"project_path": "src/Submodules/Yaaiomni/Core/Plugin.csproj",
6+
"assembly_path": "src/Submodules/Yaaiomni/Core/bin/{BuildType}/{TargetFramework}/Chireiden.TShock.Omni.dll"
7+
},
8+
{
9+
"name": "Crossplay",
10+
"project_path": "src/Submodules/Crossplay/Crossplay/Crossplay.csproj",
11+
"assembly_path": "src/Submodules/Crossplay/Crossplay/bin/{BuildType}/{TargetFramework}/Crossplay.dll"
12+
}
13+
]
14+
}

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ jobs:
4040
if: github.event_name != 'push' || github.ref != 'refs/heads/master'
4141
shell: pwsh
4242
run: |
43-
Get-ChildItem -Path src/Submodules/ -Filter "*.sln" -Recurse | ForEach-Object {dotnet build $_.FullName -c Debug}
43+
scripts/submodule_build.ps1 -BuildType Debug -TargetFramework net6.0
4444
dotnet build Plugin.sln -c Debug
4545
4646
- name: 构建插件
4747
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
4848
shell: pwsh
4949
run: |
50-
Get-ChildItem -Path src/Submodules/ -Filter "*.sln" -Recurse | ForEach-Object {dotnet build $_.FullName -c Release}
50+
scripts/submodule_build.ps1 -BuildType Release -TargetFramework net6.0
5151
dotnet build Plugin.sln -c Release
5252
5353
- name: 打包

scripts/submodule_build.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
param(
2+
[Parameter(Mandatory=$true)]
3+
[string]$BuildType,
4+
5+
[Parameter(Mandatory=$true)]
6+
[string]$TargetFramework
7+
)
8+
9+
$jsonContent = Get-Content -Path ".config/submodule_build.json" -Raw | ConvertFrom-Json
10+
11+
foreach($submodule in $jsonContent.submodules)
12+
{
13+
Write-Host "编译生成子模块: {0}" -f $submodule.name
14+
$command = "dotnet build {0} -c {1}" -f $submodule.project_path, $BuildType
15+
$assembly_path = $submodule.assembly_path -replace "{BuildType}", $BuildType -replace "{TargetFramework}" , $TargetFramework
16+
$pdb = $assembly_path -replace ".dll", ".pdb"
17+
Copy-Item -Path $assembly_path -Destination out/Debug/
18+
Copy-Item -Path $pdb -Destination out/Debug/
19+
Invoke-Expression $command
20+
}

src/Submodules/build.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
$jsonContent = Get-Content -Path ".config/submodule_build.json" -Raw | ConvertFrom-Json
4+
5+
foreach($submodule in $jsonContent.submodules)
6+
{
7+
$command = "dotnet build $submodule.project_path"
8+
& $command
9+
}

0 commit comments

Comments
 (0)