mirror of
https://github.com/darlinghq/xcbuild.git
synced 2025-02-21 17:00:49 +00:00
Add Swift Standard Library tool xcspec
Fix productType isWrapper check on SwiftResolver
This commit is contained in:
parent
490148105c
commit
2da2db34f2
@ -64,7 +64,7 @@ ShouldBundleSwiftRuntime(Tool::Context const *toolContext, pbxsetting::Environme
|
||||
* Need a place to put the runtime libraries. If the product is not a wrapper, then
|
||||
* there isn't a frameworks directory to include Swift in.
|
||||
*/
|
||||
if (productType->isWrapper()) {
|
||||
if (!productType->isWrapper()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -461,20 +461,23 @@ Create(Build::Environment const &buildEnvironment, Build::Context const &buildCo
|
||||
std::vector<std::string> variants = ResolveVariants(environment);
|
||||
environment.insertFront(ArchitecturesVariantsLevel(architectures, variants), false);
|
||||
|
||||
/* At the target level and below, the SDKROOT changes to always be a SDK path. */
|
||||
environment.insertFront(pbxsetting::Level({
|
||||
pbxsetting::Setting::Create("SDKROOT", sdk->path()),
|
||||
}), false);
|
||||
|
||||
/* Determine toolchains. Must be after the SDK levels are added, so they can be a fallback. */
|
||||
std::vector<xcsdk::SDK::Toolchain::shared_ptr> toolchains;
|
||||
std::vector<std::string> effectiveToolchainPaths;
|
||||
for (std::string const &toolchainName : pbxsetting::Type::ParseList(environment.resolve("TOOLCHAINS"))) {
|
||||
if (xcsdk::SDK::Toolchain::shared_ptr toolchain = buildEnvironment.sdkManager()->findToolchain(toolchainName)) {
|
||||
// TODO: Apply toolchain override build settings.
|
||||
toolchains.push_back(toolchain);
|
||||
effectiveToolchainPaths.push_back(toolchain->path());
|
||||
}
|
||||
}
|
||||
|
||||
environment.insertFront(pbxsetting::Level({
|
||||
/* At the target level and below, the SDKROOT changes to always be a SDK path. */
|
||||
pbxsetting::Setting::Create("SDKROOT", sdk->path()),
|
||||
pbxsetting::Setting::Create("EFFECTIVE_TOOLCHAINS_DIRS", pbxsetting::Type::FormatList(effectiveToolchainPaths)),
|
||||
}), false);
|
||||
|
||||
/* Tool search directories. Use the toolchains just discovered. */
|
||||
std::shared_ptr<xcsdk::SDK::Manager> const &sdkManager = buildEnvironment.sdkManager();
|
||||
std::vector<std::string> executablePaths = sdkManager->executablePaths(sdk->platform(), sdk, toolchains);
|
||||
|
@ -10,6 +10,7 @@
|
||||
install(FILES
|
||||
com.apple.build-tools.nmedit.xcspec
|
||||
com.apple.build-tools.strip.xcspec
|
||||
com.apple.build-tools.swift-stdlib-tool.xcspec
|
||||
com.apple.commands.built-in.compilation-database-generator.xcspec
|
||||
com.apple.commands.built-in.headermap-generator.xcspec
|
||||
com.apple.commands.built-in.validate.xcspec
|
||||
|
@ -0,0 +1,115 @@
|
||||
/**
|
||||
Copyright (c) 2015-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the BSD-style license found in the
|
||||
LICENSE file in the root directory of this source tree. An additional grant
|
||||
of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
{
|
||||
Type = Tool;
|
||||
Identifier = com.apple.build-tools.swift-stdlib-tool;
|
||||
Name = "Swift stdlib tool";
|
||||
|
||||
/* TODO: Need swift-stdlib-tool to construct valid command line. */
|
||||
CommandLine = "builtin-swiftStdLibTool [options]";
|
||||
RuleName = "CopySwiftLibs $(OutputPath)";
|
||||
|
||||
DeeplyStatInputDirectories = YES;
|
||||
Outputs = (
|
||||
"$(OutputPath)",
|
||||
);
|
||||
|
||||
Options = (
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_ACTION";
|
||||
CommandLineArgs = ( "--copy" );
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_VERBOSITY";
|
||||
Type = Enumeration;
|
||||
Values = (
|
||||
none,
|
||||
verbose,
|
||||
);
|
||||
DefaultValue = "verbose";
|
||||
CommandLineArgs = {
|
||||
none = ();
|
||||
verbose = (
|
||||
"--verbose",
|
||||
);
|
||||
};
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_EXECUTABLE_TO_SCAN";
|
||||
Type = Path;
|
||||
DefaultValue = "$(InputPath)";
|
||||
CommandLineFlag = "--scan-executable";
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_FOLDERS_TO_SCAN";
|
||||
Type = PathList;
|
||||
DefaultValue = "";
|
||||
CommandLineFlag = "--scan-folder";
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_SOURCE_LIBRARIES";
|
||||
Type = Path;
|
||||
DefaultValue = "$(SWIFT_LIBRARY_PATH)";
|
||||
CommandLineArgs = {
|
||||
"" = ( "--platform", "$(PLATFORM_NAME)" );
|
||||
"<<otherwise>>" = ( "--source-libraries", "$(value)" );
|
||||
};
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_TOOLCHAINS";
|
||||
Type = PathList;
|
||||
DefaultValue = "$(EFFECTIVE_TOOLCHAINS_DIRS)";
|
||||
CommandLineFlag = "--toolchain";
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_DESTINATION_DIR";
|
||||
Type = Path;
|
||||
DefaultValue = "$(TARGET_BUILD_DIR)/$(FRAMEWORKS_FOLDER_PATH)";
|
||||
CommandLineFlag = "--destination";
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_STRIP_BITCODE";
|
||||
Type = Boolean;
|
||||
DefaultValue = YES;
|
||||
CommandLineFlag = "--strip-bitcode";
|
||||
Condition = "$(ENABLE_BITCODE) == NO || $(BITCODE_GENERATION_MODE) != bitcode";
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_RESOURCE_DESTINATION";
|
||||
Type = Path;
|
||||
DefaultValue = "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)";
|
||||
CommandLineFlag = "--resource-destination";
|
||||
Condition = "$(DEPLOYMENT_POSTPROCESSING) == NO";
|
||||
},
|
||||
{
|
||||
Name = "SWIFT_STDLIB_TOOL_RESOURCE_LIBRARY";
|
||||
Type = StringList;
|
||||
DefaultValue = "libswiftRemoteMirror.dylib";
|
||||
CommandLineFlag = "--resource-library";
|
||||
Condition = "$(DEPLOYMENT_POSTPROCESSING) == NO";
|
||||
},
|
||||
{
|
||||
Name = TOOLCHAINS;
|
||||
Type = StringList;
|
||||
SetValueInEnvironmentVariable = TOOLCHAINS;
|
||||
},
|
||||
{
|
||||
Name = SDKROOT;
|
||||
Type = Path;
|
||||
SetValueInEnvironmentVariable = SDKROOT;
|
||||
},
|
||||
{
|
||||
Name = DEVELOPER_DIR;
|
||||
Type = Path;
|
||||
SetValueInEnvironmentVariable = DEVELOPER_DIR;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user