Skip to content

Commit

Permalink
road to DNX: compilation: adding executing assembly as dependency to …
Browse files Browse the repository at this point in the history
…project.json
  • Loading branch information
adamsitnik committed Jan 24, 2016
1 parent c8e8268 commit 2ebe6c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion BenchmarkDotNet/Plugins/Toolchains/Dnx/BenchmarkDnxGenerator.cs
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Plugins.Loggers;
Expand All @@ -20,6 +21,8 @@ protected override void GenerateProjectFile(string projectDir, Benchmark benchma
var template = ResourceHelper.LoadTemplate("BenchmarkProject.json");

var content = SetPlatform(template, benchmark.Task.Configuration.Platform);
content = SetDependency(content, benchmark.Target.Type);


string fileName = Path.Combine(projectDir, ProjectFileName);

Expand All @@ -35,5 +38,15 @@ private static string SetPlatform(string template, BenchmarkPlatform platform)
{
return template.Replace("$PLATFORM", platform.ToConfig()); // todo: verify name
}

private static string SetDependency(string template, Type benchmarkTarget)
{
var assemblyName = benchmarkTarget.Assembly.GetName();

return template
// todo: handle number.number.number-text format
.Replace("$EXECUTINGASSEMBLYVERSION", assemblyName.Version.ToString())
.Replace("$EXECUTINGASSEMBLY", assemblyName.Name);
}
}
}
3 changes: 2 additions & 1 deletion BenchmarkDotNet/Templates/BenchmarkProject.json
Expand Up @@ -25,7 +25,8 @@
"target": "Package",
"version": "0.8.2",
"comment": "not sure what to put in version and target, Assembly"
}
},
"$EXECUTINGASSEMBLY": "$EXECUTINGASSEMBLYVERSION"
}
}
}
Expand Down

0 comments on commit 2ebe6c1

Please sign in to comment.