forked from mkaring/ConfuserEx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Confuser.Build.targets
82 lines (74 loc) · 4.38 KB
/
Confuser.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfuserRuntimeDependsOn>
_ConfuserRuntimeGetTargetFrameworks;
_ConfuserRuntimeCreateTargetFrameworkList;
_ConfuserRuntimeBuildAndEmbedd;
</BuildConfuserRuntimeDependsOn>
</PropertyGroup>
<PropertyGroup>
<ConfuserRuntimeConfiguration Condition="'$(ConfuserRuntimeConfiguration)' == ''">$(Configuration)</ConfuserRuntimeConfiguration>
</PropertyGroup>
<Target Name="BuildConfuserRuntime"
AfterTargets="PrepareForBuild"
DependsOnTargets="$(BuildConfuserRuntimeDependsOn)"
Condition="'@(ConfuserRuntimeReference)' != ''" />
<Target Name="_ConfuserRuntimeGetTargetFrameworks">
<MSBuild Projects="@(ConfuserRuntimeReference)"
Targets="GetTargetFrameworks"
BuildInParallel="$(BuildInParallel)"
Properties="Configuration=$(ConfuserRuntimeConfiguration)"
RemoveProperties="TargetFramework;RuntimeIdentifier"
SkipNonexistentTargets="true">
<Output TaskParameter="TargetOutputs" ItemName="_BuildConfuserRuntimeTargets" />
</MSBuild>
<ItemGroup>
<_BuildConfuserRuntimeTargetFrameworks Include="@(_BuildConfuserRuntimeTargets->'%(TargetFrameworks)')" />
</ItemGroup>
</Target>
<Target Name="_ConfuserRuntimeCreateTargetFrameworkList">
<PropertyGroup>
<_BuildConfuserRuntimeTargetFrameworks2>@(_BuildConfuserRuntimeTargetFrameworks)</_BuildConfuserRuntimeTargetFrameworks2>
<_BuildConfuserRuntimeProjectFile>%(_BuildConfuserRuntimeTargetFrameworks.MSBuildSourceProjectFile)</_BuildConfuserRuntimeProjectFile>
</PropertyGroup>
<ItemGroup>
<_BuildConfuserRuntimeTargetFramework Include="$(_BuildConfuserRuntimeTargetFrameworks2.Split(';'))">
<MSBuildSourceProjectFile>$(_BuildConfuserRuntimeProjectFile)</MSBuildSourceProjectFile>
</_BuildConfuserRuntimeTargetFramework>
</ItemGroup>
</Target>
<Target Name="_ConfuserRuntimeBuildAndEmbedd">
<MSBuild Projects="%(_BuildConfuserRuntimeTargetFramework.MSBuildSourceProjectFile)"
Targets="Build"
Properties="Configuration=$(ConfuserRuntimeConfiguration);TargetFramework=%(_BuildConfuserRuntimeTargetFramework.Identity)"
RemoveProperties="TargetFrameworks;RuntimeIdentifier;TargetPlatformIdentifier;TargetPlatformMoniker"
BuildInParallel="$(BuildInParallel)">
<Output TaskParameter="TargetOutputs" ItemName="_ConfuserCoreRuntimeBuildOutput" />
</MSBuild>
<ItemGroup>
<_ConfuserRuntimeEmbeddedResource Include="@(_ConfuserCoreRuntimeBuildOutput)">
<Link Condition="'%(TargetFrameworkIdentifier)' == '.NETFramework'">%(Filename).net$([System.String]::Copy('%(TargetFrameworkVersion)').Replace('.', ''))%(Extension)</Link>
<Link Condition="'%(TargetFrameworkIdentifier)' == '.NETStandard'">%(Filename).netstandard%(TargetFrameworkVersion)%(Extension)</Link>
<Link Condition="'%(TargetFrameworkIdentifier)' == '.NETCoreApp'">%(Filename).netcoreapp%(TargetFrameworkVersion)%(Extension)</Link>
</_ConfuserRuntimeEmbeddedResource>
<_ConfuserRuntimeEmbeddedResource Include="@(_ConfuserCoreRuntimeBuildOutput->'%(RootDir)%(Directory)%(Filename).pdb')">
<Link Condition="'%(TargetFrameworkIdentifier)' == '.NETFramework'">%(Filename).net$([System.String]::Copy('%(TargetFrameworkVersion)').Replace('.', '')).pdb</Link>
<Link Condition="'%(TargetFrameworkIdentifier)' == '.NETStandard'">%(Filename).netstandard%(TargetFrameworkVersion).pdb</Link>
<Link Condition="'%(TargetFrameworkIdentifier)' == '.NETCoreApp'">%(Filename).netcoreapp%(TargetFrameworkVersion).pdb</Link>
</_ConfuserRuntimeEmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="@(_ConfuserRuntimeEmbeddedResource)" />
</ItemGroup>
</Target>
<Target Name="CleanConfuserRuntime"
AfterTargets="CleanReferencedProjects"
Condition="'@(ConfuserRuntimeReference)' != ''">
<MSBuild Projects="@(ConfuserRuntimeReference)"
Targets="Clean"
Properties="Configuration=$(ConfuserRuntimeConfiguration)"
RemoveProperties="TargetFrameworks;TargetFramework;RuntimeIdentifier"
BuildInParallel="$(BuildInParallel)" />
</Target>
<Import Project="$(MSBuildThisFileDirectory)Confuser.Build/GenerateInternalsVisibleTo.targets" />
</Project>