mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Move to Fody.Costura for repacking
This should be the best way for both Windows and Mono, plus is much more cleaner, get rid of those crappy tools
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -156,6 +158,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="cirno.ico" />
|
||||
<None Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
@@ -169,7 +172,6 @@
|
||||
copy "$(TargetDir)config\ASF.json" "$(SolutionDir)out\config"
|
||||
copy "$(TargetDir)config\example.json" "$(SolutionDir)out\config"
|
||||
copy "$(TargetDir)config\minimal.json" "$(SolutionDir)out\config"
|
||||
"$(SolutionDir)tools\LibZ\libz.exe" inject-dll -a "$(TargetDir)$(TargetName).exe" -i "$(TargetDir)*.dll" --move
|
||||
copy "$(TargetDir)$(TargetName).exe" "$(SolutionDir)out\ASF.exe"
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||
@@ -177,10 +179,18 @@
|
||||
cp "$(TargetDir)config/ASF.json" "$(SolutionDir)out/config"
|
||||
cp "$(TargetDir)config/example.json" "$(SolutionDir)out/config"
|
||||
cp "$(TargetDir)config/minimal.json" "$(SolutionDir)out/config"
|
||||
mono --llvm --server -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||
rm "$(SolutionDir)out/ASF.exe.config"
|
||||
cp "$(TargetDir)$(TargetName).exe" "$(SolutionDir)out/ASF.exe"
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets')" />
|
||||
<Import Project="..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
4
ArchiSteamFarm/FodyWeavers.xml
Normal file
4
ArchiSteamFarm/FodyWeavers.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers>
|
||||
<Costura IncludeDebugSymbols='false' />
|
||||
</Weavers>
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Costura.Fody" version="2.0.0-beta0018" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Fody" version="1.30.0-beta01" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9.4" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
|
||||
<package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -105,18 +107,26 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="cirno.ico" />
|
||||
<None Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||
"$(SolutionDir)tools\LibZ\libz.exe" inject-dll -a "$(TargetDir)$(TargetName).exe" -i "$(TargetDir)*.dll" --move
|
||||
copy "$(TargetDir)$(TargetName).exe" "$(SolutionDir)out\ASF-ConfigGenerator.exe"
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||
mono --llvm --server -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-ConfigGenerator.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||
rm "$(SolutionDir)out/ASF-ConfigGenerator.exe.config"
|
||||
cp "$(TargetDir)$(TargetName).exe" "$(SolutionDir)out/ASF-ConfigGenerator.exe"
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.30.0-beta01\build\dotnet\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
4
ConfigGenerator/FodyWeavers.xml
Normal file
4
ConfigGenerator/FodyWeavers.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers>
|
||||
<Costura IncludeDebugSymbols='false' />
|
||||
</Weavers>
|
||||
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Costura.Fody" version="2.0.0-beta0018" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Fody" version="1.30.0-beta01" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
|
||||
</packages>
|
||||
Binary file not shown.
BIN
packages/Costura.Fody.2.0.0-beta0018/Costura.Fody.dll
Normal file
BIN
packages/Costura.Fody.2.0.0-beta0018/Costura.Fody.dll
Normal file
Binary file not shown.
94
packages/Costura.Fody.2.0.0-beta0018/tools/install.ps1
Normal file
94
packages/Costura.Fody.2.0.0-beta0018/tools/install.ps1
Normal file
@@ -0,0 +1,94 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
|
||||
function RemoveForceProjectLevelHack($project)
|
||||
{
|
||||
Write-Host "RemoveForceProjectLevelHack"
|
||||
Foreach ($item in $project.ProjectItems)
|
||||
{
|
||||
if ($item.Name -eq "Fody_ToBeDeleted.txt")
|
||||
{
|
||||
$item.Delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function FlushVariables()
|
||||
{
|
||||
Write-Host "Flushing environment variables"
|
||||
$env:FodyLastProjectPath = ""
|
||||
$env:FodyLastWeaverName = ""
|
||||
$env:FodyLastXmlContents = ""
|
||||
}
|
||||
|
||||
function Update-FodyConfig($addinName, $project)
|
||||
{
|
||||
Write-Host "Update-FodyConfig"
|
||||
$fodyWeaversPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($project.FullName), "FodyWeavers.xml")
|
||||
|
||||
$FodyLastProjectPath = $env:FodyLastProjectPath
|
||||
$FodyLastWeaverName = $env:FodyLastWeaverName
|
||||
$FodyLastXmlContents = $env:FodyLastXmlContents
|
||||
|
||||
if (
|
||||
($FodyLastProjectPath -eq $project.FullName) -and
|
||||
($FodyLastWeaverName -eq $addinName))
|
||||
{
|
||||
Write-Host "Upgrade detected. Restoring content for $addinName"
|
||||
[System.IO.File]::WriteAllText($fodyWeaversPath, $FodyLastXmlContents)
|
||||
FlushVariables
|
||||
return
|
||||
}
|
||||
|
||||
FlushVariables
|
||||
|
||||
$xml = [xml](get-content $fodyWeaversPath)
|
||||
|
||||
$weavers = $xml["Weavers"]
|
||||
$node = $weavers.SelectSingleNode($addinName)
|
||||
|
||||
if (-not $node)
|
||||
{
|
||||
Write-Host "Appending node"
|
||||
$newNode = $xml.CreateElement($addinName)
|
||||
$weavers.AppendChild($newNode)
|
||||
}
|
||||
|
||||
$xml.Save($fodyWeaversPath)
|
||||
}
|
||||
|
||||
function Fix-ReferencesCopyLocal($package, $project)
|
||||
{
|
||||
Write-Host "Fix-ReferencesCopyLocal $($package.Id)"
|
||||
$asms = $package.AssemblyReferences | %{$_.Name}
|
||||
|
||||
foreach ($reference in $project.Object.References)
|
||||
{
|
||||
if ($asms -contains $reference.Name + ".dll")
|
||||
{
|
||||
if($reference.CopyLocal -eq $true)
|
||||
{
|
||||
$reference.CopyLocal = $false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function UnlockWeaversXml($project)
|
||||
{
|
||||
$fodyWeaversProjectItem = $project.ProjectItems.Item("FodyWeavers.xml");
|
||||
if ($fodyWeaversProjectItem)
|
||||
{
|
||||
$fodyWeaversProjectItem.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}")
|
||||
$fodyWeaversProjectItem.Save()
|
||||
$fodyWeaversProjectItem.Document.Close()
|
||||
}
|
||||
}
|
||||
|
||||
UnlockWeaversXml($project)
|
||||
|
||||
RemoveForceProjectLevelHack $project
|
||||
|
||||
Update-FodyConfig $package.Id.Replace(".Fody", "") $project
|
||||
|
||||
Fix-ReferencesCopyLocal $package $project
|
||||
47
packages/Costura.Fody.2.0.0-beta0018/tools/uninstall.ps1
Normal file
47
packages/Costura.Fody.2.0.0-beta0018/tools/uninstall.ps1
Normal file
@@ -0,0 +1,47 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
|
||||
function Update-FodyConfig($addinName, $project)
|
||||
{
|
||||
$fodyWeaversPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($project.FullName), "FodyWeavers.xml")
|
||||
|
||||
if (!(Test-Path ($fodyWeaversPath)))
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "Caching variables for possible update"
|
||||
$env:FodyLastProjectPath = $project.FullName
|
||||
$env:FodyLastWeaverName = $addinName
|
||||
$env:FodyLastXmlContents = [IO.File]::ReadAllText($fodyWeaversPath)
|
||||
|
||||
|
||||
$xml = [xml](get-content $fodyWeaversPath)
|
||||
|
||||
$weavers = $xml["Weavers"]
|
||||
$node = $weavers.SelectSingleNode($addinName)
|
||||
|
||||
if ($node)
|
||||
{
|
||||
Write-Host "Removing node from FodyWeavers.xml"
|
||||
$weavers.RemoveChild($node)
|
||||
}
|
||||
|
||||
$xml.Save($fodyWeaversPath)
|
||||
}
|
||||
|
||||
|
||||
function UnlockWeaversXml($project)
|
||||
{
|
||||
$fodyWeaversProjectItem = $project.ProjectItems.Item("FodyWeavers.xml");
|
||||
if ($fodyWeaversProjectItem)
|
||||
{
|
||||
$fodyWeaversProjectItem.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}")
|
||||
$fodyWeaversProjectItem.Save()
|
||||
$fodyWeaversProjectItem.Document.Close()
|
||||
}
|
||||
}
|
||||
|
||||
UnlockWeaversXml($project)
|
||||
|
||||
Update-FodyConfig $package.Id.Replace(".Fody", "") $project
|
||||
4
packages/Fody.1.30.0-beta01/Content/FodyWeavers.xml
Normal file
4
packages/Fody.1.30.0-beta01/Content/FodyWeavers.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Weavers>
|
||||
|
||||
</Weavers>
|
||||
BIN
packages/Fody.1.30.0-beta01/Fody.1.30.0-beta01.nupkg
Normal file
BIN
packages/Fody.1.30.0-beta01/Fody.1.30.0-beta01.nupkg
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/Fody.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/Fody.dll
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/FodyCommon.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/FodyCommon.dll
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/FodyIsolated.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/FodyIsolated.dll
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.Mdb.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.Mdb.dll
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.Pdb.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.Pdb.dll
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.Rocks.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.Rocks.dll
Normal file
Binary file not shown.
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.dll
Normal file
BIN
packages/Fody.1.30.0-beta01/Mono.Cecil.dll
Normal file
Binary file not shown.
3
packages/Fody.1.30.0-beta01/Tools/install.ps1
Normal file
3
packages/Fody.1.30.0-beta01/Tools/install.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
$item = $project.ProjectItems | where-object {$_.Name -eq "FodyWeavers.xml"}
|
||||
$item.Properties.Item("BuildAction").Value = [int]0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user