Skip to content

Commit 56e9162

Browse files
authored
Merge pull request #961 from cwakamo/eng/issue-959-add-TCASDatabase-support-to-TEngine
[llbuild3] Add support for passing a TCASDatabase to TEngine. Exposed the existing makeExtCASDatabase function to Swift via SwiftAdaptors.hpp. Added a casDB parameter to TEngine's main initializer, and used makeExtCASDatabase to make the necessary CASDatabaseRef when casDB is not nil. This matches the behavior of the TActionCache? parameter to TEngine's main initializer. This commit resolves #959.
2 parents 9571cd4 + c856e3a commit 56e9162

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

products/llbuild3/SwiftAdaptors.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ struct ExtCASDatabase {
128128

129129
class CASDatabase;
130130
typedef std::shared_ptr<CASDatabase> CASDatabaseRef;
131+
LLBUILD3_EXPORT CASDatabaseRef makeExtCASDatabase(ExtCASDatabase extCASDB);
131132
LLBUILD3_EXPORT CASDatabaseRef makeInMemoryCASDatabase();
132133

133134
struct ExtActionCache {

src/llbuild3/core/Engine.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,13 @@ extension TEngineConfig {
391391
public class TEngine {
392392
private var eng: llbuild3.core.EngineRef
393393

394-
convenience public init (config: TEngineConfig = TEngineConfig(), actionCache: TActionCache? = nil, baseRuleProvider: TRuleProvider) throws {
395-
// FIXME: move cas outside
396-
let tcas = llbuild3.core.makeInMemoryCASDatabase()
394+
convenience public init (config: TEngineConfig = TEngineConfig(), casDB: TCASDatabase? = nil, actionCache: TActionCache? = nil, baseRuleProvider: TRuleProvider) throws {
395+
let tcas: llbuild3.core.CASDatabaseRef
396+
if let casDB {
397+
tcas = llbuild3.core.makeExtCASDatabase(casDB.extCASDatabase())
398+
} else {
399+
tcas = llbuild3.core.CASDatabaseRef()
400+
}
397401

398402
let tcache: llbuild3.core.ActionCacheRef
399403
if let cache = actionCache {

0 commit comments

Comments
 (0)