Skip to content

Commit

Permalink
Update BuildTimeCodeGenerator to be Nuget Tool (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpollett authored Mar 10, 2020
1 parent 78ab454 commit 5bd7526
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/.vsts-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# DESCRIPTION:
# Builds, tests and packages the solution for the CI build configuration.
trigger:
- master
- master

name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:-r)
variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>Microsoft.Health.Extensions.BuildTimeCodeGenerator</AssemblyName>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

Expand All @@ -14,4 +15,17 @@
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
</ItemGroup>

<!-- Pack settings -->
<PropertyGroup>
<NoPackageAnalysis>true</NoPackageAnalysis>
<NuspecFile>Microsoft.Health.Extensions.BuildTimeCodeGenerator.nuspec</NuspecFile>
<IntermediatePackDir>$(MSBuildProjectDirectory)/bin/$(Configuration)/publish/</IntermediatePackDir>
<PublishDir>$(IntermediatePackDir)$(TargetFramework)/</PublishDir>
<NuspecProperties>publishDir=$([MSBuild]::NormalizeDirectory($(IntermediatePackDir)));version=$(PackageVersion)</NuspecProperties>
</PropertyGroup>

<!-- Executes /t:Publish for all target frameworks before packing-->
<Target Name="PublishAll" BeforeTargets="GenerateNuspec">
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Publish" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.Health.Extensions.BuildTimeCodeGenerator</id>
<version>1.0.0</version>
<authors>Microsoft.Health.Extensions.BuildTimeCodeGenerator</authors>
<owners>Microsoft.Health.Extensions.BuildTimeCodeGenerator</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<repository type="git" url="https://github.com/microsoft/healthcare-components.git" />
</metadata>
<files>
<file src="_._" target="lib/netstandard2.1/" />
<file src="Microsoft.Health.Extensions.BuildTimeCodeGenerator.targets" target="build/netstandard2.1/Microsoft.Health.Extensions.BuildTimeCodeGenerator.targets" />

<file src="Microsoft.Health.Extensions.BuildTimeCodeGenerator.targets" target="tools/" />
<file src="$publishdir$\netcoreapp3.1\**\*" target="tools/netcoreapp3.1/" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<GeneratorProjectPath>$(MSBuildThisFileDirectory)\Microsoft.Health.Extensions.BuildTimeCodeGenerator.csproj</GeneratorProjectPath>
<GeneratorPath>$(MSBuildThisFileDirectory)../../tools/netcoreapp3.1/Microsoft.Health.Extensions.BuildTimeCodeGenerator.dll</GeneratorPath>
</PropertyGroup>

<Target Name="BuildGenerator" BeforeTargets="CollectGenerateFilesInputs">
<MSBuild Projects="$(GeneratorProjectPath)" Targets="Build">
<Output TaskParameter="TargetOutputs" ItemName="GeneratorPath" />
</MSBuild>
</Target>

<Target Name="CollectGenerateFilesInputs" BeforeTargets="GenerateFiles">
<Message Text="hello" />

<ItemGroup>
<GenerateFilesInputs Include="@(GeneratorPath)" />
<GenerateFilesInputs Include="$(MSBuildProjectFile)" />
<GenerateFilesInputs Include="$(MSBuildThisFileFullPath)" />
</ItemGroup>
Expand All @@ -26,6 +19,6 @@
<ItemGroup>
<Compile Include="@(Generated)" Condition="!Exists('@(Generated)')" />
</ItemGroup>
<Exec Command='dotnet "@(GeneratorPath)" --generator-name "%(Generated.Generator)" --output-file "%(Generated.FullPath)" --namespace "%(Generated.Namespace)" "%(Generated.Args)"' />
<Exec Command='dotnet "$(GeneratorPath)" --generator-name "%(Generated.Generator)" --output-file "%(Generated.FullPath)" --namespace "%(Generated.Namespace)" "%(Generated.Args)"' />
</Target>
</Project>
Empty file.

0 comments on commit 5bd7526

Please sign in to comment.