public void GetDCommandLine(IVsHierarchy proj, uint itemid, out string cmdline) { Microsoft.VisualStudio.VCProjectEngine.VCFileConfiguration fcfg; Microsoft.VisualStudio.VCProjectEngine.VCConfiguration cfg; System.Reflection.IReflect vcrefl; Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage vcprop; GetVCToolProps(proj, itemid, out fcfg, out cfg, out vcrefl, out vcprop); EvalFun eval = (string s) => { return(fcfg != null?fcfg.Evaluate(s) : cfg.Evaluate(s)); }; string compiler = eval("$(DCompiler)"); bool ldc = compiler == "LDC"; string assemblyFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string xmlFileName = System.IO.Path.Combine(assemblyFolder, compiler + ".xml"); var cd = new dbuild.CompileD(); cd.Xaml = xmlFileName; cd.Compiler = compiler; cd.ToolExe = fcfg.Evaluate(ldc ? "$(LDCBinDir)ldmd2.exe" : "$(DMDBinDir)dmd.exe"); cd.CommandLineTemplate = vcprop.GetEvaluatedPropertyValue("CommandLineTemplate"); cd.AdditionalOptions = vcprop.GetEvaluatedPropertyValue("AdditionalOptions"); cd.Sources = new Microsoft.Build.Framework.ITaskItem[1] { new Microsoft.Build.Utilities.TaskItem("dummy.d") }; cd.Parameters = GetParametersFromFakeProperties(vcprop, vcrefl.GetProperties(0)); cmdline = cd.ToolExe + " " + cd.GenCmdLine(xmlFileName); }
public void GetDCommandLine(IVsHierarchy proj, uint itemid, out string cmdline) { Microsoft.VisualStudio.VCProjectEngine.VCFileConfiguration fcfg; Microsoft.VisualStudio.VCProjectEngine.VCConfiguration cfg; System.Reflection.IReflect vcrefl; Microsoft.VisualStudio.VCProjectEngine.IVCRulePropertyStorage vcprop; GetVCToolProps(proj, itemid, out fcfg, out cfg, out vcrefl, out vcprop); EvalFun eval = (string s) => { return fcfg != null ? fcfg.Evaluate(s) : cfg.Evaluate(s); }; string compiler = eval("$(DCompiler)"); bool ldc = compiler == "LDC"; string assemblyFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string xmlFileName = System.IO.Path.Combine(assemblyFolder, compiler + ".xml"); var cd = new dbuild.CompileD(); cd.Xaml = xmlFileName; cd.Compiler = compiler; cd.ToolExe = fcfg.Evaluate(ldc ? "$(LDCBinDir)ldmd2.exe" : "$(DMDBinDir)dmd.exe"); cd.CommandLineTemplate = vcprop.GetEvaluatedPropertyValue("CommandLineTemplate"); cd.AdditionalOptions = vcprop.GetEvaluatedPropertyValue("AdditionalOptions"); cd.Sources = new Microsoft.Build.Framework.ITaskItem[1] { new Microsoft.Build.Utilities.TaskItem("dummy.d") }; cd.Parameters = GetParametersFromFakeProperties(vcprop, vcrefl.GetProperties(0)); cmdline = cd.ToolExe + " " + cd.GenCmdLine(xmlFileName); }