forked from icsharpcode/SharpDevelop
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
198 lines (190 loc) · 14.8 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
198 lines (190 loc) · 14.8 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<Project>
<!--
A distribution keeps shared runtime dependencies beside OpenDevelop itself.
Remove those files from addin copy-local before they reach AddIns/. Regular
developer builds remain self-contained because this is opt-in.
-->
<Target Name="RemoveHostProvidedFilesFromAddInCopyLocal"
BeforeTargets="GetCopyToOutputDirectoryItems;_CopyFilesMarkedCopyLocal"
Condition="'$(OpenDevelopDistributionBuild)' == 'true'
and '$(OpenDevelopHostPublishDir)' != ''
and $([System.String]::Copy('$(OutputPath)').Contains('AddIns'))">
<ItemGroup>
<_OpenDevelopHostFile Include="$(OpenDevelopHostPublishDir)/**/*"
Condition="Exists('$(OpenDevelopHostPublishDir)')" />
<ReferenceCopyLocalPaths Remove="@(_OpenDevelopHostFile)"
MatchOnMetadata="Filename;Extension"
MatchOnMetadataOptions="PathLike" />
<!-- Package build targets can add native helpers as None/Content with
CopyToOutputDirectory, bypassing ReferenceCopyLocalPaths entirely. -->
<None Remove="@(_OpenDevelopHostFile)"
MatchOnMetadata="Filename;Extension"
MatchOnMetadataOptions="PathLike" />
<Content Remove="@(_OpenDevelopHostFile)"
MatchOnMetadata="Filename;Extension"
MatchOnMetadataOptions="PathLike" />
</ItemGroup>
</Target>
<!-- Repository compatibility shim. New projects consume OpenDevelop.Addin.Sdk as an
MSBuild SDK; existing addins are discovered from their deployment OutputPath. -->
<PropertyGroup>
<OpenDevelopRepoRoot Condition="'$(OpenDevelopRepoRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</OpenDevelopRepoRoot>
<OpenDevelopHostBin Condition="'$(OpenDevelopHostBin)' == ''">$(OpenDevelopRepoRoot)src/Main/SharpDevelop/bin/$(Configuration)/net10.0-windows/</OpenDevelopHostBin>
<OpenDevelopHostManifest Condition="'$(OpenDevelopHostManifest)' == ''">$(OpenDevelopHostBin)OpenDevelop.host-assemblies.txt</OpenDevelopHostManifest>
<OpenDevelopAddin Condition="'$(OpenDevelopAddin)' == '' And '$(MSBuildProjectName)' != 'SharpDevelop' And $([System.String]::Copy('$(OutputPath)').Replace('\','/').ToLower().Contains('addins/'))">true</OpenDevelopAddin>
<OpenDevelopAddinKind Condition="'$(OpenDevelopAddin)' == 'true' And '$(OpenDevelopAddinKind)' == ''">InProcessDependency</OpenDevelopAddinKind>
<OpenDevelopAddinKind Condition="'$(OpenDevelopAddin)' == 'true' And $([System.String]::Copy('$(OutputPath)').Replace('\','/').ToLower().Contains('/host/'))">OutOfProcessHost</OpenDevelopAddinKind>
<OpenDevelopTrimHostAssemblies Condition="'$(OpenDevelopTrimAddinCopyLocal)' != ''">$(OpenDevelopTrimAddinCopyLocal)</OpenDevelopTrimHostAssemblies>
<!-- Out-of-process hosts are never started through their apphost. Every one of them is launched
by DesignerHostProcessClient as "dotnet exec <host>.dll" (see GetChildDllPath), so the
generated .exe is dead weight - and worse, it is the one file in such a project that is
architecture-specific. Building the distribution on an ARM64 machine therefore put ~25 ARM64
apphosts into the win-x64 payload; none could ever have run there, which is why that payload
was broken beyond its main process. Suppressing the apphost removes the whole class of
defect at the source rather than trying to pass the right RID everywhere.
Deliberately NOT applied to the IDE itself (double-click launching) or to genuine CLI tools.
Set unconditionally for this kind rather than only when UseAppHost is empty: the .NET SDK's
own props already default it to true long before this file is imported, so a
"only if unset" guard never fires. A host project that genuinely needs an apphost should
declare a different OpenDevelopAddinKind. -->
<UseAppHost Condition="'$(OpenDevelopAddinKind)' == 'OutOfProcessHost'">false</UseAppHost>
<!-- Same rule, same reason, for three child processes that live in submodules and so cannot
carry the OpenDevelopAddinKind marker in their own csproj. Each is started by path as a
managed dll, never through its apphost:
SharpDbg.Cli - DapSession.cs resolves "SharpDbg.Cli.dll"
XamlLanguageServer.Wpf - RegisterXamlLanguageServiceCommand resolves "wpf-xaml-ls.dll"
XamlToCSharpGenerator.LanguageServer- launched the same way by the WXSG language client
Setting this here rather than in the submodules keeps the change inside this repo. -->
<UseAppHost Condition="'$(MSBuildProjectName)' == 'SharpDbg.Cli'
Or '$(MSBuildProjectName)' == 'XamlLanguageServer.Wpf'
Or '$(MSBuildProjectName)' == 'XamlToCSharpGenerator.LanguageServer'">false</UseAppHost>
</PropertyGroup>
<Target Name="OpenDevelopGenerateHostAssemblyManifest"
AfterTargets="Build"
Condition="'$(MSBuildProjectName)' == 'SharpDevelop'">
<ItemGroup>
<_OpenDevelopHostManifestAssembly Include="$(TargetDir)*.dll" />
</ItemGroup>
<WriteLinesToFile File="$(OpenDevelopHostManifest)"
Lines="@(_OpenDevelopHostManifestAssembly->'%(Filename)%(Extension)')"
Overwrite="true"
WriteOnlyWhenDifferent="true"
Condition="@(_OpenDevelopHostManifestAssembly->Count()) > 0" />
</Target>
<!--
src/Main/GlobalAssemblyInfo.cs is linked into ~60 projects and is the single place the product
version reaches the binaries from. It used to be produced by src/Tools/UpdateAssemblyInfo from
GlobalAssemblyInfo.cs.template, whose Major/Minor/Build were LITERAL CONSTANTS ("5"/"2"/"0") -
so no git tag could ever change the version - and nothing in the build invoked that tool any
more, which is why the shipped version sat at 5.2.0.5347 indefinitely. Both are now retired:
the file is generated here from GitVersion (see GitVersion.yml), so `git tag v5.4.0` is what
decides the version.
Written with WriteOnlyWhenDifferent so the ~60 projects that link this one shared file do not
keep touching it and re-triggering each other's compile. The content is a pure function of the
git state, so every project computes byte-identical text and only the first build after a tag
or commit change actually writes.
-->
<!-- Every project, not just the host: src/Main/GlobalAssemblyInfo.cs is ONE shared file linked
by ~60 projects, so each of them must compute the SAME version text. Referencing GitVersion
only in the host made every other project fall back to 0.0.0/nogit and rewrite the file with
different content on every build, which flip-flopped a source file all 60 depend on and
broke parallel builds (missing *.g.cs / locked *.g.resources as projects re-ran mid-compile
against an input that kept changing). With the values identical everywhere the
WriteOnlyWhenDifferent below genuinely no-ops after the first write. -->
<!-- "Vendored" means a submodule under <repo>/externals (ilspy, vscode-wpf, wpftoolkit, ...).
Those carry their own central-package-management and lock files, so adding a PackageReference
there fails restore (NU1010/NU1004) - and they never link GlobalAssemblyInfo.cs anyway. Note
the check is anchored to the repo root: this repository is ITSELF checked out under a folder
called "externals", so a plain Contains('/externals/') matches every project in the tree. -->
<PropertyGroup>
<_OdRepoRootSlash>$([System.String]::Copy('$(OpenDevelopRepoRoot)').Replace('\','/'))</_OdRepoRootSlash>
<_OdProjectPathSlash>$([System.String]::Copy('$(MSBuildProjectFullPath)').Replace('\','/'))</_OdProjectPathSlash>
<_OdVendoredProject>false</_OdVendoredProject>
<_OdVendoredProject Condition="$(_OdProjectPathSlash.StartsWith('$(_OdRepoRootSlash)externals/'))">true</_OdVendoredProject>
<!-- src/Libraries/AvalonDock, src/Libraries/AvalonEdit and the samples deliberately opt out of
central package management (see Directory.Packages.props), where a versionless
PackageReference is an error (NU1015). None of them link GlobalAssemblyInfo.cs, so they
want neither GitVersion nor the generation below. Keeping both scoped to the SAME set is
what guarantees every project that does link the file computes identical text for it. -->
<_OdVersionedProject>true</_OdVersionedProject>
<_OdVersionedProject Condition="'$(_OdVendoredProject)' == 'true' Or '$(ManagePackageVersionsCentrally)' != 'true'">false</_OdVersionedProject>
</PropertyGroup>
<ItemGroup Condition="'$(_OdVersionedProject)' == 'true'">
<PackageReference Include="GitVersion.MsBuild" PrivateAssets="all" />
</ItemGroup>
<Target Name="OpenDevelopGenerateGlobalAssemblyInfo"
BeforeTargets="CoreCompile"
Condition="'$(OpenDevelopSkipGlobalAssemblyInfo)' != 'true' And '$(_OdVersionedProject)' == 'true'">
<PropertyGroup>
<_OpenDevelopGlobalAssemblyInfo>$(MSBuildThisFileDirectory)src/Main/GlobalAssemblyInfo.cs</_OpenDevelopGlobalAssemblyInfo>
<!-- GitVersion is only wired into the host project (mirroring how the Roma project does it),
so every other project falls back to the tag-derived values passed down there. The
fallback keeps a plain `dotnet build <someproject>` working in a tree with no tags. -->
<_OdMajor Condition="'$(GitVersion_Major)' != ''">$(GitVersion_Major)</_OdMajor>
<_OdMajor Condition="'$(_OdMajor)' == ''">0</_OdMajor>
<_OdMinor Condition="'$(GitVersion_Minor)' != ''">$(GitVersion_Minor)</_OdMinor>
<_OdMinor Condition="'$(_OdMinor)' == ''">0</_OdMinor>
<_OdPatch Condition="'$(GitVersion_Patch)' != ''">$(GitVersion_Patch)</_OdPatch>
<_OdPatch Condition="'$(_OdPatch)' == ''">0</_OdPatch>
<_OdRevision Condition="'$(GitVersion_CommitsSinceVersionSource)' != ''">$(GitVersion_CommitsSinceVersionSource)</_OdRevision>
<_OdRevision Condition="'$(_OdRevision)' == ''">0</_OdRevision>
<_OdFullSemVer Condition="'$(GitVersion_FullSemVer)' != ''">$(GitVersion_FullSemVer)</_OdFullSemVer>
<_OdFullSemVer Condition="'$(_OdFullSemVer)' == ''">$(_OdMajor).$(_OdMinor).$(_OdPatch)</_OdFullSemVer>
<_OdSha Condition="'$(GitVersion_ShortSha)' != ''">$(GitVersion_ShortSha)</_OdSha>
<_OdSha Condition="'$(_OdSha)' == ''">nogit</_OdSha>
</PropertyGroup>
<ItemGroup>
<_OdAssemblyInfoLine Include="// <auto-generated> Generated by Directory.Build.targets from GitVersion (GitVersion.yml)." />
<_OdAssemblyInfoLine Include="// Do not edit, and do not check in: the version comes from the git tag." />
<_OdAssemblyInfoLine Include="using System.Resources%3B" />
<_OdAssemblyInfoLine Include="using System.Reflection%3B" />
<_OdAssemblyInfoLine Include="%20" />
<_OdAssemblyInfoLine Include="[assembly: System.Runtime.InteropServices.ComVisible(false)]" />
<_OdAssemblyInfoLine Include="[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows")]" />
<_OdAssemblyInfoLine Include="[assembly: AssemblyCompany("ic#code")]" />
<_OdAssemblyInfoLine Include="[assembly: AssemblyProduct("SharpDevelop")]" />
<_OdAssemblyInfoLine Include="[assembly: AssemblyCopyright("2000-$([System.DateTime]::Now.Year) AlphaSierraPapa for the SharpDevelop Team")]" />
<_OdAssemblyInfoLine Include="[assembly: AssemblyVersion(RevisionClass.Major + "." + RevisionClass.Minor + "." + RevisionClass.Build + "." + RevisionClass.Revision)]" />
<_OdAssemblyInfoLine Include="[assembly: AssemblyInformationalVersion(RevisionClass.FullVersion + "+$(_OdSha)")]" />
<_OdAssemblyInfoLine Include="[assembly: NeutralResourcesLanguage("en-US")]" />
<_OdAssemblyInfoLine Include="%20" />
<_OdAssemblyInfoLine Include="[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly"," />
<_OdAssemblyInfoLine Include=" Justification = "AssemblyInformationalVersion does not need to be a parsable version")]" />
<_OdAssemblyInfoLine Include="internal static class RevisionClass" />
<_OdAssemblyInfoLine Include="{" />
<_OdAssemblyInfoLine Include=" public const string Major = "$(_OdMajor)"%3B" />
<_OdAssemblyInfoLine Include=" public const string Minor = "$(_OdMinor)"%3B" />
<_OdAssemblyInfoLine Include=" public const string Build = "$(_OdPatch)"%3B" />
<_OdAssemblyInfoLine Include=" public const string Revision = "$(_OdRevision)"%3B" />
<_OdAssemblyInfoLine Include=" public const string VersionName = null%3B" />
<_OdAssemblyInfoLine Include=" public const string FullVersion = "$(_OdFullSemVer)"%3B" />
<_OdAssemblyInfoLine Include="}" />
</ItemGroup>
<WriteLinesToFile File="$(_OpenDevelopGlobalAssemblyInfo)"
Lines="@(_OdAssemblyInfoLine)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
</Target>
<Import Project="$(MSBuildThisFileDirectory)src/SDK/OpenDevelop.Addin.Sdk/Sdk/Sdk.targets" />
<!--
LibreWPF builds a small native Win32-compatibility shim for portable macOS
builds. On macOS 27, /usr/bin/cc can be the Xcode compiler while its
implicit SDK is CommandLineTools/MacOSX.sdk. That SDK advertises the new
arm64e.x1 architecture, which the Xcode linker used by the compiler does
not yet parse ("tapi error: unknown architecture"). Use Xcode's matching
SDK only for this native-shim invocation. This deliberately does not set
SDKROOT globally: managed compilation and other native package targets keep
their normal SDK selection.
The condition preserves the usual LibreWPF behaviour on installations that
have only Command Line Tools or a differently located Xcode.
-->
<Target Name="OpenDevelopUseMatchingXcodeSdkForProGpuWin32Compat"
BeforeTargets="_ProGpuWpfSdkBuildWin32CompatShim"
Condition="$([MSBuild]::IsOSPlatform('OSX'))
And Exists('/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk')">
<PropertyGroup>
<_OpenDevelopXcodeMacOsSdk>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk</_OpenDevelopXcodeMacOsSdk>
<_ProGpuWpfWin32CompatCompileCommand>SDKROOT="$(_OpenDevelopXcodeMacOsSdk)" "$(ProGpuWpfWin32CompatCompiler)" -dynamiclib -O2 -fvisibility=hidden -o "$(_ProGpuWpfWin32CompatOutput)" "$(_ProGpuWpfWin32CompatSource)"</_ProGpuWpfWin32CompatCompileCommand>
</PropertyGroup>
</Target>
</Project>