Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Nuget Packages for C# #177

Merged
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2320c5b
wip: building a package metaproject for creating nugets with 'dotnet …
bpkroth Oct 23, 2020
a1ffe38
cake nuget build linux comments
bpkroth Oct 26, 2020
83d7634
wip: switch to just packaging up all of the projects individually and…
bpkroth Oct 28, 2020
0bfcca8
remove nuget.config in favor of the msbuild properties for the same
bpkroth Oct 28, 2020
c6ae0f4
adjust the dotnet makefile rules to support .proj meta projects
bpkroth Oct 28, 2020
c0ee3e0
removing some files
bpkroth Oct 28, 2020
72e6806
rename the project
bpkroth Oct 28, 2020
d28e4c0
comments
bpkroth Oct 28, 2020
9552376
stop trying to provide a clean packages output target
bpkroth Oct 28, 2020
e2deb7b
refactor to support clean as a dotnet target better
bpkroth Oct 28, 2020
3d8b28f
allow packing without a second build
bpkroth Oct 28, 2020
ef6731a
wip: pack the Mlos.Agent.Server as a tool
bpkroth Oct 28, 2020
dc9d66a
wip: comments about GitVersionTask warnings
bpkroth Oct 28, 2020
1aeb68c
wip: comments
bpkroth Oct 28, 2020
033fe25
comments
bpkroth Oct 29, 2020
e5c2916
make sure not to run GitVersionTask for any CoreXT builds
bpkroth Oct 29, 2020
112f811
try to make the GitVersionTask less noisy in its output (only for nor…
bpkroth Oct 29, 2020
dc29c72
Revert "try to make the GitVersionTask less noisy in its output (only…
bpkroth Oct 29, 2020
23c1a15
fix a codegen build ordering/dependency issue
bpkroth Oct 29, 2020
8fe377b
comments
bpkroth Nov 2, 2020
7d966f2
cleanups and reorgs
bpkroth Nov 2, 2020
14e6616
Include Mlos.Core codegen outputs in the Mlos.NetCore package
bpkroth Nov 2, 2020
9ba5d58
don't run or include GitVersionTask in CDPX pipeline
bpkroth Nov 2, 2020
c9b50e5
Include the msbuild rules files in the codegen package output
bpkroth Nov 2, 2020
703e4af
wip: package build files and a project to test it with
bpkroth Nov 5, 2020
6a77540
more wip
bpkroth Nov 5, 2020
f4d4d1c
don't include the grpc.tools as a package dependency - it's just a bu…
bpkroth Nov 6, 2020
efaa4b0
add debug symbols to the nuget package, wip: add dependent dlls
bpkroth Nov 6, 2020
eb788cf
spelling
bpkroth Nov 6, 2020
1832c22
wip: fixups to make the codegen tool in the package executable
bpkroth Nov 6, 2020
2bbad6b
wip: integrated example fixups and attempts to make the dependencies …
bpkroth Nov 6, 2020
9b6becc
wip: fixups to get it to build (yay)
bpkroth Nov 6, 2020
5fbc400
wip: try to add additional package references from inside another pac…
bpkroth Nov 6, 2020
ccb77b6
wip
bpkroth Nov 6, 2020
80f01fe
wip: trying to get dynamic versions working - it doesn't
bpkroth Nov 7, 2020
72e5fc5
wip: add some checks for package version references
bpkroth Nov 8, 2020
31a3d1e
fixups for version and dependency checking
bpkroth Nov 9, 2020
43eca20
fixup the CleanMlosPackages prior to Restore logic
bpkroth Nov 9, 2020
ed1200e
fixups
bpkroth Nov 9, 2020
1bd3725
add (mostly) default stylecop checking for the external example that …
bpkroth Nov 9, 2020
a6c5d6f
reorg
bpkroth Nov 9, 2020
07cc225
reorg
bpkroth Nov 9, 2020
c48b9ab
rewrite Makefile to eliminate MLOS repo dependencies for "external" e…
bpkroth Nov 9, 2020
16ddaae
fixup for windows path length restrictions
bpkroth Nov 11, 2020
cb42d6f
add a README.md
bpkroth Nov 11, 2020
627dff7
fix path
bpkroth Nov 11, 2020
8e900f9
back out some old comments
bpkroth Nov 14, 2020
e630ec6
checkout the whole history so that GitVersionTask can do its thing
bpkroth Nov 14, 2020
a23f079
Merge branch 'main' into codegen-nuget-for-external-project-integration
bpkroth Nov 14, 2020
54d4dc2
Fixup for CI runner scenario
bpkroth Nov 14, 2020
72050f0
build the packages and test restoring them during CI
bpkroth Nov 14, 2020
817bf6d
fix a race condition
bpkroth Nov 16, 2020
b451f92
windows version of msbuild/nuget didn't have PackageName property - j…
bpkroth Nov 16, 2020
7289948
Merge branch 'main' into codegen-nuget-for-external-project-integration
bpkroth Nov 16, 2020
8b425f9
improve basic Makefile
bpkroth Nov 16, 2020
9326961
removing this file for now - will add it back in future cmake PR
bpkroth Nov 16, 2020
63bc311
fix a comment
bpkroth Nov 16, 2020
66f8a65
fix some indents
bpkroth Nov 16, 2020
c542360
update comment
bpkroth Nov 16, 2020
9aa87c4
start to enable pack/test on windows CI
bpkroth Nov 16, 2020
2e45df3
add pack target for top level makefile
bpkroth Nov 16, 2020
d9770b8
finish removing a target
bpkroth Nov 16, 2020
720aa7b
Slight tweaks for non-pipeline builds on the ADO repo
bpkroth Nov 17, 2020
cb883d9
try to work around a gitversion parallel workers issue on build servers
bpkroth Nov 17, 2020
408f83a
Merge branch 'main' into codegen-nuget-for-external-project-integration
bpkroth Nov 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0
bpkroth marked this conversation as resolved.
Show resolved Hide resolved
# Runs multiple commands using the runners shell
- name: Run ${{ matrix.configuration }} msbuild
- name: Msbuild/test ${{ matrix.configuration }}
timeout-minutes: 15
shell: cmd
run: |
set Configuration=${{ matrix.configuration }}
scripts\build.windows.cmd
- name: Pack/test ${{ matrix.configuration }}
timeout-minutes: 15
shell: cmd
run: |
set Configuration=${{ matrix.configuration }}
scripts\package.windows.cmd

# Docker build process overview:
# - We currently use the docker.pkg.github.com package registry as a staging
Expand Down Expand Up @@ -224,6 +232,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# "Fetch" the docker image precached by the "docker-image-cached-build" job that
# we depend on by re-executing (roughly) its same steps.
- name: Set up Docker Buildx
Expand Down Expand Up @@ -279,6 +289,14 @@ jobs:
run: |
docker exec mlos-${{ matrix.configuration }}-build-ubuntu-${{ matrix.UbuntuVersion }} \
make dotnet-test
- name: Run ${{ matrix.configuration }} dotnet pack test
timeout-minutes: 5
shell: bash
run: |
docker exec mlos-${{ matrix.configuration }}-build-ubuntu-${{ matrix.UbuntuVersion }} \
make -C source/Mlos.NetCore.Components.Packages/
docker exec mlos-${{ matrix.configuration }}-build-ubuntu-${{ matrix.UbuntuVersion }} \
dotnet build external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/
- name: Run ${{ matrix.configuration }} cmake build
timeout-minutes: 5
shell: bash
Expand Down
22 changes: 22 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This is the config file for the GitVersionTask tool used in build/versions/Mlos.NetCore.Version.props
# To see the resulting config use the following commands
# dotnet tool install --global gitversion.tool
# dotnet-gitversion /showconfig # should be run from this directory

# We currently merge everything to main and don't yet have release/{major.minor} branches
mode: Mainline
# Note: GitVersionTask will still search the history for v{major.minor.patch} tags to automatically
# increment the .patch portion of the versions it produces and calculate the number of commits since
# branch for the SemVers .{branchName}+{commits} suffix.
# So, to do releases in this way, from time to time we need to decide that certain commits should be
# tagged with a new v{major.minor.0} version.
bpkroth marked this conversation as resolved.
Show resolved Hide resolved
increment: Patch
branches:
master:
# Remove the "master" branch name from consideration.
bpkroth marked this conversation as resolved.
Show resolved Hide resolved
# Also allow matching the "main" branch from "origin" remote on CI pipelines with shallow fetches.
regex: ^((origin|upstream|github)/)?main$
# Mark any packages produced directly from main as "prerelease" for now.
tag: beta
# We don't currently have develop or release/{vers} branches to look for.
source-branches: []
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ check: all test
install: dotnet-install cmake-install
@ echo "make install target finished."

.PHONY: pack
pack:
$(MAKE) -C source/Mlos.NetCore.Components.Packages

.PHONY: clean
clean: cmake-clean dotnet-clean grpc-clean mlos-codegen-clean website-clean python-clean

.PHONY: distclean
distclean: clean cmake-distclean
distclean: clean dotnet-distclean dotnet-pkgs-clean cmake-distclean

.PHONY: rebuild
rebuild: clean all
Expand Down
2 changes: 1 addition & 1 deletion build/Common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ifeq ($(filter $(CONFIGURATION),$(SupportedConfigurations)),)
endif

# Variables tracking additional targets to be added to by later Makefile wrappers.
handledtargets = all test check install clean distclean rebuild ctags
handledtargets = all test check install pack clean distclean rebuild ctags

# Mark this file as imported.
MlosCommonMkImported := true
6 changes: 5 additions & 1 deletion build/DotnetWrapper.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ install: dotnet-install
clean: dotnet-clean

.PHONY: distclean
distclean: clean
distclean: dotnet-distclean

.PHONY: pack
pack: dotnet-pack
@ echo "make pack target finished."

.PHONY: test
test: dotnet-test
Expand Down
65 changes: 55 additions & 10 deletions build/DotnetWrapperRules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ endif
# Needed for "clean" target.
# See Also: Mlos.Common.props
DotnetBaseOutDir := $(MLOS_ROOT)/out/dotnet
DotnetBasePkgDir := $(MLOS_ROOT)/target/pkg/$(CONFIGURATION)
DotnetOutputPath := $(DotnetBaseOutDir)/$(RelativeSourceDir)

# Find all the *.csproj, dirs.proj files in this directory and make some
# corresponding fake targets for the "all" target to depend on.
Csprojs := $(wildcard *.csproj)
CsprojBuildTargets := $(Csprojs:.csproj=.csproj.fake-build-target)
CsprojBuildQuickTargets := $(Csprojs:.csproj=.csproj.fake-build-quick-target)
CsprojPackTargets := $(Csprojs:.csproj=.csproj.fake-pack-target)
CsprojTestTargets := $(Csprojs:.csproj=.csproj.fake-test-target)
DirsProj := $(wildcard dirs.proj)
CsprojCleanTargets := $(Csprojs:.csproj=.csproj.fake-clean-target)
CsprojCleanQuickTargets := $(Csprojs:.csproj=.csproj.fake-clean-quick-target)
# Actually, include other *.proj files as well.
DirsProj := $(wildcard *.proj)
DirsProjBuildTarget := $(DirsProj:.proj=.proj.fake-build-target)
DirsProjPackTarget := $(DirsProj:.proj=.proj.fake-pack-target)
DirsProjTestTarget := $(DirsProj:.proj=.proj.fake-test-target)
DirsProjCleanTarget := $(DirsProj:.proj=.proj.fake-clean-target)

# Increase log verbosity slightly.
#MSBUILD_ARGS := -v:normal

# To be added to the including Makefile's all target.
.PHONY: dotnet-build
Expand All @@ -40,10 +50,22 @@ dotnet-build: $(CsprojBuildTargets) $(DirsProjBuildTarget)
dotnet-build-quick: $(CsprojBuildQuickTargets)
@ echo "make dotnet-build-quick target finished."

.PHONY: dotnet-pack
dotnet-pack: $(CsprojPackTargets) $(DirsProjPackTarget)
@ echo "make dotnet-pack target finished."

.PHONY: dotnet-test
dotnet-test: $(CsprojTestTargets) $(DirsProjTestTarget)
@ echo "make dotnet-test target finished."

.PHONY: dotnet-clean
dotnet-clean: $(CsprojCleanTargets) $(DirsProjCleanTarget)
@ echo "make dotnet-clean target finished."

.PHONY: dotnet-clean-quick
dotnet-clean-quick: $(CsprojCleanQuickTargets)
@ echo "make dotnet-clean-quick target finished."

.PHONY: dotnet-install
dotnet-install:
@ echo "make dotnet-install is currently a no-op."
Expand All @@ -56,11 +78,17 @@ dotnet-install:
@ # Note: This command currently also does a "dotnet restore" first,
@ # which can be slow, however is difficult to check when it is unnecessary.
@ # Note: -m tells it to build in parallel.
@ $(DOTNET) build -m --configuration $(CONFIGURATION) $(@:.fake-build-target=)
@ $(DOTNET) build $(MSBUILD_ARGS) -m --configuration $(CONFIGURATION) $(@:.fake-build-target=)

%.fake-build-quick-target:
@ # A target to allow quickly rebuilding just a given project and none of its dependencies.
@ $(DOTNET) build -m --configuration $(CONFIGURATION) --no-restore /p:BuildProjectReferences=false $(@:.fake-build-quick-target=)
@ $(DOTNET) build $(MSBUILD_ARGS) -m --configuration $(CONFIGURATION) --no-restore /p:BuildProjectReferences=false $(@:.fake-build-quick-target=)

# For each of the fake test targets, just call "dotnet pack" on its
# corresponding *.csproj file
# For now, don't force a rebuild first.
%.fake-pack-target: #%.fake-build-target
@ $(DOTNET) pack $(MSBUILD_ARGS) --no-build -m --configuration $(CONFIGURATION) $(@:.fake-pack-target=)

# By default don't run certain tests.
# To override, run with:
Expand All @@ -74,14 +102,31 @@ endif
# corresponding *.csproj file
# For now, don't force a rebuild first.
%.fake-test-target: #%.fake-build-target
$(DOTNET) test --no-build -m --configuration $(CONFIGURATION) $(DOTNET_TEST_FILTER) $(@:.fake-test-target=)
$(DOTNET) test $(MSBUILD_ARGS) --no-build -m --configuration $(CONFIGURATION) $(DOTNET_TEST_FILTER) $(@:.fake-test-target=)

%.fake-clean-target:
$(DOTNET) build $(MSBUILD_ARGS) /t:clean --no-restore -m --configuration $(CONFIGURATION) $(@:.fake-clean-target=)

%.fake-clean-quick-target:
$(DOTNET) build $(MSBUILD_ARGS) /t:clean /p:BuildProjectReferences=false --no-restore -m --configuration $(CONFIGURATION) $(@:.fake-clean-quick-target=)

# Note: this clean method somewhat lazily removes both Debug and Release build outputs.
# To be added to the including Makefile's clean target.
.PHONY: dotnet-clean
dotnet-clean:
@ $(RM) $(DotnetOutputPath)
.PHONY: dotnet-distclean
dotnet-distclean:
$(RM) $(DotnetOutputPath)
@ $(MKDIR) $(DotnetOutputPath)

.PHONY: dotnet-pkgs-clean
dotnet-pkgs-clean:
$(RM) $(DotnetBasePkgDir)
@ $(MKDIR) $(DotnetBasePkgDir)

handledtargets += $(Csprojs) $(CsProjBuildTargets) $(CsProjTestTargets) \
$(DirsProj) $(DirsProjBuildTarget) $(DirsProjTestTarget) \
dotnet-build dotnet-build-quick dotnet-install dotnet-test dotnet-clean
handledtargets += $(Csprojs) $(DirsProj) \
dotnet-build $(CsprojBuildTargets) $(DirsProjBuildTarget) \
dotnet-build-quick $(CsprojBuildQuickTargets) \
dotnet-pack $(CsprojPackTargets) $(DirsProjPackTarget) \
dotnet-test $(CsprojTestTargets) $(DirsProjTestTarget) \
dotnet-clean $(CsprojCleanTargets) $(DirsProjCleanTarget) \
dotnet-clean-quick $(CsprojCleanQuickTargets) \
dotnet-install dotnet-pkgs-clean dotnet-distclean
6 changes: 6 additions & 0 deletions build/Mlos.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<PropertyGroup>
<MlosCodeGenOutputPathRoot Condition="'$(MlosCodeGenOutputPathRoot)' == ''">$(BaseDir)\out\Mlos.CodeGen.out\$(BuildType)</MlosCodeGenOutputPathRoot>
</PropertyGroup>
<!-- Convenience properties to detect when we're in certain build environments. -->
<PropertyGroup>
<!-- https://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/325/Versioning -->
<CdpxBuildPipeline Condition="'$(CDP_COMMIT_ID)' != '' Or '$(CDP_BUILD_NUMBER)' != ''">true</CdpxBuildPipeline>
<HasAdoPipeline Condition="Exists('$(BaseDir)\.pipelines\pipeline.user.windows.yml')">true</HasAdoPipeline>
</PropertyGroup>
<!-- Configure warning levels and errors. -->
<PropertyGroup>
<WarningLevel>4</WarningLevel>
Expand Down
21 changes: 21 additions & 0 deletions build/Mlos.MetaProj.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Some targets for basic .proj files to include for test and package proj files to build their dependencies properly. -->
<Target Name="Build" BeforeTargets="Test">
<MSBuild Projects="@(ProjectReference)" Targets="Build" RunEachTargetSeparately="true"
Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Target Name="Clean">
<MSBuild Projects="@(ProjectReference)" Targets="Clean" RunEachTargetSeparately="true"
Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Target Name="Restore">
<MSBuild Projects="@(ProjectReference)" Targets="Restore" RunEachTargetSeparately="true"
Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Target Name="VerifyAlteredTargetsUsed">
<MSBuild Projects="@(ProjectReference)" Targets="VerifyAlteredTargetsUsed" RunEachTargetSeparately="true"
Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Import Project="$(BaseDir)\build\Mlos.Common.targets" />
</Project>
bpkroth marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion build/Mlos.NetCore.Grpc.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<PackageReference Include="Grpc.AspNetCore" Version="$(GrpcVersion)" Condition="'$(GrpcServices)' == 'Server' Or '$(GrpcServices)' == 'Both'" />
<PackageReference Include="Grpc.Core" Version="$(GrpcVersion)" />
<PackageReference Include="Grpc.Net.Client" Version="$(GrpcVersion)" Condition="'$(GrpcServices)' == 'Client' OR '$(GrpcServices)' == 'Both'" />
<PackageReference Include="Grpc.Tools" Version="$(GrpcVersion)" />
<PackageReference Include="Grpc.Tools" Version="$(GrpcVersion)">
<!-- Grpc.Tools is a build time dependency only - don't include it in any nugets we create. -->
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
42 changes: 42 additions & 0 deletions build/Mlos.NetCore.Package.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file effectively takes the place of a number of .nuspec declarations
so that we can build directly with .csproj files using "dotnet pack".
-->
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Set some .nuspec style properties
Note: The Copyright property also comes from the Mlos.NetCore.Version.props file.
-->
<PropertyGroup>
<PackageProjectUrl>https://github.com/Microsoft/MLOS</PackageProjectUrl>
<RepositoryUrl>https://github.com/Microsoft/MLOS.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Authors>Microsoft</Authors>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>MLOS;Machine Learning;Optimization;Systems</PackageTags>
</PropertyGroup>

<!-- Unless specified on the commandline, set the default package output to the target/ dir. -->
<PropertyGroup>
<MlosPkgOutputBaseDir>$(BaseDir)/target/pkg</MlosPkgOutputBaseDir>
<MlosPkgOutputDir>$(MlosPkgOutputBaseDir)/$(Configuration)</MlosPkgOutputDir>
<PackageOutputPath>$(MlosPkgOutputDir)/</PackageOutputPath>
</PropertyGroup>

<!-- Also create a .snupkg along side the package for eventual publishing of symbols to nuget.org -->
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<!--
When this property is omitted a separate .symbols.nupkg file is created
that includes both the .dll and .pdb.
-->
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<!-- Include the .pdb symbols file in the standard package to make debugging easier. -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions build/Mlos.NetCore.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<Optimize>true</Optimize>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(BaseDir)/build/Mlos.NetCore.Package.props" />
<ItemGroup>
<None Remove="Makefile" />
<None Remove="CMakeLists.txt" />
Expand Down
11 changes: 9 additions & 2 deletions build/Mlos.SettingsSystem.CodeGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_callbacks.h" />
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_dispatch.h" />
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_base.h" />
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_python.h" />
bpkroth marked this conversation as resolved.
Show resolved Hide resolved
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_base.cs" />
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_deserialize.cs" />
<MlosCodeGenOutput Include="$(SettingsSystemCodeGenAbsoluteOutputPath)\$(SettingsSystemCodeGenOutputBasename)_dispatch.cs" />
Expand All @@ -49,7 +48,15 @@
so that they always run and the CodeGen process itself avoids overwriting files if their output hasn't changed.
-->
<!-- Codegen using internal compiler -->
<Target Name="SettingsSystemRegistryDefCodeGen" AfterTargets="AfterResolveReferences" Outputs="@(MlosCodeGenOutput)" Condition="'@(SettingsRegistryDef->Count())' != 0">
<!--
Make sure that codegen is run whenever compile is.
Note: We don't use AfterTargets="AfterResolveReferences" since Pack targets also use it Restore dependencies,
but Pack may not actually need to re-build.
-->
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);SettingsSystemRegistryDefCodeGen</BuildDependsOn>
</PropertyGroup>
<Target Name="SettingsSystemRegistryDefCodeGen" BeforeTargets="BeforeCompile;_GenerateCompileInputs" Outputs="@(MlosCodeGenOutput)" Condition="'@(SettingsRegistryDef->Count())' != 0">
bpkroth marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<SettingsSystemCodeGenInputArgs>@(SettingsRegistryDef -> '--input-cs=&quot;%(FullPath)&quot;', ' ')</SettingsSystemCodeGenInputArgs>
</PropertyGroup>
Expand Down
14 changes: 1 addition & 13 deletions build/Mlos.TestRun.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,5 @@
<!-- Include binplace properties. -->
<Import Project="$(BaseDir)\build\Mlos.Binplace.props" />
<!-- A basic .proj file to include for test proj files to run properly. -->
<Target Name="Build" BeforeTargets="Test">
<MSBuild Projects="@(ProjectReference)" Targets="Build" RunEachTargetSeparately="true" Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Target Name="Clean">
<MSBuild Projects="@(ProjectReference)" Targets="Clean" RunEachTargetSeparately="true" Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Target Name="Restore">
<MSBuild Projects="@(ProjectReference)" Targets="Restore" RunEachTargetSeparately="true" Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Target Name="VerifyAlteredTargetsUsed">
<MSBuild Projects="@(ProjectReference)" Targets="VerifyAlteredTargetsUsed" RunEachTargetSeparately="true" Condition="'$(QBUILD)' != '1' And '$(BuildProjectReferences)' != 'false'" />
</Target>
<Import Project="$(BaseDir)\build\Mlos.Common.targets" />
<Import Project="$(BaseDir)\build\Mlos.MetaProj.targets" />
</Project>
32 changes: 32 additions & 0 deletions build/versions/Mlos.NetCore.Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,36 @@
<Link>Properties\PipelineAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>

<!-- If we're not using the pipeline version, then use the git version by default. -->
<PropertyGroup>
<PackageUsesGitVersionInfo Condition="'$(UsePipelineVersion)' == 'true'">false</PackageUsesGitVersionInfo>
<PackageUsesGitVersionInfo Condition="'$(PackageUsesGitVersionInfo)' == '' And '$(BUILD_COREXT)' != '1' And '$(CdpxBuildPipeline)' != 'true' And '$(HasAdoPipeline)' != 'true'">true</PackageUsesGitVersionInfo>
<PackageUsesGitVersionInfo Condition="'$(PackageUsesGitVersionInfo)' != 'true'">false</PackageUsesGitVersionInfo>
</PropertyGroup>
<!--
When packaging, we need to be able to reference consistent and unique versions.
The easiest way to do that is to let GitVersionTask update them in the assemblies for us.
Note: We only do this when not using the pipeline version.
-->
<PropertyGroup>
<DisableGitVersionTask>true</DisableGitVersionTask>
<DisableGitVersionTask Condition="'$(PackageUsesGitVersionInfo)' == 'true'">false</DisableGitVersionTask>
<GitVersion_NoFetchEnabled>true</GitVersion_NoFetchEnabled>
<WriteVersionInfoToBuildLog>false</WriteVersionInfoToBuildLog>
<!--
<GetVersion>$(PackageUsesGitVersionInfo)</GetVersion>
<UpdateAssemblyInfo>$(PackageUsesGitVersionInfo)</UpdateAssemblyInfo>
<UpdateVersionProperties>$(PackageUsesGitVersionInfo)</UpdateVersionProperties>
<UseFullSemVerForNuGet>$(PackageUsesGitVersionInfo)</UseFullSemVerForNuGet>
<GenerateGitVersionInformation>$(PackageUsesGitVersionInfo)</GenerateGitVersionInformation>
-->
</PropertyGroup>
<!-- Add a build tool for discovering version info from the repository. -->
<ItemGroup Condition="'$(PackageUsesGitVersionInfo)' == 'true' And '$(DisableGitVersionTask)' != 'true'">
<PackageReference Include="GitVersionTask" Version="5.5.0">
<!-- Don't include its assets in any build output or dependency references. -->
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
Loading