Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Build extension using VSMac SDK #50

Draft
wants to merge 1 commit into
base: net6
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 138 additions & 38 deletions vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\..\MonoDevelop.props" />
<Import Project="$(ReferencesVSEditor)" />
<Import Project="$(ReferencesGtk)" />
<Import Project="VSMac\templates\templates.targets" />
<PropertyGroup>
<ProjectGuid>{4C10F8F9-3816-4647-BA6E-85F5DE39883B}</ProjectGuid>
Expand All @@ -13,9 +10,14 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<!-- TODO: RootDirectory is a vsmac property -->
<OutputPath>$(RootDirectory)build\bin\AddIns\FSharpBinding\</OutputPath>
<WarningLevel>3</WarningLevel>
<DocumentationFile>$(RootDirectory)build\bin\AddIns\FSharp.Editor\FSharp.Editor.xml</DocumentationFile>
<!-- TODO: Ensure this and pdb get included in addin -->
<DocumentationFile>$(RootDirectory)build\bin\AddIns\FSharpBinding\FSharp.Editor.xml</DocumentationFile>
<TargetFramework>net7.0-macos</TargetFramework>
<!-- See _RemoveVsmAssembliesFromLocalCopy target for details -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OtherFlags> --warnon:11111182 --subsystemversion:6.00 --simpleresolution</OtherFlags>
<SignAssembly>true</SignAssembly>
Expand All @@ -36,6 +38,17 @@
<GenerateTailCalls>true</GenerateTailCalls>
<TailCalls>true</TailCalls>
</PropertyGroup>
<PropertyGroup>
<NuGetVersionBundledFSharpCore>4.7.2</NuGetVersionBundledFSharpCore>
<NuGetVersionBundledSystemValueTuple>4.5.0</NuGetVersionBundledSystemValueTuple>
<NuGetVersionDotNet>7.0.0</NuGetVersionDotNet>
<NuGetVersionFSharpCompilerService>38.0.3</NuGetVersionFSharpCompilerService>
<NuGetVersionFSharpCore>7.0.0-beta.22427.1</NuGetVersionFSharpCore>
<NuGetVersionNewtonsoftJson>13.0.1</NuGetVersionNewtonsoftJson>
<NuGetVersionRoslyn>4.4.0-6.22578.12</NuGetVersionRoslyn>
<NugetVersionVS>17.5.0-preview-2-33117-317</NugetVersionVS>
<NuGetVersionVSEditor>17.5.176-preview</NuGetVersionVSEditor>
</PropertyGroup>
<Target Name="Clean">
<RemoveDir Directories="..\bin\" />
</Target>
Expand All @@ -45,11 +58,19 @@
<Folder Include="service\" />
</ItemGroup>
<ItemGroup>
<PackageDownload Include="FSharp.Core" Version="[4.7.2]" ExtensionDir="Packages" />
<PackageDownload Include="System.ValueTuple" Version="[4.5.0]" ExtensionDir="Packages" />
<PackageDownload Include="FSharp.Core" Version="[$(NuGetVersionBundledFSharpCore)]" />
<PackageDownload Include="System.ValueTuple" Version="[$(NuGetVersionBundledSystemValueTuple)]" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Cocoa" Version="$(NuGetVersionVSEditor)" />
<PackageReference Include="Microsoft.VisualStudio.ImageCatalog" Version="$(NugetVersionVS)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="$(NuGetVersionFSharpCore)" />
<PackageReference Include="Microsoft.VisualStudioMac.Sdk" Version="17.0.0" />
<AddinReference Include="MonoDevelop.TextEditor" />
<AddinReference Include="MonoDevelop.Debugger" />
<AddinReference Include="MonoDevelop.UnitTesting" />
<Compile Include="service\ServiceInterfaceStubGenerator.fsi" />
<Compile Include="service\ServiceInterfaceStubGenerator.fs" />
<Compile Include="Common\Logger.fsi" />
Expand Down Expand Up @@ -166,56 +187,32 @@
<Compile Include="VSMac\FSharpSymbolHelper.fs" />
<Compile Include="VSMac\GlobalSearch.fs" />
<Compile Include="Properties\AddinInfo.fs" />
<IncludeCopyLocal Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp.dll" />
<IncludeCopyLocal Include="FSharp.Compiler.Service.dll" />
<IncludeCopyLocal Include="FSharp.DependencyManager.Nuget.dll" />
<IncludeCopyLocal Include="FSharp.Core.dll" />
<IncludeCopyLocal Include="System.Runtime.Caching.dll" />
<EmbeddedResource Include="FSharp.Editor.resx">
<LogicalName>FSharp.Editor.resources</LogicalName>
<UseStandardResourceNames>true</UseStandardResourceNames>
<GenerateSource>true</GenerateSource>
<GeneratedModuleName>Microsoft.VisualStudio.FSharp.Editor.SR</GeneratedModuleName>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>FSharp.Editor.Designer.fs</LastGenOutput>
</EmbeddedResource>
<None Remove="FSharp.addin.xml" />
<EmbeddedResource Include="FSharp.addin.xml">
<LogicalName>FSharp.addin.xml</LogicalName>
</EmbeddedResource>
<IncludeCopyLocal Include="Newtonsoft.Json.dll" />
<ProjectReference Include="..\..\..\..\..\src\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\xwt\Xwt\Xwt.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\src\addins\MonoDevelop.Debugger\MonoDevelop.Debugger.csproj">
</ProjectReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(NuGetVersionRoslyn)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
<ProjectReference Include="..\..\..\..\..\src\addins\MonoDevelop.TextEditor\MonoDevelop.TextEditor\MonoDevelop.TextEditor.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
<Private>False</Private>
</ProjectReference>
<PackageReference Include="FSharp.Compiler.Service-vsmac" Version="$(NuGetVersionFSharpCompilerService)-dev" />
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="$(NuGetVersionRoslyn)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
<PackageReference Include="System.ComponentModel.Composition" Version="$(NuGetVersionDotNet)" PrivateAssets="runtime" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="$(NuGetVersionDotNet)" />
<PackageReference Include="System.Runtime.Caching" Version="$(NuGetVersionDotNet)" PrivateAssets="runtime" />
<ProjectReference Include="..\..\..\..\..\src\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\src\addins\MonoDevelop.UnitTesting\MonoDevelop.UnitTesting.csproj" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(NuGetVersionRoslyn)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
<PackageReference Include="Mono.Addins" Version="$(NuGetVersionMonoAddins)" PrivateAssets="all" />
<ProjectReference Include="..\..\..\..\..\src\addins\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.csproj">
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\fsharpbinding\FSharp\Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj">
</ProjectReference>
<!-- TODO: Either move this assembly to this repo or get it changed to an
addin in vsmac so it can be consumed via AddinReference. Also
need to address its IncludeCopyLocal earlier. -->
<Reference Include="$(VSAppDir)\Contents\MonoBundle\AddIns\FSharpBinding\Microsoft.CodeAnalysis.ExternalAccess.FSharp.dll" />
<PackageReference Include="Newtonsoft.Json" Version="$(NuGetVersionNewtonsoftJson)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="$(NuGetVersionRoslyn)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="$(NuGetVersionRoslyn)" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="17.0.216-preview" ExcludeAssets="all" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
Expand All @@ -229,4 +226,107 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>

<!-- TODO:

The VSMac-built FSharp.Editor.dll has an embedded resource named _Manifest.addin.xml with this content:

<?xml version="1.0" encoding="utf-8"?>
<ExtensionModel>
<Runtime>
<Import file="Packages/fsharp.core.4.7.2.nupkg" />
<Import file="Packages/system.valuetuple.4.5.0.nupkg" />
</Runtime>
<Dependencies />
</ExtensionModel>

Do we need to replicate that here? The SDK is producing this instead now:

<?xml version="1.0" encoding="utf-8"?>
<ExtensionModel>
<Runtime>
<Import assembly="FSharp.Compiler.Service.dll" />
<Import assembly="FSharp.DependencyManager.Nuget.dll" />
<Import assembly="FSharp.Core.dll" />
<Import assembly="System.Runtime.Caching.dll" />
<Import assembly="cs/FSharp.Compiler.Service.resources.dll" />
<Import assembly="cs/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="de/FSharp.Compiler.Service.resources.dll" />
<Import assembly="de/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="es/FSharp.Compiler.Service.resources.dll" />
<Import assembly="es/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="fr/FSharp.Compiler.Service.resources.dll" />
<Import assembly="fr/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="it/FSharp.Compiler.Service.resources.dll" />
<Import assembly="it/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="ja/FSharp.Compiler.Service.resources.dll" />
<Import assembly="ja/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="ko/FSharp.Compiler.Service.resources.dll" />
<Import assembly="ko/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="pl/FSharp.Compiler.Service.resources.dll" />
<Import assembly="pl/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="pt-BR/FSharp.Compiler.Service.resources.dll" />
<Import assembly="pt-BR/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="ru/FSharp.Compiler.Service.resources.dll" />
<Import assembly="ru/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="tr/FSharp.Compiler.Service.resources.dll" />
<Import assembly="tr/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="zh-Hans/FSharp.Compiler.Service.resources.dll" />
<Import assembly="zh-Hans/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="zh-Hant/FSharp.Compiler.Service.resources.dll" />
<Import assembly="zh-Hant/FSharp.DependencyManager.Nuget.resources.dll" />
<Import assembly="cs/FSharp.Core.resources.dll" />
<Import assembly="de/FSharp.Core.resources.dll" />
<Import assembly="es/FSharp.Core.resources.dll" />
<Import assembly="fr/FSharp.Core.resources.dll" />
<Import assembly="it/FSharp.Core.resources.dll" />
<Import assembly="ja/FSharp.Core.resources.dll" />
<Import assembly="ko/FSharp.Core.resources.dll" />
<Import assembly="pl/FSharp.Core.resources.dll" />
<Import assembly="pt-BR/FSharp.Core.resources.dll" />
<Import assembly="ru/FSharp.Core.resources.dll" />
<Import assembly="tr/FSharp.Core.resources.dll" />
<Import assembly="zh-Hans/FSharp.Core.resources.dll" />
<Import assembly="zh-Hant/FSharp.Core.resources.dll" />
<Import assembly="runtimes/win/lib/net7.0/System.Runtime.Caching.dll" />
</Runtime>
<Dependencies>
<Addin id="::MonoDevelop.TextEditor" version="17.5" />
<Addin id="::MonoDevelop.Debugger" version="17.5" />
<Addin id="::MonoDevelop.UnitTesting" version="17.5" />
<Addin id="::MonoDevelop.Core" version="17.5" />
<Addin id="::MonoDevelop.Ide" version="17.5" />
</Dependencies>
</ExtensionModel>

-->
<Target Name="_CopyBundledNuGetPackages" AfterTargets="Build">
<ItemGroup>
<_BundledNuGetPackages Include="$(NuGetPackageRoot)fsharp.core\$(NuGetVersionBundledFSharpCore)\fsharp.core.$(NuGetVersionBundledFSharpCore).nupkg" />
<_BundledNuGetPackages Include="$(NuGetPackageRoot)system.valuetuple\$(NuGetVersionBundledSystemValueTuple)\system.valuetuple.$(NuGetVersionBundledSystemValueTuple).nupkg" />
</ItemGroup>
<Copy SourceFiles="@(_BundledNugetPackages)" DestinationFolder="$(OutputPath)\Packages\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>

<!-- This is necessary because we set CopyLocalLockFileAssemblies=true to
force PackageReferences to copy to the output directory, which is a
workaround for what is likely a bug/feature in the VSMac SDK.

Until that is fixed, use this target to remove things from the output
directory that shouldn't be there. -->
<Target Name="_RemoveVsmAssembliesFromLocalCopy" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<!-- Exclude Microsoft assemblies already shipped by VSMac -->
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="!$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('System.Runtime.Caching')) and $([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').StartsWith ('System.'))" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').StartsWith ('Microsoft.'))" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('PresentationCore'))" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('PresentationFramework'))" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('UIAutomationProvider'))" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('UIAutomationTypes'))" />

<!-- Exclude other dependencies already shipped by VSMac -->
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('Newtonsoft.Json'))" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="$([System.String]::new('%(ReferenceCopyLocalPaths.Filename)').Equals ('Humanizer'))" />
</ItemGroup>
</Target>
</Project>