Skip to content

Commit

Permalink
XmlSessionLogger now closes the stream on session end + VS2015 packag…
Browse files Browse the repository at this point in the history
…ing fixes.
  • Loading branch information
Tobbe Gyllebring committed Aug 14, 2019
1 parent b164986 commit 3a37c12
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 31 deletions.
4 changes: 1 addition & 3 deletions Cone.nuspec
Expand Up @@ -19,14 +19,12 @@ Say no to FluentCobol, say hello to Check.That(() => actual == expected);
<projectUrl>https://github.com/drunkcod/Cone</projectUrl>
<tags></tags>
<dependencies>
<dependency id="Newtonsoft.Json" version="11.*" />
<dependency id="Newtonsoft.Json" version="11.0.1" />
</dependencies>
</metadata>
<files>
<file src="Build\Cone\$Configuration$\**" target="lib\" exclude="**\Newtonsoft.Json.dll" />
<!--
<file src="dotnet-conesole.targets" target="build\Cone.targets" />
<file src="dotnet-conesole.targets" target="buildMultiTargeting\Cone.targets" />
-->
</files>
</package>
4 changes: 2 additions & 2 deletions Source/Version.cs
Expand Up @@ -2,5 +2,5 @@
using System.Runtime.InteropServices;

[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2019.08.13")]
[assembly: AssemblyInformationalVersion("2019.08.13")]
[assembly: AssemblyVersion("2019.08.14")]
[assembly: AssemblyInformationalVersion("2019.08.14")]
22 changes: 9 additions & 13 deletions Source/dotnet-conesole/Program.cs
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using Newtonsoft.Json;

namespace Conesole.NetCoreApp
{
Expand All @@ -19,13 +20,6 @@ public class TargetInfo
public string GetTargetPath() => Path.Combine(OutputPath, TargetFileName);
}

[XmlRoot("Targets")]
public class TargetCollection
{
[XmlElement("Target")]
public TargetInfo[] Items;
}

class Program
{
class CommandSettings
Expand Down Expand Up @@ -68,7 +62,7 @@ class CommandSettings
var targetInfo = GetTargetInfo(settings);
var allOk = true;
runSettings.Insert(0, string.Empty);
foreach(var item in targetInfo.Items) {
foreach(var item in targetInfo) {
runSettings[0] = item.GetTargetPath();
allOk &= RunConesole(item.TargetFramework, runSettings) == 0;
}
Expand Down Expand Up @@ -126,7 +120,7 @@ static int RunConesole(string fxVersion, IEnumerable<string> args)
return (Path.Combine(probePath, "netcoreapp2.2", "Cone.Worker.dll"), true);
}

static TargetCollection GetTargetInfo(CommandSettings settings) {
static IEnumerable<TargetInfo> GetTargetInfo(CommandSettings settings) {
var tmp = Path.GetTempFileName();
try {
var build = settings.NoBuild ? string.Empty : "/t:Build";
Expand All @@ -135,11 +129,13 @@ static int RunConesole(string fxVersion, IEnumerable<string> args)
Arguments = $"msbuild {FindTargetProject()} /nologo {build} /t:Cone-TargetInfo /p:Cone-TargetFile={tmp} /p:CopyLocalLockFileAssemblies=true"
});
msbuild.WaitForExit();
using(var info = File.OpenRead(tmp)) {
var xml = new XmlSerializer(typeof(TargetCollection));
var result = (TargetCollection)xml.Deserialize(XmlReader.Create(info, new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment }));
return result;
var targets = new List<TargetInfo>();
using(var info = new JsonTextReader(File.OpenText(tmp)) { SupportMultipleContent = true }) {
var json = new JsonSerializer();
while(info.Read())
targets.Add(json.Deserialize<TargetInfo>(info));
}
return targets;
} catch(Exception ex) {
throw new InvalidOperationException("Failed to detect project", ex);
}
Expand Down
3 changes: 3 additions & 0 deletions Source/dotnet-conesole/dotnet-conesole.csproj
Expand Up @@ -7,4 +7,7 @@
<ItemGroup>
<Compile Include="..\Version.cs" Link="Version.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
</ItemGroup>
</Project>
10 changes: 8 additions & 2 deletions dotnet-conesole.nuspec
Expand Up @@ -12,14 +12,20 @@ The easiest way to execute Cone specs.
</description>
<projectUrl>https://github.com/drunkcod/Cone</projectUrl>
<tags></tags>
<dependencies>
<dependency id="Newtonsoft.Json" version="11.0.1" />
</dependencies>

<packageTypes>
<packageType name="DotnetCliTool" />
</packageTypes>
</metadata>
<files>
<file src="Build\Cone.Worker\$Configuration$\**" target="tools" />
<file src="Build\dotnet-conesole\$Configuration$\**" target="lib" />
<file src="dotnet-conesole.targets" target="build\Cone.targets" />
<file src="dotnet-conesole.targets" target="buildMultiTargeting\Cone.targets" />
<!--
<file src="dotnet-conesole.targets" target="build" />
<file src="dotnet-conesole.targets" target="buildMultiTargeting" />
-->
</files>
</package>
21 changes: 10 additions & 11 deletions dotnet-conesole.targets
@@ -1,4 +1,4 @@
<Project>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Cone-TargetInfo">
<PropertyGroup>
<Fx>$(TargetFramework)</Fx>
Expand All @@ -7,21 +7,20 @@
<ItemGroup>
<_TargetFramework Include="$(Fx.Split(';'))" />
</ItemGroup>
<WriteLinesToFile Encoding="UTF-8" File="$(Cone-TargetFile)" Lines="&lt;Targets&gt;" Overwrite="true" />
<WriteLinesToFile Encoding="UTF-8" File="$(Cone-TargetFile)" Lines="" Overwrite="true" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Cone-WriteOutput" Properties="TargetFramework=%(_TargetFramework.Identity)" />
<WriteLinesToFile Encoding="UTF-8" File="$(Cone-TargetFile)" Lines="&lt;/Targets&gt;" Overwrite="false" />

</Target>

<Target Name="Cone-WriteOutput">
<PropertyGroup>
<Lines>
<Target>;
<ProjectName>$(MSBuildProjectName)</ProjectName>;
<OutputPath>$(OutputPath)</OutputPath>;
<Configuration>$(Configuration)</Configuration>;
<TargetFileName>$(TargetFileName)</TargetFileName>;
<TargetFramework>$(TargetFramework)</TargetFramework>;
</Target>
{
Target: "$(MSBuildProjectName)",
OutputPath: "$(OutputPath.Replace('\', '/'))",
Configuration: "$(Configuration)",
TargetFileName: "$(TargetFileName)",
TargetFramework: "$(TargetFramework)"
}
</Lines>
</PropertyGroup>
<WriteLinesToFile Encoding="UTF-8" File="$(Cone-TargetFile)" Lines="$(Lines)" Overwrite="false" />
Expand Down

0 comments on commit 3a37c12

Please sign in to comment.