Skip to content

Commit d98f6fb

Browse files
Fix #123: add ValueMultiple prop
1 parent c2bcf44 commit d98f6fb

File tree

3 files changed

+89
-19
lines changed

3 files changed

+89
-19
lines changed

Samples/SSRSample/.paket/Paket.Restore.targets

Lines changed: 80 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,26 @@
1111
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
1212
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
1313
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
14+
<PaketBootstrapperStyle>classic</PaketBootstrapperStyle>
15+
<PaketBootstrapperStyle Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">proj</PaketBootstrapperStyle>
16+
<PaketExeImage>assembly</PaketExeImage>
17+
<PaketExeImage Condition=" '$(PaketBootstrapperStyle)' == 'proj' ">native</PaketExeImage>
1418
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
1519
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
1620
<!-- Paket command -->
21+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket')">$(PaketToolsPath)paket</PaketExePath>
1722
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
18-
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
19-
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
20-
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
2123

22-
<!-- .net core fdd -->
23-
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
24-
<PaketCommand Condition=" '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
24+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' ">$(PaketToolsPath)paket.exe</PaketExePath>
25+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketExeImage)' == 'assembly' ">$(PaketToolsPath)paket.exe</PaketExePath>
26+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketExeImage)' == 'native' ">$(PaketToolsPath)paket</PaketExePath>
2527

26-
<!-- no extension is a shell script -->
27-
<PaketCommand Condition=" '$(_PaketExeExtension)' == '' ">"$(PaketExePath)"</PaketCommand>
28+
<!-- Paket command -->
29+
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
30+
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
31+
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
32+
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
33+
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(OS)' != 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
2834

2935
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
3036
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
@@ -38,7 +44,11 @@
3844
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
3945
</PropertyGroup>
4046

41-
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
47+
<Target Name="PaketBootstrapping" Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">
48+
<MSBuild Projects="$(PaketToolsPath)paket.bootstrapper.proj" Targets="Restore" />
49+
</Target>
50+
51+
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="PaketBootstrapping">
4252

4353
<!-- Step 1 Check if lockfile is properly restored -->
4454
<PropertyGroup>
@@ -77,7 +87,7 @@
7787
</PropertyGroup>
7888

7989
<!-- Do a global restore if required -->
80-
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
90+
<Exec Command='$(PaketBootStrapperCommand)' Condition=" '$(PaketBootstrapperStyle)' == 'classic' AND Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
8191
<Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
8292

8393
<!-- Step 2 Detect project specific changes -->
@@ -141,15 +151,17 @@
141151

142152
<ItemGroup Condition="($(DesignTimeBuild) != true OR '$(PaketPropsLoaded)' != 'true') AND '@(PaketReferencesFileLines)' != '' " >
143153
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
154+
<Splits>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length)</Splits>
144155
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
145156
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
146157
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
147-
<CopyLocal>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
158+
<CopyLocal Condition="'$(Splits)' == '6'">$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
148159
</PaketReferencesFileLinesInfo>
149160
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
150161
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
151162
<PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>
152-
<ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.CopyLocal) == 'false'">runtime</ExcludeAssets>
163+
<ExcludeAssets Condition=" '%(PaketReferencesFileLinesInfo.Splits)' == '6' And %(PaketReferencesFileLinesInfo.CopyLocal) == 'false'">runtime</ExcludeAssets>
164+
<ExcludeAssets Condition=" '%(PaketReferencesFileLinesInfo.Splits)' != '6' And %(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>
153165
<Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>
154166
</PackageReference>
155167
</ItemGroup>
@@ -182,19 +194,27 @@
182194
<Target Name="PaketDisableDirectPack" AfterTargets="_IntermediatePack" BeforeTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
183195
<PropertyGroup>
184196
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
197+
<DetectedMSBuildVersion>$(MSBuildVersion)</DetectedMSBuildVersion>
198+
<DetectedMSBuildVersion Condition="$(MSBuildVersion) == ''">15.8.0</DetectedMSBuildVersion>
185199
</PropertyGroup>
186200
</Target>
187201

188202
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
189203
<ItemGroup>
190204
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/>
205+
<MSBuildMajorVersion Include="$(DetectedMSBuildVersion.Replace(`-`, `.`).Split(`.`)[0])" />
206+
<MSBuildMinorVersion Include="$(DetectedMSBuildVersion.Replace(`-`, `.`).Split(`.`)[1])" />
191207
</ItemGroup>
192208

193209
<PropertyGroup>
194210
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
195211
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
196-
<UseNewPack>false</UseNewPack>
197-
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
212+
<UseMSBuild15_9_Pack>false</UseMSBuild15_9_Pack>
213+
<UseMSBuild15_9_Pack Condition=" '@(MSBuildMajorVersion)' > '15' OR ('@(MSBuildMajorVersion)' == '15' AND '@(MSBuildMinorVersion)' > '8') ">true</UseMSBuild15_9_Pack>
214+
<UseMSBuild15_8_Pack>false</UseMSBuild15_8_Pack>
215+
<UseMSBuild15_8_Pack Condition=" '$(NuGetToolVersion)' != '4.0.0' AND (! $(UseMSBuild15_9_Pack)) ">true</UseMSBuild15_8_Pack>
216+
<UseNuGet4_Pack>false</UseNuGet4_Pack>
217+
<UseNuGet4_Pack Condition=" (! $(UseMSBuild15_8_Pack)) AND (! $(UseMSBuild15_9_Pack)) ">true</UseNuGet4_Pack>
198218
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath>
199219
<AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath>
200220
</PropertyGroup>
@@ -209,9 +229,52 @@
209229
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
210230
</ConvertToAbsolutePath>
211231

212-
213232
<!-- Call Pack -->
214-
<PackTask Condition="$(UseNewPack)"
233+
<PackTask Condition="$(UseMSBuild15_9_Pack)"
234+
PackItem="$(PackProjectInputFile)"
235+
PackageFiles="@(_PackageFiles)"
236+
PackageFilesToExclude="@(_PackageFilesToExclude)"
237+
PackageVersion="$(PackageVersion)"
238+
PackageId="$(PackageId)"
239+
Title="$(Title)"
240+
Authors="$(Authors)"
241+
Description="$(Description)"
242+
Copyright="$(Copyright)"
243+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
244+
LicenseUrl="$(PackageLicenseUrl)"
245+
ProjectUrl="$(PackageProjectUrl)"
246+
IconUrl="$(PackageIconUrl)"
247+
ReleaseNotes="$(PackageReleaseNotes)"
248+
Tags="$(PackageTags)"
249+
DevelopmentDependency="$(DevelopmentDependency)"
250+
BuildOutputInPackage="@(_BuildOutputInPackage)"
251+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
252+
SymbolPackageFormat="symbols.nupkg"
253+
TargetFrameworks="@(_TargetFrameworks)"
254+
AssemblyName="$(AssemblyName)"
255+
PackageOutputPath="$(PackageOutputAbsolutePath)"
256+
IncludeSymbols="$(IncludeSymbols)"
257+
IncludeSource="$(IncludeSource)"
258+
PackageTypes="$(PackageType)"
259+
IsTool="$(IsTool)"
260+
RepositoryUrl="$(RepositoryUrl)"
261+
RepositoryType="$(RepositoryType)"
262+
SourceFiles="@(_SourceFiles->Distinct())"
263+
NoPackageAnalysis="$(NoPackageAnalysis)"
264+
MinClientVersion="$(MinClientVersion)"
265+
Serviceable="$(Serviceable)"
266+
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
267+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
268+
NuspecOutputPath="$(AdjustedNuspecOutputPath)"
269+
IncludeBuildOutput="$(IncludeBuildOutput)"
270+
BuildOutputFolder="$(BuildOutputTargetFolder)"
271+
ContentTargetFolders="$(ContentTargetFolders)"
272+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
273+
NuspecFile="$(NuspecFileAbsolutePath)"
274+
NuspecBasePath="$(NuspecBasePath)"
275+
NuspecProperties="$(NuspecProperties)"/>
276+
277+
<PackTask Condition="$(UseMSBuild15_8_Pack)"
215278
PackItem="$(PackProjectInputFile)"
216279
PackageFiles="@(_PackageFiles)"
217280
PackageFilesToExclude="@(_PackageFilesToExclude)"
@@ -254,7 +317,7 @@
254317
NuspecBasePath="$(NuspecBasePath)"
255318
NuspecProperties="$(NuspecProperties)"/>
256319

257-
<PackTask Condition="! $(UseNewPack)"
320+
<PackTask Condition="$(UseNuGet4_Pack)"
258321
PackItem="$(PackProjectInputFile)"
259322
PackageFiles="@(_PackageFiles)"
260323
PackageFilesToExclude="@(_PackageFilesToExclude)"

src/Fable.React/Fable.Helpers.React.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ module rec Props =
285285
| Type of string
286286
| UseMap of string
287287
| Value of obj
288+
/// Compiles to same prop as `Value`. Intended for `select` elements
289+
/// with `Multiple` prop set to `true`.
290+
| [<CompiledName("value")>] ValueMultiple of string[]
288291
| Width of obj
289292
| Wmode of string
290293
| Wrap of string

src/Fable.React/Fable.Helpers.ReactServer.fs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ let private renderCssProp (html:TextWriter) (prop: CSSProp) =
453453
| CSSProp.Custom (key, value) -> cssProp html (slugKey key) value
454454
#endif
455455

456-
let inline boolAttr (html:TextWriter) (key: string) (value: bool) = if value then html.Write key
456+
let inline boolAttr (html:TextWriter) (key: string) (value: bool) =
457+
if value then html.Write key
457458

458459
let inline strAttr (html:TextWriter) (key: string) (value: string) =
459460
html.Write key
@@ -466,7 +467,10 @@ let inline objAttr (html:TextWriter) (key: string) (value: obj) = strAttr html k
466467
let private renderHtmlAttr (html:TextWriter) (attr: HTMLAttr) =
467468
match attr with
468469
| DefaultChecked v | Checked v -> boolAttr html "checked" v
469-
| DefaultValue v | Value v -> strAttr html "value" (string v)
470+
| DefaultValue v | Value v -> strAttr html "value" (string v)
471+
// TODO: Not sure if it's possible/easy to set multiple selected
472+
// options with an attribute in SSR, so do nothing for now
473+
| ValueMultiple _ -> ()
470474
| Accept v -> strAttr html "accept" v
471475
| AcceptCharset v -> strAttr html "accept-charset" v
472476
| AccessKey v -> strAttr html "accesskey" v

0 commit comments

Comments
 (0)