Stabilize versioning for tools and fix native asset versioning (#2745)
authorJuan Hoyos <juan.s.hoyos@outlook.com>
Thu, 11 Nov 2021 22:35:14 +0000 (14:35 -0800)
committerGitHub <noreply@github.com>
Thu, 11 Nov 2021 22:35:14 +0000 (14:35 -0800)
* Bump tooling version to 6.0
* Make dotnet tools ship as stable on nightly
This allows for a more seamless experience dogfooding daily builds - where an upgrade is transparent regardless of daily vs official build.
* Fix versioning issues for Linux variants

CMakeLists.txt
eng/Build-Native.cmd
eng/CreateVersionFile.csproj
eng/Versions.props
eng/build.sh
eng/versioning.targets [deleted file]
eng/windows-compiler-override.txt [deleted file]
src/Tools/Directory.Build.props

index cf999d7e764b2b7dffb64c133548dfc726c12482..93edd88858b226281acd527523debce49332bf72 100644 (file)
@@ -50,7 +50,7 @@ endif (NOT WIN32)
 
 # Where _version.h for Windows is generated
 if (WIN32)
-include_directories("${CMAKE_BINARY_DIR}")
+include_directories(${CLR_ARTIFACTS_OBJ_DIR})
 endif (WIN32)
 
 set(CORECLR_SET_RPATH ON)
index f2f30546295f7f58343e60d95eba1378221da973..d9d5b46f79e1dc65aedff6de291257af94ac1380 100644 (file)
@@ -112,7 +112,8 @@ echo %NUGET_PACKAGES%
 set "__RootBinDir=%__ProjectDir%\artifacts"
 set "__BinDir=%__RootBinDir%\bin\%__BuildOS%.%__BuildArch%.%__BuildType%"
 set "__LogDir=%__RootBinDir%\log\%__BuildOS%.%__BuildArch%.%__BuildType%"
-set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
+set "__ArtifactsIntermediatesDir=%__RootBinDir%\obj"
+set "__IntermediatesDir=%__ArtifactsIntermediatesDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
 set "__PackagesBinDir=%__RootBinDir%\packages\%__BuildType%\Shipping"
 
 set "__CrossComponentBinDir=%__BinDir%"
@@ -177,7 +178,7 @@ if /i %__BuildCrossArch% EQU 1 (
 
     echo Generating Version Header
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h %__CommonBuildArgs%
+    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         goto ExitWithError
@@ -251,7 +252,7 @@ if %__Build% EQU 1 (
 
     echo Generating Version Header
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h %__CommonBuildArgs%
+    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         goto ExitWithError
index e2cfe25269288a152e664acb68920082c1262ef8..f3d5d149122c275be17353789ba13a6a40edc8fd 100644 (file)
       </NativeVersionLines>
     </PropertyGroup>
 
-    <WriteLinesToFile File="$(NativeVersionHeaderFile)" Lines="$(NativeVersionLines.Replace(';', '%3B'))" Overwrite="true" />
+    <WriteLinesToFile File="$(NativeVersionHeaderFile)"
+                      Lines="$(NativeVersionLines.Replace(';', '%3B'))"
+                      Overwrite="true"
+                      WriteOnlyWhenDifferent="true" />
 
     <ItemGroup>
       <FileWrites Include="$(NativeVersionHeaderFile)" />
@@ -81,7 +84,10 @@ char sccsid[] __attribute__((used)) = "@(#)Version $(InformationalVersion)$(Buil
       </NativeVersionLines>
     </PropertyGroup>
 
-    <WriteLinesToFile File="$(NativeVersionSourceFile)" Lines="$(NativeVersionLines.Replace(';', '%3B'))" Overwrite="true" />
+    <WriteLinesToFile File="$(NativeVersionSourceFile)"
+                      Lines="$(NativeVersionLines.Replace(';', '%3B'))"
+                      Overwrite="true"
+                      WriteOnlyWhenDifferent="true" />
 
     <ItemGroup>
       <FileWrites Include="$(NativeVersionSourceFile)" />
index 70abc1d860e7b39a94d7055e5355b63a5f1252d5..92c729b9c471e607eb1c6afdf11f7a9f71f9643a 100644 (file)
@@ -2,7 +2,7 @@
   <PropertyGroup>
     <RepositoryUrl>https://github.com/dotnet/diagnostics</RepositoryUrl>
     <PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
-    <VersionPrefix>5.0.0</VersionPrefix>
+    <VersionPrefix>6.0.0</VersionPrefix>
     <DotNetUseShippingVersions>true</DotNetUseShippingVersions>
     <AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
   </PropertyGroup>
index 4249807ff0c88161a9713c5eb2bc09cd658e49bf..61824484c1741141a7fb903dbe39d6a387013204 100755 (executable)
@@ -198,6 +198,25 @@ fi
 # Build native components
 #
 if [[ "$__NativeBuild" == 1 ]]; then
+    echo "Generating Version Source File"
+    __GenerateVersionLog="$__LogsDir/GenerateVersion.binlog"
+
+    "$__RepoRootDir/eng/common/msbuild.sh" \
+        $__RepoRootDir/eng/CreateVersionFile.csproj \
+        /bl:$__GenerateVersionLog \
+        /t:GenerateVersionFiles \
+        /restore \
+        /p:GenerateVersionSourceFile=true \
+        /p:NativeVersionSourceFile="$__ArtifactsIntermediatesDir/_version.c" \
+        /p:Configuration="$__BuildType" \
+        /p:Platform="$__BuildArch" \
+        $__UnprocessedBuildArgs
+
+    if [ $? != 0 ]; then
+        echo "Generating Version Source File FAILED"
+        exit 1
+    fi
+
     build_native "$__TargetOS" "$__BuildArch" "$__RepoRootDir" "$__IntermediatesDir" "install" "$__ExtraCmakeArgs" "diagnostic component" | tee "$__LogsDir"/make.log
 fi
 
diff --git a/eng/versioning.targets b/eng/versioning.targets
deleted file mode 100644 (file)
index 4dacec0..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<Project>
-  <PropertyGroup>
-    <GenerateAssemblyInfo Condition="'$(GenerateAssemblyInfo)'==''">true</GenerateAssemblyInfo>
-  </PropertyGroup>
-
-  <PropertyGroup Condition="'$(GenerateAssemblyInfo)'=='true'">
-    <AssemblyInfoFile Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(IntermediateOutputPath)_AssemblyInfo.cs</AssemblyInfoFile>
-    <AssemblyInfoFile Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(IntermediateOutputPath)_AssemblyInfo.vb</AssemblyInfoFile>
-  </PropertyGroup>
-
-  <!-- Assembly metadata indicating that an assembly is a framework (as opposed to user) assembly:
-       Test projects need to not have this because of the way "IsFrameworkAssembly" APIs work to check this. -->
-  <ItemGroup Condition="'$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'" >
-    <AssemblyMetadata Include=".NETFrameworkAssembly">
-      <Value></Value>
-    </AssemblyMetadata>
-    <AssemblyMetadata Include="Serviceable">
-      <Value>True</Value>
-    </AssemblyMetadata>
-    <AssemblyMetadata Include="PreferInbox">
-      <Value>True</Value>
-    </AssemblyMetadata>
-    <AssemblyMetadata Include="IsTrimmable" Condition="'$(SetIsTrimmable)' != 'false'">
-      <Value>True</Value>
-    </AssemblyMetadata>
-  </ItemGroup>
-
-  <PropertyGroup Condition="'$(TargetsAnyOS)' == 'true' and !$(TargetFrameworks.Contains('$(TargetFramework)-Browser'))">
-      <CrossPlatformAndHasNoBrowserTarget>true</CrossPlatformAndHasNoBrowserTarget>
-  </PropertyGroup>
-
-  <!-- Enables warnings for Android, iOS, tvOS and macCatalyst for all builds -->
-  <ItemGroup>
-    <SupportedPlatform Include="Android" />
-    <SupportedPlatform Include="iOS" />
-    <SupportedPlatform Include="tvOS" />
-    <SupportedPlatform Include="macCatalyst" />
-  </ItemGroup>
-
-  <!-- Enables browser warnings for cross platform or Browser targeted builds -->
-  <ItemGroup Condition="('$(TargetsBrowser)' == 'true' or '$(CrossPlatformAndHasNoBrowserTarget)' == 'true') and '$(IsTestProject)' != 'true'">
-    <SupportedPlatform Include="browser"/>
-  </ItemGroup>
-
-  <!-- Add target platforms into MSBuild SupportedPlatform list -->
-  <ItemGroup Condition="'$(TargetsAnyOS)' != 'true' and '$(IsTestProject)' != 'true'">
-    <SupportedPlatform Condition="'$(Targetsillumos)' == 'true'" Include="illumos"/>
-    <SupportedPlatform Condition="'$(TargetsSolaris)' == 'true'" Include="Solaris"/>
-    <SupportedPlatform Condition="'$(TargetstvOS)' == 'true'" Include="tvOS"/>
-    <SupportedPlatform Condition="'$(TargetsUnix)' == 'true'" Include="Unix"/>
-  </ItemGroup>
-
-  <!-- Adds UnsupportedOSPlatform and SupportedOSPlatform attributes to the assembly when:
-      * This isn't a test project
-      * This is a cross-platform target
-      * The build isn't targeting .NET Framework
-    -->
-  <Target Name="AddOSPlatformAttributes" BeforeTargets="GenerateAssemblyInfo" AfterTargets="PrepareForBuild"
-    Condition="'$(TargetsAnyOS)' == 'true' and '$(IsTestProject)' != 'true' and '$(TargetFrameworkIdentifier)' != '.NETFramework'">
-    <!-- Defensively de-dupe the values -->
-    <ItemGroup>
-      <_unsupportedOSPlatforms Include="$(UnsupportedOSPlatforms)" />
-      <_supportedOSPlatforms Include="$(SupportedOSPlatforms)" />
-    </ItemGroup>
-
-    <ItemGroup Condition="'@(_unsupportedOSPlatforms)' != ''">
-      <!-- Add the assembly attribute -->
-      <AssemblyAttribute Include="System.Runtime.Versioning.UnsupportedOSPlatform">
-        <_Parameter1>%(_unsupportedOSPlatforms.Identity)</_Parameter1>
-      </AssemblyAttribute>
-
-      <!-- Ensure this platform is included in the platforms enabled for the CA1416 analyzer -->
-      <SupportedPlatform Include="%(_unsupportedOSPlatforms.Identity)" />
-    </ItemGroup>
-
-    <ItemGroup Condition="'@(_supportedOSPlatforms)' != ''">
-      <!-- Add the assembly attribute -->
-      <AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatform">
-        <_Parameter1>%(_supportedOSPlatforms.Identity)</_Parameter1>
-      </AssemblyAttribute>
-
-      <!-- Ensure this platform is included in the platforms enabled for the CA1416 analyzer -->
-      <SupportedPlatform Include="%(_supportedOSPlatforms.Identity)" />
-    </ItemGroup>
-  </Target>
-
-  <!-- Add PlatformNeutralAssembly property for targeted builds of cross platform assemblies -->
-  <ItemGroup Condition="'$(TargetsAnyOS)' != 'true' and '$(IsTestProject)' != 'true' and '@(SupportedOSPlatforms)' == ''">
-    <CompilerVisibleProperty Include="PlatformNeutralAssembly" />
-  </ItemGroup>
-
-  <PropertyGroup>
-    <!-- corefx has never generated these attributes so don't let the SDK generate them -->
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
-
-    <!-- corefx has always added a description set to assembly name so include that here -->
-    <Description Condition="'$(Description)' == ''">$(AssemblyName)</Description>
-  </PropertyGroup>
-
-  <Target Name="_ComputeBuildToolsAssemblyInfoAttributes"
-          BeforeTargets="GetAssemblyAttributes">
-    <ItemGroup>
-      <AssemblyAttribute Include="System.Reflection.AssemblyDefaultAliasAttribute">
-        <_Parameter1>$(AssemblyName)</_Parameter1>
-      </AssemblyAttribute>
-
-      <AssemblyAttribute Include="System.Resources.NeutralResourcesLanguage" Condition="'@(EmbeddedResource)' != '' and '$(IsSourceProject)' == 'true'">
-        <_Parameter1>en-US</_Parameter1>
-      </AssemblyAttribute>
-
-      <AssemblyAttribute Include="System.Reflection.AssemblyMetadata"
-                         Condition="'@(AssemblyMetadata)' != ''">
-        <_Parameter1>%(AssemblyMetadata.Identity)</_Parameter1>
-        <_Parameter2>%(AssemblyMetadata.Value)</_Parameter2>
-      </AssemblyAttribute>
-    </ItemGroup>
-  </Target>
-
-  <!-- Work around https://github.com/Microsoft/msbuild/issues/3412 by writing the non-string assembly attributes manually -->
-  <!-- Note: ReferenceAssemblies.targets still uses @(AssemblyInfoLines) as well. So if you remove this, those need to migrate too. -->
-  <Target Name="_WriteNonStringAssemblyInfoAttributes"
-          DependsOnTargets="ResolveReferences"
-          AfterTargets="CoreGenerateAssemblyInfo"
-          BeforeTargets="BeforeCompile;CoreCompile"
-          Inputs="$(MSBuildProjectFile)"
-          Outputs="$(AssemblyInfoFile)">
-
-    <!-- We want to apply the IncludeDllSafeSearchPathAttribute on all source assemblies that may contain DllImport -->
-    <PropertyGroup Condition="'$(IncludeDllSafeSearchPathAttribute)'=='' and '$(IsSourceProject)'== 'true'">
-      <IncludeDllSafeSearchPathAttribute>false</IncludeDllSafeSearchPathAttribute>
-      <!-- We don't need to include it by default. -->
-      <IncludeDllSafeSearchPathAttribute Condition="'%(ReferencePath.Filename)' == 'System.Runtime.InteropServices'">true</IncludeDllSafeSearchPathAttribute>
-      <IncludeDllSafeSearchPathAttribute Condition="'%(ReferencePath.Filename)' == 'System.Private.CoreLib'">true</IncludeDllSafeSearchPathAttribute>
-      <IncludeDllSafeSearchPathAttribute Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard' and '%(ReferencePath.Filename)' == 'netstandard'">true</IncludeDllSafeSearchPathAttribute>
-      <IncludeDllSafeSearchPathAttribute Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '%(ReferencePath.Filename)' == 'mscorlib'">true</IncludeDllSafeSearchPathAttribute>
-    </PropertyGroup>
-
-    <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
-      <AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:System.CLSCompliant(true)]" />
-
-      <AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'"
-        Include="[assembly: System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory | System.Runtime.InteropServices.DllImportSearchPath.System32)]" />
-    </ItemGroup>
-
-    <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'">
-      <AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="&lt;Assembly:System.CLSCompliant(True)&gt;" />
-
-      <AssemblyInfoLines Condition="'$(IncludeDllSafeSearchPathAttribute)'=='true'"
-        Include="&lt;Assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath.AssemblyDirectory Or System.Runtime.InteropServices.DllImportSearchPath.System32)&gt;" />
-    </ItemGroup>
-
-    <WriteLinesToFile File="$(AssemblyInfoFile)"
-                      Lines="@(AssemblyInfoLines)"
-                      Condition="'@(AssemblyInfoLines)' != ''"
-                      Overwrite="true" />
-
-    <ItemGroup Condition="'@(AssemblyInfoLines)' != ''">
-      <Compile Include="$(AssemblyInfoFile)" />
-      <FileWrites Include="$(AssemblyInfoFile)" />
-    </ItemGroup>
-  </Target>
-
-  <Target Name="GenerateRuntimeVersionFile"
-          DependsOnTargets="GenerateNativeVersionFile">
-
-    <PropertyGroup>
-      <RuntimeVersionFile Condition="'$(RuntimeVersionFile)' == ''">$(ArtifactsObjDir)runtime_version.h</RuntimeVersionFile>
-
-      <_RuntimeVersionFileContents>
-<![CDATA[
-#define RuntimeAssemblyMajorVersion $(MajorVersion)
-#define RuntimeAssemblyMinorVersion $(MinorVersion)
-
-#define RuntimeFileMajorVersion $(FileVersion.Split('.')[0])
-#define RuntimeFileMinorVersion $(FileVersion.Split('.')[1])
-#define RuntimeFileBuildVersion $(FileVersion.Split('.')[2])
-#define RuntimeFileRevisionVersion $(FileVersion.Split('.')[3])
-
-#define RuntimeProductMajorVersion $(Version.Split(".-")[0])
-#define RuntimeProductMinorVersion $(Version.Split(".-")[1])
-#define RuntimeProductPatchVersion $(Version.Split(".-")[2])
-
-#define RuntimeProductVersion $(Version)
- ]]>
-      </_RuntimeVersionFileContents>
-    </PropertyGroup>
-
-    <MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(RuntimeVersionFile)))" />
-
-    <WriteLinesToFile
-      File="$(RuntimeVersionFile)"
-      Lines="$(_RuntimeVersionFileContents)"
-      Overwrite="true"
-      WriteOnlyWhenDifferent="true" />
-
-  </Target>
-
-  <!-- Removes assembly level attributes from test projects. -->
-  <Target Name="RemoveSupportedOSPlatformAttributeFromTestProjects" AfterTargets="GetAssemblyAttributes" Condition="'$(IsTestProject)' == 'true'">
-    <ItemGroup>
-      <AssemblyAttribute Remove="System.Runtime.Versioning.SupportedOSPlatformAttribute" />
-      <AssemblyAttribute Remove="System.Runtime.Versioning.TargetPlatformAttribute" />
-    </ItemGroup>
-  </Target>
-
-</Project>
diff --git a/eng/windows-compiler-override.txt b/eng/windows-compiler-override.txt
deleted file mode 100644 (file)
index f6cb168..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-SET (CMAKE_C_FLAGS_INIT                "/Wall /FC")
-SET (CMAKE_C_FLAGS_DEBUG_INIT          "/Od /Zi")
-SET (CLR_C_FLAGS_CHECKED_INIT          "/O1 /Zi")
-SET (CMAKE_C_FLAGS_RELEASE_INIT        "/Ox /Zi")
-SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi")
-
-SET (CMAKE_CXX_FLAGS_INIT                "/Wall /FC")
-SET (CMAKE_CXX_FLAGS_DEBUG_INIT          "/Od /Zi")
-SET (CLR_CXX_FLAGS_CHECKED_INIT          "/O1 /Zi")
-SET (CMAKE_CXX_FLAGS_RELEASE_INIT        "/Ox /Zi")
-SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi")
-
-SET (CLR_DEFINES_DEBUG_INIT              DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
-SET (CLR_DEFINES_CHECKED_INIT            DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
-SET (CLR_DEFINES_RELEASE_INIT            NDEBUG URTBLDENV_FRIENDLY=Retail)
-SET (CLR_DEFINES_RELWITHDEBINFO_INIT     NDEBUG URTBLDENV_FRIENDLY=Retail)
\ No newline at end of file
index 0a0925bf80cebf259717d72c1c8976be14c2a748..47ac0e2273c76d4bb2e7f4ebd9da8b22d5827193 100644 (file)
@@ -5,6 +5,8 @@
     <OutputType>Exe</OutputType>
     <IsShipping>true</IsShipping>
     <GenerateDocumentationFile>false</GenerateDocumentationFile>
+    <!-- Tools always ship with stable versions to allow for seamless CLI upgrade experiences. -->
+    <PreReleaseVersionLabel></PreReleaseVersionLabel>
   </PropertyGroup>
 
   <Choose>