Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Commit

Permalink
fix hang in nuget restore (#82)
Browse files Browse the repository at this point in the history
* update cbt.core.dll to latest changes

* Add CBTModuleRestoreCommandAdditionalArguments

* Update unittest

* Do not run cbt module restore if being evaluated by nuget.exe 4.x by checking from ExlcudeRestorePackageImports for true.

* Update unittest
  • Loading branch information
kingerja authored Jun 12, 2017
1 parent 771682b commit 389e85b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
Binary file modified .build/CBT/CBT.Core.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions .build/CBT/build.props
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
<CBTModuleRestoreCommandArguments Condition=" '$(CBTModuleRestoreCommandAdditionalArguments)' != '' ">$(CBTModuleRestoreCommandArguments) $(CBTModuleRestoreCommandAdditionalArguments)</CBTModuleRestoreCommandArguments>

<CBTModuleNuGetAssetsFlagFile Condition=" '$(CBTModuleNuGetAssetsFlagFile)' == '' ">$(CBTIntermediateOutputPath)\AssetsLockFilePath.flag</CBTModuleNuGetAssetsFlagFile>
<!-- ExcludeRestorePackageImports implies that we are running under a nuget.exe 4.x process and module restoration should be disabled. -->
<RestoreCBTModules Condition=" '$(ExcludeRestorePackageImports)' == 'true' ">false</RestoreCBTModules>
<CBTModulesRestored Condition=" '$(RestoreCBTModules)' != 'false' And '$(BuildingInsideVisualStudio)' != 'true' And '$(CBTModulesRestored)' != 'true' And Exists('$(CBTCoreAssemblyPath)') ">$(CBTCoreAssemblyPath.GetType().Assembly.GetType('System.AppDomain').GetProperty('CurrentDomain').GetValue(null, null).CreateInstanceFromAndUnwrap($(CBTCoreAssemblyPath), $(CBTModuleRestoreTaskName)).Execute($(CBTModuleImportsAfter.Split(';')), $(CBTModuleImportsBefore.Split(';')), $(CBTModuleExtensionsPath), $(CBTModulePropertiesFile), $(CBTNuGetDownloaderAssemblyPath), $(CBTNuGetDownloaderClassName), '$(CBTNuGetDownloaderArguments)', $(CBTModuleRestoreInputs.Split(';')), $(CBTModulePackageConfigPath), $(NuGetPackagesPath), $(CBTPackagesFallbackPath), $(CBTModuleRestoreCommand), $(CBTModuleRestoreCommandArguments), $(MSBuildProjectFullPath), $(CBTModuleNuGetAssetsFlagFile)))</CBTModulesRestored>

</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/CBT.Core.UnitTests/BuildPropsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void RequiredPropertiesTest()
{new Property("CBTModuleRestoreCommandArguments", @"restore ""$(CBTModulePackageConfigPath)"" -NonInteractive", defaultCondition)},
{new Property("CBTModuleRestoreCommandArguments", @"$(CBTModuleRestoreCommandArguments) $(CBTModuleRestoreCommandAdditionalArguments)", @" '$(CBTModuleRestoreCommandAdditionalArguments)' != '' ")},
{new Property("CBTModuleNuGetAssetsFlagFile", @"$(CBTIntermediateOutputPath)\AssetsLockFilePath.flag", defaultCondition)},
{new Property("RestoreCBTModules", @"false", @" '$(ExcludeRestorePackageImports)' == 'true' ")},
{new Property("CBTModulesRestored", @"$(CBTCoreAssemblyPath.GetType().Assembly.GetType('System.AppDomain').GetProperty('CurrentDomain').GetValue(null, null).CreateInstanceFromAndUnwrap($(CBTCoreAssemblyPath), $(CBTModuleRestoreTaskName)).Execute($(CBTModuleImportsAfter.Split(';')), $(CBTModuleImportsBefore.Split(';')), $(CBTModuleExtensionsPath), $(CBTModulePropertiesFile), $(CBTNuGetDownloaderAssemblyPath), $(CBTNuGetDownloaderClassName), '$(CBTNuGetDownloaderArguments)', $(CBTModuleRestoreInputs.Split(';')), $(CBTModulePackageConfigPath), $(NuGetPackagesPath), $(CBTPackagesFallbackPath), $(CBTModuleRestoreCommand), $(CBTModuleRestoreCommandArguments), $(MSBuildProjectFullPath), $(CBTModuleNuGetAssetsFlagFile)))", @" '$(RestoreCBTModules)' != 'false' And '$(BuildingInsideVisualStudio)' != 'true' And '$(CBTModulesRestored)' != 'true' And Exists('$(CBTCoreAssemblyPath)') ")},
};
var propertiesToScan = _project.Properties.Where(p => p.Parent.Parent is ProjectRootElement);
Expand Down
2 changes: 1 addition & 1 deletion src/CBT.Core/Tasks/RestoreModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private bool RestorePackages()
},
})
{
process.StartInfo.EnvironmentVariables.Add("RestoreCBTModules", "false");
process.StartInfo.EnvironmentVariables["RestoreCBTModules"] = "false";
process.ErrorDataReceived += (sender, args) =>
{
if (!String.IsNullOrWhiteSpace(args?.Data))
Expand Down

0 comments on commit 389e85b

Please sign in to comment.