             let diagnosticFile = diaDir.appending(component: "\(packageIdentity).dia")
             try localFileSystem.createDirectory(diaDir, recursive: true)
             cmd += ["-Xfrontend", "-serialize-diagnostics-path", "-Xfrontend", diagnosticFile.pathString]
-            result.diagnosticFile = diagnosticFile
+            evaluationResult.diagnosticFile = diagnosticFile
         }
 
         cmd += [manifestPath.pathString]
 
         cmd += self.extraManifestFlags
 
-        try withTemporaryDirectory(removeTreeOnDeinit: true) { tmpDir in
+        try withTemporaryDirectory { tmpDir, cleanupTmpDir in
             // Set path to compiled manifest executable.
 #if os(Windows)
             let executableSuffix = ".exe"

        )
    }

    private func parseAndCacheManifest(
        at path: AbsolutePath,
        packageIdentity: PackageIdentity,

        }

        // TODO: we could wrap the failure here with diagnostics if it wasn't optional throughout
        var closeAfterRead = DelayableAction(target: cache) { try? $0.close() }
        defer { closeAfterRead.perform() }

        let key : CacheKey
        do {
            key = try CacheKey(
                packageIdentity: packageIdentity,
                manifestPath: path,
                toolsVersion: toolsVersion,
                env: ProcessEnv.vars,
                swiftpmVersion: SwiftVersion.currentVersion.displayString,
                fileSystem: fileSystem
            )
        } catch {
            return completion(.failure(error))
        }

        do {
            // try to get it from the cache
            if let result = try cache?.get(key: key.sha256Checksum), let manifestJSON = result.manifestJSON, !manifestJSON.isEmpty {
                return completion(.success(try self.parseManifest(
                    result,
                    packageIdentity: packageIdentity,
                    packageKind: packageKind,
