Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit db7ebc9

Browse files
committed
Add F# to dotnet cli 1..1.0
1 parent 12f4ab5 commit db7ebc9

6 files changed

+247
-122
lines changed

Microsoft.DotNet.Cli.sln

Lines changed: 154 additions & 121 deletions
Large diffs are not rendered by default.

build/Microsoft.DotNet.Cli.Compile.targets

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@
126126
VersionSuffix="$(VersionSuffix)"
127127
ProjectPath="$(SrcDirectory)/tool_roslyn/tool_roslyn.csproj" />
128128

129+
<DotNetPublish ToolPath="%(Stage.DotnetDir)"
130+
Output="$(SdkOutputDirectory)/FSharp"
131+
Configuration="$(Configuration)"
132+
VersionSuffix="$(VersionSuffix)"
133+
ProjectPath="$(SrcDirectory)/tool_fsharp/tool_fsc.csproj" />
134+
129135
<RemoveAssetFromDepsPackages DepsFile="$(SdkOutputDirectory)/redist.deps.json"
130136
SectionName="runtimeTargets"
131137
AssetPath="$(BinaryToCorehostifyRelDir)/%(RuntimeTargetsAssetsToRemoveFromDeps.Identity).exe" />
@@ -169,6 +175,7 @@
169175

170176
<!-- Removing Full CLR built TestHost assemblies from getting Crossgen as it is throwing error -->
171177
<SdkFilesExclude Include="$(SdkOutputDirectory)/TestHost*/**/*" />
178+
172179
<SdkFiles Include="$(SdkOutputDirectory)/**/*" Exclude="@(SdkFilesExclude)" />
173180
<SdkFilesWithPEMarker Remove="*" />
174181
</ItemGroup>
@@ -194,7 +201,8 @@
194201
JITPath="$(LibCLRJitPath)"
195202
CrossgenPath="$(CrossgenPath)"
196203
ReadyToRun="True"
197-
PlatformAssemblyPaths="@(PlatformAssemblies);
204+
PlatformAssemblyPaths="%(CrossgenTargets.RootDir)%(CrossgenTargets.Directory);
205+
@(PlatformAssemblies);
198206
@(CompileStageSdkDirectories);
199207
$(SharedFrameworkNameVersionPath)" />
200208

build/Microsoft.DotNet.Cli.DependencyVersions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<CLI_SharedFrameworkVersion>1.1.2</CLI_SharedFrameworkVersion>
55
<CLI_MSBuild_Version>15.3.0-preview-000400-01</CLI_MSBuild_Version>
66
<CLI_Roslyn_Version>2.3.0-beta3-61816-04</CLI_Roslyn_Version>
7+
<CLI_FSharp_Version>4.2.0-rc-170621-0</CLI_FSharp_Version>
78
<CLI_NETSDK_Version>1.1.0-alpha-20170615-3</CLI_NETSDK_Version>
89
<CLI_NuGet_Version>4.3.0-preview3-4168</CLI_NuGet_Version>
910
<CLI_WEBSDK_Version>1.0.0-alpha-20170516-2-509</CLI_WEBSDK_Version>

src/tool_fsharp/RunFsc.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
3+
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
4+
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
5+
6+
"%~dp0..\..\..\dotnet" "%~dp0fsc.exe" %*

src/tool_fsharp/RunFsc.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) .NET Foundation and contributors. All rights reserved.
4+
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
5+
#
6+
7+
set -e
8+
9+
SOURCE="${BASH_SOURCE[0]}"
10+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
11+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
12+
SOURCE="$(readlink "$SOURCE")"
13+
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
14+
done
15+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
16+
17+
"$DIR/../../../dotnet" "$DIR/fsc.exe" "$@"

src/tool_fsharp/tool_fsc.csproj

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
4+
5+
<PropertyGroup>
6+
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
7+
<TargetFramework>netcoreapp1.1</TargetFramework>
8+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.NetCore.App" Version="$(CLI_SharedFrameworkVersion)" />
13+
<PackageReference Include="Microsoft.FSharp.Compiler" Version="$(CLI_FSharp_Version)" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<Content Include="RunFsc.sh;RunFsc.cmd">
18+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
19+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
20+
</Content>
21+
</ItemGroup>
22+
23+
24+
<Target Name="AddHackFilesToPublish"
25+
AfterTargets="ComputeFilesToPublish">
26+
<ItemGroup>
27+
<!-- Workaround for https://github.com/dotnet/sdk/issues/115 -->
28+
<HackFilesToCopy Include="$(NuGetPackagesDir)\Microsoft.FSharp.Compiler\$(CLI_FSharp_Version)\contentFiles\any\any\**;" />
29+
</ItemGroup>
30+
31+
<Copy SourceFiles="@(HackFilesToCopy)"
32+
DestinationFiles="@(HackFilesToCopy->'$(PublishDir)/%(RecursiveDir)%(Filename)%(Extension)')" />
33+
</Target>
34+
<Target Name="MakeFscRunnableAndMoveToPublishDir"
35+
AfterTargets="Publish"
36+
BeforeTargets="RemoveFilesAfterPublish">
37+
38+
<ItemGroup>
39+
<AssetsToRemoveFromDeps Include="tool_fsc.dll"
40+
SectionName="runtime"/>
41+
</ItemGroup>
42+
43+
<RemoveAssetFromDepsPackages DepsFile="$(PublishDir)/$(TargetName).deps.json"
44+
SectionName="%(AssetsToRemoveFromDeps.SectionName)"
45+
AssetPath="%(AssetsToRemoveFromDeps.Identity)" />
46+
47+
<Copy SourceFiles="$(PublishDir)/$(TargetName).runtimeconfig.json;
48+
$(PublishDir)/$(TargetName).deps.json;"
49+
DestinationFiles="$(PublishDir)/fsc.runtimeconfig.json;
50+
$(PublishDir)/fsc.deps.json;"/>
51+
</Target>
52+
53+
<Target Name="RemoveFilesAfterPublish"
54+
AfterTargets="Publish">
55+
<Delete Files="$(PublishDir)/$(TargetName).dll" />
56+
<Delete Files="$(PublishDir)/$(TargetName).pdb" />
57+
<Delete Files="$(PublishDir)/$(TargetName).runtimeconfig.json" />
58+
<Delete Files="$(PublishDir)/$(TargetName).deps.json" />
59+
</Target>
60+
</Project>

0 commit comments

Comments
 (0)