Skip to content

Commit

Permalink
use local dependencies in swift CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewbastien committed Nov 15, 2024
1 parent 8464623 commit bc37a5b
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
// swift-tools-version:5.5

import Foundation
import PackageDescription

func hasEnvironmentVariable(_ name: String) -> Bool {
return ProcessInfo.processInfo.environment[name] != nil
}

/// Assume that all the package dependencies are checked out next to indexstore-db and use that instead of fetching a
/// remote dependency.
var useLocalDependencies: Bool { hasEnvironmentVariable("SWIFTCI_USE_LOCAL_DEPS") }

var dependencies: [Package.Dependency] {
if useLocalDependencies {
return [
.package(path: "../swift-lmdb"),
]
} else {
return [
.package(url: "https://github.com/swiftlang/swift-lmdb.git", branch: "main"),
]
}
}

let package = Package(
name: "IndexStoreDB",
products: [
Expand All @@ -18,9 +39,7 @@ let package = Package(
name: "tibs",
targets: ["tibs"])
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-lmdb.git", branch: "main"),
],
dependencies: dependencies,
targets: [

// MARK: Swift interface
Expand Down

0 comments on commit bc37a5b

Please sign in to comment.