Skip to content

Commit

Permalink
Add support to create TLog files for C++ projects
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Jul 6, 2016
1 parent 422bc60 commit 2e1409f
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 54 deletions.
2 changes: 1 addition & 1 deletion AddinRemoval/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Visual Studio Extension")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: AssemblyDelaySign(false)]
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Changes in Ice Builder for Visual Studio 4.3.3

- Add support to generate TLog files with C++ builds, this ensure
that Visual Studio correctly rebuild projects when out of project
dependencies change.

## Changes in Ice Builder for Visual Studio 4.3.2

- Fixed a bug that cause Slice files not being compiled after a project was
Expand Down
2 changes: 1 addition & 1 deletion IceBuilder.debug.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

set ICEBUILDERINSTALLDIR=%LOCALAPPDATA%\Microsoft\VisualStudio\14.0Exp\Extensions\ZeroC\Ice Builder\4.3.2
set ICEBUILDERINSTALLDIR=%LOCALAPPDATA%\Microsoft\VisualStudio\14.0Exp\Extensions\ZeroC\Ice Builder\4.3.3

set IceBuilderCppProps=%ICEBUILDERINSTALLDIR%\Resources\IceBuilder.Cpp.props
set IceBuilderCppTargets=%ICEBUILDERINSTALLDIR%\Resources\IceBuilder.Cpp.targets
Expand Down
2 changes: 1 addition & 1 deletion IceBuilder/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Builder")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: ComVisibleAttribute(false)]
7 changes: 4 additions & 3 deletions IceBuilder/Resources/IceBuilder.CSharp.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
<Import Project="$(IceHome)\config\Ice.CSharp.props"
Condition="Exists('$(IceHome)\config\Ice.CSharp.props')"/>

<Import Project="$(IceHome)\csharp\config\Ice.CSharp.props"
Condition="Exists('$(IceHome)\csharp\config\Ice.CSharp.props')"/>
<!-- With Ice source distribution the settings are in the cpp msbuild directory -->
<Import Project="$(IceHome)\csharp\msbuild\icebuilder.csharp.props"
Condition="Exists('$(IceHome)\csharp\msbuild\icebuilder.csharp.props')"/>

<!-- With Ice binary distribution >= 3.7.0 settings are in the Nuget package build directory -->
<Import Project="$(IceHome)\zeroc.ice.net\build\zeroc.ice.net.props"
Expand All @@ -39,7 +40,7 @@
<IceBuilderOutputDir>$(MSBuildProjectDirectory)\generated</IceBuilderOutputDir>
</PropertyGroup>

<PropertyGroup Condition="'$(IceIntVersion)' &lt; '30700'">
<PropertyGroup Condition="'$(IceIntVersion)' != '' And '$(IceIntVersion)' &lt; '30700'">
<IceToolsPath Condition="'$(IceToolsPath)' == '' And Exists('$(IceHome)\cpp\bin')">$(IceHome)\cpp\bin</IceToolsPath>
<IceToolsPath Condition="'$(IceToolsPath)' == '' And Exists('$(IceHome)\bin')">$(IceHome)\bin</IceToolsPath>
<IceToolsBin Condition="'$(IceToolsBin)' == ''">$(IceToolsPath)</IceToolsBin>
Expand Down
2 changes: 1 addition & 1 deletion IceBuilder/Resources/IceBuilder.CSharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<Target Name="IceBuilder_Validate">
<Error Text="Ice Installation not detected. Please update Ice Home in 'Tools > Options > Projects and Solutions > Ice Builder'"
Condition="'$(IceHome)' == ''" />
Condition="'$(IceHome)' == '' Or '$(IceVersion)' == '' Or '$(IceIntVersion)' == ''" />

<Error Text="The selected Ice home directory does not exist or is not an Ice installation. Please update Ice Home in 'Tools > Options > Projects and Solutions > Ice Builder'"
Condition="!Exists('$(IceHome)')" />
Expand Down
54 changes: 38 additions & 16 deletions IceBuilder/Resources/IceBuilder.Common.props
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2009-2016 ZeroC, Inc. All rights reserved. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- if ICE_HOME is set and IceHome is not set we set IceHome to ICE_HOME
this will be later used to load settings from the Ice distribution pointed
by IceHome -->
<PropertyGroup Label="IceHome" Condition="'$(IceHome)' == ''">
<IceHome>$(ICE_HOME)</IceHome>
</PropertyGroup>
<!--
If ICE_HOME is set and IceHome is not set we set IceHome to ICE_HOME
this will be later used to load settings from the Ice distribution pointed
by IceHome.
-->
<PropertyGroup Label="IceHome" Condition="'$(IceHome)' == ''">
<IceHome>$(ICE_HOME)</IceHome>
</PropertyGroup>

<!--
If IceVersion is not set import the version settings from the Ice
distribution.
-->
<ImportGroup Condition="'$(IceVersion)' == ''">
<!--
With Ice 3.6.x this settings are in config\Ice.props.
-->
<Import Project="$(IceHome)\config\Ice.props"
Condition="Exists('$(IceHome)\config\Ice.props')"/>

<PropertyGroup Label="IceHome" Condition="'$(IceHome)' == ''">
<IceHome>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceHome)</IceHome>
<IceVersion>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceVersion)</IceVersion>
<IceIntVersion>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceIntVersion)</IceIntVersion>
<IceVersionMM>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceVersionMM)</IceVersionMM>
</PropertyGroup>
<!--
With Ice 3.7 the settings were move to config\icebuilder.props.
-->
<Import Project="$(IceHome)\config\icebuilder.props"
Condition="Exists('$(IceHome)\config\icebuilder.props')"/>
</ImportGroup>

<!-- Check if IceHome denotes a source distribution -->
<PropertyGroup Condition="Exists('$(IceHome)\cpp\bin')">
<IceSourceHome>$(IceHome)</IceSourceHome>
</PropertyGroup>
<!--
If IceHome is not set above, read the settings from the Windows registry
-->
<PropertyGroup Label="IceHome" Condition="'$(IceHome)' == ''">
<IceHome>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceHome)</IceHome>
<IceVersion>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceVersion)</IceVersion>
<IceIntVersion>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceIntVersion)</IceIntVersion>
<IceVersionMM>$(Registry:HKEY_CURRENT_USER\Software\ZeroC\IceBuilder@IceVersionMM)</IceVersionMM>
</PropertyGroup>

<!--
Check if IceHome denotes a source distribution.
-->
<PropertyGroup Condition="Exists('$(IceHome)\cpp\bin')">
<IceSourceHome>$(IceHome)</IceSourceHome>
</PropertyGroup>
</Project>
8 changes: 4 additions & 4 deletions IceBuilder/Resources/IceBuilder.Cpp.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<Import Project="$(IceHome)\config\Ice.Cpp.props"
Condition="Exists('$(IceHome)\config\Ice.Cpp.props')"/>

<!-- With Ice source distribution the settings are in the cpp config directory -->
<Import Project="$(IceHome)\cpp\config\Ice.Cpp.props"
Condition="Exists('$(IceHome)\cpp\config\Ice.Cpp.props')"/>
<!-- With Ice source distribution the settings are in the cpp msbuild directory -->
<Import Project="$(IceHome)\cpp\msbuild\icebuilder.cpp.props"
Condition="Exists('$(IceHome)\cpp\msbuild\icebuilder.cpp.props')"/>

<!-- With Ice 3.7.0 binary distribution settings are in the Nuget package build directory -->
<Import Project="$(IceHome)\zeroc.ice.$(DefaultPlatformToolset)\build\zeroc.ice.$(DefaultPlatformToolset).props"
Expand Down Expand Up @@ -83,7 +83,7 @@
<LocalDebuggerEnvironment>PATH=$(Path);$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
</PropertyGroup>

<PropertyGroup Condition="'$(IceIntVersion)' &lt; '30700'">
<PropertyGroup Condition="'$(IceIntVersion)' != '' And '$(IceIntVersion)' &lt; '30700'">
<IceToolsPath Condition="'$(IceToolsPath)' == '' And Exists('$(IceHome)\cpp\bin')">$(IceHome)\cpp\bin</IceToolsPath>
<IceToolsPath Condition="'$(IceToolsPath)' == '' And Exists('$(IceHome)\bin')">$(IceHome)\bin</IceToolsPath>
<IceToolsBin Condition="'$(IceToolsBin)' == ''">$(IceToolsPath)</IceToolsBin>
Expand Down
23 changes: 20 additions & 3 deletions IceBuilder/Resources/IceBuilder.Cpp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<Target Name="IceBuilder_Validate">
<Error Text="Ice Installation not detected. Please update Ice Home in 'Tools > Options > Projects and Solutions > Ice Builder'"
Condition="'$(IceHome)' == ''" />
Condition="'$(IceHome)' == '' Or '$(IceVersion)' == '' Or '$(IceIntVersion)' == ''" />

<Error Text="The selected Ice home directory does not exist or is not an Ice installation. Please update Ice Home in 'Tools > Options > Projects and Solutions > Ice Builder'"
Condition="!Exists('$(IceHome)')" />
Expand Down Expand Up @@ -97,7 +97,8 @@
SourceExt = "$(IceBuilderSourceExt)"
DependFile = "$(IceBuilderDependFile)"
Sources = "@(_IceBuilder)"
Condition = "'%(_IceBuilder.BuildRequired)' == 'True'"/>
Condition = "'%(_IceBuilder.BuildRequired)' == 'True'">
</Slice2CppTask>

<!-- Update the dependencies -->
<Slice2CppTask
Expand All @@ -119,7 +120,23 @@
DependFile = "$(IceBuilderDependFile)"
Depend = "true"
Sources = "@(_IceBuilder)"
Condition = "'$(_IceBuilderUdateDepends)' == 'True'"/>
Condition = "'$(_IceBuilderUdateDepends)' == 'True'">
<Output
ItemName = "__IceBuilder"
TaskParameter = "ComputedSources"/>
</Slice2CppTask>

<!-- Write TLog files -->
<WriteLinesToFile File = "$(TLogLocation)\slice2cpp.write.1u.tlog"
Encoding = "Unicode"
Lines = "^%(__IceBuilder.FullPath);%(__IceBuilder.Outputs)"
Condition = "'$(_IceBuilderUdateDepends)' == 'True'"/>

<!-- Read TLog files -->
<WriteLinesToFile File = "$(TLogLocation)\slice2cpp.read.1u.tlog"
Encoding = "Unicode"
Lines = "^%(__IceBuilder.FullPath);%(__IceBuilder.Inputs)"
Condition = "'$(_IceBuilderUdateDepends)' == 'True'"/>
</Target>

<Target Name="IceBuilder_Clean" BeforeTargets="Clean">
Expand Down
2 changes: 1 addition & 1 deletion IceBuilder/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="ef9502be-dbc2-4568-a846-02b8e42d04c2" Version="4.3.2" Language="en-US" Publisher="ZeroC" />
<Identity Id="ef9502be-dbc2-4568-a846-02b8e42d04c2" Version="4.3.3" Language="en-US" Publisher="ZeroC" />
<DisplayName>Ice Builder</DisplayName>
<Description xml:space="preserve">Ice Builder manages the compilation of Slice (.ice) files to C++ and C#. It compiles your Slice files with slice2cpp and slice2cs, and allows you to specify the parameters provided to these compilers.</Description>
<MoreInfo>https://github.com/zeroc-ice/ice-builder-visualstudio</MoreInfo>
Expand Down
2 changes: 1 addition & 1 deletion IceBuilderTasks/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Builder")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: AssemblyDelaySign(false)]
[assembly: ComVisibleAttribute(false)]
80 changes: 64 additions & 16 deletions IceBuilderTasks/Tasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,22 @@ protected override String GeneratedExtensions
}
}

[Output]
public ITaskItem[] ComputedSources
{
get;
private set;
}

protected ITaskItem[] GeneratedItems(ITaskItem source)
{
return new ITaskItem[]
{
new TaskItem(GetGeneratedPath(source, OutputDir, SourceExt)),
new TaskItem(GetGeneratedPath(source, String.IsNullOrEmpty(HeaderOutputDir) ? OutputDir : HeaderOutputDir, HeaderExt)),
};
}

protected override String GenerateCommandLineCommands()
{
CommandLineBuilder builder = new CommandLineBuilder(false);
Expand Down Expand Up @@ -465,28 +481,60 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand
try
{
int status = base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
if (!String.IsNullOrEmpty(HeaderOutputDir) && !Depend && status == 0)
if(status == 0)
{
if (!Directory.Exists(HeaderOutputDir))
if(Depend)
{
Directory.CreateDirectory(HeaderOutputDir);
List<ITaskItem> computed = new List<ITaskItem>();
XmlDocument dependsDoc = new XmlDocument();
dependsDoc.Load(DependFile);

foreach(ITaskItem source in Sources)
{
List<string> dependPaths = new List<string>();
XmlNodeList depends = dependsDoc.DocumentElement.SelectNodes(
String.Format("/dependencies/source[@name='{0}']/dependsOn", source.GetMetadata("Identity")));
if(depends != null)
{
foreach(XmlNode depend in depends)
{
dependPaths.Add(Path.GetFullPath(depend.Attributes["name"].Value).ToUpper());
}
}
dependPaths.Add(Path.GetFullPath(pathToTool).ToUpper());

ITaskItem computedSource = new TaskItem(source.ItemSpec);
source.CopyMetadataTo(computedSource);
computedSource.SetMetadata("Outputs", String.Join(";",
Array.ConvertAll(GeneratedItems(source), (item) => item.GetMetadata("FullPath").ToUpper())));
computedSource.SetMetadata("Inputs", String.Join(";", dependPaths.ToArray()));
computed.Add(computedSource);
}
ComputedSources = computed.ToArray();
}
foreach (ITaskItem source in Sources)
else if(!String.IsNullOrEmpty(HeaderOutputDir))
{
String sourceH = GetGeneratedPath(source, OutputDir, HeaderExt);
String targetH = GetGeneratedPath(source, HeaderOutputDir, HeaderExt);
if (!File.Exists(targetH) || new FileInfo(targetH).LastWriteTime < new FileInfo(sourceH).LastWriteTime)
if(!Directory.Exists(HeaderOutputDir))
{
Directory.CreateDirectory(HeaderOutputDir);
}
foreach(ITaskItem source in Sources)
{
if (File.Exists(targetH))
String sourceH = GetGeneratedPath(source, OutputDir, HeaderExt);
String targetH = GetGeneratedPath(source, HeaderOutputDir, HeaderExt);
if(!File.Exists(targetH) || new FileInfo(targetH).LastWriteTime < new FileInfo(sourceH).LastWriteTime)
{
File.Delete(targetH);
if(File.Exists(targetH))
{
File.Delete(targetH);
}
File.Move(sourceH, targetH);
}
File.Move(sourceH, targetH);
}

if (File.Exists(sourceH))
{
File.Delete(sourceH);
if(File.Exists(sourceH))
{
File.Delete(sourceH);
}
}
}
}
Expand Down Expand Up @@ -815,10 +863,10 @@ public override bool Execute()
if (skip)
{
XmlNodeList depends = dependsDoc.DocumentElement.SelectNodes(
String.Format("/dependencies/source[@name='{0}']/dependsOn", source.GetMetadata("Identity")));
String.Format("/dependencies/source[@name='{0}']/dependsOn", source.GetMetadata("Identity")));

if (depends != null)
{
List<String> dependPaths = new List<String>();
foreach (XmlNode depend in depends)
{
String path = depend.Attributes["name"].Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Visual Studio Extension")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: AssemblyDelaySign(false)]
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Visual Studio Extension")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: AssemblyDelaySign(false)]
2 changes: 1 addition & 1 deletion IceBuilder_Common/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Builder")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: ComVisibleAttribute(false)]
2 changes: 1 addition & 1 deletion IceBuilder_VS2012/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Builder")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: ComVisibleAttribute(false)]
2 changes: 1 addition & 1 deletion IceBuilder_VS2013/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Builder")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: ComVisibleAttribute(false)]
2 changes: 1 addition & 1 deletion IceBuilder_VS2015/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
[assembly: AssemblyCompany("ZeroC, Inc.")]
[assembly: AssemblyProduct("Ice Builder")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2016 ZeroC, Inc.")]
[assembly: AssemblyVersion("4.3.2")]
[assembly: AssemblyVersion("4.3.3")]
[assembly: ComVisibleAttribute(false)]

0 comments on commit 2e1409f

Please sign in to comment.