From 2320c5b7b17278bf921c7826dd7c8be7f491589f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 23 Oct 2020 18:07:28 -0500 Subject: [PATCH 01/62] wip: building a package metaproject for creating nugets with 'dotnet pack' --- GitVersion.yml | 8 ++ build/Mlos.NetCore.Package.props | 109 +++++++++++++++++ build/Mlos.NetCore.props | 2 +- build/versions/Mlos.NetCore.Version.props | 3 + .../Mlos.NetCore.Components.Package/Makefile | 3 + .../Mlos.NetCore.Components.Package.csproj | 111 ++++++++++++++++++ .../build/Mlos.NetCore.Components.targets | 4 + .../build/Mlos.SettingsSystem.CodeGen.targets | 6 + 8 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 GitVersion.yml create mode 100644 build/Mlos.NetCore.Package.props create mode 100644 source/Mlos.NetCore.Components.Package/Makefile create mode 100644 source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj create mode 100644 source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets create mode 100644 source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000000..d40a37e247 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,8 @@ +# config for the GitVersionTask tool used in build/Mlos.NetCore.Package.props +mode: Mainline +branches: + master: + # Remove the "master" branch name from consideration. + regex: ^main$ + increment: Patch + tag: '' diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props new file mode 100644 index 0000000000..c7511ff6d9 --- /dev/null +++ b/build/Mlos.NetCore.Package.props @@ -0,0 +1,109 @@ + + + + + + + + + true + + + + + + + All + + + + + true + false + false + false + false + + + + $(GenerateNuspecDependsOn);SetupPackageVersionInfo + + + + $(GitVersion_BranchName) + $(GitVersion_Sha) + + + + + $(GitVersion_Sha.Substring(0, 7)) + + + -alpha.$(GitVersion_CommitsSinceVersionSource) + $(GitVersion_MajorMinorPatch) + $(PackageVersionPrefix)$(PackageVersionSuffix) + + + + + + + https://github.com/Microsoft/MLOS + https://github.com/Microsoft/MLOS.git + git + Microsoft + false + MIT + + + $(BaseDir)/target/pkg/$(Configuration)/ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/Mlos.NetCore.props b/build/Mlos.NetCore.props index db2e3ba374..fa4f0cf165 100644 --- a/build/Mlos.NetCore.props +++ b/build/Mlos.NetCore.props @@ -1,7 +1,7 @@ - + diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index 174dab597f..91a4b8f89e 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -15,4 +15,7 @@ Properties\PipelineAssemblyInfo.cs + + true + diff --git a/source/Mlos.NetCore.Components.Package/Makefile b/source/Mlos.NetCore.Components.Package/Makefile new file mode 100644 index 0000000000..1c80e81d9e --- /dev/null +++ b/source/Mlos.NetCore.Components.Package/Makefile @@ -0,0 +1,3 @@ +RelativePathToProjectRoot := ../.. +include $(RelativePathToProjectRoot)/build/DotnetWrapper.mk +#include $(RelativePathToProjectRoot)/build/CMakeWrapper.mk diff --git a/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj b/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj new file mode 100644 index 0000000000..17466093f3 --- /dev/null +++ b/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj @@ -0,0 +1,111 @@ + + + + + {9D762D20-BCB8-417E-84A7-127B3C7852AF} + Library + + + + + + + Mlos.NetCore.Components + + A NuGet package for a collection of .Net Core tools and libraries from MLOS. + Provides: + - The code generation tool, attributes, and build targets for allowing external projects to create their own + SettingsRegistry assemblies. + - The Mlos.NetCore and related libraries. + - The Mlos.Agent.Server for basic end-to-end component testing/tuning. + + $(NoWarn);NU5128 + + + true + + false + + + true + + + + + + + + + + + + + + + + + + + + true + build/$(TargetFramework)/ + + + + + $(GenerateNuspecDependsOn);CollectMlosNetCorePackageFiles + + + + + + + + + + + + + + + + true + lib/$(TargetFramework)/ + + + + + true + tools/$(TargetFramework)/@(ToolsContent->'%(FileName)') + + + + + + + + + + + diff --git a/source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets b/source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets new file mode 100644 index 0000000000..bd81264097 --- /dev/null +++ b/source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets @@ -0,0 +1,4 @@ + + + + diff --git a/source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets new file mode 100644 index 0000000000..fb4982ddfa --- /dev/null +++ b/source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets @@ -0,0 +1,6 @@ + + + + + + From a1ffe382e84b6c86f0ebf857ded5dccc78e18161 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 26 Oct 2020 13:01:26 -0500 Subject: [PATCH 02/62] cake nuget build linux comments --- build.cake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.cake b/build.cake index a1d9d68eeb..89e45f17b0 100644 --- a/build.cake +++ b/build.cake @@ -366,7 +366,12 @@ private IEnumerable CollectFilesAsNugetContent(string inputDirPat } } +// Note: this target currently fails on Linux due to lack of nuspec support by dotnet. +// Fixing this would require a mono install as well, which is a bit excessive. +// Task("Create-Nuget-Package") + .IsDependentOn("Build-NetCore") + .IsDependentOn("Binplace-CMake") .Does(()=> { var sourcePath = new DirectoryPath("./source/Mlos.Core"); @@ -394,7 +399,7 @@ Task("Create-Nuget-Package") string assemblyPath = mlosNetCoreSpec.Source; var asmVersion = FileVersionInfo.GetVersionInfo(assemblyPath); - // Create nuget package in Taget directory. + // Create nuget package in Target directory. // NuGetPack("./nuspec/Mlos.nuspec", new NuGetPackSettings @@ -514,9 +519,6 @@ Task("Default") .IsDependentOn("Test-CMake") .IsDependentOn("Generate-MlosModelServices-Dockerfile"); -// .IsDependentOn("Create-Nuget-Package") -// .IsDependentOn("Test-Docker-E2E"); - // // EXECUTION // From 83d763491ac587268c2a99961a89356443f1c0a8 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Tue, 27 Oct 2020 19:54:44 -0500 Subject: [PATCH 03/62] wip: switch to just packaging up all of the projects individually and accepting whatever GitVersionTask gives us --- GitVersion.yml | 8 +- Makefile | 2 +- NuGet.Config | 13 ++ build/DotnetWrapperRules.mk | 8 +- build/Mlos.Common.props | 5 + build/Mlos.Common.targets | 4 + build/Mlos.MetaProj.targets | 17 ++ build/Mlos.NetCore.Package.props | 152 ++++++++---------- build/Mlos.NetCore.props | 17 +- build/Mlos.NetCore.targets | 4 + build/Mlos.TestRun.targets | 14 +- build/versions/Mlos.NetCore.Version.props | 30 +++- .../Mlos.NetCore.Components.Package.csproj | 104 ++---------- .../Mlos.SettingsSystem.CodeGen.csproj | 20 +++ .../build/Mlos.SettingsSystem.CodeGen.props | 1 + .../build/Mlos.SettingsSystem.CodeGen.targets | 1 + 16 files changed, 202 insertions(+), 198 deletions(-) create mode 100644 NuGet.Config create mode 100644 build/Mlos.MetaProj.targets create mode 100644 source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props create mode 100644 source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets diff --git a/GitVersion.yml b/GitVersion.yml index d40a37e247..9185b717e3 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,8 +1,10 @@ -# config for the GitVersionTask tool used in build/Mlos.NetCore.Package.props +# config for the GitVersionTask tool used in build/versions/Mlos.NetCore.Version.props mode: Mainline branches: master: # Remove the "master" branch name from consideration. regex: ^main$ - increment: Patch - tag: '' + #increment: Patch + tag: beta +# feature: +# tag: alpha diff --git a/Makefile b/Makefile index f009a92130..f9fc232b30 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ install: dotnet-install cmake-install clean: cmake-clean dotnet-clean grpc-clean mlos-codegen-clean website-clean python-clean .PHONY: distclean -distclean: clean cmake-distclean +distclean: clean cmake-distclean nuget-clean .PHONY: rebuild rebuild: clean all diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000000..b29fbe990f --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/build/DotnetWrapperRules.mk b/build/DotnetWrapperRules.mk index a1ae95ac19..d54bdc6fbe 100644 --- a/build/DotnetWrapperRules.mk +++ b/build/DotnetWrapperRules.mk @@ -18,6 +18,7 @@ endif # See Also: Mlos.Common.props DotnetBaseOutDir := $(MLOS_ROOT)/out/dotnet DotnetOutputPath := $(DotnetBaseOutDir)/$(RelativeSourceDir) +NugetPackagesDir := $(MLOS_ROOT)/tools/.nuget/packages # Find all the *.csproj, dirs.proj files in this directory and make some # corresponding fake targets for the "all" target to depend on. @@ -82,6 +83,11 @@ endif dotnet-clean: @ $(RM) $(DotnetOutputPath) +nuget-clean: + @ $(RM) $(NugetPackagesDir) + @ $(MKDIR) $(NugetPackagesDir) + handledtargets += $(Csprojs) $(CsProjBuildTargets) $(CsProjTestTargets) \ $(DirsProj) $(DirsProjBuildTarget) $(DirsProjTestTarget) \ - dotnet-build dotnet-build-quick dotnet-install dotnet-test dotnet-clean + dotnet-build dotnet-build-quick dotnet-install dotnet-test dotnet-clean \ + nuget-clean diff --git a/build/Mlos.Common.props b/build/Mlos.Common.props index fda04d4519..d91be40d9d 100644 --- a/build/Mlos.Common.props +++ b/build/Mlos.Common.props @@ -12,6 +12,11 @@ true true + + UNKNOWN + Windows + Linux + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..')) diff --git a/build/Mlos.Common.targets b/build/Mlos.Common.targets index f78152b079..ac59dd89d0 100644 --- a/build/Mlos.Common.targets +++ b/build/Mlos.Common.targets @@ -4,4 +4,8 @@ + + + + diff --git a/build/Mlos.MetaProj.targets b/build/Mlos.MetaProj.targets new file mode 100644 index 0000000000..3538f21655 --- /dev/null +++ b/build/Mlos.MetaProj.targets @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index c7511ff6d9..e470cabca8 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -4,74 +4,10 @@ so that we can build directly with .csproj files using "dotnet pack". --> - - - - - - true - - - - - - - All - - - - true - false - false - false - false - - - - $(GenerateNuspecDependsOn);SetupPackageVersionInfo - - - - $(GitVersion_BranchName) - $(GitVersion_Sha) - - - - - $(GitVersion_Sha.Substring(0, 7)) - - - -alpha.$(GitVersion_CommitsSinceVersionSource) - $(GitVersion_MajorMinorPatch) - $(PackageVersionPrefix)$(PackageVersionSuffix) - - - - - https://github.com/Microsoft/MLOS https://github.com/Microsoft/MLOS.git @@ -79,31 +15,69 @@ Microsoft false MIT + - - $(BaseDir)/target/pkg/$(Configuration)/ + + + + $(AssemblyName) + + $(PackageId).$(OsIdString) - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/Mlos.NetCore.props b/build/Mlos.NetCore.props index fa4f0cf165..3cc04619dc 100644 --- a/build/Mlos.NetCore.props +++ b/build/Mlos.NetCore.props @@ -1,7 +1,7 @@ - + @@ -30,6 +30,21 @@ true + + + $(BaseDir)/tools/.nuget/packages + $(MlosRestorePackagesPath) + + $(BaseDir)/target/pkg + $(MlosPkgOutputBaseDir)/$(Configuration) + $(MlosPkgOutputDir)/ + + + + diff --git a/build/Mlos.NetCore.targets b/build/Mlos.NetCore.targets index 442e973182..92191fe19b 100644 --- a/build/Mlos.NetCore.targets +++ b/build/Mlos.NetCore.targets @@ -16,6 +16,10 @@ + + + + diff --git a/build/Mlos.TestRun.targets b/build/Mlos.TestRun.targets index 84b2edfdce..8173fc20c6 100644 --- a/build/Mlos.TestRun.targets +++ b/build/Mlos.TestRun.targets @@ -3,17 +3,5 @@ - - - - - - - - - - - - - + diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index 91a4b8f89e..be219b1e47 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -15,7 +15,35 @@ Properties\PipelineAssemblyInfo.cs + + - true + false + true + false + + + + + + All + + + + + true + false + true + diff --git a/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj b/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj index 17466093f3..55e8f44ad0 100644 --- a/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj +++ b/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj @@ -1,54 +1,16 @@ - + + {9D762D20-BCB8-417E-84A7-127B3C7852AF} - Library - - - - - Mlos.NetCore.Components - - A NuGet package for a collection of .Net Core tools and libraries from MLOS. - Provides: - - The code generation tool, attributes, and build targets for allowing external projects to create their own - SettingsRegistry assemblies. - - The Mlos.NetCore and related libraries. - - The Mlos.Agent.Server for basic end-to-end component testing/tuning. - - $(NoWarn);NU5128 - - - true - - false - - - true - - @@ -60,52 +22,16 @@ - - - - - true - build/$(TargetFramework)/ - - - - - $(GenerateNuspecDependsOn);CollectMlosNetCorePackageFiles - - - - - - - - - - - - - - - - true - lib/$(TargetFramework)/ - - - - - true - tools/$(TargetFramework)/@(ToolsContent->'%(FileName)') - - + + + + - - - - - + + + + + + - diff --git a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj index 5a4b67aa75..cfbb53b1b5 100644 --- a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj +++ b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj @@ -12,6 +12,26 @@ Mlos.SettingsSystem.CodeGen.MainCodeGen + + + true + + true + + $(NoWarn);NU5128 + + + + + + + + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props new file mode 100644 index 0000000000..8afe340366 --- /dev/null +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props @@ -0,0 +1 @@ + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets new file mode 100644 index 0000000000..8afe340366 --- /dev/null +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -0,0 +1 @@ + From 0bfcca8c03102d170f38cadff92f17e46cd167fe Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Tue, 27 Oct 2020 19:55:21 -0500 Subject: [PATCH 04/62] remove nuget.config in favor of the msbuild properties for the same --- NuGet.Config | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 NuGet.Config diff --git a/NuGet.Config b/NuGet.Config deleted file mode 100644 index b29fbe990f..0000000000 --- a/NuGet.Config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - From c6ae0f42710c217eec9c91bb61875e8a31384197 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 16:52:48 -0500 Subject: [PATCH 05/62] adjust the dotnet makefile rules to support .proj meta projects --- build/DotnetWrapper.mk | 4 +++ build/DotnetWrapperRules.mk | 26 ++++++++++++++++--- ...j => Mlos.NetCore.Components.Package.proj} | 16 +++--------- 3 files changed, 30 insertions(+), 16 deletions(-) rename source/Mlos.NetCore.Components.Package/{Mlos.NetCore.Components.Package.csproj => Mlos.NetCore.Components.Package.proj} (65%) diff --git a/build/DotnetWrapper.mk b/build/DotnetWrapper.mk index 81763fec25..624c3955fa 100644 --- a/build/DotnetWrapper.mk +++ b/build/DotnetWrapper.mk @@ -16,6 +16,10 @@ clean: dotnet-clean .PHONY: distclean distclean: clean +.PHONY: pack +pack: dotnet-pack + @ echo "make pack target finished." + .PHONY: test test: dotnet-test @ echo "make test target finished." diff --git a/build/DotnetWrapperRules.mk b/build/DotnetWrapperRules.mk index d54bdc6fbe..05fb37afab 100644 --- a/build/DotnetWrapperRules.mk +++ b/build/DotnetWrapperRules.mk @@ -17,6 +17,7 @@ endif # Needed for "clean" target. # See Also: Mlos.Common.props DotnetBaseOutDir := $(MLOS_ROOT)/out/dotnet +DotnetBasePkgDir := $(MLOS_ROOT)/target/pkg/$(CONFIGURATION) DotnetOutputPath := $(DotnetBaseOutDir)/$(RelativeSourceDir) NugetPackagesDir := $(MLOS_ROOT)/tools/.nuget/packages @@ -24,10 +25,13 @@ NugetPackagesDir := $(MLOS_ROOT)/tools/.nuget/packages # corresponding fake targets for the "all" target to depend on. Csprojs := $(wildcard *.csproj) CsprojBuildTargets := $(Csprojs:.csproj=.csproj.fake-build-target) +CsprojPackTargets := $(Csprojs:.csproj=.csproj.fake-pack-target) CsprojBuildQuickTargets := $(Csprojs:.csproj=.csproj.fake-build-quick-target) CsprojTestTargets := $(Csprojs:.csproj=.csproj.fake-test-target) -DirsProj := $(wildcard dirs.proj) +# 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) # To be added to the including Makefile's all target. @@ -41,6 +45,10 @@ 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." @@ -63,6 +71,12 @@ dotnet-install: @ # 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=) +# 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 --no-build -m --configuration $(CONFIGURATION) $(@:.fake-pack-target=) + # By default don't run certain tests. # To override, run with: # DOTNET_TEST_FILTER=' ' make dotnet-test @@ -82,12 +96,18 @@ endif .PHONY: dotnet-clean dotnet-clean: @ $(RM) $(DotnetOutputPath) + @ $(MKDIR) $(DotnetOutputPath) + +.PHONY: dotnet-pkg-clean +dotnet-pkg-clean: + @ $(RM) $(DotnetBasePkgDir) + @ $(MKDIR) $(DotnetBasePkgDir) +.PHONY: nuget-clean nuget-clean: @ $(RM) $(NugetPackagesDir) @ $(MKDIR) $(NugetPackagesDir) handledtargets += $(Csprojs) $(CsProjBuildTargets) $(CsProjTestTargets) \ $(DirsProj) $(DirsProjBuildTarget) $(DirsProjTestTarget) \ - dotnet-build dotnet-build-quick dotnet-install dotnet-test dotnet-clean \ - nuget-clean + dotnet-build dotnet-build-quick dotnet-install dotnet-test dotnet-pack dotnet-pkg-clean dotnet-clean nuget-clean diff --git a/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj b/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.proj similarity index 65% rename from source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj rename to source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.proj index 55e8f44ad0..081eea3e44 100644 --- a/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.csproj +++ b/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.proj @@ -3,12 +3,8 @@ This is a meta project to call the "pack" target on a subset of other projects to build nugets for external consumption. --> - + - - {9D762D20-BCB8-417E-84A7-127B3C7852AF} - - @@ -22,16 +18,10 @@ - + - - - - - - - + From c0ee3e06caba078001975a48fb3c686a00279395 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 16:53:32 -0500 Subject: [PATCH 06/62] removing some files --- .../build/Mlos.NetCore.Components.targets | 4 ---- .../build/Mlos.SettingsSystem.CodeGen.targets | 6 ------ 2 files changed, 10 deletions(-) delete mode 100644 source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets delete mode 100644 source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets diff --git a/source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets b/source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets deleted file mode 100644 index bd81264097..0000000000 --- a/source/Mlos.NetCore.Components.Package/build/Mlos.NetCore.Components.targets +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets deleted file mode 100644 index fb4982ddfa..0000000000 --- a/source/Mlos.NetCore.Components.Package/build/Mlos.SettingsSystem.CodeGen.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - From 72e6806cc849801aec76f2375c2399c248b7bffa Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 17:00:35 -0500 Subject: [PATCH 07/62] rename the project --- .../Makefile | 0 .../Mlos.NetCore.Components.Packages.proj} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename source/{Mlos.NetCore.Components.Package => Mlos.NetCore.Components.Packages}/Makefile (100%) rename source/{Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.proj => Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj} (100%) diff --git a/source/Mlos.NetCore.Components.Package/Makefile b/source/Mlos.NetCore.Components.Packages/Makefile similarity index 100% rename from source/Mlos.NetCore.Components.Package/Makefile rename to source/Mlos.NetCore.Components.Packages/Makefile diff --git a/source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.proj b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj similarity index 100% rename from source/Mlos.NetCore.Components.Package/Mlos.NetCore.Components.Package.proj rename to source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj From d28e4c071d34e1d3ba7bed67dabf4ec58e9c4e3c Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 17:02:00 -0500 Subject: [PATCH 08/62] comments --- source/dirs.proj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/dirs.proj b/source/dirs.proj index 7cbfbb73d2..071051a55a 100644 --- a/source/dirs.proj +++ b/source/dirs.proj @@ -16,6 +16,10 @@ + From 95523760e6e036f3b8f552ca5d3f6578d49ec432 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 17:02:26 -0500 Subject: [PATCH 09/62] stop trying to provide a clean packages output target --- build/Mlos.NetCore.Package.props | 56 +++----------------------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index e470cabca8..920006c83e 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -29,55 +29,9 @@ $(PackageId).$(OsIdString) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + From e2deb7bb0f36234405c731af187173cba23e48ca Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 17:28:46 -0500 Subject: [PATCH 10/62] refactor to support clean as a dotnet target better also - fix some minor bugs - and provide a way to increase the verbosity --- Makefile | 2 +- build/DotnetWrapper.mk | 2 +- build/DotnetWrapperRules.mk | 53 +++++++++++++++++++++++++++---------- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index f9fc232b30..a2eef5ddee 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ install: dotnet-install cmake-install clean: cmake-clean dotnet-clean grpc-clean mlos-codegen-clean website-clean python-clean .PHONY: distclean -distclean: clean cmake-distclean nuget-clean +distclean: clean dotnet-distclean dotnet-pkgs-clean cmake-distclean nuget-clean .PHONY: rebuild rebuild: clean all diff --git a/build/DotnetWrapper.mk b/build/DotnetWrapper.mk index 624c3955fa..15ff6a63b4 100644 --- a/build/DotnetWrapper.mk +++ b/build/DotnetWrapper.mk @@ -14,7 +14,7 @@ install: dotnet-install clean: dotnet-clean .PHONY: distclean -distclean: clean +distclean: dotnet-distclean .PHONY: pack pack: dotnet-pack diff --git a/build/DotnetWrapperRules.mk b/build/DotnetWrapperRules.mk index 05fb37afab..b348de4f6f 100644 --- a/build/DotnetWrapperRules.mk +++ b/build/DotnetWrapperRules.mk @@ -25,14 +25,20 @@ NugetPackagesDir := $(MLOS_ROOT)/tools/.nuget/packages # corresponding fake targets for the "all" target to depend on. Csprojs := $(wildcard *.csproj) CsprojBuildTargets := $(Csprojs:.csproj=.csproj.fake-build-target) -CsprojPackTargets := $(Csprojs:.csproj=.csproj.fake-pack-target) CsprojBuildQuickTargets := $(Csprojs:.csproj=.csproj.fake-build-quick-target) +CsprojPackTargets := $(Csprojs:.csproj=.csproj.fake-pack-target) CsprojTestTargets := $(Csprojs:.csproj=.csproj.fake-test-target) +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 @@ -53,6 +59,14 @@ dotnet-pack: $(CsprojPackTargets) $(DirsProjPackTarget) 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." @@ -65,17 +79,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 --no-build -m --configuration $(CONFIGURATION) $(@:.fake-pack-target=) + @ $(DOTNET) pack $(MSBUILD_ARGS) --no-build -m --configuration $(CONFIGURATION) $(@:.fake-pack-target=) # By default don't run certain tests. # To override, run with: @@ -89,18 +103,24 @@ 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-pkg-clean -dotnet-pkg-clean: - @ $(RM) $(DotnetBasePkgDir) +.PHONY: dotnet-pkgs-clean +dotnet-pkgs-clean: + $(RM) $(DotnetBasePkgDir) @ $(MKDIR) $(DotnetBasePkgDir) .PHONY: nuget-clean @@ -108,6 +128,11 @@ nuget-clean: @ $(RM) $(NugetPackagesDir) @ $(MKDIR) $(NugetPackagesDir) -handledtargets += $(Csprojs) $(CsProjBuildTargets) $(CsProjTestTargets) \ - $(DirsProj) $(DirsProjBuildTarget) $(DirsProjTestTarget) \ - dotnet-build dotnet-build-quick dotnet-install dotnet-test dotnet-pack dotnet-pkg-clean dotnet-clean nuget-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 nuget-clean From 3d8b28ffbcc58bb5616310235edacfeb85abe2c0 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 17:54:03 -0500 Subject: [PATCH 11/62] allow packing without a second build also, make sure that all MsBuild tasks use a consistent Configuration --- build/Mlos.Common.targets | 4 ++-- build/Mlos.MetaProj.targets | 14 +++++++++----- .../Mlos.NetCore.Components.Packages.proj | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build/Mlos.Common.targets b/build/Mlos.Common.targets index ac59dd89d0..ba8c1abdac 100644 --- a/build/Mlos.Common.targets +++ b/build/Mlos.Common.targets @@ -1,8 +1,8 @@ - - + + diff --git a/build/Mlos.MetaProj.targets b/build/Mlos.MetaProj.targets index 3538f21655..4f7d051e51 100644 --- a/build/Mlos.MetaProj.targets +++ b/build/Mlos.MetaProj.targets @@ -1,17 +1,21 @@ - - + + - + - + - + diff --git a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj index 081eea3e44..fcc01f4496 100644 --- a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj +++ b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj @@ -19,9 +19,9 @@ - - - + + From ef6731a7c9f7bfabc01253391754b7b82900fd52 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 18:00:05 -0500 Subject: [PATCH 12/62] wip: pack the Mlos.Agent.Server as a tool --- source/Mlos.Agent.Server/Mlos.Agent.Server.csproj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj b/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj index 743b9d7b56..e016a9f02f 100644 --- a/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj +++ b/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj @@ -11,6 +11,17 @@ true + + + true + + true + Mlos.Agent.Server.Tool + Mlos.Agent.Server + From dc9d66a028d5a62d444b0f72681eeff0a4584c34 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 18:00:15 -0500 Subject: [PATCH 13/62] wip: comments about GitVersionTask warnings --- build/versions/Mlos.NetCore.Version.props | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index be219b1e47..56694ff0d2 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -16,6 +16,11 @@ + + false From 1aeb68cc98830600cd20b8c652dfd018da37a91a Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 28 Oct 2020 18:00:43 -0500 Subject: [PATCH 14/62] wip: comments --- build/Mlos.NetCore.Package.props | 1 + 1 file changed, 1 insertion(+) diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index 920006c83e..4c4cf53f83 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -17,6 +17,7 @@ MIT + false - true + true false - - - - - All - - + + + + + All + + From 112f8110fc4cabc87edaa7fac25ed0c69dae9e47 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 29 Oct 2020 10:07:19 -0500 Subject: [PATCH 17/62] try to make the GitVersionTask less noisy in its output (only for normal logging mode) --- build/versions/Mlos.NetCore.Version.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index b386544507..27fcd597ce 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -36,6 +36,8 @@ true false true + + false - false - + + + $(BuildDependsOn);SettingsSystemRegistryDefCodeGen + + @(SettingsRegistryDef -> '--input-cs="%(FullPath)"', ' ') From 8fe377b96d029dcc1832b4009c3e50386db53547 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 2 Nov 2020 17:49:12 -0600 Subject: [PATCH 20/62] comments --- build.cake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.cake b/build.cake index 89e45f17b0..b0fd7c1f26 100644 --- a/build.cake +++ b/build.cake @@ -399,6 +399,8 @@ Task("Create-Nuget-Package") string assemblyPath = mlosNetCoreSpec.Source; var asmVersion = FileVersionInfo.GetVersionInfo(assemblyPath); + // FIXME: This currently lacks "dependency" elements for the Projects that make up the nuget package. + // Create nuget package in Target directory. // NuGetPack("./nuspec/Mlos.nuspec", From 7d966f2ff23b17f64e463b1b0ce28025159129a2 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 2 Nov 2020 17:50:08 -0600 Subject: [PATCH 21/62] cleanups and reorgs --- build/Mlos.Common.props | 5 ---- build/Mlos.NetCore.Package.props | 27 ++++++++++--------- build/Mlos.NetCore.props | 10 ------- .../Mlos.Agent.Server.csproj | 5 +--- source/dirs.proj | 2 +- 5 files changed, 16 insertions(+), 33 deletions(-) diff --git a/build/Mlos.Common.props b/build/Mlos.Common.props index d91be40d9d..fda04d4519 100644 --- a/build/Mlos.Common.props +++ b/build/Mlos.Common.props @@ -12,11 +12,6 @@ true true - - UNKNOWN - Windows - Linux - $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..')) diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index 4c4cf53f83..6e0d48b065 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -15,24 +15,25 @@ Microsoft false MIT + MLOS;Machine Learning;Optimization;Systems - - - - - $(AssemblyName) - - $(PackageId).$(OsIdString) + + + $(BaseDir)/target/pkg + $(MlosPkgOutputBaseDir)/$(Configuration) + $(MlosPkgOutputDir)/ + + + + + true + snupkg diff --git a/build/Mlos.NetCore.props b/build/Mlos.NetCore.props index 3cc04619dc..e4203a0704 100644 --- a/build/Mlos.NetCore.props +++ b/build/Mlos.NetCore.props @@ -33,16 +33,6 @@ $(BaseDir)/tools/.nuget/packages - $(MlosRestorePackagesPath) - - $(BaseDir)/target/pkg - $(MlosPkgOutputBaseDir)/$(Configuration) - $(MlosPkgOutputDir)/ - - diff --git a/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj b/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj index e016a9f02f..620978f132 100644 --- a/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj +++ b/source/Mlos.Agent.Server/Mlos.Agent.Server.csproj @@ -14,10 +14,7 @@ true - + true Mlos.Agent.Server.Tool Mlos.Agent.Server diff --git a/source/dirs.proj b/source/dirs.proj index 071051a55a..35844fdf8b 100644 --- a/source/dirs.proj +++ b/source/dirs.proj @@ -17,7 +17,7 @@ From 14e6616fa60bffd22243c721634c6f59847c2c12 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 2 Nov 2020 17:50:39 -0600 Subject: [PATCH 22/62] Include Mlos.Core codegen outputs in the Mlos.NetCore package Also fix a bug where a former codegen file was still being declared, but not referenced. --- build/Mlos.SettingsSystem.CodeGen.targets | 1 - source/Mlos.NetCore/Mlos.NetCore.csproj | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build/Mlos.SettingsSystem.CodeGen.targets b/build/Mlos.SettingsSystem.CodeGen.targets index 691d4d21b9..a09ad6e8a8 100644 --- a/build/Mlos.SettingsSystem.CodeGen.targets +++ b/build/Mlos.SettingsSystem.CodeGen.targets @@ -33,7 +33,6 @@ - diff --git a/source/Mlos.NetCore/Mlos.NetCore.csproj b/source/Mlos.NetCore/Mlos.NetCore.csproj index 66ffd0182e..f0e0933374 100644 --- a/source/Mlos.NetCore/Mlos.NetCore.csproj +++ b/source/Mlos.NetCore/Mlos.NetCore.csproj @@ -71,4 +71,11 @@ + + + + source/Mlos.CodeGen.out/$(Configuration)/$(SettingsSystemCodeGenOutputPath)/ + true + + From 9ba5d58e51687b65a4ed00ada2d0de84d2d2ead5 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 2 Nov 2020 17:51:24 -0600 Subject: [PATCH 23/62] don't run or include GitVersionTask in CDPX pipeline --- build/versions/Mlos.NetCore.Version.props | 13 ++++++------- .../Mlos.NetCore.Components.Packages.proj | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index b386544507..1fef5d1d63 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -15,16 +15,15 @@ Properties\PipelineAssemblyInfo.cs - - + + + true + false - true + true false - + All diff --git a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj index fcc01f4496..7d173bdddb 100644 --- a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj +++ b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj @@ -19,7 +19,7 @@ - + From c9b50e577f83374edea32025e7ea8e6e81787580 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 2 Nov 2020 17:52:18 -0600 Subject: [PATCH 24/62] Include the msbuild rules files in the codegen package output --- .../Mlos.SettingsSystem.CodeGen.csproj | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj index cfbb53b1b5..03d27828d3 100644 --- a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj +++ b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj @@ -19,18 +19,13 @@ true $(NoWarn);NU5128 - - - - - + + + build/ + true + From 703e4af985390b87d986da0747f070cf72591844 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 4 Nov 2020 20:20:07 -0600 Subject: [PATCH 25/62] wip: package build files and a project to test it with --- .../build/Mlos.SettingsSystem.CodeGen.props | 28 +++++- .../build/Mlos.SettingsSystem.CodeGen.targets | 85 ++++++++++++++++++- ...IntegrationExample.SettingsRegistry.csproj | 39 +++++++++ 3 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props index 8afe340366..b727867a54 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props @@ -1 +1,27 @@ - + + + + + + + + SettingsProvider_gen + + + + + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 8afe340366..20a1559a8a 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -1 +1,84 @@ - + + + + + + + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)/../tools/Mlos.SettingsSystem.CodeGen.dll')) + dotnet "$(MlosSettingsSystemCodeGenDll)" + + + + + + $([System.IO.Path]::GetFullPath('$(MlosSettingsSystemCodeGenOutputDirectory)')) + + + + $([System.IO.Path]::GetFullPath('$(MlosSettingsRegistryAssemblyOutputDirectory)')) + + + + + + + + + + + + + + + + + + + + + + + + $(BuildDependsOn);MlosSettingsSystemCodeGen + + + + + @(MlosSettingsRegistryDefinition -> '--input-cs="%(FullPath)"', ' ') + + + + + + + + + + + + + + + + + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj new file mode 100644 index 0000000000..1b856f454e --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -0,0 +1,39 @@ + + + + + + + {7747149E-BB3B-4F9A-8F1B-D94A062B492F} + Library + Properties + Mlos.UnitTest.SettingsRegistry + Mlos.UnitTest.SettingsRegistry + true + true + + + + + + + + Mlos.UnitTest + + + + + + + + + + + + + + + + From 6a77540f95d089e077459e31471ab3eeff3dd75e Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 4 Nov 2020 21:39:43 -0600 Subject: [PATCH 26/62] more wip --- .../build/Mlos.SettingsSystem.CodeGen.targets | 6 ++ .../Common.props | 6 ++ ...IntegrationExample.SettingsRegistry.csproj | 63 ++++++++++--------- 3 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 20a1559a8a..3ad55dfaea 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -42,6 +42,12 @@ Combine the user provided settings registry definitions with the C# code gen output we created from them when compiling the output settings registry assembly dll. --> + + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props new file mode 100644 index 0000000000..0d2e4bef52 --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -0,0 +1,6 @@ + + + + $(MSBuildThisFileDirectory)/../../../out/Mlos.CodeGen.out + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj index 1b856f454e..99e56e1c8f 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -1,39 +1,46 @@ - - - - - + + + + + {7747149E-BB3B-4F9A-8F1B-D94A062B492F} Library - Properties - Mlos.UnitTest.SettingsRegistry - Mlos.UnitTest.SettingsRegistry - true - true + ExternalIntegrationExample + ExternalIntegrationExample.SettingsRegistry - + + $(MlosSettingsSystemCodeGenOutputBaseDir)/ExternalIntegrationExample + + - - + + + - - Mlos.UnitTest - - - - - - - - - + + + + + + + + + + - - From f4d4d1c236923a5e98d534ed2b801588d00738a3 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 5 Nov 2020 20:02:54 -0600 Subject: [PATCH 27/62] don't include the grpc.tools as a package dependency - it's just a build time thing --- build/Mlos.NetCore.Grpc.props | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/Mlos.NetCore.Grpc.props b/build/Mlos.NetCore.Grpc.props index 869662c6ca..9d9e2db1ac 100644 --- a/build/Mlos.NetCore.Grpc.props +++ b/build/Mlos.NetCore.Grpc.props @@ -11,6 +11,9 @@ - + + all + runtime; build; native; contentfiles; analyzers + From efaa4b00c6e9fca467d3d4c04857d5b67d26fa77 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 5 Nov 2020 20:04:58 -0600 Subject: [PATCH 28/62] add debug symbols to the nuget package, wip: add dependent dlls --- build/Mlos.NetCore.Package.props | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index 6e0d48b065..8333ab2b6f 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -28,9 +28,37 @@ true + snupkg + + + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + + + + + + + + + + + + + + + + + + + true + true $(NoWarn);NU5128 + + + IncludeDependentAssembliesInToolsPackage;$(GenerateNuspecDependsOn);$(GetPackageVersionDependsOn) + + + + + + + true + tools/ + + + + + - - build/ true + build/ + + 3.6.0 + - - + + + + - + + From 2bbad6b88051ebccf98bd1e94006e320c6a99890 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 5 Nov 2020 20:07:13 -0600 Subject: [PATCH 31/62] wip: integrated example fixups and attempts to make the dependencies work to make the codegen tool executable in its package --- .../build/Mlos.SettingsSystem.CodeGen.targets | 29 +++--- .../AssemblyInitializer.cs | 50 +++++++++++ .../CMakeLists.txt | 14 +++ .../CodeGen/AssemblyInfo.cs | 22 +++++ .../CodeGen/SmartComponentExampleConfig.cs | 37 ++++++++ .../CodeGen/SmartComponentExampleMessages.cs | 90 +++++++++++++++++++ .../Common.props | 42 ++++++++- ...IntegrationExample.SettingsRegistry.csproj | 30 +++---- .../Makefile | 3 + 9 files changed, 285 insertions(+), 32 deletions(-) create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 3ad55dfaea..5714ab01dc 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -30,12 +30,12 @@ - - - - - - + + + + + + + + false + false - - - + + + @@ -65,14 +68,16 @@ $(BuildDependsOn);MlosSettingsSystemCodeGen - + @(MlosSettingsRegistryDefinition -> '--input-cs="%(FullPath)"', ' ') + + @@ -81,7 +86,7 @@ - + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs new file mode 100644 index 0000000000..26b21c0bd1 --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs @@ -0,0 +1,50 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root +// for license information. +// +// ----------------------------------------------------------------------- + +using Mlos.Core; + +using MlosCoreProxy = Proxy.Mlos.Core; +using MlosUnitTestProxy = Proxy.Mlos.UnitTest; + +namespace Mlos.UnitTest +{ + public static class AssemblyInitializer + { + static AssemblyInitializer() + { + MlosUnitTestProxy.WideStringViewArray.Callback = RunA; + MlosUnitTestProxy.Line.Callback = RunB; + MlosUnitTestProxy.UpdateConfigTestMessage.Callback = UpdateConfigTestMessage; + } + + internal static void RunA(MlosUnitTestProxy.WideStringViewArray wideStringArrayProxy) + { + var a = wideStringArrayProxy.Id; + var b = wideStringArrayProxy.Strings[0].Value; + var c = wideStringArrayProxy.Strings[1].Value; + var d = wideStringArrayProxy.Strings[2].Value; + var e = wideStringArrayProxy.Strings[3].Value; + var f = wideStringArrayProxy.Strings[4].Value; + } + + internal static void RunB(MlosUnitTestProxy.Line line) + { + var a = line.Colors[0]; + var b = line.Colors[0]; + var c = line.Points[0]; + } + + internal static void UpdateConfigTestMessage(MlosUnitTestProxy.UpdateConfigTestMessage msg) + { + // Update config. + // + var channelReaderStats = MlosContext.Instance.SharedConfigManager.Lookup().Config; + channelReaderStats.SpinCount++; + } + } +} diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt new file mode 100644 index 0000000000..81b7fa4dbb --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt @@ -0,0 +1,14 @@ +# This project also does the SettingsProvider code generation. + +project(ExternalIntegrationExample.SettingsRegistry LANGUAGES NONE) + +# TODO: FIXME: Develop cmake patterns for settings registries for external projects to use. + +#get_filename_component(MLOS_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) +#include("${MLOS_ROOT}/build/Mlos.Common.cmake") +#include("${MLOS_ROOT}/build/Mlos.NetCore.cmake") +# +#add_mlos_dotnet_project(NAME ${PROJECT_NAME} +# DIRECTORY ${PROJECT_SOURCE_DIR} +# MLOS_SETTINGS_REGISTRY +# WITH_BINPLACE) diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs new file mode 100644 index 0000000000..b9a9ee05a6 --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root +// for license information. +// +// ----------------------------------------------------------------------- + +/// +/// This file provides optional assembly wide annotations for both the codegen output and the +/// compiled SettingsRegistry assembly dll. +/// + +using System.Runtime.CompilerServices; + +using Mlos.SettingsSystem.Attributes; + +/// +/// This is ths namespace used for the C++ codegen output for the messages and settings in this +/// Settings Registry. +/// +[assembly: DispatchTableNamespace(@namespace: "ExternalIntegrationExample")] diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs new file mode 100644 index 0000000000..16c1a374bb --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root +// for license information. +// +// ----------------------------------------------------------------------- + +using Mlos.SettingsSystem.Attributes; + +namespace ExternalIntegrationExample +{ + /// + /// An example settings config structure for a smart component in the external project. + /// + [CodegenConfig] + internal partial struct SmartComponentExampleConfig + { + /// + /// Set by the agent upon suggesting new config. + /// + [ScalarSetting] + internal long NewConfigId; + + /// + /// Set by the component, upon consuming the config. + /// + [ScalarSetting] + internal long ActiveConfigId; + + /// + /// The size for the smart component example. + /// + [ScalarSetting] + internal int Size; + } +} diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs new file mode 100644 index 0000000000..40982ec08f --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs @@ -0,0 +1,90 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root +// for license information. +// +// ----------------------------------------------------------------------- + +using Mlos.SettingsSystem.Attributes; +using Mlos.SettingsSystem.StdTypes; + +namespace ExternalIntegrationExample +{ + /// + /// A message to ask optimizer for the new configuration. + /// + /// + /// Note: This message contains no members to detail the request. + /// It's very existence on the channel is signal enough of its intent. + /// + [CodegenMessage] + internal partial struct RequestConfigUpdateExampleMessage + { + } + + /// + /// An enum describing the request type for this component. + /// + public enum ComponentRequestType + { + Get, + Put, + Delete, + } + + /// + /// An enum describing the response type for the request. + /// + public enum ComponentResponseType + { + Success, + Failure, + } + + /// + /// A telemetry message to inform the agent of the smart component's activity/state. + /// + /// + /// Messages can be combined/aggregated by the agent in various ways before being passed to the optimizer. + /// + [CodegenMessage] + internal partial struct SmartComponentExampleTelemetryMessage + { + /// + /// The + /// + [ScalarSetting] + internal long RequestKey; + + /// + /// What type of request it was. + /// + [ScalarSetting] + internal ComponentRequestType RequestType; + + /// + /// The size of the request (or response in the case of Get). + /// + [ScalarSetting] + internal long RequestSize; + + /// + /// The duration of the request. + /// + [ScalarSetting] + internal double RequestDuration; + + /// + /// The status of the response. + /// + [ScalarSetting] + internal ComponentResponseType ResponseType; + + /// + /// The size of the component. + /// + [ScalarSetting] + internal long Size; + } +} diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props index 0d2e4bef52..b85a046769 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -1,6 +1,46 @@ - $(MSBuildThisFileDirectory)/../../../out/Mlos.CodeGen.out + + netcoreapp3.1 + + + false + false + + + $(MSBuildThisFileDirectory)/../../../out/Mlos.CodeGen.out + + + + *-* + + + + + + + + + + + + $(MSBuildThisFileDirectory)/../../../out/dotnet/test/nuget/packages + $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration);$(RestoreSources);https://api.nuget.org/v3/index.json diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj index 99e56e1c8f..1640927ee7 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -1,7 +1,8 @@ - + - + + {7747149E-BB3B-4F9A-8F1B-D94A062B492F} @@ -9,31 +10,22 @@ ExternalIntegrationExample ExternalIntegrationExample.SettingsRegistry + $(MlosSettingsSystemCodeGenOutputBaseDir)/ExternalIntegrationExample - + - - + + + - + - - - - - - + + - IncludeDependentAssembliesInToolsPackage;$(GenerateNuspecDependsOn);$(GetPackageVersionDependsOn) - + IncludeDependentAssembliesInToolsPackage;$(GenerateNuspecDependsOn) + + - + + - true tools/ - diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 5714ab01dc..b410284971 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -44,9 +44,11 @@ --> + + true + false false diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs index 26b21c0bd1..baba42a3a1 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs @@ -9,7 +9,6 @@ using Mlos.Core; using MlosCoreProxy = Proxy.Mlos.Core; -using MlosUnitTestProxy = Proxy.Mlos.UnitTest; namespace Mlos.UnitTest { @@ -17,34 +16,7 @@ public static class AssemblyInitializer { static AssemblyInitializer() { - MlosUnitTestProxy.WideStringViewArray.Callback = RunA; - MlosUnitTestProxy.Line.Callback = RunB; - MlosUnitTestProxy.UpdateConfigTestMessage.Callback = UpdateConfigTestMessage; - } - - internal static void RunA(MlosUnitTestProxy.WideStringViewArray wideStringArrayProxy) - { - var a = wideStringArrayProxy.Id; - var b = wideStringArrayProxy.Strings[0].Value; - var c = wideStringArrayProxy.Strings[1].Value; - var d = wideStringArrayProxy.Strings[2].Value; - var e = wideStringArrayProxy.Strings[3].Value; - var f = wideStringArrayProxy.Strings[4].Value; - } - - internal static void RunB(MlosUnitTestProxy.Line line) - { - var a = line.Colors[0]; - var b = line.Colors[0]; - var c = line.Points[0]; - } - - internal static void UpdateConfigTestMessage(MlosUnitTestProxy.UpdateConfigTestMessage msg) - { - // Update config. - // - var channelReaderStats = MlosContext.Instance.SharedConfigManager.Lookup().Config; - channelReaderStats.SpinCount++; + // TODO: } } } diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs index 16c1a374bb..6b8e75f8af 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root // for license information. diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs index 40982ec08f..831e1b5e8c 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root // for license information. diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props index b85a046769..11c21ca836 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -7,6 +7,7 @@ false false + true - $(MSBuildThisFileDirectory)/../../../out/Mlos.CodeGen.out + $(MSBuildThisFileDirectory)/../../../out/Mlos.CodeGen.out/$(Configuration) + + - + - - - + + + + + + *-* + + + + + + + + + + + + + + + + + + + + *-* + + + + + + + + + + + + + + + + + + + + + true + + false + + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 17c39b48f6..49018c96d2 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -8,6 +8,14 @@ See TODO-FIXME.csproj for example usage. --> + + + ;netcoreapp3.1; + + - - - - true - - - false - false - @@ -60,24 +57,6 @@ - - - - *-* - - - - - - - - - - - - - - - - @(MlosSettingsRegistryDefinition -> '--input-cs="%(FullPath)"', ' ') - + + + + + + @(MlosSettingsRegistryDefinition -> '--input-cs="%(FullPath)"', ' ') + + + diff --git a/test/ExternalIntegrationExample/.gitignore b/test/ExternalIntegrationExample/.gitignore new file mode 100644 index 0000000000..709a97b82c --- /dev/null +++ b/test/ExternalIntegrationExample/.gitignore @@ -0,0 +1,2 @@ +# Ignore the local MLOS codegen output for this example: +./Mlos.CodeGen.out/ diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props index 11c21ca836..1441cd3d8c 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -1,23 +1,21 @@ - - - netcoreapp3.1 - - - false - false - true + + - $(MSBuildThisFileDirectory)/../../../out/Mlos.CodeGen.out/$(Configuration) + $(MSBuildThisFileDirectory/../Mlos.CodeGen.out/$(Configuration) + + + netcoreapp3.1 + + + + $(MSBuildThisFileDirectory)/../../../out/dotnet/test/nuget/packages + $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration) + $(MlosLocalPkgOutput);$(RestoreSources);https://api.nuget.org/v3/index.json + + + + + + + + + + + + + + + + - + + + Pack + + Restore;$(LocalPackProjectTargets) + + - - $(MSBuildThisFileDirectory)/../../../out/dotnet/test/nuget/packages - $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration);$(RestoreSources);https://api.nuget.org/v3/index.json - diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj index b8acf07ac4..0b7260369c 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -20,9 +20,11 @@ - + From 80f01fe1a39b162769e8cd450bc4868a39b30817 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Sat, 7 Nov 2020 00:47:04 -0600 Subject: [PATCH 35/62] wip: trying to get dynamic versions working - it doesn't --- build/Mlos.NetCore.Package.props | 27 ++-------- .../Mlos.SettingsSystem.CodeGen.csproj | 47 ++++++++++++---- .../build/Mlos.SettingsSystem.CodeGen.props | 41 +++++--------- .../build/Mlos.SettingsSystem.CodeGen.targets | 2 +- test/ExternalIntegrationExample/.gitignore | 1 + .../Common.props | 50 ++--------------- ...IntegrationExample.SettingsRegistry.csproj | 21 +++++--- .../LocalTesting.targets | 53 +++++++++++++++++++ 8 files changed, 125 insertions(+), 117 deletions(-) create mode 100644 test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index 8333ab2b6f..f38c9435a1 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -36,32 +36,11 @@ - + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - - - - - - - - - - + + - - diff --git a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj index 9ceead9566..90fcb58cad 100644 --- a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj +++ b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj @@ -12,6 +12,7 @@ Mlos.SettingsSystem.CodeGen.MainCodeGen + true @@ -21,34 +22,58 @@ $(NoWarn);NU5128 + IncludeDependentAssembliesInToolsPackage;$(GenerateNuspecDependsOn) - + true tools/ + + + + + true + build/ + + + + + true + build/ + + - - - - true - build/ - - + + + + + + + + + + 3.6.0 - - + @@ -56,6 +81,7 @@ + @@ -106,6 +132,7 @@ + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props index c2336f409d..44233787e0 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props @@ -7,10 +7,8 @@ This path property is expected to be set by the including project referencing this package. On the C++ consumer side, it is also the path to add to the cmake target_include_directories(). We recommend using a BaseDir path combined with the ProjectName for this path. - - TODO: Add a reasonable default here. Maybe something in the source tree? (*yuck*) --> - + $(MSBuildThisFileDirectory)/Mlos.CodeGen.out/$(Configuration)/$(MSBuildProjectName) - - - *-* - - - - - - - - - - - - - - - - - + true false + + + + + + + + + + + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 49018c96d2..ae5167f3bf 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -5,7 +5,7 @@ a) Generate output code from the MlosSettingsRegistryDefinition input-cs, and b) And (for the case of C#) combine and compile them with the resulting .cs files to produce a SettingsRegistry dll. - See TODO-FIXME.csproj for example usage. + See ExternalIntegrationExample.csproj for example usage. --> diff --git a/test/ExternalIntegrationExample/.gitignore b/test/ExternalIntegrationExample/.gitignore index 709a97b82c..6fd4d52877 100644 --- a/test/ExternalIntegrationExample/.gitignore +++ b/test/ExternalIntegrationExample/.gitignore @@ -1,2 +1,3 @@ # Ignore the local MLOS codegen output for this example: ./Mlos.CodeGen.out/ +./ExternalIntegrationExample/.nuget/ diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props index 1441cd3d8c..579696a44f 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -1,6 +1,5 @@ - - $(MSBuildThisFileDirectory/../Mlos.CodeGen.out/$(Configuration) + $(MSBuildThisFileDirectory)/../Mlos.CodeGen.out/$(Configuration) - *-* + *-* @@ -39,46 +38,5 @@ For local testing, use a locally built package instead of the one pulled from NOTE: this section should be *removed* in your own examples. --> - - $(MSBuildThisFileDirectory)/../../../out/dotnet/test/nuget/packages - $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration) - $(MlosLocalPkgOutput);$(RestoreSources);https://api.nuget.org/v3/index.json - - - - - - - - - - - - - - - - - - - - - - - - - Pack - - Restore;$(LocalPackProjectTargets) - - - + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj index 0b7260369c..c34b58e8bb 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -1,7 +1,9 @@ + + @@ -10,28 +12,31 @@ ExternalIntegrationExample ExternalIntegrationExample.SettingsRegistry + $(MlosSettingsSystemCodeGenOutputBaseDir)/ExternalIntegrationExample - - + + + + + - - + + + + $(MSBuildThisFileDirectory)/.nuget/packages + $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration) + $(MlosLocalPkgOutput);$(RestoreSources);https://api.nuget.org/v3/index.json + + + + + + + + + + + false + + + + + + + + + + + + + + + + true + + + + + + + + + + + + From 72e5fc5d00749e997984bc57ffec472ee19f11f0 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Sat, 7 Nov 2020 22:32:01 -0600 Subject: [PATCH 36/62] wip: add some checks for package version references --- build/Mlos.NetCore.Package.props | 4 --- .../build/Mlos.SettingsSystem.CodeGen.props | 31 +++++++++++++------ .../Common.props | 6 ++-- ...IntegrationExample.SettingsRegistry.csproj | 8 ++++- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index f38c9435a1..af0a44a43c 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -39,8 +39,4 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props index 44233787e0..033593d66a 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props @@ -29,19 +29,30 @@ true + false + + + False + AnyCPU - - - - - - - - - - + + + + + + @(RuntimeCopyLocalItems->'%(PackageName)') + @(RuntimeCopyLocalItems->'%(PackageVersion)') + + + + + + + + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props index 579696a44f..6cb912b52f 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -18,11 +18,9 @@ - + *-* diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj index c34b58e8bb..773f53e441 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -20,9 +20,15 @@ - + + + IncludeDependentAssembliesInToolsPackage;$(GenerateNuspecDependsOn) @@ -31,7 +32,7 @@ - + true tools/ @@ -42,43 +43,33 @@ Include our build rules in the package, but not in the TargetFramework specific path. --> - + true build/ - + true build/ - - - - - - - - - 3.6.0 - + - + diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props index 033593d66a..94070210ad 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props @@ -38,21 +38,4 @@ False AnyCPU - - - - - - - @(RuntimeCopyLocalItems->'%(PackageName)') - @(RuntimeCopyLocalItems->'%(PackageVersion)') - - - - - - - - - diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index ae5167f3bf..29eeafe3d7 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -99,4 +99,50 @@ + + + + + + + @(RuntimeCopyLocalItems->'%(PackageName)') + @(RuntimeCopyLocalItems->'%(PackageVersion)') + + + + + + ;@(MlosPackageRefs->'%(PackageName)'); + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj index 773f53e441..7f0811f9fd 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj @@ -25,10 +25,8 @@ Note: These should all reference the same nuget package versions. To make that easier, we specify the version in the Common.props file. --> - + $(MSBuildThisFileDirectory)/.nuget/packages + + $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration) $(MlosLocalPkgOutput);$(RestoreSources);https://api.nuget.org/v3/index.json - - - - - - - + + + - - false + false - - + - + From ed1200ee57dd34ca3f00b759b2893fc1266d4ccd Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 9 Nov 2020 13:22:13 -0600 Subject: [PATCH 39/62] fixups --- build/Mlos.Common.targets | 4 --- build/Mlos.NetCore.Grpc.props | 1 + build/Mlos.NetCore.props | 6 +--- build/Mlos.NetCore.targets | 4 --- .../Mlos.NetCore.Components.Packages.proj | 4 +++ source/Mlos.NetCore/Mlos.NetCore.csproj | 2 +- .../Mlos.SettingsSystem.CodeGen.csproj | 33 +++++++++---------- .../LocalTesting.targets | 13 ++++++-- 8 files changed, 33 insertions(+), 34 deletions(-) diff --git a/build/Mlos.Common.targets b/build/Mlos.Common.targets index ba8c1abdac..3412d51ab4 100644 --- a/build/Mlos.Common.targets +++ b/build/Mlos.Common.targets @@ -4,8 +4,4 @@ - - - - diff --git a/build/Mlos.NetCore.Grpc.props b/build/Mlos.NetCore.Grpc.props index 9d9e2db1ac..bb9a3d824e 100644 --- a/build/Mlos.NetCore.Grpc.props +++ b/build/Mlos.NetCore.Grpc.props @@ -12,6 +12,7 @@ + all runtime; build; native; contentfiles; analyzers diff --git a/build/Mlos.NetCore.props b/build/Mlos.NetCore.props index e4203a0704..093760c371 100644 --- a/build/Mlos.NetCore.props +++ b/build/Mlos.NetCore.props @@ -30,11 +30,7 @@ true - - - $(BaseDir)/tools/.nuget/packages - - + diff --git a/build/Mlos.NetCore.targets b/build/Mlos.NetCore.targets index 92191fe19b..442e973182 100644 --- a/build/Mlos.NetCore.targets +++ b/build/Mlos.NetCore.targets @@ -16,10 +16,6 @@ - - - - diff --git a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj index 7d173bdddb..48d987fb70 100644 --- a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj +++ b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj @@ -19,6 +19,10 @@ + - source/Mlos.CodeGen.out/$(Configuration)/$(SettingsSystemCodeGenOutputPath)/ + source/Mlos.CodeGen.out/$(SettingsSystemCodeGenOutputPath)/ true diff --git a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj index 489f449273..0af368f2af 100644 --- a/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj +++ b/source/Mlos.SettingsSystem.CodeGen/Mlos.SettingsSystem.CodeGen.csproj @@ -38,24 +38,22 @@ tools/ - - - - - true - build/ - - - - - true - build/ - - + + + + true + build/ + + + true + build/ + + + 3.6.0 @@ -69,8 +67,7 @@ - - + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets index 6932147c80..224a4550ff 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets @@ -13,7 +13,12 @@ $(MlosLocalPkgOutput);$(RestoreSources);https://api.nuget.org/v3/index.json - + + + + + + false @@ -38,16 +43,20 @@ - + + + true + + Date: Mon, 9 Nov 2020 13:50:24 -0600 Subject: [PATCH 40/62] add (mostly) default stylecop checking for the external example that consumes our codegen nuget --- .../CodeWriters/CSharpCodeWriter.cs | 5 +++ .../CSharpObjectDispatchHandlerCodeWriter.cs | 12 ++--- .../build/Mlos.SettingsSystem.CodeGen.props | 3 ++ .../AssemblyInitializer.cs | 5 ++- .../CodeGen/AssemblyInfo.cs | 14 +++--- .../CodeGen/SmartComponentExampleMessages.cs | 44 +++++++++++++------ .../Common.props | 28 +++++++++++- 7 files changed, 81 insertions(+), 30 deletions(-) diff --git a/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpCodeWriter.cs b/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpCodeWriter.cs index c1ce7116a5..c18f3a679f 100644 --- a/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpCodeWriter.cs +++ b/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpCodeWriter.cs @@ -24,11 +24,16 @@ public override void WriteBeginFile() // Tell stylecop to ignore this file. // WriteLine("// "); + + // Tell stylecop to *really* ignore some documentation requirement rules. + // + WriteLine("#pragma warning disable CS1591"); } /// public override void WriteEndFile() { + WriteLine("#pragma warning restore CS1591"); } /// diff --git a/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpObjectExchangeCodeWriters/CSharpObjectDispatchHandlerCodeWriter.cs b/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpObjectExchangeCodeWriters/CSharpObjectDispatchHandlerCodeWriter.cs index 826f3dc53d..40c23ece3c 100644 --- a/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpObjectExchangeCodeWriters/CSharpObjectDispatchHandlerCodeWriter.cs +++ b/source/Mlos.SettingsSystem.CodeGen/CodeWriters/CSharpObjectExchangeCodeWriters/CSharpObjectDispatchHandlerCodeWriter.cs @@ -76,12 +76,12 @@ public override void WriteEndFile() // Define a dispatch table base index. // WriteBlock(@" - // - // Base assembly type index. - // - // - // Mlos.Agent updates this value when assembly is registered. - // + /// + /// Base assembly type index. + /// + /// + /// Mlos.Agent updates this value when assembly is registered. + /// public static uint DispatchTableBaseIndex = 0;"); IndentationLevel--; diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props index 94070210ad..01a4e058e1 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.props @@ -37,5 +37,8 @@ False AnyCPU + + + true diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs index baba42a3a1..e9fa425acf 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs @@ -10,8 +10,11 @@ using MlosCoreProxy = Proxy.Mlos.Core; -namespace Mlos.UnitTest +namespace ExternalIntegrationExample { + /// + /// A static class for the Mlos.Agent.Server to use help setup the message handler code for this SettingsRegistry assembly. + /// public static class AssemblyInitializer { static AssemblyInitializer() diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs index b9a9ee05a6..a367d2f136 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs @@ -5,18 +5,14 @@ // for license information. // // ----------------------------------------------------------------------- - -/// -/// This file provides optional assembly wide annotations for both the codegen output and the -/// compiled SettingsRegistry assembly dll. -/// +// +// This file provides optional assembly wide annotations for both the codegen output and the +// compiled SettingsRegistry assembly dll. using System.Runtime.CompilerServices; using Mlos.SettingsSystem.Attributes; -/// -/// This is ths namespace used for the C++ codegen output for the messages and settings in this -/// Settings Registry. -/// +// This is ths namespace used for the C++ codegen output for the messages and settings in this +// Settings Registry. [assembly: DispatchTableNamespace(@namespace: "ExternalIntegrationExample")] diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs index 831e1b5e8c..1329509a43 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs @@ -11,25 +11,24 @@ namespace ExternalIntegrationExample { - /// - /// A message to ask optimizer for the new configuration. - /// - /// - /// Note: This message contains no members to detail the request. - /// It's very existence on the channel is signal enough of its intent. - /// - [CodegenMessage] - internal partial struct RequestConfigUpdateExampleMessage - { - } - /// /// An enum describing the request type for this component. /// public enum ComponentRequestType { + /// + /// A Get request type. + /// Get, + + /// + /// A Put request type. + /// Put, + + /// + /// A Delete request type. + /// Delete, } @@ -38,10 +37,29 @@ public enum ComponentRequestType /// public enum ComponentResponseType { + /// + /// A Success response type. + /// Success, + + /// + /// A Failure response type. + /// Failure, } + /// + /// A message to ask optimizer for the new configuration. + /// + /// + /// Note: This message contains no members to detail the request. + /// It's very existence on the channel is signal enough of its intent. + /// + [CodegenMessage] + internal partial struct RequestConfigUpdateExampleMessage + { + } + /// /// A telemetry message to inform the agent of the smart component's activity/state. /// @@ -52,7 +70,7 @@ public enum ComponentResponseType internal partial struct SmartComponentExampleTelemetryMessage { /// - /// The + /// The key for the Request. /// [ScalarSetting] internal long RequestKey; diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props index 6cb912b52f..bbb518104b 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props @@ -29,8 +29,34 @@ netcoreapp3.1 + + + 4 + true + true + true + false + + - + + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + + stylecop.json + + - + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile index b173648a66..bca20fbbc9 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile @@ -1,3 +1,5 @@ RelativePathToProjectRoot := ../../.. +MSBUILD_ARGS := /p:PackMlosDependencies=true $(MSBUILD_ARGS) +#MSBUILD_ARGS := /p:CleanMlosPackages=true $(MSBUILD_ARGS) include $(RelativePathToProjectRoot)/build/DotnetWrapper.mk #include $(RelativePathToProjectRoot)/build/CMakeWrapper.mk diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props similarity index 85% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props rename to test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props index bbb518104b..46fa064d25 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Common.props +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props @@ -14,7 +14,7 @@ Note: This should match the cmake include_directory() specficiation so that the output SettingsProvider_gen_base.h and related files can be found. --> - $(MSBuildThisFileDirectory)/../Mlos.CodeGen.out/$(Configuration) + $(MSBuildProjectDirectory)/../Mlos.CodeGen.out/$(Configuration) + + $(MSBuildThisFileDirectory)/ExternalIntegrationExample.Stylecop.ruleset @@ -53,7 +51,7 @@ runtime; build; native; contentfiles; analyzers - + stylecop.json diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset new file mode 100644 index 0000000000..0483a2b702 --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets similarity index 91% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets rename to test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets index 224a4550ff..368edd9d2a 100644 --- a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/LocalTesting.targets +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets @@ -9,7 +9,7 @@ $(MSBuildThisFileDirectory)/.nuget/packages - $(MSBuildThisFileDirectory)/../../../target/pkg/$(Configuration) + $(MSBuildThisFileDirectory)/../../../../target/pkg/$(Configuration) $(MlosLocalPkgOutput);$(RestoreSources);https://api.nuget.org/v3/index.json @@ -52,9 +52,9 @@ - - - + + + diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json new file mode 100644 index 0000000000..af832fda97 --- /dev/null +++ b/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "companyName": "Microsoft Corporation", + "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} License. See {licenseFile} in the project root\nfor license information.", + "headerDecoration": "-----------------------------------------------------------------------", + "variables": { + "licenseFile": "LICENSE", + "licenseName": "MIT" + }, + "xmlHeader": true + }, + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace" + } + } +} From 07cc225c1232d6d6614ba8ccc765934974d0876b Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 9 Nov 2020 15:32:14 -0600 Subject: [PATCH 42/62] reorg --- {test => external}/ExternalIntegrationExample/.gitignore | 0 .../AssemblyInitializer.cs | 0 .../ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt | 0 .../CodeGen/AssemblyInfo.cs | 0 .../CodeGen/SmartComponentExampleConfig.cs | 0 .../CodeGen/SmartComponentExampleMessages.cs | 0 .../ExternalIntegrationExample.SettingsRegistry.csproj | 0 .../ExternalIntegrationExample.SettingsRegistry/Makefile | 0 .../build/Common.props | 0 .../build/ExternalIntegrationExample.Stylecop.ruleset | 0 .../build/LocalTesting.targets | 0 .../build/stylecop.json | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {test => external}/ExternalIntegrationExample/.gitignore (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets (100%) rename {test => external}/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json (100%) diff --git a/test/ExternalIntegrationExample/.gitignore b/external/ExternalIntegrationExample/.gitignore similarity index 100% rename from test/ExternalIntegrationExample/.gitignore rename to external/ExternalIntegrationExample/.gitignore diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/AssemblyInitializer.cs diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/AssemblyInfo.cs diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleConfig.cs diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CodeGen/SmartComponentExampleMessages.cs diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/ExternalIntegrationExample.SettingsRegistry.csproj diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/ExternalIntegrationExample.Stylecop.ruleset diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets diff --git a/test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json similarity index 100% rename from test/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json rename to external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/stylecop.json From c48b9abd0598a26d124d339db576732c6ef04fe1 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 9 Nov 2020 15:36:54 -0600 Subject: [PATCH 43/62] rewrite Makefile to eliminate MLOS repo dependencies for "external" example --- .../Makefile | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile index bca20fbbc9..db8ab89016 100644 --- a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile +++ b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile @@ -1,5 +1,15 @@ -RelativePathToProjectRoot := ../../.. -MSBUILD_ARGS := /p:PackMlosDependencies=true $(MSBUILD_ARGS) -#MSBUILD_ARGS := /p:CleanMlosPackages=true $(MSBUILD_ARGS) -include $(RelativePathToProjectRoot)/build/DotnetWrapper.mk -#include $(RelativePathToProjectRoot)/build/CMakeWrapper.mk +all: dotnet-build + +clean: dotnet-clean + +dotnet-build: + dotnet build /p:PackMlosDependencies=true + +dotnet-build-quick: + dotnet build --no-restore + +dotnet-rebuild-all: + dotnet build /p:PackMlosDependencies=true /p:CleanMlosPackages=true + +dotnet-clean: + dotnet build --no-restore /t:clean From 16ddaae20ab920919e552fedea008035ff05f4d9 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 11 Nov 2020 17:15:57 -0600 Subject: [PATCH 44/62] fixup for windows path length restrictions --- .../build/LocalTesting.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets index 368edd9d2a..b980778ea4 100644 --- a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets +++ b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/LocalTesting.targets @@ -6,7 +6,8 @@ --> - $(MSBuildThisFileDirectory)/.nuget/packages + + $(MSBuildThisFileDirectory)/../../.nuget/packages $(MSBuildThisFileDirectory)/../../../../target/pkg/$(Configuration) From cb42d6f1e05d199574cb6f29d9a479ad19d4e559 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 11 Nov 2020 16:59:41 -0600 Subject: [PATCH 45/62] add a README.md --- external/ExternalIntegrationExample/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 external/ExternalIntegrationExample/README.md diff --git a/external/ExternalIntegrationExample/README.md b/external/ExternalIntegrationExample/README.md new file mode 100644 index 0000000000..07c22aee31 --- /dev/null +++ b/external/ExternalIntegrationExample/README.md @@ -0,0 +1,8 @@ +# ExternalIntegrationExample + +This directory serves as a minimal example for testing integration of MLOS with an external C++ example. + +It generally does not depend on anything in the rest of the MLOS repo other than the header files and C# NuGet packages that its build produces. + +TODO: Extend this to work for a real example (e.g. LevelDB, MySQL, etc.) + From 627dff7325795f37652814074375d303eb62d2e9 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 11 Nov 2020 17:46:49 -0600 Subject: [PATCH 46/62] fix path --- external/ExternalIntegrationExample/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ExternalIntegrationExample/.gitignore b/external/ExternalIntegrationExample/.gitignore index 6fd4d52877..c10c9e9683 100644 --- a/external/ExternalIntegrationExample/.gitignore +++ b/external/ExternalIntegrationExample/.gitignore @@ -1,3 +1,3 @@ # Ignore the local MLOS codegen output for this example: ./Mlos.CodeGen.out/ -./ExternalIntegrationExample/.nuget/ +.nuget/ From 8e900f9291b8a64379892f0e47f7c99e1175e31e Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 13 Nov 2020 21:51:48 -0600 Subject: [PATCH 47/62] back out some old comments --- build.cake | 12 ++++-------- build/DotnetWrapperRules.mk | 8 +------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/build.cake b/build.cake index b0fd7c1f26..a1d9d68eeb 100644 --- a/build.cake +++ b/build.cake @@ -366,12 +366,7 @@ private IEnumerable CollectFilesAsNugetContent(string inputDirPat } } -// Note: this target currently fails on Linux due to lack of nuspec support by dotnet. -// Fixing this would require a mono install as well, which is a bit excessive. -// Task("Create-Nuget-Package") - .IsDependentOn("Build-NetCore") - .IsDependentOn("Binplace-CMake") .Does(()=> { var sourcePath = new DirectoryPath("./source/Mlos.Core"); @@ -399,9 +394,7 @@ Task("Create-Nuget-Package") string assemblyPath = mlosNetCoreSpec.Source; var asmVersion = FileVersionInfo.GetVersionInfo(assemblyPath); - // FIXME: This currently lacks "dependency" elements for the Projects that make up the nuget package. - - // Create nuget package in Target directory. + // Create nuget package in Taget directory. // NuGetPack("./nuspec/Mlos.nuspec", new NuGetPackSettings @@ -521,6 +514,9 @@ Task("Default") .IsDependentOn("Test-CMake") .IsDependentOn("Generate-MlosModelServices-Dockerfile"); +// .IsDependentOn("Create-Nuget-Package") +// .IsDependentOn("Test-Docker-E2E"); + // // EXECUTION // diff --git a/build/DotnetWrapperRules.mk b/build/DotnetWrapperRules.mk index b348de4f6f..245f073d99 100644 --- a/build/DotnetWrapperRules.mk +++ b/build/DotnetWrapperRules.mk @@ -19,7 +19,6 @@ endif DotnetBaseOutDir := $(MLOS_ROOT)/out/dotnet DotnetBasePkgDir := $(MLOS_ROOT)/target/pkg/$(CONFIGURATION) DotnetOutputPath := $(DotnetBaseOutDir)/$(RelativeSourceDir) -NugetPackagesDir := $(MLOS_ROOT)/tools/.nuget/packages # Find all the *.csproj, dirs.proj files in this directory and make some # corresponding fake targets for the "all" target to depend on. @@ -123,11 +122,6 @@ dotnet-pkgs-clean: $(RM) $(DotnetBasePkgDir) @ $(MKDIR) $(DotnetBasePkgDir) -.PHONY: nuget-clean -nuget-clean: - @ $(RM) $(NugetPackagesDir) - @ $(MKDIR) $(NugetPackagesDir) - handledtargets += $(Csprojs) $(DirsProj) \ dotnet-build $(CsprojBuildTargets) $(DirsProjBuildTarget) \ dotnet-build-quick $(CsprojBuildQuickTargets) \ @@ -135,4 +129,4 @@ handledtargets += $(Csprojs) $(DirsProj) \ dotnet-test $(CsprojTestTargets) $(DirsProjTestTarget) \ dotnet-clean $(CsprojCleanTargets) $(DirsProjCleanTarget) \ dotnet-clean-quick $(CsprojCleanQuickTargets) \ - dotnet-install dotnet-pkgs-clean dotnet-distclean nuget-clean + dotnet-install dotnet-pkgs-clean dotnet-distclean From e630ec62ca71b9f5ac2e428082d6bfeeedbe06a9 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 13 Nov 2020 22:05:15 -0600 Subject: [PATCH 48/62] checkout the whole history so that GitVersionTask can do its thing --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28cc42e7ce..8f1c44b1a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,6 +33,8 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Runs multiple commands using the runners shell - name: Run ${{ matrix.configuration }} msbuild timeout-minutes: 15 @@ -224,6 +226,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 From 54d4dc20ca9ccef1ba5d3e2de6ae5e4bf8097ccd Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 13 Nov 2020 22:22:00 -0600 Subject: [PATCH 49/62] Fixup for CI runner scenario There the main branch is never checked out, so we need to adjust the regex used to match against the upstream main as well. --- GitVersion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitVersion.yml b/GitVersion.yml index 5f69e41578..eeeb4a9798 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -14,7 +14,7 @@ increment: Patch branches: master: # Remove the "master" branch name from consideration. - regex: ^main$ + regex: ^((origin|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. From 72050f09e510eef1d4cec9cc17505ab008eb7d7b Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 13 Nov 2020 22:27:34 -0600 Subject: [PATCH 50/62] build the packages and test restoring them during CI --- .github/workflows/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f46048529..cb507420b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -283,6 +283,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 From 817bf6dbfee3929d523e25a4cb009a63ac974860 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 10:58:05 -0600 Subject: [PATCH 51/62] fix a race condition --- build/Mlos.Common.targets | 4 ++-- build/Mlos.MetaProj.targets | 8 ++++---- .../Mlos.NetCore.Components.Packages.proj | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build/Mlos.Common.targets b/build/Mlos.Common.targets index 3412d51ab4..f78152b079 100644 --- a/build/Mlos.Common.targets +++ b/build/Mlos.Common.targets @@ -1,7 +1,7 @@ - - + + diff --git a/build/Mlos.MetaProj.targets b/build/Mlos.MetaProj.targets index 4f7d051e51..15d13cc2c7 100644 --- a/build/Mlos.MetaProj.targets +++ b/build/Mlos.MetaProj.targets @@ -2,19 +2,19 @@ - - - - diff --git a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj index 48d987fb70..2dbe1c3ddc 100644 --- a/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj +++ b/source/Mlos.NetCore.Components.Packages/Mlos.NetCore.Components.Packages.proj @@ -25,7 +25,6 @@ --> - + From b451f9250f7cbc2ec4c30cc473df75aeebba02b5 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 10:58:56 -0600 Subject: [PATCH 52/62] windows version of msbuild/nuget didn't have PackageName property - just NuGetPackageId --- .../build/Mlos.SettingsSystem.CodeGen.targets | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 29eeafe3d7..88f6d61c23 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -107,9 +107,11 @@ - - @(RuntimeCopyLocalItems->'%(PackageName)') - @(RuntimeCopyLocalItems->'%(PackageVersion)') + + @(RuntimeCopyLocalItems->'%(NuGetPackageId)') + @(RuntimeCopyLocalItems->'%(PackageName)') + @(RuntimeCopyLocalItems->'%(NuGetPackageVersion)') + @(RuntimeCopyLocalItems->'%(PackageVersion)') From 8b425f920910148b5d7368afd0afec7a87eb80f4 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:01:38 -0600 Subject: [PATCH 53/62] improve basic Makefile --- .../Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile index db8ab89016..9ad323ab16 100644 --- a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile +++ b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/Makefile @@ -1,15 +1,17 @@ +CONFIGURATION ?= Release + all: dotnet-build clean: dotnet-clean dotnet-build: - dotnet build /p:PackMlosDependencies=true + dotnet build $(MSBUILD_ARGS) -c $(CONFIGURATION) /p:PackMlosDependencies=true dotnet-build-quick: - dotnet build --no-restore + dotnet build $(MSBUILD_ARGS) -c $(CONFIGURATION) --no-restore dotnet-rebuild-all: - dotnet build /p:PackMlosDependencies=true /p:CleanMlosPackages=true + dotnet build $(MSBUILD_ARGS) -c $(CONFIGURATION) /p:PackMlosDependencies=true /p:CleanMlosPackages=true dotnet-clean: - dotnet build --no-restore /t:clean + dotnet build $(MSBUILD_ARGS) -c $(CONFIGURATION) --no-restore /t:clean From 93269615621035462485f06a9c29d3d9a1b9b2db Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:02:14 -0600 Subject: [PATCH 54/62] removing this file for now - will add it back in future cmake PR --- .../CMakeLists.txt | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt diff --git a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt deleted file mode 100644 index 81b7fa4dbb..0000000000 --- a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# This project also does the SettingsProvider code generation. - -project(ExternalIntegrationExample.SettingsRegistry LANGUAGES NONE) - -# TODO: FIXME: Develop cmake patterns for settings registries for external projects to use. - -#get_filename_component(MLOS_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) -#include("${MLOS_ROOT}/build/Mlos.Common.cmake") -#include("${MLOS_ROOT}/build/Mlos.NetCore.cmake") -# -#add_mlos_dotnet_project(NAME ${PROJECT_NAME} -# DIRECTORY ${PROJECT_SOURCE_DIR} -# MLOS_SETTINGS_REGISTRY -# WITH_BINPLACE) From 63bc311683baf912082903efa1fc4cd89df6aaf6 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:06:06 -0600 Subject: [PATCH 55/62] fix a comment --- build/Mlos.NetCore.Package.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Mlos.NetCore.Package.props b/build/Mlos.NetCore.Package.props index af0a44a43c..e479c3b32f 100644 --- a/build/Mlos.NetCore.Package.props +++ b/build/Mlos.NetCore.Package.props @@ -29,7 +29,7 @@ true snupkg From 66f8a65fba769c65f6fdf6ab16a772ee5eb8db8c Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:08:27 -0600 Subject: [PATCH 56/62] fix some indents --- .../build/Common.props | 4 ++-- .../build/Mlos.SettingsSystem.CodeGen.targets | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props index 46fa064d25..048e97954a 100644 --- a/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props +++ b/external/ExternalIntegrationExample/ExternalIntegrationExample.SettingsRegistry/build/Common.props @@ -41,7 +41,7 @@ - + all runtime; build; native; contentfiles; analyzers @@ -50,7 +50,7 @@ all runtime; build; native; contentfiles; analyzers - + stylecop.json diff --git a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets index 88f6d61c23..bb1e162879 100644 --- a/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets +++ b/source/Mlos.SettingsSystem.CodeGen/build/Mlos.SettingsSystem.CodeGen.targets @@ -136,7 +136,7 @@ - + From c54236070301803e1ace29a72655864dbd68891f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:19:05 -0600 Subject: [PATCH 57/62] update comment --- GitVersion.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GitVersion.yml b/GitVersion.yml index eeeb4a9798..b21c72144d 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -14,7 +14,8 @@ increment: Patch branches: master: # Remove the "master" branch name from consideration. - regex: ^((origin|github)/)?main$ + # 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. From 9aa87c431b706062719943e7c6d5159e4fb8615b Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:31:13 -0600 Subject: [PATCH 58/62] start to enable pack/test on windows CI --- .github/workflows/main.yml | 8 +++++++- scripts/package.windows.cmd | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 scripts/package.windows.cmd diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb507420b0..a2fc45cef7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,12 +36,18 @@ jobs: with: fetch-depth: 0 # 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 diff --git a/scripts/package.windows.cmd b/scripts/package.windows.cmd new file mode 100644 index 0000000000..62e24ad924 --- /dev/null +++ b/scripts/package.windows.cmd @@ -0,0 +1,21 @@ +:: Copyright (c) Microsoft Corporation. +:: Licensed under the MIT License. + +@echo off +rem Package script for Windows. Used in Github Actions for continuous integration checks. +rem Note: "set Configuration={Release or Debug}" to switch the build type. + +rem Move to the root of the repo. +pushd "%~dp0\.." + +rem Setup the build environment. +call .\scripts\init.windows.cmd + +rem Use msbuild to effectively call "dotnet pack" on a number of projects. +msbuild /m /r .\source\Mlos.NetCore.Components.Packages\Mlos.NetCore.Components.Packages.proj +rem Now, use those to build an external integration example project. +dotnet build .\external\ExternalIntegrationExample\ExternalIntegrationExample.SettingsRegistry\ExternalIntegrationExample.SettingsRegistry.csproj + +popd +@echo on +exit /B %ERRORLEVEL% From 2e45df3a897334ae5dd1b21bff2afb8a26dd4c78 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:26:14 -0600 Subject: [PATCH 59/62] add pack target for top level makefile --- Makefile | 4 ++++ build/Common.mk | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a2eef5ddee..c03d0efe3b 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,10 @@ 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 diff --git a/build/Common.mk b/build/Common.mk index 01c0eaa037..3bed9a474f 100644 --- a/build/Common.mk +++ b/build/Common.mk @@ -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 From d9770b83ee79c970cf8649d055c50858447b16be Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 16 Nov 2020 11:49:31 -0600 Subject: [PATCH 60/62] finish removing a target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c03d0efe3b..bfd1a3e16f 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ pack: clean: cmake-clean dotnet-clean grpc-clean mlos-codegen-clean website-clean python-clean .PHONY: distclean -distclean: clean dotnet-distclean dotnet-pkgs-clean cmake-distclean nuget-clean +distclean: clean dotnet-distclean dotnet-pkgs-clean cmake-distclean .PHONY: rebuild rebuild: clean all From 720aa7ba8e1fd5f2a2fc68168f5d99eae37aa4f0 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Tue, 17 Nov 2020 09:52:01 -0600 Subject: [PATCH 61/62] Slight tweaks for non-pipeline builds on the ADO repo This works around the fact that GitVersionTask doesn't support pre-release tags (the only kinds we have for the "master" branch in ADO atm), when attempting to compute the current "version" as an offset from the last tag in Mainline mode. Instead, we detect when we're on the ADO branch by looking for the ADO `.pipelines\pipeline.windows.yml` file and disable GitVersionTask in that case. Also, since Mlos.NetCore.Components.Packages.proj is not a .csproj, it doesn't include the `build/version/Mlos.NetCore.Version.props` file, so we move those property definitions to `build/Mlos.Common.props`. Note that this doesn't prevent that project from packaging things when built on ADO (though it isn't included by default in `dirs.proj`), so one could still test the `ExternalIntegrationExample.SettingsRegistry.csproj` manually, however the versions of the `.nupkg` files it produces will currently always be `1.0.0` so some additional effort may be required to replace previously restored packages using that version. --- build/Mlos.Common.props | 6 ++++++ build/versions/Mlos.NetCore.Version.props | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build/Mlos.Common.props b/build/Mlos.Common.props index fda04d4519..bf45ccff36 100644 --- a/build/Mlos.Common.props +++ b/build/Mlos.Common.props @@ -32,6 +32,12 @@ $(BaseDir)\out\Mlos.CodeGen.out\$(BuildType) + + + + true + true + 4 diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index 1fef5d1d63..4709fe3680 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -15,15 +15,11 @@ Properties\PipelineAssemblyInfo.cs - - - true - false - true + true false - + All From cb883d91d0cb410f33414c3d67f6a40fa65bee54 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Tue, 17 Nov 2020 13:24:23 -0600 Subject: [PATCH 62/62] try to work around a gitversion parallel workers issue on build servers https://github.com/GitTools/GitVersion/issues/1381 --- build/versions/Mlos.NetCore.Version.props | 1 + 1 file changed, 1 insertion(+) diff --git a/build/versions/Mlos.NetCore.Version.props b/build/versions/Mlos.NetCore.Version.props index 4709fe3680..b764badb0d 100644 --- a/build/versions/Mlos.NetCore.Version.props +++ b/build/versions/Mlos.NetCore.Version.props @@ -31,6 +31,7 @@ true false true + false