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

Commit c3062b5

Browse files
committed
Allow user to define GitHubVS_ClientId envvar
1 parent bc89d8e commit c3062b5

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,35 @@
77

88
<Import Project="$(SolutionDir)\src\common\signing.props" />
99

10-
<ItemGroup Condition="$(Buildtype) == 'Internal'">
11-
<Compile Remove="ApiClientConfiguration_User.cs" />
12-
<Compile Include="..\..\script\src\ApiClientConfiguration_User.cs">
13-
<Link>ApiClientConfiguration_User.cs</Link>
14-
</Compile>
15-
</ItemGroup>
16-
10+
<Target Name="AddClientSecret" BeforeTargets="BeforeCompile" Condition="$(Buildtype) == 'Internal'"
11+
Inputs="$(MSBuildThisFileFullPath)" Outputs="$(IntermediateOutputPath)ApiClientConfiguration_User.cs">
12+
<Error Condition="'$(GitHubVS_ClientId)' == ''" Text="Please define a 'GitHubVS_ClientId' environment variable" />
13+
<Error Condition="'$(GitHubVS_ClientSecret)' == ''" Text="Please define a 'GitHubVS_ClientSecret' environment variable" />
14+
<PropertyGroup>
15+
<GeneratedFilePath>$(IntermediateOutputPath)ApiClientConfiguration_User.cs</GeneratedFilePath>
16+
<GeneratedText>
17+
<![CDATA[
18+
namespace GitHub.Api
19+
{
20+
static partial class ApiClientConfiguration
21+
{
22+
static partial void Configure()
23+
{
24+
ClientId = "$(GitHubVS_ClientId)"%3b
25+
ClientSecret = "$(GitHubVS_ClientSecret)"%3b
26+
}
27+
}
28+
}
29+
]]>
30+
</GeneratedText>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Compile Remove="ApiClientConfiguration_User.cs" />
34+
<Compile Include="$(GeneratedFilePath)" />
35+
</ItemGroup>
36+
<WriteLinesToFile File="$(GeneratedFilePath)" Lines="$(GeneratedText)" WriteOnlyWhenDifferent="true" Overwrite="true" />
37+
</Target>
38+
1739
<ItemGroup>
1840
<Reference Include="System.ComponentModel.Composition" />
1941
<Reference Include="System.Net.Http" />

0 commit comments

Comments
 (0)