Skip to content

Commit

Permalink
Got rid of some unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Gummesson committed Sep 14, 2016
1 parent c612f4d commit 451e2d3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 53 deletions.
4 changes: 0 additions & 4 deletions BuildTimeAnalyzer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
2A5404011D86D01700DBD44C /* BuildManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5404001D86D01700DBD44C /* BuildManager.swift */; };
2A5404031D86DE0C00DBD44C /* XcodeDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5404021D86DE0C00DBD44C /* XcodeDatabase.swift */; };
2A5404051D86F3C700DBD44C /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5404041D86F3C700DBD44C /* File.swift */; };
2A5B32C21D86C629000705E1 /* CacheFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5B32C11D86C629000705E1 /* CacheFile.swift */; };
2A9807DD1D7C71F900B9232C /* DirectoryMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9807DC1D7C71F900B9232C /* DirectoryMonitor.swift */; };
2A9807DF1D7C76FD00B9232C /* ProjectSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9807DE1D7C76FD00B9232C /* ProjectSelection.swift */; };
2ABFB6CE1D81F2DE00D060BF /* NSAlert+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2ABFB6CD1D81F2DE00D060BF /* NSAlert+Extensions.swift */; };
Expand Down Expand Up @@ -53,7 +52,6 @@
2A5404001D86D01700DBD44C /* BuildManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildManager.swift; sourceTree = "<group>"; };
2A5404021D86DE0C00DBD44C /* XcodeDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XcodeDatabase.swift; sourceTree = "<group>"; };
2A5404041D86F3C700DBD44C /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
2A5B32C11D86C629000705E1 /* CacheFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CacheFile.swift; sourceTree = "<group>"; };
2A9807DC1D7C71F900B9232C /* DirectoryMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirectoryMonitor.swift; sourceTree = "<group>"; };
2A9807DE1D7C76FD00B9232C /* ProjectSelection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectSelection.swift; sourceTree = "<group>"; };
2ABFB6CD1D81F2DE00D060BF /* NSAlert+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAlert+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -131,7 +129,6 @@
2ABFB6D11D81F37300D060BF /* Models */ = {
isa = PBXGroup;
children = (
2A5B32C11D86C629000705E1 /* CacheFile.swift */,
2A3164C01D21D73F00064045 /* CompileMeasure.swift */,
2A5404041D86F3C700DBD44C /* File.swift */,
2A3164C31D21D73F00064045 /* ProcessingState.swift */,
Expand Down Expand Up @@ -308,7 +305,6 @@
files = (
2A9807DD1D7C71F900B9232C /* DirectoryMonitor.swift in Sources */,
2A3164DA1D21D90100064045 /* NSData+GZIP.m in Sources */,
2A5B32C21D86C629000705E1 /* CacheFile.swift in Sources */,
2A3164C91D21D73F00064045 /* LogProcessor.swift in Sources */,
2A5404011D86D01700DBD44C /* BuildManager.swift in Sources */,
2A5404051D86F3C700DBD44C /* File.swift in Sources */,
Expand Down
12 changes: 0 additions & 12 deletions BuildTimeAnalyzer/CacheFile.swift

This file was deleted.

37 changes: 0 additions & 37 deletions BuildTimeAnalyzer/DerivedDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,4 @@ class DerivedDataManager {

return enumerator.map{ $0 as! URL }
}

static func listCacheFiles() -> [CacheFile] {
let files = cacheFiles(at: URL(fileURLWithPath: UserSettings.derivedDataLocation))
let earliestDate = Date().addingTimeInterval(-24 * 60 * 60)
return filterFiles(files, byEarliestDate: earliestDate)
}

static private func cacheFiles(at url: URL) -> [CacheFile] {
let fileManager = FileManager.default
let keys = [URLResourceKey.nameKey, URLResourceKey.isDirectoryKey]
let options: FileManager.DirectoryEnumerationOptions = [.skipsHiddenFiles, .skipsPackageDescendants, .skipsSubdirectoryDescendants]

guard let enumerator = fileManager.enumerator(at: url, includingPropertiesForKeys: keys, options: options, errorHandler: nil) else { return [] }

var result: [CacheFile] = []
for case let fileURL as URL in enumerator {
let name = fileURL.lastPathComponent
let cachePath = fileURL.appendingPathComponent("Logs/Build/Cache.db").path

if let properties = try? fileManager.attributesOfItem(atPath: cachePath),
let modificationDate = properties[FileAttributeKey.modificationDate] as? Date {
result.append(CacheFile(name: name, path: cachePath, modificationDate: modificationDate))
}
}
return result
}

static private func filterFiles(_ files: [CacheFile], byEarliestDate date: Date) -> [CacheFile] {
guard files.count > 0 else { return [] }

let sortedFiles = files.sorted(by: { $0.modificationDate > $1.modificationDate })
let recentFiles = sortedFiles.filter({ $0.modificationDate > date })
if recentFiles.count == 0 {
return [sortedFiles[0]]
}
return recentFiles
}
}

0 comments on commit 451e2d3

Please sign in to comment.