diff options
author | Jose <jose@zeroc.com> | 2012-10-05 16:50:09 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-10-05 16:50:09 +0200 |
commit | dc396cc28073eae1f0e15c09aa053ad0fe2a3fab (patch) | |
tree | b2f680ab12072080c4400cd6033e70a6c7fdb076 | |
parent | Fixed ICE-4697 and ICE-4229 (diff) | |
download | ice-dc396cc28073eae1f0e15c09aa053ad0fe2a3fab.tar.bz2 ice-dc396cc28073eae1f0e15c09aa053ad0fe2a3fab.tar.xz ice-dc396cc28073eae1f0e15c09aa053ad0fe2a3fab.zip |
Fixed ICE-4741 and minor add-in issues
-rw-r--r-- | vsaddin/INSTALL.txt | 6 | ||||
-rw-r--r-- | vsaddin/config/Ice.props (renamed from vsaddin/config/ice.props) | 16 | ||||
-rw-r--r-- | vsaddin/config/Make.rules.mak | 4 | ||||
-rw-r--r-- | vsaddin/src/Builder.cs | 480 | ||||
-rw-r--r-- | vsaddin/src/Util.cs | 111 |
5 files changed, 272 insertions, 345 deletions
diff --git a/vsaddin/INSTALL.txt b/vsaddin/INSTALL.txt index ca7139009bb..952caf3bca8 100644 --- a/vsaddin/INSTALL.txt +++ b/vsaddin/INSTALL.txt @@ -183,9 +183,9 @@ Configuration > copy C:\Ice-@ver@\vsaddin\config\ice.vsprops .
- For VS 2010 and VS 2012 the property sheet is ice.props
+ For VS 2010 and VS 2012 the property sheet is Ice.props
- > copy C:\Ice-@ver@\vsaddin\config\ice.props .
+ > copy C:\Ice-@ver@\vsaddin\config\Ice.props .
After copy the files, you must edit the property sheet
files to reflect your installation path.
@@ -193,7 +193,7 @@ Configuration For ice.vsprops set the "Value" attribute of the UserMacro
to your Ice installation path.
- For ice.props set the content of the element IceHome to your Ice
+ For Ice.props set the content of the element IceHome to your Ice
installation path.
5) This completes the configuration. The add-in is available once you
diff --git a/vsaddin/config/ice.props b/vsaddin/config/Ice.props index 9c5d3000977..95e73ed5f32 100644 --- a/vsaddin/config/ice.props +++ b/vsaddin/config/Ice.props @@ -2,17 +2,17 @@ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="!Exists('$(IceSourceHome)')">
- <IceHome>C:\Program Files\ZeroC\Ice-3.4.2</IceHome>
+ <IceHome>$(Registry:HKEY_LOCAL_MACHINE\Software\ZeroC\Ice 3.4.2@InstallDir)</IceHome>
<IceInclude>$(IceHome)\include</IceInclude>
</PropertyGroup>
<PropertyGroup Condition="!Exists('$(IceSourceHome)') And '$(Platform)' == 'Win32' And '$(MinimumVisualStudioVersion)' == 10.0">
- <IceLib>$(IceHome)\lib\vc100</IceLib>
- <IceBin>$(IceHome)\bin\vc100</IceBin>
+ <IceLib>$(IceHome)\lib</IceLib>
+ <IceBin>$(IceHome)\bin</IceBin>
</PropertyGroup>
<PropertyGroup Condition="!Exists('$(IceSourceHome)') And '$(Platform)' != 'Win32' And '$(MinimumVisualStudioVersion)' == 10.0">
- <IceLib>$(IceHome)\lib\vc100\$(Platform)</IceLib>
- <IceBin>$(IceHome)\bin\vc100\$(Platform)</IceBin>
+ <IceLib>$(IceHome)\lib\$(Platform)</IceLib>
+ <IceBin>$(IceHome)\bin\$(Platform)</IceBin>
</PropertyGroup>
<PropertyGroup Condition="!Exists('$(IceSourceHome)') And '$(Platform)' == 'Win32' And '$(MinimumVisualStudioVersion)' == 11.0">
@@ -50,4 +50,10 @@ <EnvironmentVariable>true</EnvironmentVariable>
</BuildMacro>
</ItemGroup>
+
+ <PropertyGroup>
+ <IncludePath>$(IceInclude);$(IncludePath)</IncludePath>
+ <LibraryPath>$(IceLib);$(LibraryPath)</LibraryPath>
+ <ExecutablePath>$(IceBin);$(ExecutablePath)</ExecutablePath>
+ </PropertyGroup>
</Project>
diff --git a/vsaddin/config/Make.rules.mak b/vsaddin/config/Make.rules.mak index a3ab6546347..7d7ce4f4744 100644 --- a/vsaddin/config/Make.rules.mak +++ b/vsaddin/config/Make.rules.mak @@ -91,9 +91,9 @@ VS_HOME = $(VSINSTALLDIR) PKG_PREFIX = $(VSTARGET)
!if "$(VS)" == "VS2008"
-PROPERTY_SHEET = "ice.vsprops"
+PROPERTY_SHEET = "Ice.vsprops"
!else
-PROPERTY_SHEET = "ice.props"
+PROPERTY_SHEET = "Ice.props"
!endif
bindir = ..\bin
diff --git a/vsaddin/src/Builder.cs b/vsaddin/src/Builder.cs index 084ea94331d..73c579bf723 100644 --- a/vsaddin/src/Builder.cs +++ b/vsaddin/src/Builder.cs @@ -85,10 +85,10 @@ namespace Ice.VisualStudio public DTE getCurrentDTE() { return _applicationObject.DTE; - }
-
- public DTE2 getApplicationObject()
- {
+ } + + public DTE2 getApplicationObject() + { return _applicationObject; } @@ -661,9 +661,7 @@ namespace Ice.VisualStudio try { _opening = true; - DependenciesMap dependenciesMap = getDependenciesMap();
- _reverseDependencyMap = new Dictionary<ProjectItem, List<Project>>(); - + DependenciesMap dependenciesMap = getDependenciesMap(); initDocumentEvents(); List<Project> projects = Util.buildOrder(_applicationObject.Solution); foreach(Project p in projects) @@ -724,13 +722,13 @@ namespace Ice.VisualStudio { components = new ComponentList(Util.getProjectProperty(project, Util.PropertyIceComponents)); - }
-
- if(!components.Contains("Ice"))
- {
+ } + + if(!components.Contains("Ice")) + { components.Add("Ice"); } - if(!Util.isWinRTProject(project))
+ if(!Util.isWinRTProject(project)) { if(!components.Contains("IceUtil")) { @@ -797,7 +795,7 @@ namespace Ice.VisualStudio Util.setProjectProperty(project, Util.PropertyIceComponents, components.ToString()); } else if(Util.isCSharpProject(project)) - {
+ { Util.removeDotNetReference(project, "Ice"); } @@ -1014,22 +1012,22 @@ namespace Ice.VisualStudio removeCSharpGeneratedItems(i, remove); } } - }
-
- public void buildProject(Project project, bool force, vsBuildScope scope, bool buildDependencies)
- {
- List<Project> builded = new List<Project>();
- buildProject(project, force, null, scope, buildDependencies, ref builded);
- }
-
+ } + + public void buildProject(Project project, bool force, vsBuildScope scope, bool buildDependencies) + { + List<Project> builded = new List<Project>(); + buildProject(project, force, null, scope, buildDependencies, ref builded); + } + public void buildProject(Project project, bool force, vsBuildScope scope, bool buildDependencies, ref List<Project> builded) { buildProject(project, force, null, scope, buildDependencies, ref builded); - }
-
- public void buildProject(Project project, bool force, ProjectItem excludeItem, vsBuildScope scope, bool buildDependencies)
- {
- List<Project> builded = new List<Project>();
+ } + + public void buildProject(Project project, bool force, ProjectItem excludeItem, vsBuildScope scope, bool buildDependencies) + { + List<Project> builded = new List<Project>(); buildProject(project, force, excludeItem, scope, buildDependencies, ref builded); } @@ -1044,56 +1042,56 @@ namespace Ice.VisualStudio if(!Util.isSliceBuilderEnabled(project)) { return; - }
-
- if(builded.Contains(project))
- {
- return;
- }
- builded.Add(project);
-
+ } + + if(builded.Contains(project)) + { + return; + } + builded.Add(project); + List<ProjectItem> buildItems = new List<ProjectItem>(); // // When building a single project, we must first build projects // that this project depends on. - //
+ // if(vsBuildScope.vsBuildScopeProject == scope && buildDependencies) { BuildDependencies dependencies = _applicationObject.Solution.SolutionBuild.BuildDependencies; for(int i = 0; i < dependencies.Count; ++i) { - BuildDependency dp = dependencies.Item(i + 1);
- if(dp == null)
- {
+ BuildDependency dp = dependencies.Item(i + 1); + if(dp == null) + { continue; } if(dp.Project.Equals(project)) { - System.Array projects = dp.RequiredProjects as System.Array;
- if(projects != null)
- {
- foreach(Project p in projects)
- {
- buildProject(p, force, vsBuildScope.vsBuildScopeProject, buildDependencies, ref builded);
- }
+ System.Array projects = dp.RequiredProjects as System.Array; + if(projects != null) + { + foreach(Project p in projects) + { + buildProject(p, force, vsBuildScope.vsBuildScopeProject, buildDependencies, ref builded); + } } } } - }
-
- if(Util.isVBProject(project))
- {
- //
- // For VB projects we just build dependencies.
- //
- return;
- }
-
- DTE dte = Util.getCurrentDTE();
- if(!_opening)
- {
- dte.StatusBar.Text = "Ice Add-in: building project '" + project.FullName + "'";
+ } + + if(Util.isVBProject(project)) + { + // + // For VB projects we just build dependencies. + // + return; + } + + DTE dte = Util.getCurrentDTE(); + if(!_opening) + { + dte.StatusBar.Text = "Ice Add-in: building project '" + project.FullName + "'"; } string msg = "------ Slice compilation started " + "Project: " + Util.getTraceProjectName(project) + " ------\n"; @@ -1112,7 +1110,7 @@ namespace Ice.VisualStudio buildCSharpProject(project, force, excludeItem); } else if(Util.isCppProject(project)) - {
+ { buildCppProject(project, force, ref buildItems); } @@ -1136,61 +1134,61 @@ namespace Ice.VisualStudio if(!_opening) { dte.StatusBar.Text = "Ready"; - }
-
- //
- // If we are not in CommandLine mode we also update projects
- // that depend on the project being build.
- //
- if(scope == vsBuildScope.vsBuildScopeProject &&
- _connectMode != ext_ConnectMode.ext_cm_CommandLine)
- {
- List<Project> dependantProjects = new List<Project>();
- foreach(ProjectItem i in buildItems)
- {
- updateReverseDependencies(i, ref dependantProjects);
- }
- foreach(Project p in dependantProjects)
- {
- buildProject(p, force, excludeItem, scope, buildDependencies, ref builded);
- }
+ } + + // + // If we are not in CommandLine mode we also update projects + // that depend on the project being build. + // + if(scope == vsBuildScope.vsBuildScopeProject && + _connectMode != ext_ConnectMode.ext_cm_CommandLine) + { + List<Project> dependantProjects = new List<Project>(); + foreach(ProjectItem i in buildItems) + { + updateReverseDependencies(i, ref dependantProjects); + } + foreach(Project p in dependantProjects) + { + buildProject(p, force, excludeItem, scope, buildDependencies, ref builded); + } } } public bool buildCppProject(Project project, bool force, ref List<ProjectItem> buildedItems) { - VCConfiguration conf = Util.getActiveVCConfiguration(project);
- if(conf.ConfigurationType == ConfigurationTypes.typeGeneric ||
- conf.ConfigurationType == ConfigurationTypes.typeUnknown)
- {
- string err = "Configuration Type: '" + conf.ConfigurationType.ToString() + "' not supported by Ice Visual Studio Add-in";
- Util.write(project, Util.msgLevel.msgError,
+ VCConfiguration conf = Util.getActiveVCConfiguration(project); + if(conf.ConfigurationType == ConfigurationTypes.typeGeneric || + conf.ConfigurationType == ConfigurationTypes.typeUnknown) + { + string err = "Configuration Type: '" + conf.ConfigurationType.ToString() + "' not supported by Ice Visual Studio Add-in"; + Util.write(project, Util.msgLevel.msgError, "------ Slice compilation failed: Project: " + Util.getTraceProjectName(project) + " ------\n\n" + - err);
- MessageBox.Show(err, "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
- (MessageBoxOptions)0);
-
- Connect.getBuilder().addError(project, "", TaskErrorCategory.Error, 0, 0, err);
-
+ err); + MessageBox.Show(err, "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, + (MessageBoxOptions)0); + + Connect.getBuilder().addError(project, "", TaskErrorCategory.Error, 0, 0, err); + return false; } VCCLCompilerTool compilerTool = - (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool"));
-
- bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary;
- LinkerAdapter linkerAdapter;
- if(staticLib)
- {
- linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool")));
- }
- else
- {
- linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")));
+ (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); + + bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; + LinkerAdapter linkerAdapter; + if(staticLib) + { + linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); + } + else + { + linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); } if(!_opening) - {
+ { Util.checkCppRunTimeLibrary(this, project, compilerTool, linkerAdapter); } string sliceCompiler = getSliceCompilerPath(project); @@ -1217,7 +1215,7 @@ namespace Ice.VisualStudio } } else if(Util.isProjectItemFile(i)) - {
+ { if(!buildCppProjectItem(project, i, sliceCompiler, force, ref buildedItems)) { success = false; @@ -1227,7 +1225,7 @@ namespace Ice.VisualStudio return success; } - public bool buildCppProjectItem(Project project, ProjectItem item, string sliceCompiler, bool force,
+ public bool buildCppProjectItem(Project project, ProjectItem item, string sliceCompiler, bool force, ref List<ProjectItem> buildedItems) { if(project == null) @@ -1255,13 +1253,13 @@ namespace Ice.VisualStudio iceFileInfo.FullName, Util.getHeaderExt(project))); FileInfo cppFileInfo = new FileInfo(Path.ChangeExtension(hFileInfo.FullName, Util.getSourceExt(project))); - string output = Path.GetDirectoryName(cppFileInfo.FullName);
+ string output = Path.GetDirectoryName(cppFileInfo.FullName); return buildCppProjectItem(project, output, iceFileInfo, cppFileInfo, hFileInfo, sliceCompiler, force, ref buildedItems); } public bool buildCppProjectItem(Project project, String output, FileSystemInfo ice, FileSystemInfo cpp, - FileSystemInfo h, string sliceCompiler, bool force,
+ FileSystemInfo h, string sliceCompiler, bool force, ref List<ProjectItem> buildedItems) { bool updated = false; @@ -1633,21 +1631,21 @@ namespace Ice.VisualStudio if(Util.isCSharpProject(project)) { compiler = Util.slice2cs; - }
-
- if(!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("IceSourceHome")))
- {
- return Path.Combine(Environment.GetEnvironmentVariable("IceSourceHome"), "cpp", "bin", compiler);
- }
-
- string iceHome = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- if(iceHome.EndsWith("\\vsaddin", StringComparison.CurrentCultureIgnoreCase))
- {
- return Path.Combine(iceHome.Substring(0, iceHome.Length - "\\vsaddin".Length), "bin", compiler);
- }
- if(iceHome.EndsWith("\\vsaddin\\bin", StringComparison.CurrentCultureIgnoreCase))
- {
- return Path.Combine(iceHome.Substring(0, iceHome.Length - "\\vsaddin\\bin".Length), "cpp", "bin", compiler);
+ } + + if(!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("IceSourceHome"))) + { + return Path.Combine(Environment.GetEnvironmentVariable("IceSourceHome"), "cpp", "bin", compiler); + } + + string iceHome = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + if(iceHome.EndsWith("\\vsaddin", StringComparison.CurrentCultureIgnoreCase)) + { + return Path.Combine(iceHome.Substring(0, iceHome.Length - "\\vsaddin".Length), "bin", compiler); + } + if(iceHome.EndsWith("\\vsaddin\\bin", StringComparison.CurrentCultureIgnoreCase)) + { + return Path.Combine(iceHome.Substring(0, iceHome.Length - "\\vsaddin\\bin".Length), "cpp", "bin", compiler); } throw new ArgumentException("Unable to determite Slice compiler location"); } @@ -1812,7 +1810,7 @@ namespace Ice.VisualStudio public bool updateDependencies(Project project, ProjectItem item, string file, string sliceCompiler) { - Util.write(project, Util.msgLevel.msgInfo, " Computing dependencies\n");
+ Util.write(project, Util.msgLevel.msgInfo, " Computing dependencies\n"); if(!File.Exists(sliceCompiler)) { @@ -1878,12 +1876,12 @@ namespace Ice.VisualStudio process.BeginOutputReadLine(); // Read Standard error. string stderr = process.StandardError.ReadToEnd(); - process.WaitForExit();
- if(process.ExitCode != 0)
- {
- addError(project, file, TaskErrorCategory.Error, 0, 0, "Slice compiler `" + sliceCompiler +
- "' failed to start (error code " + process.ExitCode.ToString() + ")");
- return false;
+ process.WaitForExit(); + if(process.ExitCode != 0) + { + addError(project, file, TaskErrorCategory.Error, 0, 0, "Slice compiler `" + sliceCompiler + + "' failed to start (error code " + process.ExitCode.ToString() + ")"); + return false; } if(parseErrors(project, sliceCompiler, file, stderr)) { @@ -1946,46 +1944,46 @@ namespace Ice.VisualStudio } } projectDeps[file] = dependencies; - dependenciesMap[project.Name] = projectDeps;
+ dependenciesMap[project.Name] = projectDeps; process.Close(); return true; - }
-
- public void updateReverseDependencies(ProjectItem item, ref List<Project> dependantProjects)
- {
- DependenciesMap dependenciesMap = getDependenciesMap();
- List<Project> projects = Util.buildOrder(_applicationObject.Solution);
-
- foreach(Project p in projects)
- {
- if(p.Equals(item.ContainingProject) || !dependenciesMap.ContainsKey(p.Name))
- {
- continue;
- }
-
- Dictionary<string, List<string>> projectDependencies = dependenciesMap[p.Name];
- foreach(KeyValuePair<string, List<string>> pair in projectDependencies)
- {
- bool found = false;
- foreach(string f in pair.Value)
- {
- ProjectItem other = Util.findItem(f);
- if(item.Equals(other))
- {
- if(!dependantProjects.Contains(p))
- {
- dependantProjects.Add(p);
- found = true;
- }
- break;
- }
- }
- if(found)
- {
- break;
- }
- }
+ } + + public void updateReverseDependencies(ProjectItem item, ref List<Project> dependantProjects) + { + DependenciesMap dependenciesMap = getDependenciesMap(); + List<Project> projects = Util.buildOrder(_applicationObject.Solution); + + foreach(Project p in projects) + { + if(p.Equals(item.ContainingProject) || !dependenciesMap.ContainsKey(p.Name)) + { + continue; + } + + Dictionary<string, List<string>> projectDependencies = dependenciesMap[p.Name]; + foreach(KeyValuePair<string, List<string>> pair in projectDependencies) + { + bool found = false; + foreach(string f in pair.Value) + { + ProjectItem other = Util.findItem(f); + if(item.Equals(other)) + { + if(!dependantProjects.Contains(p)) + { + dependantProjects.Add(p); + found = true; + } + break; + } + } + if(found) + { + break; + } + } } } @@ -2002,27 +2000,27 @@ namespace Ice.VisualStudio new _dispProjectItemsEvents_ItemAddedEventHandler(csharpItemAdded); _csProjectItemsEvents.ItemRemoved += new _dispProjectItemsEvents_ItemRemovedEventHandler(csharpItemRemoved); - }
- }
- catch(COMException)
+ } + } + catch(COMException) { // Can happen if the Visual Studio install don't support C# - }
-
- try
- {
- // Cpp project item events.
- _vcProjectItemsEvents =
- (VCProjectEngineEvents)_applicationObject.Events.GetObject("VCProjectEngineEventsObject");
- if (_vcProjectItemsEvents != null)
- {
- _vcProjectItemsEvents.ItemAdded +=
- new _dispVCProjectEngineEvents_ItemAddedEventHandler(cppItemAdded);
- _vcProjectItemsEvents.ItemRemoved +=
- new _dispVCProjectEngineEvents_ItemRemovedEventHandler(cppItemRemoved);
- }
- }
- catch(COMException)
+ } + + try + { + // Cpp project item events. + _vcProjectItemsEvents = + (VCProjectEngineEvents)_applicationObject.Events.GetObject("VCProjectEngineEventsObject"); + if (_vcProjectItemsEvents != null) + { + _vcProjectItemsEvents.ItemAdded += + new _dispVCProjectEngineEvents_ItemAddedEventHandler(cppItemAdded); + _vcProjectItemsEvents.ItemRemoved += + new _dispVCProjectEngineEvents_ItemRemovedEventHandler(cppItemRemoved); + } + } + catch(COMException) { // Can happen if the Visual Studio install don't support C++ } @@ -2072,15 +2070,15 @@ namespace Ice.VisualStudio } public Project getActiveProject() - {
- Array projects = null;
- if(_applicationObject.ActiveSolutionProjects != null)
- {
- projects = (Array)_applicationObject.ActiveSolutionProjects;
- if (projects != null && projects.Length > 0)
- {
- return projects.GetValue(0) as Project;
- }
+ { + Array projects = null; + if(_applicationObject.ActiveSolutionProjects != null) + { + projects = (Array)_applicationObject.ActiveSolutionProjects; + if (projects != null && projects.Length > 0) + { + return projects.GetValue(0) as Project; + } } projects = (Array)_applicationObject.Solution.SolutionBuild.StartupProjects; @@ -2090,9 +2088,9 @@ namespace Ice.VisualStudio } if(_applicationObject.Solution.Projects != null) - {
+ { if (_applicationObject.Solution.Projects != null && _applicationObject.Solution.Projects.Count > 0) - {
+ { return _applicationObject.Solution.Projects.Item(1) as Project; } } @@ -2124,10 +2122,10 @@ namespace Ice.VisualStudio if(file == null) { return; - }
-
- if(_applicationObject.ActiveSolutionProjects == null)
- {
+ } + + if(_applicationObject.ActiveSolutionProjects == null) + { return; } @@ -2183,11 +2181,11 @@ namespace Ice.VisualStudio if(file == null) { return; - }
-
- if(_applicationObject.ActiveSolutionProjects == null)
- {
- return;
+ } + + if(_applicationObject.ActiveSolutionProjects == null) + { + return; } if(!Util.isSliceFilename(file.Name)) @@ -2581,7 +2579,7 @@ namespace Ice.VisualStudio process.WaitForExit(); if(process.ExitCode != 0) - {
+ { addError(project, file, TaskErrorCategory.Error, 0, 0, "Slice compiler `" + sliceCompiler + "' failed to start (error code " + process.ExitCode.ToString() + ")"); return false; @@ -2795,23 +2793,23 @@ namespace Ice.VisualStudio } try - {
- string projectName = null;
- if(commandLine)
- {
- projectName = Util.getCommandLineArgument("/Project");
+ { + string projectName = null; + if(commandLine) + { + projectName = Util.getCommandLineArgument("/Project"); } _building = true; - _buildScope = scope;
- Project project = null;
- if(String.IsNullOrEmpty(projectName))
- {
- project = getSelectedProject();
- }
- else
- {
- project = Util.getProjectByNameOrFile(_applicationObject.Solution, projectName);
- }
+ _buildScope = scope; + Project project = null; + if(String.IsNullOrEmpty(projectName)) + { + project = getSelectedProject(); + } + else + { + project = Util.getProjectByNameOrFile(_applicationObject.Solution, projectName); + } if(action == vsBuildAction.vsBuildActionBuild || action == vsBuildAction.vsBuildActionRebuildAll) { @@ -3092,25 +3090,25 @@ namespace Ice.VisualStudio } } return errors; - }
-
- private const string buildOutputPaneGuid = "{1BD8A850-02D1-11d1-BEE7-00A0C913D1F8}";
- public OutputWindowPane buildOutput()
- {
- if(_output == null)
- {
- OutputWindow window = (OutputWindow)_applicationObject.Windows.Item(
- EnvDTE.Constants.vsWindowKindOutput).Object;
- foreach(OutputWindowPane w in window.OutputWindowPanes)
- {
- if(w.Guid.Equals(buildOutputPaneGuid, StringComparison.CurrentCultureIgnoreCase))
- {
- _output = w;
- break;
- }
- }
- }
- return _output;
+ } + + private const string buildOutputPaneGuid = "{1BD8A850-02D1-11d1-BEE7-00A0C913D1F8}"; + public OutputWindowPane buildOutput() + { + if(_output == null) + { + OutputWindow window = (OutputWindow)_applicationObject.Windows.Item( + EnvDTE.Constants.vsWindowKindOutput).Object; + foreach(OutputWindowPane w in window.OutputWindowPanes) + { + if(w.Guid.Equals(buildOutputPaneGuid, StringComparison.CurrentCultureIgnoreCase)) + { + _output = w; + break; + } + } + } + return _output; } public ext_ConnectMode connectMode() @@ -3487,8 +3485,8 @@ namespace Ice.VisualStudio private List<ErrorTask> _errors; private int _errorCount; private FileTracker _fileTracker; - private DependenciesMap _dependenciesMap;
- private Dictionary<ProjectItem, List<Project>> _reverseDependencyMap; + private DependenciesMap _dependenciesMap; + private string _deletedFile; private OutputWindowPane _output; diff --git a/vsaddin/src/Util.cs b/vsaddin/src/Util.cs index efa95c7dd18..06562469a26 100644 --- a/vsaddin/src/Util.cs +++ b/vsaddin/src/Util.cs @@ -378,16 +378,25 @@ namespace Ice.VisualStudio public static string getIceHome()
{
- string defaultIceHome = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- if(defaultIceHome.EndsWith("\\vsaddin", StringComparison.CurrentCultureIgnoreCase))
+ string iceSourceHome = System.Environment.GetEnvironmentVariable("IceSourceHome");
+ if (iceSourceHome != null && System.IO.Directory.Exists(iceSourceHome) &&
+ System.IO.File.Exists(Path.Combine(iceSourceHome, "cpp", "bin", slice2cpp)))
{
- defaultIceHome = defaultIceHome.Substring(0, defaultIceHome.Length - "\\vsaddin".Length);
+ return iceSourceHome;
}
- else if(defaultIceHome.EndsWith("\\vsaddin\\bin", StringComparison.CurrentCultureIgnoreCase))
+ else
{
- defaultIceHome = defaultIceHome.Substring(0, defaultIceHome.Length - "\\vsaddin\bin".Length);
+ string defaultIceHome = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ if (defaultIceHome.EndsWith("\\vsaddin", StringComparison.CurrentCultureIgnoreCase))
+ {
+ defaultIceHome = defaultIceHome.Substring(0, defaultIceHome.Length - "\\vsaddin".Length);
+ }
+ else if (defaultIceHome.EndsWith("\\vsaddin\\bin", StringComparison.CurrentCultureIgnoreCase))
+ {
+ defaultIceHome = defaultIceHome.Substring(0, defaultIceHome.Length - "\\vsaddin\bin".Length);
+ }
+ return defaultIceHome;
}
- return defaultIceHome;
}
public static string getProjectOutputDirRaw(Project project)
@@ -469,7 +478,7 @@ namespace Ice.VisualStudio {
VCProject vcProj = (VCProject)project.Object;
- string propSheetFileName = "$(ALLUSERSPROFILE)\\ZeroC\\ice";
+ string propSheetFileName = "$(ALLUSERSPROFILE)\\ZeroC\\Ice";
#if VS2008
propSheetFileName += ".vsprops";
@@ -568,12 +577,6 @@ namespace Ice.VisualStudio return path.ToString();
}
- private static readonly string iceIncludeDir =
-#if VS2008
- "$(IceHome)\\include";
-#else
- "$(IceInclude)";
-#endif
public static bool addCppIncludes(VCCLCompilerTool tool, Project project)
{
if(tool == null || project == null)
@@ -581,16 +584,9 @@ namespace Ice.VisualStudio return false;
}
- bool winrt = isWinRTProject(project);
bool changed = false;
ComponentList includes = new ComponentList(tool.AdditionalIncludeDirectories);
- if(!winrt && !includes.Contains(iceIncludeDir) && !includes.Contains(quote(iceIncludeDir)))
- {
- changed = true;
- includes.Add(quote(iceIncludeDir));
- }
-
string outputDir = getProjectOutputDirRaw(project);
if(outputDir.Equals(""))
{
@@ -625,11 +621,6 @@ namespace Ice.VisualStudio changed = true;
}
- if(includes.Remove(quote(iceIncludeDir)) || includes.Remove(iceIncludeDir))
- {
- changed = true;
- }
-
if(!generatedDir.Equals("."))
{
if(includes.Remove(generatedDir))
@@ -663,7 +654,7 @@ namespace Ice.VisualStudio IVCCollection sheets = (IVCCollection)configuration.PropertySheets;
foreach(VCPropertySheet s in sheets)
{
- if(!s.PropertySheetFile.Equals(configuration.Evaluate("$(ALLUSERSPROFILE)\\ZeroC\\IceCommon.props"),
+ if(!s.PropertySheetFile.Equals(configuration.Evaluate("$(ALLUSERSPROFILE)\\ZeroC\\Ice.props"),
StringComparison.CurrentCultureIgnoreCase))
{
continue;
@@ -1006,74 +997,6 @@ namespace Ice.VisualStudio return;
}
- public static bool addIceCppLibraryDir(LinkerAdapter tool, Project project, CPUType arch)
- {
- if(tool == null || project == null)
- {
- return false;
- }
-
-
-#if VS2010 || VS2012
- string iceLibDir = isWinRTProject(project) ? "$(IceLib)\\winrt" : "$(IceLib)";
-#else
- if(arch == CPUType.x64CPUType)
- {
- iceLibDir += "\\x64";
- }
-#endif
- string additionalLibraryDirectories = tool.AdditionalLibraryDirectories;
- if(String.IsNullOrEmpty(additionalLibraryDirectories))
- {
- tool.AdditionalLibraryDirectories = quote(iceLibDir);
- return true;
- }
-
- ComponentList libs = new ComponentList(additionalLibraryDirectories);
- bool changed = false;
-#if !VS2010 && !VS2012
- //
- // Remove Ice lib directories that doesn't match the current ice lib dir.
- //
- ComponentList remove = new ComponentList();
-
- foreach(string lib in libs)
- {
- if(lib.Equals(iceLibDir) ||
- lib.Equals(quote(iceLibDir)))
- {
- continue;
- }
- if(lib.StartsWith("$(IceHome)") ||
- lib.StartsWith("\"$(IceHome)"))
- {
- remove.Add(lib);
- }
- }
-
- foreach(string lib in remove)
- {
- if(libs.Remove(lib))
- {
- changed = true;
- }
- }
-#endif
- if(!libs.Contains(iceLibDir) &&
- !libs.Contains(quote(iceLibDir)))
- {
- libs.Add(quote(iceLibDir));
- changed = true;
- }
-
- if(changed)
- {
- tool.AdditionalLibraryDirectories = libs.ToString();
- }
-
- return changed;
- }
-
public static void removeIceCppLibraryDir(LinkerAdapter tool, string iceHome)
{
if(tool == null || String.IsNullOrEmpty(tool.AdditionalLibraryDirectories))
|