コード例 #1
0
ファイル: codecomplete.py プロジェクト: kilikkuo/gecko-dev
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir,
            path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith('.c'):
            name = 'COMPILE_CFLAGS'
        else:
            name = 'COMPILE_CXXFLAGS'

        if name not in build_vars:
            return

        print(' '.join(shell_quote(arg)
                       for arg in shell_split(build_vars[name])))
コード例 #2
0
ファイル: codecomplete.py プロジェクト: wenshiqi0/gecko-dev
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir,
            path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith('.c'):
            cc = 'CC'
            name = 'COMPILE_CFLAGS'
        else:
            cc = 'CXX'
            name = 'COMPILE_CXXFLAGS'

        if name not in build_vars:
            return

        # Drop the first flag since that is the pathname of the compiler.
        flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]

        print(' '.join(shell_quote(arg)
                       for arg in util.sanitize_cflags(flags)))
コード例 #3
0
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir,
            path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith('.c'):
            name = 'COMPILE_CFLAGS'
        else:
            name = 'COMPILE_CXXFLAGS'

        if name not in build_vars:
            return

        print(' '.join(shell_quote(arg)
                       for arg in util.get_flags(self.topobjdir, make_dir,
                                                 build_vars, name)))
コード例 #4
0
ファイル: database.py プロジェクト: wilsonsun/gecko-dev
    def _get_dir_flags(self, directory):
        if directory in self._flags:
            return self._flags[directory]

        from mozbuild.util import resolve_target_to_make

        make_dir, make_target = resolve_target_to_make(
            self.environment.topobjdir, directory)
        if make_dir is None and make_target is None:
            raise Exception('Cannot figure out the make dir and target for ' +
                            directory)

        build_vars = util.get_build_vars(directory, self._cmd)

        # We only care about the following build variables.
        for name in ('COMPILE_CFLAGS', 'COMPILE_CXXFLAGS', 'COMPILE_CMFLAGS',
                     'COMPILE_CMMFLAGS'):
            if name not in build_vars:
                continue

            build_vars[name] = util.sanitize_cflags(
                shell_split(build_vars[name]))

        self._flags[directory] = build_vars
        return self._flags[directory]
コード例 #5
0
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir, path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith(".c"):
            cc = "CC"
            name = "COMPILE_CFLAGS"
        else:
            cc = "CXX"
            name = "COMPILE_CXXFLAGS"

        if name not in build_vars:
            return

        # Drop the first flag since that is the pathname of the compiler.
        flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]

        print(" ".join(shell_quote(arg) for arg in util.sanitize_cflags(flags)))
コード例 #6
0
ファイル: codecomplete.py プロジェクト: Floflis/gecko-b2g
def compileflags(command_context, what):
    from mozbuild.util import resolve_target_to_make
    from mozbuild.compilation import util

    if not util.check_top_objdir(command_context.topobjdir):
        return 1

    path_arg = command_context._wrap_path_argument(what)

    make_dir, make_target = resolve_target_to_make(command_context.topobjdir,
                                                   path_arg.relpath())

    if make_dir is None and make_target is None:
        return 1

    build_vars = util.get_build_vars(make_dir, command_context)

    if what.endswith(".c"):
        cc = "CC"
        name = "COMPILE_CFLAGS"
    else:
        cc = "CXX"
        name = "COMPILE_CXXFLAGS"

    if name not in build_vars:
        return

    # Drop the first flag since that is the pathname of the compiler.
    flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]

    print(" ".join(shell_quote(arg) for arg in util.sanitize_cflags(flags)))
コード例 #7
0
ファイル: database.py プロジェクト: npark-mozilla/gecko-dev
    def _get_dir_flags(self, directory):
        if directory in self._flags:
            return self._flags[directory]

        from mozbuild.util import resolve_target_to_make

        make_dir, make_target = resolve_target_to_make(self.environment.topobjdir, directory)
        if make_dir is None and make_target is None:
            raise Exception("Cannot figure out the make dir and target for " + directory)

        build_vars = util.get_build_vars(directory, self._cmd)

        # We only care about the following build variables.
        for name in ("COMPILE_CFLAGS", "COMPILE_CXXFLAGS", "COMPILE_CMFLAGS", "COMPILE_CMMFLAGS"):
            if name not in build_vars:
                continue

            build_vars[name] = util.get_flags(self.environment.topobjdir, directory, build_vars, name)

        self._flags[directory] = build_vars
        return self._flags[directory]