From 66d8cd53d321239147dfbb368251b7a6bf10c250 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 7 Nov 2018 08:41:01 +0100 Subject: [PATCH] Write paket version to /paket-files during restore --- RELEASE_NOTES.md | 3 +++ src/Paket.Core/Common/Constants.fs | 2 ++ src/Paket.Core/Installation/RestoreProcess.fs | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0e9fd5edac..6166383ec9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 5.185.0 - 2018-11-07 +* Write paket version to /paket-files during restore + #### 5.184.0 - 2018-10-30 * REVERT: Adjustable timeouts for NuGet - https://github.com/fsprojects/Paket/pull/3383 diff --git a/src/Paket.Core/Common/Constants.fs b/src/Paket.Core/Common/Constants.fs index ae50146230..07a1f5bc76 100644 --- a/src/Paket.Core/Common/Constants.fs +++ b/src/Paket.Core/Common/Constants.fs @@ -16,6 +16,7 @@ let [] LockFileName = "paket.lock" let [] LocalFileName = "paket.local" /// 'paket.restore.sha512' let [] RestoreHashFile = "paket.restore.cached" +let [] RestoreVersionFile = "paket.restore.version" /// 'paket.dependencies' let [] DependenciesFileName = "paket.dependencies" /// '.paket' @@ -97,6 +98,7 @@ let PaketConfigFolder = Path.Combine(AppDataFolder, "Paket") let PaketConfigFile = Path.Combine(PaketConfigFolder, "paket.config") let PaketRestoreHashFilePath = Path.Combine(PaketFilesFolderName, RestoreHashFile) +let PaketRestoreVersionFilePath = Path.Combine(PaketFilesFolderName, RestoreVersionFile) let LocalRootForTempData = getEnvDir Environment.SpecialFolder.UserProfile diff --git a/src/Paket.Core/Installation/RestoreProcess.fs b/src/Paket.Core/Installation/RestoreProcess.fs index 31bf5b4e2c..7e8ef65a8c 100644 --- a/src/Paket.Core/Installation/RestoreProcess.fs +++ b/src/Paket.Core/Installation/RestoreProcess.fs @@ -538,10 +538,12 @@ let RestoreNewSdkProject lockFile resolved groups (projectFile:ProjectFile) targ let private isRestoreUpDoDate (lockFileName:FileInfo) (lockFileContents:string) = let root = lockFileName.Directory.FullName let restoreCacheFile = Path.Combine(root, Constants.PaketRestoreHashFilePath) + let restoreVersionFile = Path.Combine(root, Constants.PaketRestoreVersionFilePath) + // We ignore our check when we do a partial restore, this way we can // fixup project specific changes (like an additional target framework or a changed references file) // We could still skip the actual "restore" work, but that is left as an exercise for the interesting reader. - if File.Exists restoreCacheFile then + if File.Exists restoreCacheFile && File.Exists restoreVersionFile then let oldContents = File.ReadAllText(restoreCacheFile) oldContents = lockFileContents else false @@ -687,6 +689,9 @@ let Restore(dependenciesFileName,projectFile,force,group,referencesFileNames,ign CreateScriptsForGroups lockFile.Value groups if isFullRestore then + let restoreVersionFile = Path.Combine(root, Constants.PaketRestoreVersionFilePath) + let paketVersion = AssemblyVersionInformation.AssemblyInformationalVersion + File.WriteAllText(restoreVersionFile, paketVersion) let restoreCacheFile = Path.Combine(root, Constants.PaketRestoreHashFilePath) File.WriteAllText(restoreCacheFile, newContents)) )