Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit ecf259c

Browse files
committed
Make sure files are regenerated on build when the json changes
1 parent 0c62477 commit ecf259c

11 files changed

+592
-7
lines changed
55.3 KB
Binary file not shown.

lib/Microsoft.TextTemplating.targets

Lines changed: 535 additions & 0 deletions
Large diffs are not rendered by default.
52.3 KB
Binary file not shown.

src/GitHub.Exports/GitHub.Exports.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@
197197
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
198198
</ItemGroup>
199199
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
200+
<Import Project="$(SolutionDir)\src\common\t4.targets" />
201+
<Import Project="$(SolutionDir)\lib\Microsoft.TextTemplating.targets" />
202+
200203
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
201204
Other similar extension points exist, see Microsoft.Common.targets.
202205
<Target Name="BeforeBuild">

src/GitHub.Exports/Settings/IPackageSettings.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
// This is an automatically generated file, based on settings.json and IPackageSettings.tt
1+
// This is an automatically generated file, based on settings.json and PackageSettingsGen.tt
2+
/* settings.json content:
3+
{
4+
"settings": [
5+
{
6+
"name": "CollectMetrics",
7+
"type": "bool",
8+
"default": 'true'
9+
}
10+
]
11+
}
12+
*/
213
namespace GitHub.Settings
314
{
415
public interface IPackageSettings

src/GitHub.Exports/Settings/IPackageSettings.tt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44
<#@ import namespace="System.Text" #>
55
<#@ import namespace="System.Collections.Generic" #>
66
<#@ import namespace="System.IO" #>
7-
<#@ assembly name="$(SolutionDir)\build\$(Configuration)\Newtonsoft.Json.Dll" #>
7+
<#@ assembly name="$(PackageDir)\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll" #>
88
<#@ import namespace="Newtonsoft.Json.Linq" #>
99
<#@ output extension=".cs" #>
1010
<#
1111
var file = this.Host.ResolvePath(@"..\..\common\settings.json");
1212
var json = JObject.Parse(File.ReadAllText(file));
1313
#>
14-
// This is an automatically generated file, based on settings.json and IPackageSettings.tt
14+
// This is an automatically generated file, based on settings.json and PackageSettingsGen.tt
15+
/* settings.json content:
16+
<#@ include file="..\..\common\settings.json" #>
17+
*/
1518
namespace GitHub.Settings
1619
{
1720
public interface IPackageSettings
1821
{
1922
void Save();
2023
<#
21-
foreach (var j in json.Children().Children().Children()) {
24+
foreach (var j in json["settings"].Children()) {
2225
#>
2326
<#= j["type"] #> <#= j["name"] #> { get; set; }
2427
<#

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@
612612
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
613613
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
614614
<Import Project="packaging.targets" />
615+
<!-- For regenerating templates on build -->
616+
<Import Project="$(SolutionDir)\src\common\t4.targets" />
617+
<Import Project="$(SolutionDir)\lib\Microsoft.TextTemplating.targets" />
615618
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
616619
<PropertyGroup>
617620
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>

src/GitHub.VisualStudio/Settings/PackageSettingsGen.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
// This is an automatically generated file, based on settings.json and PackageSettingsGen.tt
2+
/* settings.json content:
3+
{
4+
"settings": [
5+
{
6+
"name": "CollectMetrics",
7+
"type": "bool",
8+
"default": 'true'
9+
}
10+
]
11+
}
12+
*/
13+
214
using GitHub.Settings;
315

416
namespace GitHub.VisualStudio.Settings {

src/GitHub.VisualStudio/Settings/PackageSettingsGen.tt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
<#@ import namespace="System.Linq" #>
44
<#@ import namespace="System.Collections.Generic" #>
55
<#@ import namespace="System.IO" #>
6-
<#@ assembly name="$(TargetDir)\Newtonsoft.Json.Dll" #>
6+
<#@ assembly name="$(PackageDir)\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll" #>
77
<#@ import namespace="Newtonsoft.Json.Linq" #>
88
<#@ output extension=".cs" #>
99
<#
1010
var file = this.Host.ResolvePath(@"..\..\common\settings.json");
1111
var json = JObject.Parse(File.ReadAllText(file));
1212
#>
1313
// This is an automatically generated file, based on settings.json and PackageSettingsGen.tt
14+
/* settings.json content:
15+
<#@ include file="..\..\common\settings.json" #>
16+
*/
17+
1418
using GitHub.Settings;
1519

1620
namespace GitHub.VisualStudio.Settings {
@@ -19,7 +23,7 @@ namespace GitHub.VisualStudio.Settings {
1923
{
2024

2125
<#
22-
foreach (var j in json.Children().Children().Children()) {
26+
foreach (var j in json["settings"].Children()) {
2327
#>
2428
public <#= j["type"] #> <#= j["name"] #> { get; set; }
2529
<#

src/common/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "CollectMetrics",
55
"type": "bool",
6-
"default": "true"
6+
"default": 'true'
77
}
88
]
99
}

0 commit comments

Comments
 (0)