Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes308downloads
PowerShell.Common.props235 linesDownload Raw Back to PowerShell-master
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">2  <Import Project=".\Analyzers.props" />3 4  <!--5      The 'version' property is populated with the default value in 'Microsoft.NET.DefaultAssemblyInfo.targets'6      *before* any targets get a chance to execute.7      We need to *explicitly* re-assign the 'version' property and other version tags in this target.8 9      In order for the versions assigned here to take effect, we need to execute this target at an early stage:10        before 'Restore' target - '_GenerateRestoreProjectSpec'11        before 'Pack' target    - 'GenerateNuspec'12        before 'Build' target   - 'BeforeBuild'13  -->14  <Target Name="GetPSCoreVersionFromGit"15    BeforeTargets="_GenerateRestoreProjectSpec;GenerateNuspec;BeforeBuild"16  >17 18    <Exec Command='git describe --abbrev=60 --long'19          WorkingDirectory="$(MSBuildProjectDirectory)"20          ConsoleToMSBuild="true"21          StandardOutputImportance="Low">22      <Output TaskParameter="ConsoleOutput" PropertyName="PowerShellVersion" />23    </Exec>24 25    <PropertyGroup Condition = "'$(ReleaseTag)' != ''">26      <!--27         DO NOT UPDATE without reviewing with the Microsoft update plan.28 29         7.2.0-preview.130         __a__.__b____.c31 32        a = Version part and is group 1 of the regex33        b = the Semantic version prerelease name.  This is optional.34        c = The semantic version prerelease iteration.  This is optional and only allowed of the prerelease name is present.35 36        Our version will become the version part with the prerelease iteration being the revision (the 4th part of the version).37        For RCs, we will increment the iteration from 100.38 39        Examples40        7.2.0 becomes 7.2.041        7.2.0-preview.1 becomes 7.2.0.142        7.2.0-rc.1 becomes 7.2.0.10143      -->44 45      <!-- parse the release tag into the parts we need -->46      <RegexReleaseTag>^((\d+).(\d+).(\d+))(-(\w+)(.(\d+))?)?$</RegexReleaseTag>47      <ReleaseTagVersionPart>$([System.Text.RegularExpressions.Regex]::Match($(ReleaseTag), $(RegexReleaseTag)).Groups[1].Value)</ReleaseTagVersionPart>48      <ReleaseTagSemVersionPart>$([System.Text.RegularExpressions.Regex]::Match($(ReleaseTag), $(RegexReleaseTag)).Groups[8].Value)</ReleaseTagSemVersionPart>49      <ReleaseTagSemVersionPrereleaseNamePart>$([System.Text.RegularExpressions.Regex]::Match($(ReleaseTag), $(RegexReleaseTag)).Groups[6].Value)</ReleaseTagSemVersionPrereleaseNamePart>50      <!-- Increment revision 100 for rc releases -->51      <RCIncrementValue>100</RCIncrementValue>52      <!-- Increment revision 500 for GA releases -->53      <GAIncrementValue>500</GAIncrementValue>54      <ReleaseTagSemVersionPart Condition = "'$(ReleaseTagSemVersionPrereleaseNamePart)' == 'rc'">$([MSBuild]::Add($(ReleaseTagSemVersionPart), $(RCIncrementValue)))</ReleaseTagSemVersionPart>55      <!-- Create the internal version -->56      <PSCoreBuildVersion>$(ReleaseTag)</PSCoreBuildVersion>57      <!-- Create the version if we have a pre-release -->58      <PSCoreFileVersion Condition = "'$(ReleaseTagSemVersionPart)' != ''">$(ReleaseTagVersionPart).$(ReleaseTagSemVersionPart)</PSCoreFileVersion>59      <!-- Create the version if we have a release build -->60      <PSCoreFileVersion Condition = "'$(PSCoreFileVersion)' == ''">$(ReleaseTagVersionPart).$(GAIncrementValue)</PSCoreFileVersion>61      <!-- Set 'FileVersion' and 'AssemblyVersion' explicitly:62           - make 'FileVersion' the same as 'PSCoreFileVersion'63           - make 'AssemblyVersion' be the 'PSCoreFileVersion' with the 'Build' field set to 0, so the assembly version doesn't change for servicing releases -->64      <FileVersion>$(PSCoreFileVersion)</FileVersion>65      <AssemblyVersion>$([System.Version]::Parse($(PSCoreFileVersion)).Major).$([System.Version]::Parse($(PSCoreFileVersion)).Minor).0.$([System.Version]::Parse($(PSCoreFileVersion)).Revision)</AssemblyVersion>66    </PropertyGroup>67 68    <PropertyGroup>69      <RegexGitVersion>^v(.+)-(\d+)-g(.+)</RegexGitVersion>70      <PSCoreFileVersion Condition = "'$(PSCoreFileVersion)' == ''">$([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[1].Value)</PSCoreFileVersion>71      <PSCoreBuildVersion Condition = "'$(PSCoreBuildVersion)' == ''">$([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[1].Value)</PSCoreBuildVersion>72      <PSCoreAdditionalCommits>$([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[2].Value)</PSCoreAdditionalCommits>73      <PSCoreCommitSHA>$([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[3].Value)</PSCoreCommitSHA>74 75      <!--76            Caution! 'PSVersion' and 'GitCommitId' from 'PSVersionInfo.cs' depend on the format of this version string.77      -->78      <PSCoreFormattedVersion Condition = "'$(ReleaseTag)' != '' or '$(PSCoreAdditionalCommits)' == '0'">$(PSCoreBuildVersion) SHA: $(PSCoreCommitSHA)</PSCoreFormattedVersion>79      <PSCoreFormattedVersion Condition = "'$(PSCoreFormattedVersion)' == ''">$(PSCoreBuildVersion) Commits: $(PSCoreAdditionalCommits) SHA: $(PSCoreCommitSHA)</PSCoreFormattedVersion>80 81      <!-- Extract the major, minor and patch version numbers, as well as the preview label.82           They are currently not used anywhere, so we comment them out for now.83        <RegexSymVer>^((\d+).(\d+).(\d+))(?:-(.+))?</RegexSymVer>84        <PSCorePrefixVersion>$([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[1].Value)</PSCorePrefixVersion>85        <PSCoreMajorVersion>$([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[2].Value)</PSCoreMajorVersion>86        <PSCoreMinorVersion>$([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[3].Value)</PSCoreMinorVersion>87        <PSCorePatchVersion>$([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[4].Value)</PSCorePatchVersion>88        <PSCoreLabelVersion>$([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[5].Value)</PSCoreLabelVersion>89      -->90 91      <!--92            Here we define explicitly 'Version' to set 'FileVersion' and 'AssemblyVersion' when they are not explicitly set.93            Here we define explicitly 'InformationalVersion' because by default it is defined as 'Version' by 'GetAssemblyVersion' target in 'Microsoft.NET.GenerateAssemblyInfo.targets'.94      -->95      <Version>$(PSCoreFileVersion)</Version>96      <InformationalVersion>$(PSCoreFormattedVersion)</InformationalVersion>97      <ProductVersion>$(PSCoreFormattedVersion)</ProductVersion>98 99      <!--100        We have to explicitly assign 'PackageVersion' here because we're changing 'Version' in a target.101        Before any targets have run (during static evaluation), 'Version' will have defaulted to '1.0.0' and PackageVersion will have defaulted to 'Version'.102        See https://github.com/dotnet/sdk/issues/1557103      -->104      <PackageVersion>$(PSCoreBuildVersion)</PackageVersion>105 106      <ApplicationIcon Condition="$(ProductVersion.Contains('preview'))">..\..\assets\Powershell_av_colors.ico</ApplicationIcon>107      <ApplicationIcon Condition="$(ProductVersion.Contains('daily'))">..\..\assets\Powershell_avatar.ico</ApplicationIcon>108      <ApplicationIcon Condition="!$(ProductVersion.Contains('preview')) And !$(ProductVersion.Contains('daily'))">..\..\assets\Powershell_black.ico</ApplicationIcon>109 110    </PropertyGroup>111 112    <!-- Remove existing generated files by source generators because new source code will soon be generated when the build starts -->113    <RemoveDir Directories="gen\SourceGenerated" Condition="Exists('gen\SourceGenerated')" />114 115    <!-- Output For Debugging116      <WriteLinesToFile File="targetfile1.txt"117        Lines="ReleaseTag=$(ReleaseTag);118               PowerShellVersion = $(PowerShellVersion);119               PSCoreBuildVersion = $(PSCoreBuildVersion);120               PSCoreFileVersion = $(PSCoreFileVersion);121               ReleaseTagVersionPart = $(ReleaseTagVersionPart);122               ReleaseTagSemVersionPart = $(ReleaseTagSemVersionPart);123               PSCoreAdditionalCommits = $(PSCoreAdditionalCommits);124               PSCoreCommitSHA = $(PSCoreCommitSHA);125               PSCoreMajorVersion = $(PSCoreMajorVersion);126               PSCoreMinorVersion = $(PSCoreMinorVersion);127               PSCorePatchVersion = $(PSCorePatchVersion);128               PSCoreLabelVersion = $(PSCoreLabelVersion);129               RegexGitVersion = $(RegexGitVersion);130               PSCoreFormattedVersion = $(PSCoreFormattedVersion);131               ProductVersion = $(ProductVersion);132               Version = $(Version);133               ProjectVersion = '!$(ProjectVersion)!'134               InformationalVersion = $(InformationalVersion);135              "136        Overwrite="true" />137    -->138 139  </Target>140 141  <PropertyGroup>142    <Product>PowerShell</Product>143    <Company>Microsoft Corporation</Company>144    <Copyright>(c) Microsoft Corporation.</Copyright>145    <AssemblyTitle>PowerShell 7</AssemblyTitle>146 147    <TargetFramework>net11.0</TargetFramework>148    <LangVersion>preview</LangVersion>149 150    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>151    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>152    <GenerateDocumentationFile>true</GenerateDocumentationFile>153    <SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>154    <NeutralLanguage>en-US</NeutralLanguage>155    <DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>156    <DisableImplicitNamespaceImports_DotNet>true</DisableImplicitNamespaceImports_DotNet>157 158    <DelaySign>true</DelaySign>159    <AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk</AssemblyOriginatorKeyFile>160    <SignAssembly>true</SignAssembly>161    <HighEntropyVA>true</HighEntropyVA>162  </PropertyGroup>163 164  <PropertyGroup>165    <DefineConstants>$(DefineConstants);CORECLR</DefineConstants>166    <IsWindows Condition="'$(IsWindows)' == 'true' or ('$(IsWindows)' == '' and '$(OS)' == 'Windows_NT')">true</IsWindows>167  </PropertyGroup>168 169  <!-- Define non-windows, all configuration properties -->170  <PropertyGroup Condition=" '$(IsWindows)' != 'true' ">171    <DefineConstants>$(DefineConstants);UNIX</DefineConstants>172  </PropertyGroup>173 174  <!-- Define all OS, debug configuration properties -->175  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">176    <DebugType>portable</DebugType>177  </PropertyGroup>178 179  <!-- Define properties for Framework dependent deployments in Packages180        https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#apphostdotnetsearch181        For FxDependent, we want to search for the apphost in the Environment or global location,182        as this was not causing any issues.183        For FxDependentDeployment, we want to search ONLY in global location.184        For SelfContained, we want to search in the app local location.185  -->186  <PropertyGroup Condition=" '$(AppDeployment)' == 'FxDependent' ">187    <!-- Specify both to keep existing behavior because we have not had complaints about this scenario -->188    <AppHostDotNetSearch>EnvironmentVariable;Global</AppHostDotNetSearch>189    <PublishReadyToRun>false</PublishReadyToRun>190    <PublishReadyToRunEmitSymbols>false</PublishReadyToRunEmitSymbols>191  </PropertyGroup>192 193  <PropertyGroup Condition=" '$(AppDeployment)' == 'FxDependentDeployment' ">194    <!-- If we specify Environment too, it searches that first, no matter what order we specify-->195    <AppHostDotNetSearch>Global</AppHostDotNetSearch>196  </PropertyGroup>197 198  <!-- Enable ready-to-run only for Release configuration -->199  <PropertyGroup Condition=" '$(AppDeployment)' == 'FxDependentDeployment' And '$(Configuration)' == 'Release' ">200    <PublishReadyToRun>true</PublishReadyToRun>201    <PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>202  </PropertyGroup>203 204  <PropertyGroup Condition=" '$(AppDeployment)' == 'SelfContained' ">205    <AppHostDotNetSearch>AppLocal</AppHostDotNetSearch>206  </PropertyGroup>207 208  <!-- Enable ready-to-run only for Release configuration -->209  <PropertyGroup Condition=" '$(AppDeployment)' == 'SelfContained' And '$(Configuration)' == 'Release' ">210    <PublishReadyToRun>true</PublishReadyToRun>211    <PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>212  </PropertyGroup>213 214  <!-- Define all OS, release configuration properties -->215  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">216    <Optimize>true</Optimize>217    <DebugType>portable</DebugType>218  </PropertyGroup>219 220  <!-- Define all OS, release configuration properties -->221  <PropertyGroup Condition=" '$(Configuration)' == 'StaticAnalysis' ">222    <Optimize>true</Optimize>223    <!-- This is required to be full for compliance tools !-->224    <DebugType>full</DebugType>225  </PropertyGroup>226 227  <PropertyGroup>228    <Features>strict</Features>229  </PropertyGroup>230 231  <PropertyGroup>232    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>233  </PropertyGroup>234</Project>235