-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
130 lines (110 loc) · 6.08 KB
/
Copy pathDirectory.Build.props
File metadata and controls
130 lines (110 loc) · 6.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<Project>
<!--
Copyright (c) 2018-2026 GraphDefined GmbH <achim.friedland@graphdefined.com>
This file is part of ChargyCore <https://github.com/OpenChargingCloud/ChargyCore.NET>
Settings shared by every project in this repository.
Styx and Hermod are referenced from sibling directories and therefore keep
their own settings — this file reaches only what lives below it.
-->
<PropertyGroup Label="Language and platform">
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<!-- Every public member is documented, and the compiler is what enforces
that: with the documentation file switched on, an undocumented public
member is a warning, and the build runs warning-free. -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Label="Reproducibility">
<Deterministic>true</Deterministic>
<!-- A stable path map, so that two builds of the same commit produce the
same assembly regardless of where the repository was cloned. -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Label="Package metadata">
<Authors>GraphDefined GmbH</Authors>
<Company>GraphDefined GmbH</Company>
<Copyright>Copyright (c) 2018-2026 GraphDefined GmbH</Copyright>
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/OpenChargingCloud/ChargyCore.NET</PackageProjectUrl>
<RepositoryUrl>https://github.com/OpenChargingCloud/ChargyCore.NET</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>eichrecht;charge-transparency;e-mobility;ocmf;transparenzsoftware;ev-charging;calibration-law</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<!-- Debug symbols travel with the package: verifying somebody's charging
session is exactly the situation in which a stack trace has to be
readable. -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<!-- Nothing is packable unless it says so. -->
<IsPackable>false</IsPackable>
</PropertyGroup>
<!--
Where this assembly came from, recorded while it is being built.
A launcher that reads git at startup describes the working tree as it is at
startup. This describes the tree the code was actually compiled from, which
is not the same thing: build at one commit, check out another, start without
rebuilding, and a launcher reports the commit that is checked out while the
running code is the one before it. A version in a bug report that looks
right and is wrong costs more than no version at all.
Both values are asked of git rather than written down here, so this file is
byte-identical in every repository that carries it and cannot name the wrong
one - including for a project that reaches it from a repository of its own,
further down, which has no such file yet.
rev-parse rather than describe, for two reasons. describe answers with a tag
once a repository has any, and what is wanted here is a commit. And its
dirty marker only sees tracked files: an SDK project compiles every .cs in
its directory, so a source file that was never added to git is in the build
while describe still calls the tree clean. That is the one case this stamp
exists to catch, so the marker is taken from status instead, which sees it.
The status lines are counted as items and never expanded into a condition.
A file name holding a quote would otherwise take the condition apart, and a
build that breaks over somebody's file name is a poor way to learn that.
Without git - a source archive, a build machine with no client - the Execs
fail, ContinueOnError keeps the build going, and the stamp reads "unknown".
A missing provenance is not a reason to be unable to build.
-->
<Target Name="StampGitProvenance"
BeforeTargets="GetAssemblyAttributes">
<Exec Command="git -C "$(MSBuildProjectDirectory)" rev-parse --show-toplevel"
ConsoleToMSBuild="true"
StandardOutputImportance="low"
StandardErrorImportance="low"
ContinueOnError="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_GitToplevel" />
</Exec>
<Exec Command="git -C "$(MSBuildProjectDirectory)" rev-parse HEAD"
ConsoleToMSBuild="true"
StandardOutputImportance="low"
StandardErrorImportance="low"
ContinueOnError="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_GitHead" />
</Exec>
<Exec Command="git -C "$(MSBuildProjectDirectory)" status --porcelain"
ConsoleToMSBuild="true"
StandardOutputImportance="low"
StandardErrorImportance="low"
ContinueOnError="true">
<Output TaskParameter="ConsoleOutput" ItemName="_GitStatusLine" />
</Exec>
<PropertyGroup>
<_GitChangedFiles>@(_GitStatusLine->Count())</_GitChangedFiles>
<_GitRepository Condition="'$(_GitToplevel)' != ''">$([System.IO.Path]::GetFileName($(_GitToplevel.Trim())))</_GitRepository>
<_GitRepository Condition="'$(_GitRepository)' == ''">unknown</_GitRepository>
<_GitCommit Condition="'$(_GitHead)' != ''">$(_GitHead.Trim())</_GitCommit>
<_GitCommit Condition="'$(_GitCommit)' != '' and '$(_GitChangedFiles)' != '0'">$(_GitCommit)-dirty</_GitCommit>
<_GitCommit Condition="'$(_GitCommit)' == ''">unknown</_GitCommit>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>GitRepository</_Parameter1>
<_Parameter2>$(_GitRepository)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>GitCommit</_Parameter1>
<_Parameter2>$(_GitCommit)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>