Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Using msbuild restore instead of nuget restore #14333

Merged
merged 6 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -880,24 +880,34 @@ Task("cg-android")
.IsDependentOn("BuildTasks")
.Does(() =>
{
var buildSettings = GetMSBuildSettings();

if(isCIBuild)
{
var buildRestoreSettings = GetMSBuildSettings();
var binaryRestoreLogger = new MSBuildBinaryLogSettings {
Enabled = true
};

buildRestoreSettings.BinaryLogger = binaryRestoreLogger;
binaryRestoreLogger.FileName = $"{artifactStagingDirectory}/android-restore-{ANDROID_RENDERERS}.binlog";

MSBuild("./Xamarin.Forms.sln", buildRestoreSettings.WithTarget("restore"));

var buildSettings = GetMSBuildSettings();
buildSettings = buildSettings.WithTarget("Rebuild").WithTarget("SignAndroidPackage");
var binaryLogger = new MSBuildBinaryLogSettings {
Enabled = true
};

buildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/android-{ANDROID_RENDERERS}.binlog";
MSBuild("./Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj", buildSettings);
}
else
{
var buildSettings = GetMSBuildSettings();
buildSettings = buildSettings.WithRestore();
MSBuild("./Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj", buildSettings);
}

MSBuild("./Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj", buildSettings);
});

Task("cg-android-vs")
Expand All @@ -913,26 +923,44 @@ Task("cg-ios")
.IsDependentOn("BuildTasks")
.Does(() =>
{
var buildSettings =
GetMSBuildSettings(null)
.WithProperty("BuildIpa", $"{IOS_BUILD_IPA}");

if(isCIBuild)
{
var buildRestoreSettings = GetMSBuildSettings();
var binaryRestoreLogger = new MSBuildBinaryLogSettings {
Enabled = true
};

buildRestoreSettings.BinaryLogger = binaryRestoreLogger;
binaryRestoreLogger.FileName = $"{artifactStagingDirectory}/ios-restore-cg.binlog";

MSBuild("./Xamarin.Forms.sln", buildRestoreSettings.WithTarget("restore"));

var buildSettings =
GetMSBuildSettings(null)
.WithProperty("BuildIpa", $"{IOS_BUILD_IPA}");

var binaryLogger = new MSBuildBinaryLogSettings {
Enabled = true
};

buildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/ios-cg.binlog";

MSBuild("./Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj",
buildSettings);
}
else
{

var buildSettings =
GetMSBuildSettings(null)
.WithProperty("BuildIpa", $"{IOS_BUILD_IPA}");

buildSettings = buildSettings.WithRestore();
}

MSBuild("./Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj",
buildSettings);
MSBuild("./Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj",
buildSettings);
}
});

Task("cg-ios-vs")
Expand Down
18 changes: 1 addition & 17 deletions build/steps/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,7 @@ jobs:
inputs:
SourceFolder: 'Nuget/nuget/${{ parameters.buildConfiguration }}'
TargetFolder: 'Nuget'

- bash: |
echo "##vso[task.setvariable variable=NUGET_RESTORE_MSBUILD_ARGS]${{ parameters.MSBuildArguments_cg_android }}"
displayName: 'Set NUGET_RESTORE_MSBUILD_ARGS for Nuget'

- bash: |
env | grep NUGET_RESTORE_MSBUILD_ARGS
displayName: 'Display NUGET_RESTORE_MSBUILD_ARGS for Nuget'

- task: NuGetCommand@2
displayName: 'NuGet restore ${{ parameters.slnPath }}'
inputs:
command: restore
restoreSolution: 'Xamarin.Forms.sln'
feedsToUse: config
nugetConfigPath: 'DevopsNuget.config'


- task: Bash@3
displayName: 'Build Android $(renderers)'
inputs:
Expand Down
14 changes: 0 additions & 14 deletions build/steps/build-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ steps:
filePath: 'build.sh'
arguments: --target provision --TeamProject="$(System.TeamProject)"

- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: $(NUGET_VERSION)

- task: DownloadBuildArtifacts@0
displayName: 'Download build artifact nuget'
condition: eq(variables['System.TeamProject'], 'DevDiv')
Expand All @@ -56,14 +50,6 @@ steps:
SourceFolder: '$(Build.ArtifactsDirectory)/nuget/$(buildConfiguration)'
TargetFolder: '$(System.DefaultWorkingDirectory)/Nuget'

- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
command: restore
restoreSolution: 'Xamarin.Forms.sln'
feedsToUse: config
nugetConfigPath: 'DevopsNuget.config'

- task: InstallAppleCertificate@2
displayName: 'Install an Apple certificate'
inputs:
Expand Down