-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathSystem.Runtime.TimeZoneData.csproj
More file actions
68 lines (60 loc) · 3.08 KB
/
System.Runtime.TimeZoneData.csproj
File metadata and controls
68 lines (60 loc) · 3.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
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TimeZoneDataVersion>2026a</TimeZoneDataVersion>
<TimeZoneDataIntermediateDir>$([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)', 'timezonedata'))</TimeZoneDataIntermediateDir>
<TimeZoneDataSrcDir>$([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', 'data'))</TimeZoneDataSrcDir>
<ZicBloat>slim</ZicBloat>
</PropertyGroup>
<ItemGroup>
<Area Include="africa" />
<Area Include="antarctica" />
<Area Include="asia" />
<Area Include="australasia" />
<Area Include="etcetera" />
<Area Include="europe" />
<Area Include="northamerica" />
<Area Include="southamerica" />
<Area Include="backward" />
</ItemGroup>
<Target Name="SetLatestVersion" DependsOnTargets="GetLatestVersion">
<PropertyGroup>
<TimeZoneDataVersion>$(LatestTimeZoneDataVersion)</TimeZoneDataVersion>
<_TZPropName>TimeZoneDataVersion</_TZPropName>
</PropertyGroup>
<WriteLinesToFile
File="$(MSBuildProjectFile)"
Lines="$([System.Text.RegularExpressions.Regex]::Replace($([System.IO.File]::ReadAllText('$(MSBuildProjectFile)')), '<$(_TZPropName)>[^$]*</$(_TZPropName)>','<$(_TZPropName)>$(TimeZoneDataVersion)</$(_TZPropName)>'))"
Overwrite="true"/>
</Target>
<Target Name="GetLatestVersion" BeforeTargets="PrepareForBuild">
<DownloadFile SourceUrl="https://data.iana.org/time-zones/tzdb/version"
DestinationFolder="$(TimeZoneDataIntermediateDir)">
<Output TaskParameter="DownloadedFile" ItemName="VersionFile" />
</DownloadFile>
<ReadLinesFromFile File="@(VersionFile)">
<Output TaskParameter="Lines" ItemName="VersionLines" />
</ReadLinesFromFile>
<ItemGroup>
<FileWrites Include="@(VersionFile)" />
</ItemGroup>
<PropertyGroup>
<LatestTimeZoneDataVersion>@(VersionLines)</LatestTimeZoneDataVersion>
</PropertyGroup>
</Target>
<Target Name="UpdateData">
<RemoveDir Directories="$(TimeZoneDataSrcDir)" />
<Exec Command="wget -r -nH --cut-dirs=2 --no-parent --reject='index.html*' -P $(TimeZoneDataIntermediateDir) https://data.iana.org/time-zones/tzdb-$(TimeZoneDataVersion)/" />
<Exec Command="touch README" WorkingDirectory="$(TimeZoneDataIntermediateDir)"/>
<DownloadFile SourceUrl="https://data.iana.org/time-zones/tzdb-$(TimeZoneDataVersion)/zone1970.tab"
DestinationFolder="$(TimeZoneDataSrcDir)"
DestinationFileName="zone.tab" />
</Target>
<Target Name="CompileZic" DependsOnTargets="UpdateData">
<Exec Command="make zic" WorkingDirectory="$(TimeZoneDataIntermediateDir)"/>
</Target>
<Target Name="CompileTimeZoneData" DependsOnTargets="CompileZic">
<Exec Command="./zic -d $(TimeZoneDataSrcDir) -b $(ZicBloat) %(Area.Identity)" WorkingDirectory="$(TimeZoneDataIntermediateDir)"/>
<Exec Command="find . ! -name zone.tab -maxdepth 1 -type f -exec rm -f {} +" WorkingDirectory="$(TimeZoneDataSrcDir)"/>
</Target>
<Target Name="UpdateToLatestVersion" DependsOnTargets="SetLatestVersion;CompileTimeZoneData"/>
</Project>