This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1021 from brandonh-msft/hurlburb/vsix-offline
Pivot VSIX to use offline mode
- Loading branch information
Showing
14 changed files
with
121 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/ApiPort/ApiPort.VisualStudio/DependencyBuilder.Offline.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Autofac; | ||
|
||
using Microsoft.Fx.Portability; | ||
using Microsoft.Fx.Portability.Analysis; | ||
using Microsoft.Fx.Portability.Analyzer; | ||
using Microsoft.Fx.Portability.Reporting; | ||
|
||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace ApiPort | ||
{ | ||
internal static class DependencyBuilder | ||
{ | ||
internal const string DefaultOutputFormatInstanceName = "DefaultOutputFormat"; | ||
|
||
public static void RegisterOfflineModule(this ContainerBuilder builder) | ||
{ | ||
builder.RegisterType<DependencyOrderer>() | ||
.As<IDependencyOrderer>() | ||
.SingleInstance(); | ||
|
||
builder.RegisterType<RequestAnalyzer>() | ||
.As<IRequestAnalyzer>() | ||
.SingleInstance(); | ||
|
||
builder.RegisterType<AnalysisEngine>() | ||
.As<IAnalysisEngine>() | ||
.SingleInstance(); | ||
|
||
builder.RegisterModule(new OfflineDataModule(DefaultOutputFormatInstanceName)); | ||
LoadReportWriters(builder); | ||
} | ||
|
||
private static void LoadReportWriters(ContainerBuilder builder) | ||
{ | ||
foreach (var path in Directory.EnumerateFiles(GetApplicationDirectory(), "Microsoft.Fx.Portability.Reports.*.dll")) | ||
{ | ||
try | ||
{ | ||
var name = new AssemblyName(Path.GetFileNameWithoutExtension(path)); | ||
var assembly = Assembly.Load(name); | ||
|
||
builder.RegisterAssemblyTypes(assembly) | ||
.AssignableTo<IReportWriter>() | ||
.As<IReportWriter>() | ||
.SingleInstance(); | ||
} | ||
catch (Exception) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
private static string GetApplicationDirectory() | ||
{ | ||
return Path.GetDirectoryName(typeof(DependencyBuilder).GetTypeInfo().Assembly.Location); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters