static string CopyToReferenceFolder(Artifact.Artifact artifact, string referenceFolder) { string artifactReferenceFilePath = ArtifactUtils.GetArtifactReferenceFilePath(artifact, referenceFolder); bool overwriteReferenceFile; DateTime localRepoArtifactTimestamp = ArtifactUtils.GetArtifactTimestamp(artifact); if (File.Exists(artifactReferenceFilePath)) { DateTime referenceFileTimestamp = new FileInfo(artifactReferenceFilePath).LastWriteTimeUtc; overwriteReferenceFile = ArtifactUtils.IsEarlierArtifactTimestamp( referenceFileTimestamp, localRepoArtifactTimestamp); } else { overwriteReferenceFile = true; } if (overwriteReferenceFile) { File.Copy(artifact.FileInfo.FullName, artifactReferenceFilePath, true); // set the timestamp of the local repo's artifact new FileInfo(artifactReferenceFilePath).LastWriteTimeUtc = localRepoArtifactTimestamp; } return(artifactReferenceFilePath); }
private void CopyArtifactImpl( Artifact.Artifact artifact, ArtifactResyncSource artifactResyncSource) { EnsureInitialized(); bool isSnapshot = ArtifactUtils.IsSnapshot(artifact); bool resyncFromRemoteRepo = artifactResyncSource == ArtifactResyncSource.RemoteRepository; if (!ArtifactUtils.Exists(artifact) || (isSnapshot && resyncFromRemoteRepo)) { if (!ArtifactUtils.DownloadFromRemoteRepository(artifact)) { RaiseError("Unable to get the artifact {0} from any of your repositories.", artifact.ArtifactId); return; } } CopyToReferenceFolder(artifact, referenceFolder); }