예제 #1
0
std::unique_ptr<Tool::ScriptResolver> Tool::ScriptResolver::
Create(Phase::Environment const &phaseEnvironment)
{
    Build::Environment const &buildEnvironment = phaseEnvironment.buildEnvironment();
    Target::Environment const &targetEnvironment = phaseEnvironment.targetEnvironment();

    pbxspec::PBX::Tool::shared_ptr scriptTool = buildEnvironment.specManager()->tool(ScriptResolver::ToolIdentifier(), targetEnvironment.specDomains());
    if (scriptTool == nullptr) {
        fprintf(stderr, "warning: could not find shell script tool\n");
        return nullptr;
    }

    return std::unique_ptr<ScriptResolver>(new ScriptResolver(scriptTool));
}
std::unique_ptr<Tool::InterfaceBuilderResolver> Tool::InterfaceBuilderResolver::
Create(Phase::Environment const &phaseEnvironment, std::string const &toolIdentifier)
{
    Build::Environment const &buildEnvironment = phaseEnvironment.buildEnvironment();
    Target::Environment const &targetEnvironment = phaseEnvironment.targetEnvironment();

    pbxspec::PBX::Compiler::shared_ptr interfaceBuilderTool = buildEnvironment.specManager()->compiler(toolIdentifier, targetEnvironment.specDomains());
    if (interfaceBuilderTool == nullptr) {
        fprintf(stderr, "warning: could not find interface builder tool\n");
        return nullptr;
    }

    return std::unique_ptr<Tool::InterfaceBuilderResolver>(new Tool::InterfaceBuilderResolver(interfaceBuilderTool));
}
std::unique_ptr<Tool::SwiftStandardLibraryResolver> Tool::SwiftStandardLibraryResolver::
Create(Phase::Environment const &phaseEnvironment)
{
    Build::Environment const &buildEnvironment = phaseEnvironment.buildEnvironment();
    Target::Environment const &targetEnvironment = phaseEnvironment.targetEnvironment();

    pbxspec::PBX::Tool::shared_ptr swiftStandardLibraryTool = buildEnvironment.specManager()->tool(Tool::SwiftStandardLibraryResolver::ToolIdentifier(), targetEnvironment.specDomains());
    if (swiftStandardLibraryTool == nullptr) {
        fprintf(stderr, "warning: could not find swift standard library tool\n");
        return nullptr;
    }

    return std::unique_ptr<Tool::SwiftStandardLibraryResolver>(new Tool::SwiftStandardLibraryResolver(swiftStandardLibraryTool));
}
예제 #4
0
std::unique_ptr<Tool::HeadermapResolver> Tool::HeadermapResolver::
Create(Phase::Environment const &phaseEnvironment, pbxspec::PBX::Compiler::shared_ptr const &compiler)
{
    Build::Environment const &buildEnvironment = phaseEnvironment.buildEnvironment();
    Target::Environment const &targetEnvironment = phaseEnvironment.targetEnvironment();

    pbxspec::PBX::Tool::shared_ptr headermapTool = buildEnvironment.specManager()->tool(Tool::HeadermapResolver::ToolIdentifier(), targetEnvironment.specDomains());
    if (headermapTool == nullptr) {
        fprintf(stderr, "warning: could not find headermap tool\n");
        return nullptr;
    }

    return std::unique_ptr<Tool::HeadermapResolver>(new Tool::HeadermapResolver(headermapTool, compiler, buildEnvironment.specManager()));
}
예제 #5
0
std::unique_ptr<Tool::ToolResolver> Tool::ToolResolver::
Create(Phase::Environment const &phaseEnvironment, std::string const &identifier)
{
    Build::Environment const &buildEnvironment = phaseEnvironment.buildEnvironment();
    Target::Environment const &targetEnvironment = phaseEnvironment.targetEnvironment();

    pbxspec::PBX::Tool::shared_ptr tool = nullptr;
    if (pbxspec::PBX::Tool::shared_ptr tool_ = buildEnvironment.specManager()->tool(identifier, targetEnvironment.specDomains())) {
        tool = tool_;
    } else if (pbxspec::PBX::Compiler::shared_ptr compiler = buildEnvironment.specManager()->compiler(identifier, targetEnvironment.specDomains())) {
        tool = std::static_pointer_cast<pbxspec::PBX::Tool>(compiler);
    } else if (pbxspec::PBX::Linker::shared_ptr linker = buildEnvironment.specManager()->linker(identifier, targetEnvironment.specDomains())) {
        tool = std::static_pointer_cast<pbxspec::PBX::Tool>(linker);
    } else {
        fprintf(stderr, "warning: could not find tool %s\n", identifier.c_str());
        return nullptr;
    }

    return std::unique_ptr<Tool::ToolResolver>(new Tool::ToolResolver(tool));
}
예제 #6
0
std::unique_ptr<Tool::ClangResolver> Tool::ClangResolver::
Create(Phase::Environment const &phaseEnvironment)
{
    Build::Environment const &buildEnvironment = phaseEnvironment.buildEnvironment();
    Target::Environment const &targetEnvironment = phaseEnvironment.targetEnvironment();

    // TODO(grp): This should probably try a number of other compilers if it's not clang.
    std::string gccVersion = targetEnvironment.environment().resolve("GCC_VERSION");

    // TODO(grp): Depending on the build action, add a different suffix than ".compiler".
    pbxspec::PBX::Compiler::shared_ptr defaultCompiler = buildEnvironment.specManager()->compiler(gccVersion + ".compiler", targetEnvironment.specDomains());
    if (defaultCompiler == nullptr) {
        // TODO(grp): Should this fallback to a hardcoded default compiler here?
        defaultCompiler = buildEnvironment.specManager()->compiler("com.apple.compilers.llvm.clang.1_0.compiler", targetEnvironment.specDomains());
        if (defaultCompiler == nullptr) {
            fprintf(stderr, "error: couldn't get default compiler\n");
            return nullptr;
        }
    }

    return std::unique_ptr<Tool::ClangResolver>(new Tool::ClangResolver(defaultCompiler));
}