refactor(plugin): share SDK artifacts by game version and require explicit version declarations
This commit is contained in:
+12
-3
@@ -3,19 +3,28 @@
|
||||
<Compile Include="$(BD2SdkDir)\GameSdkIdentity.g.cs" />
|
||||
<ProjectReference Include="$(BD2GameNamesProject)" />
|
||||
<Reference Include="Assembly-CSharp.Readable">
|
||||
<HintPath>$(BD2SdkDir)\ref\Assembly-CSharp.Readable.dll</HintPath>
|
||||
<HintPath>$(BD2SharedSdkDir)/ref/Assembly-CSharp.Readable.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(BD2SdkDir)/GameSourceNavigation.props" Condition="Exists('$(BD2SdkDir)/GameSourceNavigation.props')" />
|
||||
<Target Name="PrepareBD2GameSdk" BeforeTargets="ResolveProjectReferences;ResolveAssemblyReferences">
|
||||
<Error Condition="'$(BD2GameVersion)' == ''" Text="Declare BD2GameVersion explicitly in this plugin's csproj, for example <BD2GameVersion>2.35.10</BD2GameVersion>." />
|
||||
<Error Condition="'$(GameDir)' == '' and '$(BD2ManagedDir)' == ''" Text="Set BD2LocalGameDir in plugins/Directory.Build.local.props, or pass -p:GameDir=<game-directory>." />
|
||||
<Error Condition="!Exists('$(BD2ManagedDir)/Assembly-CSharp.dll')" Text="Assembly-CSharp.dll missing in $(BD2ManagedDir). Set GameDir or BD2ManagedDir." />
|
||||
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Condition="'$(DesignTimeBuild)' != 'true' or !Exists('$(BD2SdkTool)')" Command="dotnet build "$(BD2SdkProject)" -c $(BD2SdkConfiguration) --nologo" />
|
||||
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" EnvironmentVariables="BD2_GAME_SDK_CACHE=$(BD2GameSdkCache)" Command="dotnet "$(BD2SdkTool)" prepare-embedded "$(BD2ManagedDir)/Assembly-CSharp.dll" "$(BD2SdkDir)" "$(BD2VersionConfig)"" />
|
||||
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" EnvironmentVariables="BD2_GAME_SDK_CACHE=$(BD2GameSdkCache)" Command="dotnet "$(BD2SdkTool)" prepare-embedded "$(BD2ManagedDir)/Assembly-CSharp.dll" "$(BD2SdkDir)" "$(BD2VersionConfig)" --game-version "$(BD2GameVersion)"" />
|
||||
<ReadLinesFromFile File="$(BD2SdkDir)/shared-sdk.txt"><Output TaskParameter="Lines" PropertyName="BD2SharedSdkDir" /></ReadLinesFromFile>
|
||||
<ItemGroup>
|
||||
<Reference Remove="Assembly-CSharp.Readable" />
|
||||
<Reference Include="Assembly-CSharp.Readable">
|
||||
<HintPath>$(BD2SharedSdkDir)/ref/Assembly-CSharp.Readable.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<Target Name="ReobfuscateBD2Plugin" AfterTargets="Build" Condition="'$(DesignTimeBuild)' != 'true' and '$(SkipCompilerExecution)' != 'true'">
|
||||
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="dotnet "$(BD2SdkTool)" reobf "$(BD2SdkDir)\names.json" "$(IntermediateOutputPath)$(TargetFileName)" "$(TargetPath)" "$(BD2ManagedDir)\Assembly-CSharp.dll" "$(BD2BepInExDir)\core"" />
|
||||
<Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="dotnet "$(BD2SdkTool)" reobf "$(BD2SharedSdkDir)/names.json" "$(IntermediateOutputPath)$(TargetFileName)" "$(TargetPath)" "$(BD2ManagedDir)\Assembly-CSharp.dll" "$(BD2BepInExDir)\core"" />
|
||||
<Delete Files="$(TargetDir)$(TargetName).pdb" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user