diff --git a/build_projects/dotnet-host-build/CompileTargets.cs b/build_projects/dotnet-host-build/CompileTargets.cs index cf2b5464a..1f7e0be2a 100644 --- a/build_projects/dotnet-host-build/CompileTargets.cs +++ b/build_projects/dotnet-host-build/CompileTargets.cs @@ -106,6 +106,7 @@ namespace Microsoft.DotNet.Host.Build var ridMacro = $"-DCLI_CMAKE_RUNTIME_ID:STRING={rid}"; var arch = IsWinx86 ? "x86" : "x64"; var baseSupportedRid = $"win7-{arch}"; + var cmakeHostVer = $"-DCLI_CMAKE_HOST_VER:STRING={hostVersion.LatestHostVersion}"; var cmakeHostPolicyVer = $"-DCLI_CMAKE_HOST_POLICY_VER:STRING={hostVersion.LatestHostPolicyVersion}"; var cmakeHostFxrVer = $"-DCLI_CMAKE_HOST_FXR_VER:STRING={hostVersion.LatestHostFxrVersion}"; var cmakeBaseRid = $"-DCLI_CMAKE_PKG_RID:STRING={baseSupportedRid}"; @@ -115,6 +116,7 @@ namespace Microsoft.DotNet.Host.Build corehostSrcDir, archMacro, ridMacro, + cmakeHostVer, cmakeHostFxrVer, cmakeHostPolicyVer, cmakeBaseRid, @@ -149,6 +151,8 @@ namespace Microsoft.DotNet.Host.Build ExecIn(cmakeOut, Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost", "build.sh"), "--arch", "x64", + "--hostver", + hostVersion.LatestHostVersion, "--fxrver", hostVersion.LatestHostFxrVersion, "--policyver", @@ -187,6 +191,7 @@ namespace Microsoft.DotNet.Host.Build .Environment("__WorkaroundCliCoreHostFxrVer", hostVersion.LatestHostFxrVersionNoSuffix) .Environment("__WorkaroundCliCoreHostVer", hostVersion.LatestHostVersionNoSuffix) .Environment("__WorkaroundCliCoreHostBuildMajor", hostVersion.LatestHostBuildMajor) + .Environment("__WorkaroundCliCoreHostBuildMinor", hostVersion.LatestHostBuildMinor) .Environment("__WorkaroundCliCoreHostVersionTag", hostVersion.LatestHostPrerelease) .ForwardStdOut() .ForwardStdErr() @@ -206,8 +211,10 @@ namespace Microsoft.DotNet.Host.Build hostVersion.LatestHostFxrVersionNoSuffix, "--hostver", hostVersion.LatestHostVersionNoSuffix, - "--build", + "--build-major", hostVersion.LatestHostBuildMajor, + "--build-minor", + hostVersion.LatestHostBuildMinor, "--vertag", hostVersion.LatestHostPrerelease); } diff --git a/build_projects/shared-build-targets-utils/Utils/HostVersion.cs b/build_projects/shared-build-targets-utils/Utils/HostVersion.cs index 17f8dd867..b57ee8cd5 100644 --- a/build_projects/shared-build-targets-utils/Utils/HostVersion.cs +++ b/build_projects/shared-build-targets-utils/Utils/HostVersion.cs @@ -24,7 +24,8 @@ namespace Microsoft.DotNet.Cli.Build public string LatestHostPolicyVersionNoSuffix => $"{Major}.{Minor}.{Patch}"; public string LatestHostPrerelease => ReleaseSuffix; public string LatestHostBuildMajor => $"{CommitCountString}"; - public string LatestHostSuffix => $"{ReleaseSuffix}-{LatestHostBuildMajor}-00"; + public string LatestHostBuildMinor => "00"; + public string LatestHostSuffix => $"{ReleaseSuffix}-{LatestHostBuildMajor}-{LatestHostBuildMinor}"; // Full versions and package information. public string LatestHostVersion => $"{LatestHostVersionNoSuffix}-{LatestHostSuffix}"; diff --git a/pkg/dir.props b/pkg/dir.props index 187591ee2..6aeb69e14 100644 --- a/pkg/dir.props +++ b/pkg/dir.props @@ -44,9 +44,9 @@ - $(HostPolicyVersion)-$(PreReleaseLabel)-$(BuildNumberMajor) - $(HostResolverVersion)-$(PreReleaseLabel)-$(BuildNumberMajor) - $(HostVersion)-$(PreReleaseLabel)-$(BuildNumberMajor) + $(HostPolicyVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor) + $(HostResolverVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor) + $(HostVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor) @@ -55,5 +55,6 @@ + diff --git a/pkg/pack.cmd b/pkg/pack.cmd index 414a40edd..96ce7a682 100644 --- a/pkg/pack.cmd +++ b/pkg/pack.cmd @@ -15,6 +15,7 @@ set __HostVer=%__WorkaroundCliCoreHostVer% set __FxrVer=%__WorkaroundCliCoreHostFxrVer% set __PolicyVer=%__WorkaroundCliCoreHostPolicyVer% set __BuildMajor=%__WorkaroundCliCoreHostBuildMajor% +set __BuildMinor=%__WorkaroundCliCoreHostBuildMinor% set __VersionTag=%__WorkaroundCliCoreHostVersionTag% :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -37,7 +38,8 @@ if /i "%1" == "/hostbindir" (set __DotNetHostBinDir=%2&shift&shift&goto if /i "%1" == "/hostver" (set __HostVer=%2&shift&shift&goto Arg_Loop) if /i "%1" == "/fxrver" (set __FxrVer=%2&shift&shift&goto Arg_Loop) if /i "%1" == "/policyver" (set __PolicyVer=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "/build" (set __BuildMajor=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "/buildmajor" (set __BuildMajor=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "/buildminor" (set __BuildMinor=%2&shift&shift&goto Arg_Loop) if /i "%1" == "/vertag" (set __VersionTag=%2&shift&shift&goto Arg_Loop) echo Invalid command line argument: %1 @@ -63,7 +65,7 @@ if exist "%__ProjectDir%\bin" (rmdir /s /q "%__ProjectDir%\bin") copy /y "%__DotNetHostBinDir%\corehost.exe" "%__DotNetHostBinDir%\dotnet.exe" -"%__ProjectDir%\Tools\corerun" "%__ProjectDir%\Tools\MSBuild.exe" "%__ProjectDir%\projects\packages.builds" /p:Platform=%__BuildArch% /p:DotNetHostBinDir=%__DotNetHostBinDir% /p:TargetsWindows=true /p:HostVersion=%__HostVer% /p:HostResolverVersion=%__FxrVer% /p:HostPolicyVersion=%__PolicyVer% /p:BuildNumberMajor=%__BuildMajor% /p:PreReleaseLabel=%__VersionTag% /p:CLIBuildVersion=%__BuildMajor% /verbosity:minimal +"%__ProjectDir%\Tools\corerun" "%__ProjectDir%\Tools\MSBuild.exe" "%__ProjectDir%\projects\packages.builds" /p:Platform=%__BuildArch% /p:DotNetHostBinDir=%__DotNetHostBinDir% /p:TargetsWindows=true /p:HostVersion=%__HostVer% /p:HostResolverVersion=%__FxrVer% /p:HostPolicyVersion=%__PolicyVer% /p:BuildNumberMajor=%__BuildMajor% /p:BuildNumberMinor=%__BuildMinor% /p:PreReleaseLabel=%__VersionTag% /p:CLIBuildVersion=%__BuildMajor% /verbosity:minimal if not ERRORLEVEL 0 goto :Error diff --git a/pkg/pack.sh b/pkg/pack.sh index 70c1ff17d..0199918f6 100755 --- a/pkg/pack.sh +++ b/pkg/pack.sh @@ -41,6 +41,7 @@ __host_ver= __fxr_ver= __policy_ver= __build_major= +__build_minor= __version_tag= # parse arguments @@ -71,10 +72,14 @@ while [ "$1" != "" ]; do shift __policy_ver=$1 ;; - --build) + --build-major) shift __build_major=$1 ;; + --build-minor) + shift + __build_minor=$1 + ;; --vertag) shift __version_tag=$1 @@ -116,7 +121,7 @@ else init_distro_name fi -__common_parameters="/p:Platform=$__build_arch /p:DotNetHostBinDir=$__dotnet_host_bin_dir /p:$__targets_param /p:DistroName=$__distro_name /p:HostVersion=$__host_ver /p:HostResolverVersion=$__fxr_ver /p:HostPolicyVersion=$__policy_ver /p:BuildNumberMajor=$__build_major /p:PreReleaseLabel=$__version_tag /p:CLIBuildVersion=$__build_major /verbosity:minimal" +__common_parameters="/p:Platform=$__build_arch /p:DotNetHostBinDir=$__dotnet_host_bin_dir /p:$__targets_param /p:DistroName=$__distro_name /p:HostVersion=$__host_ver /p:HostResolverVersion=$__fxr_ver /p:HostPolicyVersion=$__policy_ver /p:BuildNumberMajor=$__build_major /p:BuildNumberMinor=$__build_minor /p:PreReleaseLabel=$__version_tag /p:CLIBuildVersion=$__build_major /verbosity:minimal" $__corerun $__msbuild $__project_dir/projects/packages.builds $__common_parameters || exit 1 diff --git a/src/corehost/build.sh b/src/corehost/build.sh index 297965e99..443a4322b 100755 --- a/src/corehost/build.sh +++ b/src/corehost/build.sh @@ -27,11 +27,12 @@ init_distro_name_and_rid() usage() { - echo "Usage: $0 --arch --rid --fxrver --policyver --commithash [--xcompiler ]" + echo "Usage: $0 --arch --rid --hostver --fxrver --policyver --commithash [--xcompiler ]" echo "" echo "Options:" echo " --arch Target Architecture (amd64, x86, arm)" echo " --rid Target Runtime Identifier" + echo " --hostver Version of the dotnet executable" echo " --fxrver Version of the hostfxr library" echo " --policyver Version of the hostpolicy library" echo " --commithash Current commit hash of the repo at build time" @@ -53,6 +54,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" __build_arch= __runtime_id= +__host_ver= __policy_ver= __fxr_ver= __CrossBuild=0 @@ -73,6 +75,10 @@ while [ "$1" != "" ]; do shift __runtime_id=$1 ;; + --hostver) + shift + __host_ver=$1 + ;; --fxrver) shift __fxr_ver=$1 @@ -139,9 +145,9 @@ __base_rid=$__rid_plat-$__build_arch_lowcase echo "Building Corehost from $DIR to $(pwd)" set -x # turn on trace if [ $__CrossBuild == 1 ]; then - cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash -DCMAKE_CXX_COMPILER="$__CrossCompiler" + cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_VER:STRING=$__host_ver -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash -DCMAKE_CXX_COMPILER="$__CrossCompiler" else - cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash + cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCLI_CMAKE_HOST_VER:STRING=$__host_ver -DCLI_CMAKE_HOST_FXR_VER:STRING=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER:STRING=$__policy_ver -DCLI_CMAKE_PKG_RID:STRING=$__base_rid -DCLI_CMAKE_COMMIT_HASH:STRING=$__commit_hash fi set +x # turn off trace make diff --git a/src/corehost/cli/fxr/hostfxr.cpp b/src/corehost/cli/fxr/hostfxr.cpp index 1929f41cd..010cadc86 100644 --- a/src/corehost/cli/fxr/hostfxr.cpp +++ b/src/corehost/cli/fxr/hostfxr.cpp @@ -76,6 +76,16 @@ int execute_app( return code; } +static char sccsid[] = "@(#)" \ + HOST_PKG_VER \ + "; Commit Hash: " \ + REPO_COMMIT_HASH \ + "; Built on: " \ + __DATE__ \ + " " \ + __TIME__ \ + ; + SHARED_API int hostfxr_main(const int argc, const pal::char_t* argv[]) { trace::setup(); diff --git a/src/corehost/cli/hostpolicy.cpp b/src/corehost/cli/hostpolicy.cpp index 686883b59..93ad5c305 100644 --- a/src/corehost/cli/hostpolicy.cpp +++ b/src/corehost/cli/hostpolicy.cpp @@ -222,6 +222,16 @@ SHARED_API int corehost_load(host_interface_t* init) return 0; } +static char sccsid[] = "@(#)" \ + HOST_PKG_VER \ + "; Commit Hash: " \ + REPO_COMMIT_HASH \ + "; Built on: " \ + __DATE__ \ + " " \ + __TIME__ \ + ; + SHARED_API int corehost_main(const int argc, const pal::char_t* argv[]) { if (trace::is_enabled()) diff --git a/src/corehost/cli/setup.cmake b/src/corehost/cli/setup.cmake index 5658a5acf..54b3d9f71 100644 --- a/src/corehost/cli/setup.cmake +++ b/src/corehost/cli/setup.cmake @@ -76,6 +76,12 @@ else() add_definitions(-DHOST_FXR_PKG_VER="${CLI_CMAKE_HOST_FXR_VER}") endif() +if("${CLI_CMAKE_HOST_VER}" STREQUAL "") + message(FATAL_ERROR "Dotnet host version is not specified") +else() + add_definitions(-DHOST_PKG_VER="${CLI_CMAKE_HOST_VER}") +endif() + if("${CLI_CMAKE_PKG_RID}" STREQUAL "") message(FATAL_ERROR "A minimum supported package rid is not specified (ex: win7-x86 or ubuntu.14.04-x64, osx.10.10-x64, rhel.7-x64)") else() diff --git a/src/corehost/corehost.cpp b/src/corehost/corehost.cpp index a904a41c7..95b1ba6ac 100644 --- a/src/corehost/corehost.cpp +++ b/src/corehost/corehost.cpp @@ -86,6 +86,17 @@ int run(const int argc, const pal::char_t* argv[]) return code; } +static char sccsid[] = "@(#)" \ + "version: " \ + HOST_PKG_VER \ + "; commit: " \ + REPO_COMMIT_HASH \ + "; built: " \ + __DATE__ \ + " " \ + __TIME__ \ + ; + #if defined(_WIN32) int __cdecl wmain(const int argc, const pal::char_t* argv[]) #else @@ -94,9 +105,10 @@ int main(const int argc, const pal::char_t* argv[]) { trace::setup(); +printf("%s\n", sccsid); if (trace::is_enabled()) { - trace::info(_X("--- Invoked dotnet [commit hash: %s] main = {"), _STRINGIFY(REPO_COMMIT_HASH)); + trace::info(_X("--- Invoked dotnet [version: %s, commit hash: %s] main = {"), _STRINGIFY(HOST_PKG_VER), _STRINGIFY(REPO_COMMIT_HASH)); for (int i = 0; i < argc; ++i) { trace::info(_X("%s"), argv[i]);