Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb123d9a

Browse files
committed
Fix resource file processing in bootstrap when using MSBuild
The FSStrings.resources was being dropped. This is because ofdifferences in resource file processing for MSBuild and XBuild. Thisdetects which is being used and adjusts resource file processingaccordingly.
1 parent7148329 commitb123d9a

File tree

2 files changed

+311
-192
lines changed

2 files changed

+311
-192
lines changed

‎src/fsharp/FSharp.Build-proto/Microsoft.FSharp-proto.targets‎

Lines changed: 156 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,31 @@ Copyright (C) Microsoft Corporation. Apache 2.0 License.
1717

1818
<Projectxmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1919

20-
<UsingTaskTaskName="Fsc"AssemblyFile="FSharp.Build-proto.dll"/>
21-
<UsingTaskTaskName="CreateFSharpManifestResourceName"AssemblyFile="FSharp.Build-proto.dll"/>
22-
23-
24-
<PropertyGroup>
25-
<DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
26-
<Language>F#</Language>
27-
<TailcallsCondition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
28-
<FrameworkRegistryBaseCondition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
29-
<!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work.-->
30-
<RootNamespaceCondition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
31-
</PropertyGroup>
32-
33-
<!--
20+
<UsingTaskTaskName="Fsc"AssemblyFile="FSharp.Build-proto.dll"/>
21+
<UsingTaskTaskName="CreateFSharpManifestResourceName"AssemblyFile="FSharp.Build-proto.dll"/>
22+
23+
24+
<PropertyGroup>
25+
<ImportByWildcardBeforeMicrosoftFSharpTargetsCondition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == ''">true</ImportByWildcardBeforeMicrosoftFSharpTargets>
26+
<ImportByWildcardAfterMicrosoftFSharpTargetsCondition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == ''">true</ImportByWildcardAfterMicrosoftFSharpTargets>
27+
</PropertyGroup>
28+
29+
<ImportProject="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*"Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>
30+
31+
<PropertyGroup>
32+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
33+
<DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
34+
<Language>F#</Language>
35+
<TargetRuntime>Managed</TargetRuntime>
36+
<TailcallsCondition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
37+
<FrameworkRegistryBaseCondition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
38+
<!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work.-->
39+
<RootNamespaceCondition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
40+
<Actual32BitCondition="'$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0'">false</Actual32Bit>
41+
<Actual32BitCondition="!('$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0')">$(Prefer32Bit)</Actual32Bit>
42+
</PropertyGroup>
43+
44+
<!--
3445
The CreateManifestResourceNames target create the manifest resource names from the .RESX
3546
files.
3647
@@ -50,63 +61,105 @@ Copyright (C) Microsoft Corporation. Apache 2.0 License.
5061
5162
For other project systems, this transformation may be different.
5263
-->
53-
<PropertyGroup>
54-
<CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
55-
</PropertyGroup>
56-
57-
<TargetName="CreateManifestResourceNames"
58-
Condition="'@(EmbeddedResource)' != ''"
59-
DependsOnTargets="$(CreateManifestResourceNamesDependsOn)">
60-
<CreateFSharpManifestResourceNameCondition="'@(ResxWithNoCulture)' != ''"
64+
<PropertyGroup>
65+
<CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
66+
</PropertyGroup>
67+
68+
<!-- This is the implementation of CreateManifestResourceNames which is compatible with the way-->
69+
<!-- xbuild processes resource names-->
70+
<Target
71+
Name="CreateManifestResourceNames"
72+
Condition="'@(EmbeddedResource)' != '' AND Exists('$(MSBuildToolsPath)\..\4.0\Mono.Posix.dll')"
73+
DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
74+
>
75+
<CreateFSharpManifestResourceNameCondition="'@(ResxWithNoCulture)' != ''"
6176
ResourceFiles="@(ResxWithNoCulture)"RootNamespace="$(RootNamespace)">
62-
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestResourceWithNoCultureName" />
63-
</CreateFSharpManifestResourceName>
77+
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestResourceWithNoCultureName" />
78+
</CreateFSharpManifestResourceName>
6479

65-
<CreateFSharpManifestResourceNameCondition="'@(NonResxWithNoCulture)' != ''"
80+
<CreateFSharpManifestResourceNameCondition="'@(NonResxWithNoCulture)' != ''"
6681
ResourceFiles="@(NonResxWithNoCulture)"RootNamespace="$(RootNamespace)">
67-
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestNonResxWithNoCulture" />
68-
</CreateFSharpManifestResourceName>
82+
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestNonResxWithNoCulture" />
83+
</CreateFSharpManifestResourceName>
6984

70-
<CreateFSharpManifestResourceNameCondition="'@(ResxWithCulture)' != ''"
85+
<CreateFSharpManifestResourceNameCondition="'@(ResxWithCulture)' != ''"
7186
ResourceFiles="@(ResxWithCulture)"RootNamespace="$(RootNamespace)">
72-
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestResourceWithCultureName" />
73-
</CreateFSharpManifestResourceName>
87+
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestResourceWithCultureName" />
88+
</CreateFSharpManifestResourceName>
7489

75-
<CreateFSharpManifestResourceNameCondition="'@(NonResxWithCulture)' != ''"
90+
<CreateFSharpManifestResourceNameCondition="'@(NonResxWithCulture)' != ''"
7691
ResourceFiles="@(NonResxWithCulture)"RootNamespace="$(RootNamespace)">
77-
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestNonResxWithCulture" />
78-
</CreateFSharpManifestResourceName>
92+
<Output TaskParameter ="ManifestResourceNames" ItemName ="ManifestNonResxWithCulture" />
93+
</CreateFSharpManifestResourceName>
94+
7995

96+
<ItemGroup>
97+
<EmbeddedResourceRemove="@(EmbeddedResource)"Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
98+
</ItemGroup>
8099

81-
<ItemGroup>
82-
<EmbeddedResourceRemove="@(EmbeddedResource)"Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
83-
<EmbeddedResourceInclude="@(_Temporary)" />
84-
<_TemporaryRemove="@(_Temporary)" />
85-
</ItemGroup>
100+
</Target>
86101

87-
</Target>
102+
<!-- This is the implementation of CreateManifestResourceNames which is compatible with the way-->
103+
<!-- msbuild processes resource names-->
104+
<Target
105+
Name="CreateManifestResourceNames"
106+
Condition="'@(EmbeddedResource)' != '' AND !Exists('$(MSBuildToolsPath)\..\4.0\Mono.Posix.dll')"
107+
DependsOnTargets="$(CreateManifestResourceNamesDependsOn)">
88108

89109
<ItemGroup>
90-
<DocFileItemInclude="$(DocumentationFile)"Condition="'$(DocumentationFile)'!=''"/>
110+
<_TemporaryRemove="@(_Temporary)" />
91111
</ItemGroup>
92112

93-
<ItemGroupCondition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
94-
<_DebugSymbolsIntermediatePathTemporaryInclude="$(PdbFile)"/>
95-
<!-- Add any missing .pdb extension, as the compiler does-->
96-
<_DebugSymbolsIntermediatePathInclude="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
113+
<!-- Create manifest names for culture and non-culture Resx files, and for non-culture Non-Resx resources-->
114+
<CreateFSharpManifestResourceName
115+
ResourceFiles="@(EmbeddedResource)"
116+
RootNamespace="$(RootNamespace)"
117+
Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx')">
118+
119+
<OutputTaskParameter="ResourceFilesWithManifestResourceNames"ItemName="_Temporary" />
120+
121+
</CreateFSharpManifestResourceName>
122+
123+
<!-- Create manifest names for all culture non-resx resources-->
124+
<CreateFSharpManifestResourceName
125+
ResourceFiles="@(EmbeddedResource)"
126+
RootNamespace="$(RootNamespace)"
127+
PrependCultureAsDirectory="false"
128+
Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'">
129+
130+
<OutputTaskParameter="ResourceFilesWithManifestResourceNames"ItemName="_Temporary" />
131+
132+
</CreateFSharpManifestResourceName>
133+
134+
<ItemGroup>
135+
<EmbeddedResourceRemove="@(EmbeddedResource)"Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
136+
<EmbeddedResourceInclude="@(_Temporary)" />
137+
<_TemporaryRemove="@(_Temporary)" />
97138
</ItemGroup>
139+
</Target>
140+
141+
<ItemGroup>
142+
<DocFileItemInclude="$(DocumentationFile)"Condition="'$(DocumentationFile)'!=''"/>
143+
</ItemGroup>
98144

99-
<PropertyGroup>
100-
<CoreCompileDependsOn>_ComputeNonExistentFileProperty</CoreCompileDependsOn>
101-
</PropertyGroup>
145+
<ItemGroupCondition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
146+
<_DebugSymbolsIntermediatePathTemporaryInclude="$(PdbFile)"/>
147+
<!-- Add any missing .pdb extension, as the compiler does-->
148+
<_DebugSymbolsIntermediatePathInclude="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
149+
</ItemGroup>
102150

103-
<Target
104-
Name="CoreCompile"
105-
Inputs="$(MSBuildAllProjects);
151+
<PropertyGroup>
152+
<CoreCompileDependsOn></CoreCompileDependsOn>
153+
</PropertyGroup>
154+
155+
<Target
156+
Name="CoreCompile"
157+
Inputs="$(MSBuildAllProjects);
106158
@(CompileBefore);
107159
@(Compile);
108160
@(CompileAfter);
109161
@(_CoreCompileResourceInputs);
162+
@(ManifestNonResxWithNoCultureOnDisk);
110163
$(ApplicationIcon);
111164
$(AssemblyOriginatorKeyFile);
112165
@(ReferencePath);
@@ -117,70 +170,77 @@ Copyright (C) Microsoft Corporation. Apache 2.0 License.
117170
@(CustomAdditionalCompileInputs);
118171
$(VersionFile);
119172
$(KeyOriginatorFile)"
120-
Outputs="@(DocFileItem);
173+
Outputs="@(DocFileItem);
121174
@(IntermediateAssembly);
122175
@(_DebugSymbolsIntermediatePath);
123176
$(NonExistentFile);
124177
@(CustomAdditionalCompileOutputs)"
125-
DependsOnTargets="$(CoreCompileDependsOn)"
178+
DependsOnTargets="$(CoreCompileDependsOn)"
126179
>
127180

128-
<!-- See bug 6053
181+
<!-- See bug 6053
129182
<Error
130183
Condition="'$(SilverlightVersion)' != '' and !(Exists('$(ProgramFiles)\Microsoft F#\Silverlight\Libraries\Client\$(SilverlightVersion)\FSharp.Core.dll'))"
131184
Text="F# runtime for Silverlight version $(SilverlightVersion) is not installed. Please go to http://go.microsoft.com/fwlink/?LinkId=177463 to download and install matching F# runtime"
132185
/>
133186
-->
134187

135-
<Warning
136-
Condition="'$(Win32ResourceFile)' != ''"
137-
Text="The property&lt;Win32ResourceFile> has been renamed to&lt;Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
188+
<Warning
189+
Condition="'$(Win32ResourceFile)' != ''"
190+
Text="The property&lt;Win32ResourceFile> has been renamed to&lt;Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
138191
/>
139192

140-
<!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler-->
141-
<FscCondition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true'"
142-
BaseAddress="$(BaseAddress)"
143-
CodePage="$(CodePage)"
144-
DebugSymbols="$(DebugSymbols)"
145-
DebugType="$(DebugType)"
146-
DefineConstants="$(DefineConstants)"
147-
DisabledWarnings="$(NoWarn)"
148-
DocumentationFile="$(DocumentationFile)"
149-
GenerateInterfaceFile="$(GenerateInterfaceFile)"
150-
KeyFile="$(KeyOriginatorFile)"
151-
LCID="$(LCID)"
152-
NoFramework="true"
153-
Optimize="$(Optimize)"
154-
OtherFlags="$(OtherFlags)"
155-
OutputAssembly="@(IntermediateAssembly)"
156-
PdbFile="$(PdbFile)"
157-
Platform="$(PlatformTarget)"
158-
References="@(ReferencePath)"
159-
ReferencePath="$(ReferencePath)"
160-
Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
161-
Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
162-
Tailcalls="$(Tailcalls)"
163-
TargetType="$(OutputType)"
164-
ToolExe="$(FscToolExe)"
165-
ToolPath="$(FscToolPath)"
166-
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
167-
Utf8Output="$(Utf8Output)"
168-
ValidateTypeProviders="$(ValidateTypeProviders)"
169-
VersionFile="$(VersionFile)"
170-
VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
171-
WarningLevel="$(WarningLevel)"
172-
WarningsAsErrors="$(WarningsAsErrors)"
173-
Win32ManifestFile="$(Win32Manifest)"
174-
Win32ResourceFile="$(Win32Resource)"
193+
<!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler-->
194+
<FscCondition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true'"
195+
BaseAddress="$(BaseAddress)"
196+
CodePage="$(CodePage)"
197+
DebugSymbols="$(DebugSymbols)"
198+
DebugType="$(DebugType)"
199+
DefineConstants="$(DefineConstants)"
200+
DisabledWarnings="$(NoWarn)"
201+
DocumentationFile="$(DocumentationFile)"
202+
GenerateInterfaceFile="$(GenerateInterfaceFile)"
203+
KeyFile="$(KeyOriginatorFile)"
204+
LCID="$(LCID)"
205+
NoFramework="true"
206+
Optimize="$(Optimize)"
207+
OtherFlags="$(OtherFlags)"
208+
OutputAssembly="@(IntermediateAssembly)"
209+
PdbFile="$(PdbFile)"
210+
Platform="$(PlatformTarget)"
211+
References="@(ReferencePath)"
212+
ReferencePath="$(ReferencePath)"
213+
Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
214+
Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
215+
Tailcalls="$(Tailcalls)"
216+
TargetType="$(OutputType)"
217+
ToolExe="$(FscToolExe)"
218+
ToolPath="$(FscToolPath)"
219+
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
220+
Utf8Output="$(Utf8Output)"
221+
ValidateTypeProviders="$(ValidateTypeProviders)"
222+
VersionFile="$(VersionFile)"
223+
VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
224+
WarningLevel="$(WarningLevel)"
225+
WarningsAsErrors="$(WarningsAsErrors)"
226+
Win32ManifestFile="$(Win32Manifest)"
227+
Win32ResourceFile="$(Win32Resource)"
175228
/>
176229

177-
<ItemGroup>
178-
<_CoreCompileResourceInputsRemove="@(_CoreCompileResourceInputs)" />
179-
</ItemGroup>
230+
<!-- These parameters are supported by F# 3.0 but not yet supported by the F# open source edition:
231+
Prefer32Bit="$(Actual32Bit)"
232+
SubsystemVersion="$(SubsystemVersion)"
233+
HighEntropyVA="$(HighEntropyVA)"-->
234+
235+
<ItemGroup>
236+
<_CoreCompileResourceInputsRemove="@(_CoreCompileResourceInputs)" />
237+
</ItemGroup>
238+
239+
</Target>
180240

181-
</Target>
241+
<ImportProject="$(MSBuildBinPath)\Microsoft.Common.targets"/>
182242

183-
<ImportProject="$(MSBuildBinPath)\Microsoft.Common.targets"/>
243+
<ImportProject="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*"Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>
184244

185245
</Project>
186246

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp