コード例 #1
0
ファイル: actool.cpp プロジェクト: Ktwu/xcbuild
int
main(int argc, char **argv)
{
    DefaultFilesystem filesystem = DefaultFilesystem();
    process::DefaultContext processContext = process::DefaultContext();
    return acdriver::Driver::Run(&processContext, &filesystem);
}
コード例 #2
0
ファイル: infoPlistUtility.cpp プロジェクト: Ktwu/xcbuild
int
main(int argc, char **argv, char **envp)
{
    DefaultFilesystem filesystem = DefaultFilesystem();
    process::DefaultContext processContext = process::DefaultContext();

    builtin::infoPlistUtility::Driver driver;
    return driver.run(&processContext, &filesystem);
}
コード例 #3
0
ファイル: xcode-select.cpp プロジェクト: stlwtr/xcbuild
int
main(int argc, char **argv)
{
    DefaultFilesystem filesystem = DefaultFilesystem();
    std::vector<std::string> args = std::vector<std::string>(argv + 1, argv + argc);

    /*
     * Parse out the options, or print help & exit.
     */
    Options options;
    std::pair<bool, std::string> result = libutil::Options::Parse<Options>(&options, args);
    if (!result.first) {
        return Help(result.second);
    }

    /*
     * Handle the various actions.
     */
    if (options.help()) {
        return Help();
    } else if (options.version()) {
        return Version();
    } else if (options.printPath()) {
        ext::optional<std::string> developer = xcsdk::Environment::DeveloperRoot(&filesystem);
        if (!developer) {
            fprintf(stderr, "error: no developer directory found\n");
            return 1;
        }

        fprintf(stdout, "%s\n", developer->c_str());
        return 0;
    } else if (options.resetPath()) {
        if (!xcsdk::Environment::WriteDeveloperRoot(&filesystem, ext::nullopt)) {
            fprintf(stderr, "error: failed to reset developer root. are you root?\n");
            return 1;
        }

        return 0;
    } else if (options.switchPath()) {
        if (!xcsdk::Environment::WriteDeveloperRoot(&filesystem, *options.switchPath())) {
            fprintf(stderr, "error: failed to set developer root. are you root?\n");
            return 1;
        }

        return 0;
    } else if (options.install()) {
        fprintf(stderr, "error: install not implemented\n");
        return 1;
    } else {
        return Help(std::string("no actions provided"));
    }
}
コード例 #4
0
ファイル: dump_xcspec.cpp プロジェクト: Ktwu/xcbuild
int
main(int argc, char **argv)
{
    DefaultFilesystem filesystem = DefaultFilesystem();

    if (argc < 2) {
        fprintf(stderr, "usage: %s path\n", argv[0]);
        return -1;
    }

    std::string path = argv[1];
    Manager::shared_ptr manager = Manager::Create();
    manager->registerDomains(&filesystem, { { "xcspec", path } });

    return 0;
}
コード例 #5
0
int
main(int argc, char **argv)
{
    DefaultFilesystem filesystem = DefaultFilesystem();
    process::DefaultContext processContext = process::DefaultContext();

    /*
     * Parse out the options, or print help & exit.
     */
    Options options;
    std::pair<bool, std::string> result = libutil::Options::Parse<Options>(&options, processContext.commandLineArguments());
    if (!result.first) {
        return Help(result.second);
    }

    /*
     * Handle the basic options.
     */
    if (options.help()) {
        return Help();
    } else if (options.version()) {
        return Version();
    }

    /*
     * Diagnose missing options.
     */
    if (options.inputs().empty() || !options.output() || !options.name()) {
        return Help("missing option(s)");
    }

    std::vector<std::string> inputs;
    for (std::pair<dependency::DependencyInfoFormat, std::string> const &input : options.inputs()) {
        /*
         * Load the dependency info.
         */
        std::vector<dependency::DependencyInfo> info;
        if (!LoadDependencyInfo(&filesystem, input.second, input.first, &info)) {
            return -1;
        }

        for (dependency::DependencyInfo const &dependencyInfo : info) {
            inputs.insert(inputs.end(), dependencyInfo.inputs().begin(), dependencyInfo.inputs().end());
        }
    }

    /*
     * Serialize the output.
     */
    std::string contents = SerializeMakefileDependencyInfo(processContext.currentDirectory(), *options.name(), inputs);

    /*
     * Write out the output.
     */
    std::vector<uint8_t> makefileContents = std::vector<uint8_t>(contents.begin(), contents.end());
    if (!filesystem.write(makefileContents, *options.output())) {
        return false;
    }

    return 0;
}