Added a project tree for plugs.

This commit is contained in:
José Pedro 2018-01-21 22:01:46 +00:00
parent 14bf74389c
commit 50867e7287
No known key found for this signature in database
GPG key ID: B8247B9301707B83
4 changed files with 283 additions and 162 deletions

View file

@ -0,0 +1,2 @@
[*]
indent_size = 4

View file

@ -1,132 +1,130 @@
<Project>
<PropertyGroup>
<CosmosDir Condition="$(CosmosDir) == ''">$(AppData)\Cosmos User Kit</CosmosDir>
<KernelAssembliesDir>$(CosmosDir)\Kernel\</KernelAssembliesDir>
</PropertyGroup>
<PropertyGroup>
<CosmosDir Condition="$(CosmosDir) == ''">$(AppData)\Cosmos User Kit</CosmosDir>
<KernelAssembliesDir>$(CosmosDir)\Kernel\</KernelAssembliesDir>
</PropertyGroup>
<PropertyGroup>
<BinFile Condition="'$(BinFile)' == ''">$(OutputPath)$(AssemblyName).bin</BinFile>
<IsoFile Condition="'$(IsoFile)' == ''">$(OutputPath)$(AssemblyName).iso</IsoFile>
</PropertyGroup>
<PropertyGroup>
<BinFile Condition="'$(BinFile)' == ''">$(OutputPath)$(AssemblyName).bin</BinFile>
<IsoFile Condition="'$(IsoFile)' == ''">$(OutputPath)$(AssemblyName).iso</IsoFile>
</PropertyGroup>
<PropertyGroup>
<CosmosToolsPath Condition="'$(CosmosToolsPath)' == ''">$(MSBuildThisFileDirectory)..\tools\</CosmosToolsPath>
<PropertyGroup>
<CosmosToolsPath Condition="'$(CosmosToolsPath)' == ''">$(MSBuildThisFileDirectory)..\tools\</CosmosToolsPath>
<NasmToolPath Condition = "'$(NasmToolPath)' == ''">$(CosmosToolsPath)nasm\</NasmToolPath>
<NasmToolExe Condition = "'$(NasmToolExe)' == ''">nasm.exe</NasmToolExe>
<NasmToolPath Condition = "'$(NasmToolPath)' == ''">$(CosmosToolsPath)nasm\</NasmToolPath>
<NasmToolExe Condition = "'$(NasmToolExe)' == ''">nasm.exe</NasmToolExe>
<LdToolPath Condition = "'$(LdToolPath)' == ''">$(CosmosToolsPath)cygwin\</LdToolPath>
<LdToolExe Condition = "'$(LdToolExe)' == ''">ld.exe</LdToolExe>
<LdToolPath Condition = "'$(LdToolPath)' == ''">$(CosmosToolsPath)cygwin\</LdToolPath>
<LdToolExe Condition = "'$(LdToolExe)' == ''">ld.exe</LdToolExe>
<ObjdumpToolPath Condition = "'$(ObjdumpToolPath)' == ''">$(CosmosToolsPath)cygwin\</ObjdumpToolPath>
<ObjdumpToolExe Condition = "'$(ObjdumpToolExe)' == ''">objdump.exe</ObjdumpToolExe>
<ObjdumpToolPath Condition = "'$(ObjdumpToolPath)' == ''">$(CosmosToolsPath)cygwin\</ObjdumpToolPath>
<ObjdumpToolExe Condition = "'$(ObjdumpToolExe)' == ''">objdump.exe</ObjdumpToolExe>
<MkisofsToolPath Condition = "'$(MkisofsToolPath)' == ''">$(CosmosToolsPath)mkisofs\</MkisofsToolPath>
<MkisofsToolExe Condition = "'$(MkisofsToolExe)' == ''">mkisofs.exe</MkisofsToolExe>
</PropertyGroup>
<MkisofsToolPath Condition = "'$(MkisofsToolPath)' == ''">$(CosmosToolsPath)mkisofs\</MkisofsToolPath>
<MkisofsToolExe Condition = "'$(MkisofsToolExe)' == ''">mkisofs.exe</MkisofsToolExe>
</PropertyGroup>
<PropertyGroup>
<Il2cpuOutput Condition="'$(Il2cpuOutput)' == ''">$(OutputPath)$(AssemblyName).asm</Il2cpuOutput>
<PropertyGroup>
<Il2cpuOutput Condition="'$(Il2cpuOutput)' == ''">$(OutputPath)$(AssemblyName).asm</Il2cpuOutput>
<NasmOutput Condition="'$(NasmOutput)' == '' AND '$(BinFormat)' == 'ELF'">$(OutputPath)$(AssemblyName).obj</NasmOutput>
<NasmOutput Condition="'$(NasmOutput)' == ''">$(OutputPath)$(AssemblyName).bin</NasmOutput>
<BinFormat Condition="'$(BinFormat)' == ''">Bin</BinFormat>
<NasmOutput Condition="'$(NasmOutput)' == '' AND '$(BinFormat)' == 'ELF'">$(OutputPath)$(AssemblyName).obj</NasmOutput>
<NasmOutput Condition="'$(NasmOutput)' == ''">$(OutputPath)$(AssemblyName).bin</NasmOutput>
<BinFormat Condition="'$(BinFormat)' == ''">Bin</BinFormat>
<_NasmMap>$([System.IO.Path]::GetDirectoryName('$(NasmOutput)'))\main.map</_NasmMap>
<_NasmMap>$([System.IO.Path]::GetDirectoryName('$(NasmOutput)'))\main.map</_NasmMap>
<MapFile Condition="'$(MapFile)' == ''">$(OutputPath)$(AssemblyName).map</MapFile>
<CosmosDebugSymbolsFile Condition="'$(CosmosDebugSymbolsFile)' == ''">$(OutputPath)$(AssemblyName).cdb</CosmosDebugSymbolsFile>
<MapFile Condition="'$(MapFile)' == ''">$(OutputPath)$(AssemblyName).map</MapFile>
<CosmosDebugSymbolsFile Condition="'$(CosmosDebugSymbolsFile)' == ''">$(OutputPath)$(AssemblyName).cdb</CosmosDebugSymbolsFile>
<IntermediateIsoDirectory Condition="'$(IntermediateIsoDirectory)' == ''">$(OutputPath)ISO\</IntermediateIsoDirectory>
<ISOLINUX Condition="'$(ISOLINUX)' == ''">$(CosmosToolsPath)isolinux\</ISOLINUX>
</PropertyGroup>
<IntermediateIsoDirectory Condition="'$(IntermediateIsoDirectory)' == ''">$(OutputPath)ISO\</IntermediateIsoDirectory>
<ISOLINUX Condition="'$(ISOLINUX)' == ''">$(CosmosToolsPath)isolinux\</ISOLINUX>
</PropertyGroup>
<PropertyGroup>
<CosmosBuildTasksAssembly Condition="'$(CosmosBuildTasksAssembly)' == '' OR !Exists('$(CosmosBuildTasksAssembly)')">$(CosmosToolsPath)Cosmos.Build.Tasks.dll</CosmosBuildTasksAssembly>
</PropertyGroup>
<PropertyGroup>
<CosmosBuildTasksAssembly Condition="'$(CosmosBuildTasksAssembly)' == '' OR !Exists('$(CosmosBuildTasksAssembly)')">$(CosmosToolsPath)Cosmos.Build.Tasks.dll</CosmosBuildTasksAssembly>
</PropertyGroup>
<ItemGroup>
<PlugReference Include="$(KernelAssembliesDir)Cosmos.Core_Asm.dll" />
<PlugReference Include="$(KernelAssembliesDir)Cosmos.Core_Plugs.dll" />
<PlugReference Include="$(KernelAssembliesDir)Cosmos.Debug.Kernel.Plugs.Asm.dll" />
<PlugReference Include="$(KernelAssembliesDir)Cosmos.System2_Plugs.dll" />
</ItemGroup>
<ItemGroup>
<PlugsReference Include="$(KernelAssembliesDir)Cosmos.Core_Asm.dll" />
<PlugsReference Include="$(KernelAssembliesDir)Cosmos.Core_Plugs.dll" />
<PlugsReference Include="$(KernelAssembliesDir)Cosmos.Debug.Kernel.Plugs.Asm.dll" />
<PlugsReference Include="$(KernelAssembliesDir)Cosmos.System2_Plugs.dll" />
</ItemGroup>
<UsingTask TaskName="Cosmos.Build.Tasks.CreateSyslinuxConfig" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.ExtractMapFromElfFile" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.IL2CPU" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.Ld" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.MakeIso" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.Nasm" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.ReadNasmMapToDebugInfo" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.TheRingMaster" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.CreateSyslinuxConfig" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.ExtractMapFromElfFile" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.IL2CPU" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.Ld" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.MakeIso" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.Nasm" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.ReadNasmMapToDebugInfo" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<UsingTask TaskName="Cosmos.Build.Tasks.TheRingMaster" AssemblyFile="$(CosmosBuildTasksAssembly)" />
<PropertyGroup>
<CosmosBuildDependsOn>
FailIfRelease;
TheRingMaster;
IL2CPU;
Nasm;
Ld;
ExtractMapFromElfFile;
ReadNasmMapToDebugInfo;
MakeIso
</CosmosBuildDependsOn>
</PropertyGroup>
<PropertyGroup>
<CosmosBuildDependsOn>
FailIfRelease;
TheRingMaster;
IL2CPU;
Nasm;
Ld;
ExtractMapFromElfFile;
ReadNasmMapToDebugInfo;
MakeIso
</CosmosBuildDependsOn>
</PropertyGroup>
<Target Name="CosmosBuild" AfterTargets="Build" DependsOnTargets="$(CosmosBuildDependsOn)" />
<Target Name="CosmosBuild" AfterTargets="Build" DependsOnTargets="$(CosmosBuildDependsOn)" />
<Target Name="FailIfRelease" Condition="'$(Configuration)' == 'Release'">
<Error Text="The Release configuration isn't currently supported!" />
</Target>
<Target Name="FailIfRelease" Condition="'$(Configuration)' == 'Release'">
<Error Text="The Release configuration isn't currently supported!" />
</Target>
<!--
<!--
================================================================================
TheRingMaster
================================================================================
-->
<Target Name="TheRingMaster">
<Target Name="TheRingMaster">
<!--
<!--
Disabled for now
-->
<!--<TheRingMaster KernelAssemblyPath="$(TargetPath)"
<!--<TheRingMaster KernelAssemblyPath="$(TargetPath)"
ToolPath="$(TheRingMasterToolPath)"
ToolExe="$(TheRingMasterToolExe)" />-->
</Target>
</Target>
<!-- TODO: IL2CPU should provide targets for this, but how to consume them? implicit package reference? include it
in this package? -->
<Target Name="IL2CPU"
Inputs="$(TargetPath);@(PlugReference)"
Outputs="$(Il2cpuOutput)">
<Target Name="IL2CPU"
Inputs="$(TargetPath);@(PlugsReference)"
Outputs="$(Il2cpuOutput)">
<ItemGroup>
<AssemblySearchDir Include="$(KernelAssembliesDir)" />
<AssemblySearchDir Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" />
</ItemGroup>
<ItemGroup>
<AssemblySearchDir Include="$(KernelAssembliesDir)" />
<AssemblySearchDir Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" />
</ItemGroup>
<IL2CPU KernelPkg="$(KernelPkg)"
DebugMode="$(DebugMode)"
DebugEnabled="$(DebugEnabled)"
StackCorruptionDetectionEnabled="$(StackCorruptionDetectionEnabled)"
StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)"
TraceAssemblies="$(TraceAssemblies)"
IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)"
DebugCom="1"
References="$(TargetPath);@(PlugReference)"
AssemblySearchDirs="@(AssemblySearchDir)"
OutputFilename="$(Il2cpuOutput)"
EnableLogging="True"
EmitDebugSymbols="$(DebugSymbols)"
CosmosBuildDir="$(CosmosDir)\Build"
WorkingDir="$(TargetDir)"/>
<IL2CPU KernelPkg="$(KernelPkg)"
DebugMode="$(DebugMode)"
DebugEnabled="$(DebugEnabled)"
StackCorruptionDetectionEnabled="$(StackCorruptionDetectionEnabled)"
StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)"
TraceAssemblies="$(TraceAssemblies)"
IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)"
DebugCom="1"
References="$(TargetPath);@(PlugsReference)"
AssemblySearchDirs="@(AssemblySearchDir)"
OutputFilename="$(Il2cpuOutput)"
EnableLogging="True"
EmitDebugSymbols="$(DebugSymbols)"
CosmosBuildDir="$(CosmosDir)\Build"
WorkingDir="$(TargetDir)"/>
</Target>
</Target>
<!--
<!--
================================================================================
Nasm
@ -138,19 +136,19 @@
================================================================================
-->
<Target Name="Nasm"
Inputs="$(Il2cpuOutput)"
Outputs="$(NasmOutput)">
<Target Name="Nasm"
Inputs="$(Il2cpuOutput)"
Outputs="$(NasmOutput)">
<NASM InputFile="$(Il2cpuOutput)"
OutputFile="$(NasmOutput)"
OutputFormat="$(BinFormat)"
ToolPath="$(NasmToolPath)"
ToolExe="$(NasmToolExe)" />
<NASM InputFile="$(Il2cpuOutput)"
OutputFile="$(NasmOutput)"
OutputFormat="$(BinFormat)"
ToolPath="$(NasmToolPath)"
ToolExe="$(NasmToolExe)" />
</Target>
</Target>
<!--
<!--
================================================================================
Ld
@ -162,22 +160,22 @@
================================================================================
-->
<Target Name="Ld"
Inputs="$(NasmOutput)"
Outputs="$(BinFile)"
Condition="'$(BinFormat)' == 'ELF'">
<Target Name="Ld"
Inputs="$(NasmOutput)"
Outputs="$(BinFile)"
Condition="'$(BinFormat)' == 'ELF'">
<Ld InputFiles="$(NasmOutput)"
OutputFile="$(BinFile)"
TextAddress="0x2000000"
DataAddress="0x1000000"
Entry="Kernel_Start"
ToolPath="$(LdToolPath)"
ToolExe="$(LdToolExe)" />
<Ld InputFiles="$(NasmOutput)"
OutputFile="$(BinFile)"
TextAddress="0x2000000"
DataAddress="0x1000000"
Entry="Kernel_Start"
ToolPath="$(LdToolPath)"
ToolExe="$(LdToolExe)" />
</Target>
</Target>
<!--
<!--
================================================================================
ExtractMapFromElfFile
@ -189,20 +187,20 @@
================================================================================
-->
<Target Name="ExtractMapFromElfFile"
Inputs="$(BinFile)"
Outputs="$(CosmosDebugSymbolsPath)"
Condition="'$(BinFormat)' == 'ELF'">
<Target Name="ExtractMapFromElfFile"
Inputs="$(BinFile)"
Outputs="$(CosmosDebugSymbolsPath)"
Condition="'$(BinFormat)' == 'ELF'">
<ExtractMapFromElfFile InputFile="$(BinFile)"
MapFile="$(MapFile)"
DebugInfoFile="$(CosmosDebugSymbolsFile)"
ToolPath="$(ObjdumpToolPath)"
ToolExe="$(ObjdumpToolExe)" />
<ExtractMapFromElfFile InputFile="$(BinFile)"
MapFile="$(MapFile)"
DebugInfoFile="$(CosmosDebugSymbolsFile)"
ToolPath="$(ObjdumpToolPath)"
ToolExe="$(ObjdumpToolExe)" />
</Target>
</Target>
<!--
<!--
================================================================================
ReadNasmMapToDebugInfo
@ -214,17 +212,17 @@
================================================================================
-->
<Target Name="ReadNasmMapToDebugInfo"
Inputs="$(_NasmMap)"
Outputs="$(CosmosDebugSymbolsPath)"
Condition="'$(BinFormat)' != 'ELF'">
<Target Name="ReadNasmMapToDebugInfo"
Inputs="$(_NasmMap)"
Outputs="$(CosmosDebugSymbolsPath)"
Condition="'$(BinFormat)' != 'ELF'">
<ReadNasmMapToDebugInfo MapFile="$(_NasmMap)"
DebugInfoFile="$(CosmosDebugSymbolsFile)" />
<ReadNasmMapToDebugInfo MapFile="$(_NasmMap)"
DebugInfoFile="$(CosmosDebugSymbolsFile)" />
</Target>
</Target>
<!--
<!--
================================================================================
MakeISO
@ -236,34 +234,34 @@
================================================================================
-->
<Target Name="MakeIso"
Inputs="$(BinFile)"
Outputs="$(IsoFile)"
Condition="'$(Deployment)' == 'ISO'">
<Target Name="MakeIso"
Inputs="$(BinFile)"
Outputs="$(IsoFile)"
Condition="'$(Deployment)' == 'ISO'">
<ItemGroup>
<_ISOLINUX Include="$(ISOLINUX)**" />
</ItemGroup>
<ItemGroup>
<_ISOLINUX Include="$(ISOLINUX)**" />
</ItemGroup>
<MakeDir Directories="$(IntermediateIsoDirectory)" />
<MakeDir Directories="$(IntermediateIsoDirectory)" />
<Copy SourceFiles="@(_ISOLINUX);$(BinFile)"
DestinationFolder="$(IntermediateIsoDirectory)" />
<Copy SourceFiles="@(_ISOLINUX);$(BinFile)"
DestinationFolder="$(IntermediateIsoDirectory)" />
<CreateSyslinuxConfig IsoDirectory="$(IntermediateIsoDirectory)"
BinName="$([System.IO.Path]::GetFileName('$(BinFile)'))" />
<CreateSyslinuxConfig IsoDirectory="$(IntermediateIsoDirectory)"
BinName="$([System.IO.Path]::GetFileName('$(BinFile)'))" />
<MakeIso IsoDirectory="$(IntermediateIsoDirectory)"
OutputFile="$(IsoFile)"
ToolPath="$(MkisofsToolPath)"
ToolExe="$(MkisofsToolExe)" />
<MakeIso IsoDirectory="$(IntermediateIsoDirectory)"
OutputFile="$(IsoFile)"
ToolPath="$(MkisofsToolPath)"
ToolExe="$(MkisofsToolExe)" />
</Target>
</Target>
<PropertyGroup>
<CosmosDesignTimeTargetsPath Condition="'$(CosmosDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Cosmos\Cosmos.DesignTime.targets</CosmosDesignTimeTargetsPath>
</PropertyGroup>
<PropertyGroup>
<CosmosDesignTimeTargetsPath Condition="'$(CosmosDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Cosmos\Cosmos.DesignTime.targets</CosmosDesignTimeTargetsPath>
</PropertyGroup>
<Import Project="$(CosmosDesignTimeTargetsPath)" Condition="'$(CosmosDesignTimeTargetsPath)' != '' AND Exists('$(CosmosDesignTimeTargetsPath)')" />
<Import Project="$(CosmosDesignTimeTargetsPath)" Condition="'$(CosmosDesignTimeTargetsPath)' != '' AND Exists('$(CosmosDesignTimeTargetsPath)')" />
</Project>

View file

@ -65,14 +65,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime" Version="14.3.25407" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem" Version="15.3.224" />
<PackageReference Include="Microsoft.VisualStudio.ImageCatalog" Version="15.5.27130" />
<PackageReference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime" Version="14.3.25408" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.Analyzers" Version="15.3.224" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.SDK" Version="15.3.224" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.SDK.Tools" Version="15.3.224" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.14" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.15" />
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="15.4.27004" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Framework" Version="15.4.27004" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Framework" Version="15.5.27130" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.11.0" Version="11.0.61030" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="15.5.24" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.1.192" />

View file

@ -0,0 +1,122 @@
using System;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Properties;
namespace Cosmos.VS.ProjectSystem.VS
{
[Export(ExportContractNames.ProjectTreeProviders.PhysicalViewRootGraft, typeof(IProjectTreeProvider))]
[AppliesTo(ProjectCapability.Cosmos)]
internal class PlugsProjectTreeProvider : ProjectTreeProviderBase
{
private static readonly ProjectImageMoniker ReferenceIcon = KnownMonikers.Reference.ToProjectSystemType();
private static readonly ProjectTreeFlags PlugsProjectTreeFlags = ProjectTreeFlags.Create(
ProjectTreeFlags.Common.BubbleUp | ProjectTreeFlags.Common.VirtualFolder);
private IDisposable _itemsSubscriptionLink;
[ImportingConstructor]
protected PlugsProjectTreeProvider(
IProjectThreadingService threadingService,
UnconfiguredProject unconfiguredProject)
: base(threadingService, unconfiguredProject)
{
}
protected override void Initialize()
{
base.Initialize();
SubmitTreeUpdateAsync(
(treeSnapshot, configuredProjectExports, cancellationToken) =>
{
return Task.FromResult(new TreeUpdateResult(CreatePlugsFolder(), true));
});
var subscriptionService = UnconfiguredProject.Services.ActiveConfiguredProjectSubscription;
var itemsBlock = subscriptionService.ProjectCatalogSource.SourceBlock;
var targetBlock = new ActionBlock<IProjectVersionedValue<IProjectCatalogSnapshot>>(ItemsChangedAsync);
_itemsSubscriptionLink = itemsBlock.LinkTo(
targetBlock, new DataflowLinkOptions() { PropagateCompletion = true });
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_itemsSubscriptionLink?.Dispose();
}
base.Dispose(disposing);
}
protected override ConfiguredProjectExports GetActiveConfiguredProjectExports(
ConfiguredProject newActiveConfiguredProject)
{
return GetActiveConfiguredProjectExports<MyConfiguredProjectExports>(newActiveConfiguredProject);
}
private IProjectTree CreatePlugsFolder()
{
var caption = "Plugs";
var icon = KnownMonikers.Reference.ToProjectSystemType();
var flags = PlugsProjectTreeFlags;
return NewTree(caption, icon: ReferenceIcon, expandedIcon: ReferenceIcon, flags: PlugsProjectTreeFlags);
}
private Task ItemsChangedAsync(IProjectVersionedValue<IProjectCatalogSnapshot> snapshot)
{
SubmitTreeUpdateAsync(
(treeSnapshot, configuredProjectExports, cancellationToken) =>
{
var dependenciesNode = treeSnapshot.Value.Tree;
if (!cancellationToken.IsCancellationRequested)
{
dependenciesNode = BuildTree(dependenciesNode, snapshot.Value, cancellationToken);
}
return Task.FromResult(new TreeUpdateResult(dependenciesNode, false));
});
return Task.CompletedTask;
}
private IProjectTree BuildTree(
IProjectTree oldTree,
IProjectCatalogSnapshot snapshot,
CancellationToken cancellationToken)
{
var tree = oldTree.ClearChildren();
foreach (var reference in snapshot.Project.Value.GetItems("PlugsReference"))
{
if (cancellationToken.IsCancellationRequested)
{
return oldTree;
}
tree = tree.Add(NewTree(reference.GetMetadataValue("Filename"),
icon: ReferenceIcon, flags: ProjectTreeFlags.ResolvedReference)).Parent;
}
return tree;
}
[Export]
protected class MyConfiguredProjectExports : ConfiguredProjectExports
{
[ImportingConstructor]
protected MyConfiguredProjectExports(ConfiguredProject configuredProject)
: base(configuredProject)
{
}
}
}
}