Don't query for Skylark sources by default
--
PiperOrigin-RevId: 178800102
MOS_MIGRATED_REVID=178800102
diff --git a/src/TulsiGenerator/Base.lproj/Options.strings b/src/TulsiGenerator/Base.lproj/Options.strings
index db8f040..7c3c11b 100644
--- a/src/TulsiGenerator/Base.lproj/Options.strings
+++ b/src/TulsiGenerator/Base.lproj/Options.strings
@@ -38,6 +38,6 @@
"SuppressSwiftUpdateCheck" = "Suppress Xcode Swift update check";
"SuppressSwiftUpdateCheck_DESC" = "Suppresses Xcode's update notification for projects containing Swift code. This asserts that the Swift code is at least version 2.1.";
-"SkipSkylarkFilesQuery" = "Don't add Skylark sources to the project";
-"SkipSkylarkFilesQuery_DESC" = "Avoid running a bazel query to get all BUILD and .bzl files in the build. This could save time during project generation.";
+"IncludeBuildSources" = "Include Bazel sources in the generated project.";
+"IncludeBuildSources_DESC" = "Add .bzl and BUILD files related to selected targets in the generated Xcode project. This may slow down project generation significantly.";
diff --git a/src/TulsiGenerator/TulsiOptionSet.swift b/src/TulsiGenerator/TulsiOptionSet.swift
index 68644b1..2659d10 100644
--- a/src/TulsiGenerator/TulsiOptionSet.swift
+++ b/src/TulsiGenerator/TulsiOptionSet.swift
@@ -43,8 +43,8 @@
// Option to enable ObjC module map workarounds in the generated Xcodeproj.
ObjCModuleMapWorkarounds,
- // Skip running a bazel query to find all .bzl files
- SkipSkylarkFilesQuery
+ // Include all .bzl files related to the build in the generated Xcodeproj.
+ IncludeBuildSources
// Options for build invocations.
@@ -277,7 +277,7 @@
addStringOption(.BazelBuildStartupOptionsDebug, [.TargetSpecializable, .SupportsInheritKeyword])
addStringOption(.BazelBuildStartupOptionsRelease, [.TargetSpecializable, .SupportsInheritKeyword])
addBoolOption(.SuppressSwiftUpdateCheck, .Generic, true)
- addBoolOption(.SkipSkylarkFilesQuery, .Generic, false)
+ addBoolOption(.IncludeBuildSources, .Generic, false)
addStringOption(.CommandlineArguments, [.TargetSpecializable, .SupportsInheritKeyword])
addStringOption(.EnvironmentVariables, [.TargetSpecializable, .SupportsInheritKeyword])
diff --git a/src/TulsiGenerator/XcodeProjectGenerator.swift b/src/TulsiGenerator/XcodeProjectGenerator.swift
index 5640f38..8c7f339 100644
--- a/src/TulsiGenerator/XcodeProjectGenerator.swift
+++ b/src/TulsiGenerator/XcodeProjectGenerator.swift
@@ -389,8 +389,8 @@
progressNotifier.incrementValue()
}
- if let skipSkylarkFiles = config.options[.SkipSkylarkFilesQuery].commonValueAsBool,
- !skipSkylarkFiles {
+ if let includeSkylarkSources = config.options[.IncludeBuildSources].commonValueAsBool,
+ includeSkylarkSources {
profileAction("adding_buildfiles") {
let buildfiles = workspaceInfoExtractor.extractBuildfiles(expandedTargetLabels)
let paths = buildfiles.map() { $0.asFileName! }
diff --git a/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift b/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift
index 2fc2aa3..fd1525c 100644
--- a/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift
+++ b/src/TulsiGeneratorIntegrationTests/EndToEndGenerationTests.swift
@@ -155,13 +155,17 @@
let additionalFilePaths = ["\(testDir)/BUILD"]
let projectName = "ComplexSingleProject"
+
+ let projectOptions = TulsiOptionSet()
+ projectOptions[.IncludeBuildSources].projectValue = "YES"
let projectURL = try generateProjectNamed(projectName,
buildTargets: buildTargets,
pathFilters: ["\(testDir)/...",
"blaze-bin/...",
"blaze-genfiles/..."],
additionalFilePaths: additionalFilePaths,
- outputDir: "tulsi_e2e_output")
+ outputDir: "tulsi_e2e_output",
+ options: projectOptions)
let diffLines = diffProjectAt(projectURL, againstGoldenProject: projectName)
validateDiff(diffLines)
diff --git a/src/TulsiGeneratorTests/TulsiOptionSetTests.swift b/src/TulsiGeneratorTests/TulsiOptionSetTests.swift
index c362ae8..d039e2d 100644
--- a/src/TulsiGeneratorTests/TulsiOptionSetTests.swift
+++ b/src/TulsiGeneratorTests/TulsiOptionSetTests.swift
@@ -94,7 +94,7 @@
parent[.BazelBuildStartupOptionsRelease].projectValue = parentValue
parent[.ALWAYS_SEARCH_USER_PATHS].projectValue = "YES"
parent[.SuppressSwiftUpdateCheck].projectValue = "NO"
- parent[.SkipSkylarkFilesQuery].projectValue = "NO"
+ parent[.IncludeBuildSources].projectValue = "NO"
let childValue = "ChildValue"