public static void Register(CommandLineApplication cmdApp, Microsoft.Extensions.PlatformAbstractions.IApplicationEnvironment appEnvironment, Microsoft.Extensions.PlatformAbstractions.IAssemblyLoadContextAccessor loadContextAccessor, Microsoft.Extensions.PlatformAbstractions.IRuntimeEnvironment runtimeEnvironment) { cmdApp.Command("graph", (Action <CommandLineApplication>)(c => { c.Description = "Perform parsing, static analysis, semantic analysis, and type inference"; c.HelpOption("-?|-h|--help"); c.OnExecute((Func <System.Threading.Tasks.Task <int> >)(async() => { var jsonIn = await Console.In.ReadToEndAsync(); var sourceUnit = JsonConvert.DeserializeObject <SourceUnit>(jsonIn); var root = Directory.GetCurrentDirectory(); var dir = Path.Combine(root, sourceUnit.Dir); var context = new GraphContext { RootPath = root, SourceUnit = sourceUnit, ProjectDirectory = dir, HostEnvironment = appEnvironment, LoadContextAccessor = loadContextAccessor, RuntimeEnvironment = runtimeEnvironment }; var result = await GraphRunner.Graph(context); Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); return(0); })); })); }
public Program(Microsoft.Extensions.PlatformAbstractions.IApplicationEnvironment env, Microsoft.Extensions.PlatformAbstractions.IRuntimeEnvironment runtimeEnv, Microsoft.Extensions.PlatformAbstractions.IAssemblyLoadContextAccessor loadContextAccessor) { _env = env; _runtimeEnv = runtimeEnv; _loadContextAccessor = loadContextAccessor; }
/// <summary> /// Initialization method for depresolve process /// </summary> /// <param name="cmdApp">application to run (srclib-csharp)</param> /// <param name="appEnv">common application information</param> /// <param name="runtimeEnv">environment representation</param> public static void Register(CommandLineApplication cmdApp, Microsoft.Extensions.PlatformAbstractions.IApplicationEnvironment appEnv, Microsoft.Extensions.PlatformAbstractions.IRuntimeEnvironment runtimeEnv) { _dnuPath = new Lazy <string>(FindDnuNix); cmdApp.Command("depresolve", c => { c.Description = "Perform a combination of parsing, static analysis, semantic analysis, and type inference"; c.HelpOption("-?|-h|--help"); c.OnExecute(async() => { var jsonIn = await Console.In.ReadToEndAsync(); var sourceUnit = JsonConvert.DeserializeObject <SourceUnit>(jsonIn); var dir = Path.Combine(Directory.GetCurrentDirectory(), sourceUnit.Dir); var deps = DepResolve(dir); var result = new List <Resolution>(); foreach (var dep in deps) { result.Add(Resolution.FromLibrary(dep)); } Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); return(0); }); }); }