Skip to content

Commit

Permalink
Write paket version to /paket-files during restore
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Nov 7, 2018
1 parent 9f05288 commit 66d8cd5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/Paket.Core/Common/Constants.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let [<Literal>] LockFileName = "paket.lock"
let [<Literal>] LocalFileName = "paket.local"
/// 'paket.restore.sha512'
let [<Literal>] RestoreHashFile = "paket.restore.cached"
let [<Literal>] RestoreVersionFile = "paket.restore.version"
/// 'paket.dependencies'
let [<Literal>] DependenciesFileName = "paket.dependencies"
/// '.paket'
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/Paket.Core/Installation/RestoreProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
)

0 comments on commit 66d8cd5

Please sign in to comment.