forked from lmm713281/etlbox
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDirectory.Build.targets
60 lines (54 loc) · 3.3 KB
/
Directory.Build.targets
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
<Project>
<PropertyGroup>
<PackageVersion>$(Version)</PackageVersion>
<Copyright>© 2018 Andreas Lennartz, © 2021-2024 RapidSoft</Copyright>
<PackageAuthors>RapidSoft</PackageAuthors>
<PackageOwners>RapidSoft</PackageOwners>
<PackageProjectUrl>https://rapidsoft.ru/</PackageProjectUrl>
<RepositoryUrl>https://github.com/rpsft/etlbox.git</RepositoryUrl>
<PackageCopyright>$(Copyright)</PackageCopyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<IsCI Condition="'$(CI_JOB_ID)'!=''">true</IsCI>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" PackagePath="/" Visible="false"/>
</ItemGroup>
<PropertyGroup>
<BuildDependsOn>
InstallHusky;
$(BuildDependsOn)
</BuildDependsOn>
</PropertyGroup>
<Target Name="InstallHusky" Condition="!Exists('$(MSBuildThisFileDirectory).husky/_/husky.sh') And '$(IsCI)'!='true'">
<Message Importance="high" Text="Installing Husky into $(MSBuildThisFileDirectory).husky/_/husky.sh"/>
<Exec Command="dotnet tool restore" WorkingDirectory="$(MSBuildThisFileDirectory)" StandardOutputImportance="High" StandardErrorImportance="High"/>
<Exec Command="dotnet husky install" WorkingDirectory="$(MSBuildThisFileDirectory)" StandardOutputImportance="High" StandardErrorImportance="High"/>
</Target>
<Target Name="ParseVersionFile">
<PropertyGroup Condition="$([System.IO.File]::Exists('$(MSBuildThisFileDirectory).version.yml')) And '$(Version)' == '1.0.0' ">
<VersionYmlText>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory).version.yml'))</VersionYmlText>
<VersionPrefix>$([System.Text.RegularExpressions.Regex]::Match($(VersionYmlText), 'PACKAGE_RELEASE:\s*([^\s]+)').Groups[1].Value)</VersionPrefix>
<VersionSuffix>$([System.Text.RegularExpressions.Regex]::Match($(VersionYmlText), 'PACKAGE_POSTFIX:[\s\-]*([^\s\-][^\s]*)').Groups[1].Value)</VersionSuffix>
<DefaultPackageDescription>$([System.Text.RegularExpressions.Regex]::Match($(VersionYmlText), 'PACKAGE_DESCRIPTION:\s*([^\s].*)').Groups[1].Value)</DefaultPackageDescription>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>
<PackageVersion>$(Version)</PackageVersion>
</PropertyGroup>
<Message Condition=" '$(Version)' == '1.0.0' "
Text="Not found version in .version.yml, using default version $(Version)" Importance="high"/>
<PropertyGroup Condition=" '$(Version)' == '1.0.0' ">
<VersionSuffix>development</VersionSuffix>
<VersionPrefix>$(DefaultVersionPrefix)</VersionPrefix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(PackageDescription)' == 'Package Description' ">
<PackageDescription>$(DefaultPackageDescription)</PackageDescription>
</PropertyGroup>
<Message Text="Building project $(MSBuildProjectName) version: $(PackageVersion) - $(PackageDescription)" Importance="high"/>
</Target>
</Project>