|
412 | 412 |
|
413 | 413 | <!-- Hook up .NET Core to enable solution refresh of packages--> |
414 | 414 | <PropertyGroupCondition="'$(TargetFramework)'=='coreclr'"> |
415 | | - |
416 | | - <NuGetPackagesPathCondition="'$(NuGetPackagesPath)' == ''">$(FSharpSourcesRoot)\..\packages</NuGetPackagesPath> |
417 | 415 |
|
418 | 416 | <!-- Implicitly needed by packageresolve.targets. Should file a bug for a better error message here--> |
419 | | - <PackagesDir>$(NuGetPackagesPath)\</PackagesDir> |
| 417 | + <PackagesDir>$(NUGET_PACKAGES)</PackagesDir> |
420 | 418 |
|
421 | 419 | <NuGetToolPathCondition="'$(NuGetToolPath)' == ''">$(FSharpSourcesRoot)\..\.nuget\</NuGetToolPath> |
422 | 420 | <NuGetConfigCommandLine>-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine> |
423 | 421 |
|
424 | | - <NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe install -OutputDirectory "$(NuGetPackagesPath)" -Config "$(NuGetToolPath)NuGet.Config"</NugetRestoreCommand> |
| 422 | + <NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe install -OutputDirectory "$(PackagesDir)" -Config "$(NuGetToolPath)NuGet.Config"</NugetRestoreCommand> |
425 | 423 |
|
426 | | - <DnuRestoreCommand>"$(NuGetToolPath)NuGet.exe" restore -OutputDirectory "$(NuGetPackagesPath)" -Config "$(NuGetToolPath)NuGet.Config"</DnuRestoreCommand> |
| 424 | + <DnuRestoreCommand>"$(NuGetToolPath)NuGet.exe" restore -OutputDirectory "$(PackagesDir)" -Config "$(NuGetToolPath)NuGet.Config"</DnuRestoreCommand> |
427 | 425 |
|
428 | 426 | <!-- Current version of .NET Core does not support all semantics used in our packages, |
429 | 427 | so we ignore the pre-calculation in the lock file and calculate asset applicability in the build task--> |
|
473 | 471 | </Target> |
474 | 472 |
|
475 | 473 | <TargetName="dotnetrestore"BeforeTargets="Build"Condition=" '$(TargetFramework)' == 'coreclr'"> |
476 | | - <ExecCommand="$(MSBuildThisFileDirectory)..\.nuget\nuget.exe restore -PackagesDirectory $(MSBuildThisFileDirectory)..\packages -Config $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json" /> |
477 | | - </Target> |
478 | | - |
479 | | - <TargetName="nugetpack"AfterTargets="Build"Condition="'$(TargetFramework)' == 'coreclr'" |
480 | | -Inputs="@(PackageNuspec)"Outputs='$(OutputPath.TrimEnd("\"))\nuget\"%(PackageNuspec.Filename)).nupkg'> |
481 | | - <PropertyGroup> |
482 | | - <PackageProperties>-prop "licenseUrl=$(PackageLicenceUrl)" -prop "version=$(PackageVersion)" -prop "authors=$(PackageAuthors)" -prop "projectUrl=$(PackageProjectUrl)" -prop "tags=$(PackageTags)"</PackageProperties> |
483 | | - </PropertyGroup> |
484 | | - |
485 | | - <ExecCommand='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack %(PackageNuspec.Filename)%(PackageNuspec.Extension) -BasePath "$(OutputPath.TrimEnd("\"))" -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory "$(MSBuildThisFileDirectory)..\artifacts' /> |
| 474 | + <ExecCommand="$(MSBuildThisFileDirectory)..\.nuget\nuget.exe restore -PackagesDirectory $(PackagesDir) -Config $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json" /> |
486 | 475 | </Target> |
487 | 476 |
|
488 | 477 | <TargetName="dotnetrestore"BeforeTargets="Build"Condition=" '$(DOTNET_PUBLISH)' == 'true'"> |
| 478 | + <SetEnvVarName="NUGET_PACKAGES"Value="$(NUGET_PACKAGES)" /> |
489 | 479 | <ExecCommand="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore --configfile $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json"/> |
490 | 480 | </Target> |
491 | 481 |
|
492 | 482 | <TargetName="dotnetpublish"AfterTargets="Build"Condition=" '$(DOTNET_PUBLISH)' == 'true'"> |
| 483 | + <SetEnvVarName="NUGET_PACKAGES"Value="$(NUGET_PACKAGES)" /> |
493 | 484 | <ExecCommand="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe --verbose publish --no-build project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_PATH)"/> |
494 | 485 | </Target> |
495 | 486 |
|
496 | 487 | <TargetName="dotnetpublishfsccompiler"AfterTargets="CopyFilesToOutputDirectory"Condition=" '$(DOTNET_PUBLISH_FSC)' == 'true'"> |
| 488 | + <SetEnvVarName="NUGET_PACKAGES"Value="$(NUGET_PACKAGES)" /> |
497 | 489 | <ExecCommand="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsc\project.json"/> |
498 | 490 | <ExecCommand="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe --verbose publish --no-build DeployCompiler\fsc\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSC_PATH)"/> |
499 | 491 | </Target> |
500 | 492 |
|
501 | 493 | <TargetName="dotnetpublishfsicompiler"AfterTargets="CopyFilesToOutputDirectory"Condition=" '$(DOTNET_PUBLISH_FSI)' == 'true'"> |
| 494 | + <SetEnvVarName="NUGET_PACKAGES"Value="$(NUGET_PACKAGES)" /> |
502 | 495 | <ExecCommand="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsi\project.json"/> |
503 | 496 | <ExecCommand="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe --verbose publish --no-build DeployCompiler\fsi\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSI_PATH)"/> |
504 | 497 | </Target> |
|
518 | 511 | <WriteLinesToFileFile="$(IntermediateOutputPath)source_link.json"Overwrite="true"Lines='{"documents": { "$(SrcRootDirectory)/*" : "$(RemoteUri.Replace(".git", "").Replace("github.com", "raw.githubusercontent.com"))/$(LatestCommit)/*" }}' /> |
519 | 512 | </Target> |
520 | 513 |
|
| 514 | +<!-- If BuildVersionFilePath not specified then do nothing--> |
| 515 | + <TargetName="CleanVersionFile" Condition ="'$(BuildVersionFilePath)' != ''"> |
| 516 | + <PropertyGroup> |
| 517 | + <BuildVersionFileDir>$([System.IO.Path]::GetDirectoryName($(BuildVersionFilePath)))</BuildVersionFileDir> |
| 518 | + </PropertyGroup> |
| 519 | + <RemoveDirCondition="Exists('$(BuildVersionFileDir)')"Directories="$(BuildVersionFileDir)" /> |
| 520 | + </Target> |
| 521 | + |
| 522 | +<!-- If BuildVersionFilePath not specified then do nothing--> |
| 523 | + <TargetName="CreateOrUpdateBuildVersionFile" Condition ="'$(BuildVersionFilePath)' != ''"> |
| 524 | + <PropertyGroup> |
| 525 | + <BuildVersionFileDir>$([System.IO.Path]::GetDirectoryName($(BuildVersionFilePath)))</BuildVersionFileDir> |
| 526 | + <PackageVersionMajorCondition="'$(PackageVersionMajor)' == ''" >$(NuGetPerBuildPreReleaseVersion)</PackageVersionMajor> |
| 527 | + <PackageVersionMinorCondition="'$(PackageVersionMinor)' != ''" >$([MSBuild]::Add($(PackageVersionMinor), 1))</PackageVersionMinor> |
| 528 | + <PackageVersionMinorCondition="'$(PackageVersionMinor)' == ''" >1</PackageVersionMinor> |
| 529 | + </PropertyGroup> |
| 530 | + |
| 531 | + <ItemGroup> |
| 532 | + <CurrentVersionLinesInclude="%3C%3Fxml version=%221.0%22 encoding=%22utf-8%22%3F%3E" /> |
| 533 | + <CurrentVersionLinesInclude="%3C!-- This is a generated file. $(VersionSeedSourceComment) Seed Date is $(VersionSeedDate). --%3E" /> |
| 534 | + <CurrentVersionLinesInclude="%3CProject xmlns=%22http://schemas.microsoft.com/developer/msbuild/2003%22%3E" /> |
| 535 | + <CurrentVersionLinesInclude="%3CPropertyGroup%3E" /> |
| 536 | + <CurrentVersionLinesInclude="%3CPackageVersionMajor Condition=%22%27%24(PackageVersionMajor)%27==%27%27%22%3E$(NuGetPerBuildPreReleaseVersion)%3C/PackageVersionMajor%3E" /> |
| 537 | + <CurrentVersionLinesInclude="%3CPackageVersionMinor Condition=%22%27%24(PackageVersionMinor)%27==%27%27%22%3E$(PackageVersionMinor)%3C/PackageVersionMinor%3E" /> |
| 538 | + <CurrentVersionLinesInclude="%3C/PropertyGroup%3E" /> |
| 539 | + <CurrentVersionLinesInclude="%3C/Project%3E" /> |
| 540 | + </ItemGroup> |
| 541 | + |
| 542 | +<!-- Since by default the file will get dropped at the obj dir, make sure that the dir is created already or else WriteLinesToFile will error.--> |
| 543 | + <MakeDirCondition="!Exists('$(BuildVersionFileDir)')"Directories="$(BuildVersionFileDir)" /> |
| 544 | + |
| 545 | + <WriteLinesToFile |
| 546 | +ContinueOnError="WarnAndContinue" |
| 547 | +File="$(BuildVersionFilePath)" |
| 548 | +Lines="@(CurrentVersionLines)" |
| 549 | +Overwrite="true" /> |
| 550 | + |
| 551 | +<!-- Delete old BuildVersion.props files--> |
| 552 | + <ItemGroup> |
| 553 | + <OldBuildVersionFilesInclude="$(BuildVersionFilePath)BuildVersions-*.props"Exclude="$(BuildVersionFilePath)%(BuildVersionFileItem.Filename).props" /> |
| 554 | + </ItemGroup> |
| 555 | + <DeleteFiles="@(OldBuildVersionFiles)"TreatErrorsAsWarnings="true"/> |
| 556 | + </Target> |
| 557 | + |
| 558 | + <TargetName="nugetpack" |
| 559 | +DependsOnTargets="CreateOrUpdateBuildVersionFile" |
| 560 | +AfterTargets="Build" |
| 561 | +Condition="'$(TargetFramework)' == 'coreclr'" |
| 562 | +Inputs="@(PackageNuspec)" |
| 563 | +Outputs='$(FSharpSourcesRoot.TrimEnd("\"))\..\$(Configuration)\artifacts\"%(PackageNuspec.Filename)).nupkg'> |
| 564 | + |
| 565 | + <PropertyGroup> |
| 566 | + <PackageProperties>-prop "licenseUrl=$(PackageLicenceUrl)" -prop "version=$(PackageVersion)" -prop "authors=$(PackageAuthors)" -prop "projectUrl=$(PackageProjectUrl)" -prop "tags=$(PackageTags)"</PackageProperties> |
| 567 | + </PropertyGroup> |
| 568 | + |
| 569 | + <MakeDirDirectories="$(FSharpSourcesRoot.TrimEnd('\'))\..\$(Configuration)\artifacts" /> |
| 570 | + <MakeDirDirectories="$(FSharpSourcesRoot.TrimEnd('\'))\..\artifacts" /> |
| 571 | + <SetEnvVarName="NUGET_PACKAGES"Value="$(NUGET_PACKAGES)" /> |
| 572 | + <ExecCommand='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack @(PackageNuspec) -BasePath $(OutputPath.TrimEnd("\")) -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory $(FSharpSourcesRoot.TrimEnd("\"))\..\$(Configuration)\artifacts' /> |
| 573 | + <ExecCommand='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack @(PackageNuspec) -BasePath $(OutputPath.TrimEnd("\")) -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory $(FSharpSourcesRoot.TrimEnd("\"))\..\artifacts' /> |
| 574 | + </Target> |
| 575 | + |
521 | 576 | <UsingTaskTaskName="ReplaceFileText"TaskFactory="CodeTaskFactory"AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
522 | 577 | <ParameterGroup> |
523 | 578 | <InputFilenameParameterType="System.String"Required="true" /> |
|
541 | 596 | </Task> |
542 | 597 | </UsingTask> |
543 | 598 |
|
544 | | -</Project> |
| 599 | + <UsingTaskTaskName="SetEnvVar"TaskFactory="CodeTaskFactory"AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
| 600 | + <ParameterGroup> |
| 601 | + <NameParameterType="System.String"Required="true" /> |
| 602 | + <ValueParameterType="System.String"Required="true" /> |
| 603 | + </ParameterGroup> |
| 604 | + <Task> |
| 605 | + <UsingNamespace="System" /> |
| 606 | + <CodeType="Fragment"Language="cs"> |
| 607 | +<![CDATA[ |
| 608 | + Environment.SetEnvironmentVariable(Name, Value); |
| 609 | +]]> |
| 610 | + </Code> |
| 611 | + </Task> |
| 612 | + </UsingTask> |
| 613 | + |
| 614 | + </Project> |