当前位置: 首页>>代码示例>>C++>>正文


C++ pbxsetting::Environment类代码示例

本文整理汇总了C++中pbxsetting::Environment的典型用法代码示例。如果您正苦于以下问题:C++ Environment类的具体用法?C++ Environment怎么用?C++ Environment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Environment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: resolve

void Tool::ScriptResolver::
resolve(
    Tool::Context *toolContext,
    pbxsetting::Environment const &environment,
    pbxproj::PBX::LegacyTarget::shared_ptr const &legacyTarget) const
{
    std::string logMessage = "ExternalBuildToolExecution " + legacyTarget->name();

    std::string script = environment.expand(legacyTarget->buildArgumentsString());

    std::unordered_map<std::string, std::string> environmentVariables;
    if (legacyTarget->passBuildSettingsInEnvironment()) {
        environmentVariables = environment.computeValues(pbxsetting::Condition::Empty());
    }

    std::string fullWorkingDirectory = FSUtil::ResolveRelativePath(legacyTarget->buildWorkingDirectory(), toolContext->workingDirectory());

    Tool::Invocation invocation;
    invocation.executable() = Tool::Invocation::Executable::Determine(legacyTarget->buildToolPath(), toolContext->executablePaths());
    invocation.arguments() = pbxsetting::Type::ParseList(script);
    invocation.environment() = environmentVariables;
    invocation.workingDirectory() = fullWorkingDirectory;
    invocation.logMessage() = logMessage;
    toolContext->invocations().push_back(invocation);
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:25,代码来源:ScriptResolver.cpp

示例2: DeploymentTargetArguments

std::vector<std::string> Tool::InterfaceBuilderCommon::
DeploymentTargetArguments(pbxsetting::Environment const &environment)
{
    return {
        "--minimum-deployment-target",
        environment.resolve(environment.resolve("DEPLOYMENT_TARGET_SETTING_NAME")),
    };
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:8,代码来源:InterfaceBuilderCommon.cpp

示例3: AppendNotUsedInPrecompsFlags

static void
AppendNotUsedInPrecompsFlags(std::vector<std::string> *args, pbxsetting::Environment const &environment)
{
    std::vector<std::string> preprocessorDefinitions = pbxsetting::Type::ParseList(environment.resolve("GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS"));
    Tool::CompilerCommon::AppendCompoundFlags(args, "-D", true, preprocessorDefinitions);

    std::vector<std::string> otherFlags = pbxsetting::Type::ParseList(environment.resolve("GCC_OTHER_CFLAGS_NOT_USED_IN_PRECOMPS"));
    args->insert(args->end(), otherFlags.begin(), otherFlags.end());
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:9,代码来源:ClangResolver.cpp

示例4: ResolveArchitectures

static std::vector<std::string>
ResolveArchitectures(pbxsetting::Environment const &environment)
{
    std::vector<std::string> archsVector = pbxsetting::Type::ParseList(environment.resolve("ARCHS"));
    std::set<std::string> archs = std::set<std::string>(archsVector.begin(), archsVector.end());
    std::vector<std::string> validArchsVector = pbxsetting::Type::ParseList(environment.resolve("VALID_ARCHS"));
    std::set<std::string> validArchs = std::set<std::string>(validArchsVector.begin(), validArchsVector.end());

    std::vector<std::string> architectures;
    std::set_intersection(archs.begin(), archs.end(), validArchs.begin(), validArchs.end(), std::back_inserter(architectures));
    return architectures;
}
开发者ID:Ktwu,项目名称:xcbuild,代码行数:12,代码来源:Environment.cpp

示例5: TargetedDeviceSetting

pbxsetting::Setting Tool::InterfaceBuilderCommon::
TargetedDeviceSetting(pbxsetting::Environment const &environment)
{
    /*
     * Determine the target devices from the environment.
     */
    std::vector<std::string> targetDeviceNames = InterfaceBuilderCommon::TargetedDeviceNames(
        environment.resolve("PLATFORM_NAME"),
        environment.resolve("TARGETED_DEVICE_FAMILY"));

    return pbxsetting::Setting::Create("RESOURCES_TARGETED_DEVICE_FAMILY", pbxsetting::Type::FormatList(targetDeviceNames));
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:12,代码来源:InterfaceBuilderCommon.cpp

示例6: EvaluateCondition

static bool
EvaluateCondition(std::string const &condition, pbxsetting::Environment const &environment)
{
#define WARN_UNHANDLED_CONDITION 0

    // TODO(grp): Evaluate condition expression language correctly.
    std::string expression = environment.expand(pbxsetting::Value::Parse(condition));

    std::string::size_type eq = expression.find(" == ");
    if (eq != std::string::npos) {
        std::string lhs = expression.substr(0, eq);
        std::string rhs = expression.substr(eq + 4);
#if WARN_UNHANDLED_CONDITION
        fprintf(stderr, "warning: unhandled condition evaluation '%s' == '%s'\n", lhs.c_str(), rhs.c_str());
#endif
        return (lhs == rhs);
    }

    std::string::size_type noteq = expression.find(" != ");
    if (noteq != std::string::npos) {
        std::string lhs = expression.substr(0, noteq);
        std::string rhs = expression.substr(noteq + 4);
#if WARN_UNHANDLED_CONDITION
        fprintf(stderr, "warning: unhandled condition evaluation '%s' != '%s'\n", lhs.c_str(), rhs.c_str());
#endif
        return (lhs != rhs);
    }

#if WARN_UNHANDLED_CONDITION
    fprintf(stderr, "warning: unhandled condition evaluation '%s'\n", expression.c_str());
#endif
    return expression != "NO";
}
开发者ID:Ktwu,项目名称:xcbuild,代码行数:33,代码来源:OptionsResult.cpp

示例7: AppendFrameworkPathFlags

static void
AppendFrameworkPathFlags(std::vector<std::string> *args, pbxsetting::Environment const &environment, Tool::SearchPaths const &searchPaths)
{
    std::vector<std::string> specialFrameworkPaths = {
        environment.resolve("BUILT_PRODUCTS_DIR"),
    };
    Tool::CompilerCommon::AppendCompoundFlags(args, "-F", true, specialFrameworkPaths);
    Tool::CompilerCommon::AppendCompoundFlags(args, "-F", true, searchPaths.frameworkSearchPaths());
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:9,代码来源:ClangResolver.cpp

示例8: AddOptionArgumentValues

static void
AddOptionArgumentValues(std::vector<std::string> *arguments, pbxsetting::Environment const &environment, std::string const &workingDirectory, std::vector<pbxsetting::Value> const &args, pbxspec::PBX::PropertyOption::shared_ptr const &option)
{
    if ((option->type() == "StringList" || option->type() == "stringlist") ||
        (option->type() == "PathList" || option->type() == "pathlist")) {
        std::vector<std::string> values = pbxsetting::Type::ParseList(environment.resolve(option->name()));
        if (option->flattenRecursiveSearchPathsInValue()) {
            values = Tool::SearchPaths::ExpandRecursive(values, environment, workingDirectory);
        }

        for (std::string const &value : values) {
            AddOptionArgumentValue(arguments, environment, args, value);
        }
    } else {
        std::string value = environment.resolve(option->name());
        AddOptionArgumentValue(arguments, environment, args, value);
    }
}
开发者ID:Ktwu,项目名称:xcbuild,代码行数:18,代码来源:OptionsResult.cpp

示例9: AppendDependencyInfoFlags

static void
AppendDependencyInfoFlags(std::vector<std::string> *args, pbxspec::PBX::Compiler::shared_ptr const &compiler, pbxsetting::Environment const &environment)
{
    if (compiler->dependencyInfoArgs()) {
        for (pbxsetting::Value const &arg : *compiler->dependencyInfoArgs()) {
            args->push_back(environment.expand(arg));
        }
    }
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:9,代码来源:ClangResolver.cpp

示例10: AppendCustomFlags

static void
AppendCustomFlags(std::vector<std::string> *args, pbxsetting::Environment const &environment, ext::optional<std::string> const &dialect)
{
    std::vector<std::string> flagSettings;
    flagSettings.push_back("WARNING_CFLAGS");
    flagSettings.push_back("OPTIMIZATION_CFLAGS");
    if (DialectIsCPlusPlus(dialect)) {
        flagSettings.push_back("OTHER_CPLUSPLUSFLAGS");
    } else {
        flagSettings.push_back("OTHER_CFLAGS");
    }
    flagSettings.push_back("OTHER_CFLAGS_" + environment.resolve("CURRENT_VARIANT"));
    flagSettings.push_back("PER_ARCH_CFLAGS_" + environment.resolve("CURRENT_ARCH"));

    for (std::string const &flagSetting : flagSettings) {
        std::vector<std::string> flags = pbxsetting::Type::ParseList(environment.resolve(flagSetting));
        args->insert(args->end(), flags.begin(), flags.end());
    }
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:19,代码来源:ClangResolver.cpp

示例11: LoadConfigurationFile

static pbxsetting::XC::Config::shared_ptr
LoadConfigurationFile(pbxproj::XC::BuildConfiguration::shared_ptr const &buildConfiguration, pbxsetting::Environment const &environment)
{
    if (buildConfiguration->baseConfigurationReference() == nullptr) {
        return nullptr;
    }

    pbxsetting::Value configurationValue = buildConfiguration->baseConfigurationReference()->resolve();
    std::string configurationPath = environment.expand(configurationValue);
    return pbxsetting::XC::Config::Open(configurationPath, environment);
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:11,代码来源:Environment.cpp

示例12: CompileLogMessage

static std::string
CompileLogMessage(
    pbxspec::PBX::Compiler::shared_ptr const &compiler,
    std::string const &logTitle,
    std::string const &input,
    pbxspec::PBX::FileType::shared_ptr const &fileType,
    std::string const &output,
    pbxsetting::Environment const &environment,
    std::string const &workingDirectory
)
{
    std::string logMessage;
    logMessage += logTitle + " ";
    logMessage += output + " ";
    logMessage += FSUtil::GetRelativePath(input, workingDirectory) + " ";
    logMessage += environment.resolve("variant") + " ";
    logMessage += environment.resolve("arch") + " ";
    if (fileType->GCCDialectName()) {
        logMessage += *fileType->GCCDialectName() + " ";
    }
    logMessage += compiler->identifier();
    return logMessage;
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:23,代码来源:ClangResolver.cpp

示例13: resolvePrecompiledHeader

void Tool::ClangResolver::
resolvePrecompiledHeader(
    Tool::Context *toolContext,
    pbxsetting::Environment const &environment,
    Tool::PrecompiledHeaderInfo const &precompiledHeaderInfo
) const
{
    std::string const &input = precompiledHeaderInfo.prefixHeader();
    pbxspec::PBX::FileType::shared_ptr const &fileType = precompiledHeaderInfo.fileType();
    std::string output = environment.expand(precompiledHeaderInfo.compileOutputPath());

    pbxspec::PBX::Tool::shared_ptr tool = std::static_pointer_cast <pbxspec::PBX::Tool> (_compiler);
    Tool::Environment toolEnvironment = Tool::Environment::Create(tool, environment, toolContext->workingDirectory(), { input }, { output });
    pbxsetting::Environment const &env = toolEnvironment.environment();
    Tool::OptionsResult options = Tool::OptionsResult::Create(toolEnvironment, toolContext->workingDirectory(), fileType);
    Tool::Tokens::ToolExpansions tokens = Tool::Tokens::ExpandTool(toolEnvironment, options);

    std::vector<std::string> arguments = precompiledHeaderInfo.arguments();
    AppendDependencyInfoFlags(&arguments, _compiler, env);
    AppendInputOutputFlags(&arguments, _compiler, input, output);

    ext::optional<std::string> const &dialect = fileType->GCCDialectName();
    std::string logTitle = DialectIsCPlusPlus(dialect) ? "ProcessPCH++" : "ProcessPCH";
    std::string logMessage = CompileLogMessage(_compiler, logTitle, input, fileType, output, env, toolContext->workingDirectory());

    auto serializedFile = Tool::Invocation::AuxiliaryFile(
        env.expand(precompiledHeaderInfo.serializedOutputPath()),
        precompiledHeaderInfo.serialize(),
        false);

    std::vector<Tool::Invocation::DependencyInfo> dependencyInfo;
    if (_compiler->dependencyInfoFile()) {
        dependencyInfo.push_back(Tool::Invocation::DependencyInfo(
            dependency::DependencyInfoFormat::Makefile,
            env.expand(*_compiler->dependencyInfoFile())));
    }

    Tool::Invocation invocation;
    invocation.executable() = Tool::Invocation::Executable::Determine(tokens.executable(), toolContext->executablePaths());
    invocation.arguments() = arguments;
    invocation.environment() = options.environment();
    invocation.workingDirectory() = toolContext->workingDirectory();
    invocation.inputs() = toolEnvironment.inputs(toolContext->workingDirectory());
    invocation.outputs() = toolEnvironment.outputs(toolContext->workingDirectory());
    invocation.dependencyInfo() = dependencyInfo;
    invocation.auxiliaryFiles().push_back(serializedFile);
    invocation.logMessage() = logMessage;
    toolContext->invocations().push_back(invocation);
}
开发者ID:husshazein,项目名称:xcbuild,代码行数:49,代码来源:ClangResolver.cpp

示例14: ExpandBuildSettings

static void
ExpandBuildSettings(plist::Object *value, pbxsetting::Environment const &environment)
{
    /*
     * Recursively expand any strings in the plist. Dictionary keys are not expanded.
     */
    if (auto dictionary = plist::CastTo<plist::Dictionary>(value)) {
        for (size_t n = 0; n < dictionary->count(); n++) {
            ExpandBuildSettings(dictionary->value(n), environment);
        }
    } else if (auto array = plist::CastTo<plist::Array>(value)) {
        for (size_t n = 0; n < array->count(); n++) {
            ExpandBuildSettings(array->value(n), environment);
        }
    } else if (auto string = plist::CastTo<plist::String>(value)) {
        pbxsetting::Value parsed = pbxsetting::Value::Parse(string->value());
        string->setValue(environment.expand(parsed));
    }
}
开发者ID:stlwtr,项目名称:xcbuild,代码行数:19,代码来源:Driver.cpp

示例15: AppendPaths

static void
AppendPaths(std::vector<std::string> *args, pbxsetting::Environment const &environment, std::string const &workingDirectory, std::vector<std::string> const &paths)
{
    Filesystem const *filesystem = Filesystem::GetDefaultUNSAFE();

    for (std::string path : paths) {
        // TODO(grp): Is this the right place to insert the SDKROOT? Should all path lists have this, or just *_SEARCH_PATHS?
        std::string const system = "/System";
        std::string const usr    = "/usr";
        if ((path.size() >= system.size() && path.compare(0, system.size(), system) == 0) ||
            (path.size() >=    usr.size() && path.compare(0,    usr.size(),    usr) == 0)) {
            std::string sdkPath = FSUtil::NormalizePath(environment.resolve("SDKROOT") + path);

            // TODO(grp): Testing if the directory exists seems fragile.
            if (filesystem->type(sdkPath) == Filesystem::Type::Directory) {
                path = sdkPath;
            }
        }

        std::string recursive = "**";
        if (path.size() >= recursive.size() && path.substr(path.size() - recursive.size()) == recursive) {
            std::string root = path.substr(0, path.size() - recursive.size());
            args->push_back(root);

            std::string absoluteRoot = FSUtil::ResolveRelativePath(root, workingDirectory);
            filesystem->readDirectory(absoluteRoot, true, [&](std::string const &relative) -> bool {
                // TODO(grp): Use build settings for included and excluded recursive paths.
                // Included: INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES
                // Excluded: EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES
                // Follow: RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS

                std::string absolute = absoluteRoot + "/" + relative;
                if (filesystem->type(absolute) == Filesystem::Type::Directory) {
                    args->push_back(root + "/" + relative);
                }
                return true;
            });
        } else {
            args->push_back(path);
        }
    }
}
开发者ID:Ktwu,项目名称:xcbuild,代码行数:42,代码来源:SearchPaths.cpp


注:本文中的pbxsetting::Environment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。