Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

工作流: 更改子模块编译方式 #464

Merged
merged 20 commits into from
Sep 12, 2024
22 changes: 22 additions & 0 deletions .config/submodule_build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"submodules": [
{
"name": "Chireiden.TShock.Omni",
Controllerdestiny marked this conversation as resolved.
Show resolved Hide resolved
"project_path": "src/Submodules/Yaaiomni/Core/Plugin.csproj",
"assembly_path": "src/Submodules/Yaaiomni/Core/bin/{BuildType}/{TargetFramework}/Chireiden.TShock.Omni.dll",
"readme": "src/Submodules/Yaaiomni/README.md"
},
{
"name": "Chireiden.TShock.Omni.Misc",
"project_path": "src/Submodules/Yaaiomni/Misc/Misc.csproj",
"assembly_path": "src/Submodules/Yaaiomni/Misc/bin/{BuildType}/{TargetFramework}/Chireiden.TShock.Omni.Misc.dll",
"readme": "src/Submodules/Yaaiomni/README.md"
},
{
"name": "Crossplay",
"project_path": "src/Submodules/Crossplay/Crossplay/Crossplay.csproj",
"assembly_path": "src/Submodules/Crossplay/Crossplay/bin/{BuildType}/{TargetFramework}/Crossplay.dll",
"readme": "src/Submodules/Crossplay/README.md"
}
]
}
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ jobs:

- name: 构建插件
if: github.event_name != 'push' || github.ref != 'refs/heads/master'
shell: pwsh
run: |
./scripts/submodule_build.ps1 -BuildType Debug -TargetFramework net6.0
dotnet build Plugin.sln -c Debug

- name: 构建插件
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: pwsh
run: |
./scripts/submodule_build.ps1 -BuildType Release -TargetFramework net6.0
dotnet build Plugin.sln -c Release

- name: 打包
Expand All @@ -68,6 +72,7 @@ jobs:
}
$ErrorActionPreference = "Continue"
Copy-Item out/**/*.dll,out/**/*.pdb out/Target/Plugins/
Copy-Item SubmoduleAssembly/* out/Target/Plugins/
Copy-Item bin/Plugins.json,README.md,Usage.txt,LICENSE out/Target/
python scripts/zip.py

Expand Down
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "src/Yaaiomni"]
path = src/Yaaiomni
[submodule "src/Submodules/Yaaiomni"]
path = src/Submodules/Yaaiomni
url = https://github.com/sgkoishi/yaaiomni.git
[submodule "src/Submodules/Crossplay"]
path = src/Submodules/Crossplay
url = https://github.com/UnrealMultiple/Crossplay.git
30 changes: 0 additions & 30 deletions Plugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterWhitelist", "src\Bett
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoReset", "src\AutoReset\AutoReset.csproj", "{023244CF-F536-4621-9C89-6BCD0D242878}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniPlugin", "src\Yaaiomni\Core\Plugin.csproj", "{951F0545-1630-4E9B-B365-535D7FE9A845}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniMisc", "src\Yaaiomni\Misc\Misc.csproj", "{44B035E4-3049-4AB1-A8C1-212A427371A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OmniSourceGen", "src\Yaaiomni\SourceGen\SourceGen.csproj", "{0CD78DBF-DC60-4B91-B5EF-4910172547CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartRegions", "src\SmartRegions\SmartRegions.csproj", "{CBB56AB5-84D6-460A-8D0C-DA85A03BA811}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyProtocolSocket", "src\ProxyProtocolSocket\ProxyProtocolSocket.csproj", "{CBCF3F14-A506-435D-BC55-A06FFEB095B2}"
Expand Down Expand Up @@ -1064,30 +1058,6 @@ Global
{023244CF-F536-4621-9C89-6BCD0D242878}.Release|Any CPU.Build.0 = Release|Any CPU
{023244CF-F536-4621-9C89-6BCD0D242878}.Release|x64.ActiveCfg = Release|x64
{023244CF-F536-4621-9C89-6BCD0D242878}.Release|x64.Build.0 = Release|x64
{951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|Any CPU.Build.0 = Debug|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|x64.ActiveCfg = Debug|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|x64.Build.0 = Debug|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Release|Any CPU.ActiveCfg = Release|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Release|Any CPU.Build.0 = Release|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Release|x64.ActiveCfg = Release|Any CPU
{951F0545-1630-4E9B-B365-535D7FE9A845}.Release|x64.Build.0 = Release|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|x64.ActiveCfg = Debug|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|x64.Build.0 = Debug|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|Any CPU.Build.0 = Release|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|x64.ActiveCfg = Release|Any CPU
{44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|x64.Build.0 = Release|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|x64.ActiveCfg = Debug|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|x64.Build.0 = Debug|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|Any CPU.Build.0 = Release|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|x64.ActiveCfg = Release|Any CPU
{0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|x64.Build.0 = Release|Any CPU
{CBB56AB5-84D6-460A-8D0C-DA85A03BA811}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBB56AB5-84D6-460A-8D0C-DA85A03BA811}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBB56AB5-84D6-460A-8D0C-DA85A03BA811}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down
29 changes: 29 additions & 0 deletions scripts/submodule_build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env pwsh

param(
Controllerdestiny marked this conversation as resolved.
Show resolved Hide resolved
[Parameter(Mandatory)]
[string]$BuildType,

[Parameter(Mandatory)]
[string]$TargetFramework
)

function Join-Repo-Root {
param (
[Parameter(Mandatory, Position=0, ValueFromRemainingArguments)]
[string[]] $Paths
)
return Join-Path $PSScriptRoot '..' @Paths
}

$jsonContent = Get-Content -Path $(Join-Repo-Root '.config/submodule_build.json') -Raw | ConvertFrom-Json
New-Item -Path $(Join-Repo-Root 'SubmoduleAssembly') -ItemType Directory -Force
foreach($submodule in $jsonContent.submodules)
{
dotnet build $(Join-Repo-Root $submodule.project_path) -c $BuildType
$assembly_path = $(Join-Repo-Root $submodule.assembly_path) -replace '{BuildType}', $BuildType -replace '{TargetFramework}', $TargetFramework
$pdb = $assembly_path -replace '.dll', '.pdb'
Copy-Item -Path $assembly_path -Destination $(Join-Repo-Root 'SubmoduleAssembly')
Copy-Item -Path $pdb -Destination $(Join-Repo-Root 'SubmoduleAssembly')
Copy-Item -Path $(Join-Repo-Root $submodule.readme) -Destination $(Join-Repo-Root 'SubmoduleAssembly' ($submodule.name + ".md"))
}
4 changes: 3 additions & 1 deletion src/SimultaneousUseFix/SimultaneousUseFix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<Import Project="..\..\template.targets" />

<ItemGroup>
<ProjectReference Include="..\Yaaiomni\Core\Plugin.csproj" />
<Reference Include="Chireiden.TShock.Omni">
Controllerdestiny marked this conversation as resolved.
Show resolved Hide resolved
<HintPath>..\Submodules\Yaaiomni\Core\bin\$(Configuration)\$(TargetFramework)\Chireiden.TShock.Omni.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Submodules/Crossplay
Submodule Crossplay added at c7e992
Loading