Skip to content

Commit

Permalink
Add support for direct CASAPI access from libToolchainCASPlugin.dylib
Browse files Browse the repository at this point in the history
Add initial CAS support through libToolchainCASPlugin.dylib
  • Loading branch information
cachemeifyoucan committed Aug 15, 2023
1 parent 688a840 commit 3be6d03
Show file tree
Hide file tree
Showing 17 changed files with 716 additions and 17 deletions.
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ let package = Package(
.target(name: "CSwiftScan",
exclude: [ "CMakeLists.txt" ]),

/// C modules wrapper for ToolchainCASPlugin.
.target(name: "CToolchainCASPlugin",
exclude: [ "CMakeLists.txt" ]),

/// The driver library.
.target(
name: "SwiftDriver",
dependencies: [
"SwiftOptions",
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
"CSwiftScan",
"CToolchainCASPlugin",
.product(name: "Yams", package: "yams"),
],
exclude: ["CMakeLists.txt"]),
Expand Down
1 change: 1 addition & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_subdirectory(CSwiftScan)
add_subdirectory(CToolchainCASPlugin)
add_subdirectory(SwiftOptions)
add_subdirectory(SwiftDriver)
add_subdirectory(SwiftDriverExecution)
Expand Down
5 changes: 5 additions & 0 deletions Sources/CSwiftScan/include/swiftscan_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ typedef struct {

//=== Scanner CAS Operations ----------------------------------------------===//
swiftscan_cas_t (*swiftscan_cas_create)(const char *path);
swiftscan_cas_t (*swiftscan_cas_create_from_plugin)(const char *plugin_path,
const char *ondisk_path,
int argc,
const char **keys,
const char **values);
void (*swiftscan_cas_dispose)(swiftscan_cas_t cas);
swiftscan_string_ref_t (*swiftscan_cas_store)(swiftscan_cas_t cas,
uint8_t *data, unsigned size);
Expand Down
10 changes: 10 additions & 0 deletions Sources/CToolchainCASPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(CToolchainCASPlugin STATIC
ToolchainCASPluginImpl.c)
3 changes: 3 additions & 0 deletions Sources/CToolchainCASPlugin/ToolchainCASPluginImpl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file is here to prevent the package manager from warning about a
// target with no sources.
#include "include/ToolchainCASPlugin_CAPI.h"
Loading

0 comments on commit 3be6d03

Please sign in to comment.