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

Commit

Permalink
Using msbuild restore instead of nuget restore (#14333)
Browse files Browse the repository at this point in the history
* Restore via msbuild

* - compile error

* - add msbuild back in

* - fix ios

* - build settings

* - remove restore
  • Loading branch information
PureWeen committed Jun 8, 2021
1 parent bcc22f2 commit 0e06946
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
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

0 comments on commit 0e06946

Please sign in to comment.