Skip to content

Commit b7ad3e0

Browse files
committed
First attempt at a pack target
1 parent ac46086 commit b7ad3e0

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

build2.proj

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
<!-- dotnet binary in the PATH variable. The provided path should end with a `\` (or -->
1313
<!-- `/`) character. Eg. C:\x86\ -->
1414
<DotnetPath Condition="'$(DotnetPath)' == ''" />
15+
16+
<!-- NugetPath: Path to folder containing `nuget` binary. Override this if a specific -->
17+
<!-- version is required. Othrwise, this defaults to the `nuget` binary in the PATH -->
18+
<!-- variable. The provided path should end with a `\` (or `/` character. Eg, -->
19+
<!-- `C:\x86\`. In majority of cases, this is not necessary. -->
20+
<!-- This argument is only used in Pack* targets -->
21+
<NugetPath Condition="'$(NugetPath)' == ''" />
1522
</PropertyGroup>
1623

1724
<!-- Imports ======================================================= -->
@@ -20,7 +27,8 @@
2027
<!-- =============================================================== -->
2128
<!-- Microsoft.Data.SqlClient Build Targets -->
2229
<PropertyGroup>
23-
<MdsProjectPath>$(RepoRoot)src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj</MdsProjectPath>
30+
<MdsNuspecPath>$(RepoRoot)tools/specs/Microsoft.Data.SqlClient.nuspec</MdsNuspecPath>
31+
<MdsProjectPath>$(RepoRoot)src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj</MdsProjectPath>
2432
</PropertyGroup>
2533

2634
<!-- BuildMds: Builds all binaries for MDS -->
@@ -58,7 +66,30 @@
5866

5967
<!-- PackMds: Packages MDS binaries into a NuGet package -->
6068
<Target Name="PackMds">
61-
<!-- @TODO -->
69+
<PropertyGroup>
70+
<GitCommand>
71+
git rev-parse HEAD
72+
</GitCommand>
73+
</PropertyGroup>
74+
<Message Text=">>> Fetching git commit hash via command: $(GitCommand)" />
75+
<Exec Command="$(GitCommand)" ConsoleToMsBuild="true">
76+
<Output TaskParameter="ConsoleOutput" PropertyName="CommitHash" />
77+
</Exec>
78+
79+
<PropertyGroup>
80+
<NugetCommand>
81+
$(NugetPath)nuget pack $(MdsNuspecPath)
82+
-OutputDirectory $ @TODO:
83+
-Version $(MdsPackageVersion)
84+
-Properties &quot;COMMITID=$(CommitHash);Configuration=$(Configuration);&quot;
85+
-Symbols
86+
-SymbolPackageFormat snupkg
87+
</NugetCommand>
88+
<!-- Convert more than one whitespace character into one space -->
89+
<DotnetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " "))</DotnetCommand>
90+
</PropertyGroup>
91+
<Message Text=">>> Packageing MDS via command: $(NugetCommand)" />
92+
<Exec ConsoleToMsBuild="true" Command="$(NugetCommand)" />
6293
</Target>
6394

6495
<!-- TestMds: Runs all test projects for MDS -->

0 commit comments

Comments
 (0)