Skip to content

Update structure of the package to align more closely with standard SwiftPM packages #229

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 1 commit into from
Feb 5, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ find_package(LMDB CONFIG)

include(SwiftSupport)

add_subdirectory(lib)
add_subdirectory(Sources)
add_subdirectory(cmake/modules)
6 changes: 0 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ let package = Package(
.target(
name: "IndexStoreDB_Index",
dependencies: ["IndexStoreDB_Database"],
path: "lib/Index",
exclude: [
"CMakeLists.txt",
"indexstore_functions.def",
Expand All @@ -96,7 +95,6 @@ let package = Package(
.target(
name: "IndexStoreDB_CIndexStoreDB",
dependencies: ["IndexStoreDB_Index"],
path: "lib/CIndexStoreDB",
exclude: ["CMakeLists.txt"]),

// The lmdb database layer.
Expand All @@ -106,7 +104,6 @@ let package = Package(
"IndexStoreDB_Core",
.product(name: "CLMDB", package: "swift-lmdb"),
],
path: "lib/Database",
exclude: [
"CMakeLists.txt",
]),
Expand All @@ -115,21 +112,18 @@ let package = Package(
.target(
name: "IndexStoreDB_Core",
dependencies: ["IndexStoreDB_Support"],
path: "lib/Core",
exclude: ["CMakeLists.txt"]),

// Support code that is generally useful to the C++ implementation.
.target(
name: "IndexStoreDB_Support",
dependencies: ["IndexStoreDB_LLVMSupport"],
path: "lib/Support",
exclude: ["CMakeLists.txt"]),

// Copy of a subset of llvm's ADT and Support libraries.
.target(
name: "IndexStoreDB_LLVMSupport",
dependencies: [],
path: "lib/LLVMSupport",
exclude: [
"LICENSE.TXT",
"CMakeLists.txt",
Expand Down
6 changes: 6 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
add_subdirectory(IndexStoreDB_LLVMSupport)
add_subdirectory(IndexStoreDB_Support)
add_subdirectory(IndexStoreDB_Core)
add_subdirectory(IndexStoreDB_Database)
add_subdirectory(IndexStoreDB_Index)
add_subdirectory(IndexStoreDB_CIndexStoreDB)
add_subdirectory(IndexStoreDB)
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/IndexDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import CIndexStoreDB
@_implementationOnly import IndexStoreDB_CIndexStoreDB

public struct StoreUnitInfo {
public let mainFilePath: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/IndexStoreDB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB
import Foundation

// For `strdup`
Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/IndexStoreDBError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB

import protocol Foundation.LocalizedError

Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/Symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB

public enum IndexSymbolKind: Hashable, Sendable {
case unknown
Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/SymbolLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB
import Foundation

public struct SymbolLocation: Equatable, Sendable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/SymbolOccurrence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB

public struct SymbolOccurrence: Equatable {
public var symbol: Symbol
Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/SymbolProperty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB

public struct SymbolProperty: OptionSet, Hashable, Sendable {
public var rawValue: UInt64
Expand Down
2 changes: 1 addition & 1 deletion Sources/IndexStoreDB/SymbolRole.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

@_implementationOnly
import CIndexStoreDB
import IndexStoreDB_CIndexStoreDB

public struct SymbolRole: OptionSet, Hashable, Sendable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
//
//===----------------------------------------------------------------------===//

#include "CIndexStoreDB/CIndexStoreDB.h"
#include "CIndexStoreDB/CIndexStoreDB_Internal.h"
#include "IndexStoreDB/Index/IndexStoreLibraryProvider.h"
#include "IndexStoreDB/Index/IndexSystem.h"
#include "IndexStoreDB/Index/IndexSystemDelegate.h"
#include "IndexStoreDB/Support/Path.h"
#include "IndexStoreDB/Core/Symbol.h"
#include "indexstore/IndexStoreCXX.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include <IndexStoreDB_CIndexStoreDB/CIndexStoreDB.h>
#include <IndexStoreDB_CIndexStoreDB/CIndexStoreDB_Internal.h>
#include <IndexStoreDB_Index/IndexStoreLibraryProvider.h>
#include <IndexStoreDB_Index/IndexSystem.h>
#include <IndexStoreDB_Index/IndexSystemDelegate.h>
#include <IndexStoreDB_Support/Path.h>
#include <IndexStoreDB_Core/Symbol.h>
#include <IndexStoreDB_Index/IndexStoreCXX.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_IntrusiveRefCntPtr.h>
#include <Block.h>

using namespace IndexStoreDB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ add_library(CIndexStoreDB STATIC
target_compile_options(CIndexStoreDB PRIVATE
-fblocks)
target_include_directories(CIndexStoreDB PUBLIC
${PROJECT_SOURCE_DIR}/include/CIndexStoreDB)
include)
target_link_libraries(CIndexStoreDB PRIVATE
LLVMSupport)
target_link_libraries(CIndexStoreDB PUBLIC
Index)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
target_link_libraries(CIndexStoreDB PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef INDEXSTOREDB_INDEX_H
#define INDEXSTOREDB_INDEX_H

#include "indexstore/indexstore_functions.h"
#include <IndexStoreDB_CIndexStoreDB/indexstore_functions.h>
#include <stdint.h>
#include <stdbool.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef INDEXSTOREDB_INTERNAL_H
#define INDEXSTOREDB_INTERNAL_H

#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include <IndexStoreDB_LLVMSupport/llvm_ADT_IntrusiveRefCntPtr.h>
#include <utility>

namespace IndexStoreDB {
Expand Down
4 changes: 4 additions & 0 deletions Sources/IndexStoreDB_CIndexStoreDB/include/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module IndexStoreDB_CIndexStoreDB {
header "IndexStoreDB_CIndexStoreDB/CIndexStoreDB.h"
header "IndexStoreDB_CIndexStoreDB/indexstore_functions.h"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
add_library(Core STATIC
Symbol.cpp)
target_include_directories(Core PRIVATE
target_include_directories(Core PUBLIC
include)
target_link_libraries(Core PRIVATE
Support
LLVMSupport)
target_link_libraries(Core PUBLIC
Support)

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY IndexStoreDB_EXPORTS Core)
Expand Down
10 changes: 5 additions & 5 deletions lib/Core/Symbol.cpp → Sources/IndexStoreDB_Core/Symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
//
//===----------------------------------------------------------------------===//

#include "IndexStoreDB/Core/Symbol.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <IndexStoreDB_Core/Symbol.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_STLExtras.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_StringSwitch.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_ErrorHandling.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_raw_ostream.h>

using namespace IndexStoreDB;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
#ifndef INDEXSTOREDB_CORE_SYMBOL_H
#define INDEXSTOREDB_CORE_SYMBOL_H

#include "IndexStoreDB/Support/LLVM.h"
#include "IndexStoreDB/Support/Path.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/OptionSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Chrono.h"
#include <IndexStoreDB_Support/LLVM.h>
#include <IndexStoreDB_Support/Path.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_ArrayRef.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_Optional.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_OptionSet.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_StringRef.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_SmallVector.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_DataTypes.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_Chrono.h>
#include <memory>
#include <string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ target_compile_definitions(Database PRIVATE
_CRT_SECURE_NO_WARNINGS)
target_compile_options(Database PRIVATE
-fblocks)
target_include_directories(Database PRIVATE
target_include_directories(Database PUBLIC
include)
target_link_libraries(Database PRIVATE
LMDB::CLMDB
target_link_libraries(Database PUBLIC
Core
LLVMSupport)
LLVMSupport
Support)
target_link_libraries(Database PRIVATE
LMDB::CLMDB)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
target_link_libraries(Database PRIVATE
dispatch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
//===----------------------------------------------------------------------===//

#include "DatabaseImpl.h"
#include "IndexStoreDB/Core/Symbol.h"
#include "IndexStoreDB/Database/UnitInfo.h"
#include "IndexStoreDB/Support/Logging.h"
#include "IndexStoreDB/Support/Path.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/WindowsError.h"
#include <IndexStoreDB_Core/Symbol.h>
#include <IndexStoreDB_Database/UnitInfo.h>
#include <IndexStoreDB_Support/Logging.h>
#include <IndexStoreDB_Support/Path.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_Hashing.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_StringRef.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_StringMap.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_STLExtras.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_Errc.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_FileSystem.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_Mutex.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_Path.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_raw_ostream.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_WindowsError.h>
#if defined(_WIN32)
#define NOMINMAX
#include "Windows.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//

#include "IndexStoreDB/Database/DatabaseError.h"
#include <IndexStoreDB_Database/DatabaseError.h>
#include "lmdb/lmdb++.h"
#include "llvm/Support/raw_ostream.h"
#include <IndexStoreDB_LLVMSupport/llvm_Support_raw_ostream.h>

using namespace IndexStoreDB;
using namespace IndexStoreDB::db;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef INDEXSTOREDB_SKDATABASE_LIB_DATABASEIMPL_H
#define INDEXSTOREDB_SKDATABASE_LIB_DATABASEIMPL_H

#include "IndexStoreDB/Database/Database.h"
#include <IndexStoreDB_Database/Database.h>
#include "lmdb/lmdb++.h"
#include <dispatch/dispatch.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

#include "ImportTransactionImpl.h"
#include "DatabaseImpl.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Path.h"
#include <IndexStoreDB_LLVMSupport/llvm_ADT_StringRef.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_SmallString.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_Path.h>

using namespace IndexStoreDB;
using namespace IndexStoreDB::db;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#ifndef INDEXSTOREDB_SKDATABASE_LIB_IMPORTTRANSACTIONIMPL_H
#define INDEXSTOREDB_SKDATABASE_LIB_IMPORTTRANSACTIONIMPL_H

#include "IndexStoreDB/Database/ImportTransaction.h"
#include "IndexStoreDB/Database/UnitInfo.h"
#include <IndexStoreDB_Database/ImportTransaction.h>
#include <IndexStoreDB_Database/UnitInfo.h>
#include "lmdb/lmdb++.h"

namespace IndexStoreDB {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
//===----------------------------------------------------------------------===//

#include "ReadTransactionImpl.h"
#include "IndexStoreDB/Support/Path.h"
#include "IndexStoreDB/Support/PatternMatching.h"
#include "IndexStoreDB/Support/Logging.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <IndexStoreDB_Support/Path.h>
#include <IndexStoreDB_Support/PatternMatching.h>
#include <IndexStoreDB_Support/Logging.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_ArrayRef.h>
#include <IndexStoreDB_LLVMSupport/llvm_ADT_StringRef.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_Path.h>
#include <IndexStoreDB_LLVMSupport/llvm_Support_raw_ostream.h>

using namespace IndexStoreDB;
using namespace IndexStoreDB::db;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef INDEXSTOREDB_SKDATABASE_LIB_READTRANSACTIONIMPL_H
#define INDEXSTOREDB_SKDATABASE_LIB_READTRANSACTIONIMPL_H

#include "IndexStoreDB/Database/ReadTransaction.h"
#include <IndexStoreDB_Database/ReadTransaction.h>
#include "DatabaseImpl.h"
#include "lmdb/lmdb++.h"
#include <unordered_set>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#ifndef INDEXSTOREDB_SKDATABASE_DATABASE_H
#define INDEXSTOREDB_SKDATABASE_DATABASE_H

#include "IndexStoreDB/Database/IDCode.h"
#include "IndexStoreDB/Support/LLVM.h"
#include "IndexStoreDB/Support/Visibility.h"
#include <IndexStoreDB_Database/IDCode.h>
#include <IndexStoreDB_Support/LLVM.h>
#include <IndexStoreDB_Support/Visibility.h>
#include <memory>
#include <string>

Expand Down
Loading