Skip to content

[CAS] Teach swift compiler to compute cache key and store outputs into CAS #65288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/swift/AST/DiagnosticsFrontend.def
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ ERROR(error_output_missing,none,
REMARK(matching_output_produced,none,
"produced matching output file '%0' for deterministic check: hash '%1'", (StringRef, StringRef))

// Caching related diagnostics
ERROR(error_caching_no_cas_fs, none,
"caching is enabled without -cas-fs option, input is not immutable", ())

// CAS related diagnostics
ERROR(error_create_cas, none, "failed to create CAS '%0' (%1)", (StringRef, StringRef))
ERROR(error_invalid_cas_id, none, "invalid CASID '%0' (%1)", (StringRef, StringRef))
Expand Down
3 changes: 3 additions & 0 deletions include/swift/Basic/FileTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@ TYPE("pch", PCH, "pch", "")
TYPE("none", Nothing, "", "")

TYPE("abi-baseline-json", SwiftABIDescriptor, "abi.json", "")
TYPE("fixit", SwiftFixIt, "", "")
TYPE("module-semantic-info", ModuleSemanticInfo, "", "")
TYPE("cached-diagnostics", CachedDiagnostics, "", "")

#undef TYPE
156 changes: 156 additions & 0 deletions include/swift/Basic/SupplementaryOutputPaths.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
//===--- SupplementaryOutputPaths.def - Output Names and Types --*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines all the Supplemtary Output Path variables and their
// output types.
//
//===----------------------------------------------------------------------===//

/// The path to which we should emit a header file that exposes the Swift
/// declarations to C, Objective-C and C++ clients for the module.
///
/// Currently only makes sense when the compiler has whole module knowledge.
/// The modes for which it makes sense incuide both WMO and the "merge
/// modules" job that happens after the normal compilation jobs. That's where
/// the header is emitted in single-file mode, since it needs whole-module
/// information.
///
/// \sa swift::printAsClangHeader
OUTPUT(ClangHeaderOutputPath, TY_ClangHeader)

/// The path to which we should emit a serialized module.
/// It is valid whenever there are any inputs.
///
/// This binary format is used to describe the interface of a module when
/// imported by client source code. The swiftmodule format is described in
/// docs/Serialization.md.
///
/// \sa swift::serialize
OUTPUT(ModuleOutputPath, TY_SwiftModuleFile)

/// The path to which we should emit a module source information file.
/// It is valid whenever there are any inputs.
///
/// This binary format stores source locations and other information about the
/// declarations in a module.
///
/// \sa swift::serialize
OUTPUT(ModuleSourceInfoOutputPath, TY_SwiftSourceInfoFile)

/// The path to which we should emit a module documentation file.
/// It is valid whenever there are any inputs.
///
/// This binary format stores doc comments and other information about the
/// declarations in a module.
///
/// \sa swift::serialize
OUTPUT(ModuleDocOutputPath, TY_SwiftModuleDocFile)

/// The path to which we should output a Make-style dependencies file.
/// It is valid whenever there are any inputs.
///
/// Swift's compilation model means that Make-style dependencies aren't
/// well-suited to model fine-grained dependencies. See docs/Driver.md for
/// more information.
///
/// \sa ReferenceDependenciesFilePath
OUTPUT(DependenciesFilePath, TY_Dependencies)

/// The path to which we should output a Swift "reference dependencies" file.
/// It is valid whenever there are any inputs.
///
/// "Reference dependencies" track dependencies on a more fine-grained level
/// than just "this file depends on that file". With Swift's "implicit
/// visibility" within a module, that becomes very important for any sort of
/// incremental build. These files are consumed by the Swift driver to decide
/// whether a source file needs to be recompiled during a build. See
/// docs/DependencyAnalysis.md for more information.
///
/// \sa swift::emitReferenceDependencies
/// \sa DependencyGraph
OUTPUT(ReferenceDependenciesFilePath, TY_SwiftDeps)

/// Path to a file which should contain serialized diagnostics for this
/// frontend invocation.
///
/// This uses the same serialized diagnostics format as Clang, for tools that
/// want machine-parseable diagnostics. There's a bit more information on
/// how clients might use this in docs/Driver.md.
///
/// \sa swift::serialized_diagnostics::createConsumer
OUTPUT(SerializedDiagnosticsPath, TY_SerializedDiagnostics)

/// The path to which we should output fix-its as source edits.
///
/// This is a JSON-based format that is used by the migrator, but is not
/// really vetted for anything else.
///
/// \sa swift::writeEditsInJson
OUTPUT(FixItsOutputPath, TY_SwiftFixIt)

/// The path to which we should output a loaded module trace file.
/// It is valid whenever there are any inputs.
///
/// The file is appended to, and consists of line-delimited JSON objects,
/// where each line is of the form `{ "name": NAME, "target": TARGET,
/// "swiftmodules": [PATH, PATH, ...] }`, representing the (real-path) PATHs
/// to each .swiftmodule that was loaded while building module NAME for target
/// TARGET. This format is subject to arbitrary change, however.
OUTPUT(LoadedModuleTracePath, TY_ModuleTrace)

/// The path to which we should output a TBD file.
///
/// "TBD" stands for "text-based dylib". It's a YAML-based format that
/// describes the public ABI of a library, which clients can link against
/// without having an actual dynamic library binary.
///
/// Only makes sense when the compiler has whole-module knowledge.
///
/// \sa swift::writeTBDFile
OUTPUT(TBDPath, TY_TBD)

/// The path to which we should emit a module interface, which can
/// be used by a client source file to import this module.
///
/// This format is similar to the binary format used for #ModuleOutputPath,
/// but is intended to be stable across compiler versions.
///
/// Currently only makes sense when the compiler has whole-module knowledge.
///
/// \sa swift::emitSwiftInterface
OUTPUT(ModuleInterfaceOutputPath, TY_SwiftModuleInterfaceFile)

/// The path to which we should emit a private module interface.
///
/// The private module interface contains all SPI decls and attributes.
///
/// \sa ModuleInterfaceOutputPath
OUTPUT(PrivateModuleInterfaceOutputPath,
TY_PrivateSwiftModuleInterfaceFile)

/// The path to which we should emit module summary file.
OUTPUT(ModuleSummaryOutputPath, TY_SwiftModuleSummaryFile)

/// The output path to generate ABI baseline.
OUTPUT(ABIDescriptorOutputPath, TY_SwiftABIDescriptor)

/// The output path for extracted compile-time-known value information
OUTPUT(ConstValuesOutputPath, TY_ConstValues)

/// The output path of Swift semantic info for this module.
OUTPUT(ModuleSemanticInfoOutputPath, TY_ModuleSemanticInfo)

/// The output path for YAML optimization record file.
OUTPUT(YAMLOptRecordPath, TY_YAMLOptRecord)

/// The output path for bitstream optimization record file.
OUTPUT(BitstreamOptRecordPath, TY_BitstreamOptRecord)
Loading