コード例 #1
0
  def GenerateFiles(self, args):
    self.module.Stylize(generator.Stylizer())

    if self.generate_non_variant_code:
      if self.generate_message_ids:
        self.WriteWithComment(self._GenerateModuleSharedMessageIdsHeader(),
                              "%s-shared-message-ids.h" % self.module.path)
      else:
        self.WriteWithComment(self._GenerateModuleSharedHeader(),
                              "%s-shared.h" % self.module.path)
        self.WriteWithComment(self._GenerateModuleSharedInternalHeader(),
                              "%s-shared-internal.h" % self.module.path)
        self.WriteWithComment(self._GenerateModuleSharedSource(),
                              "%s-shared.cc" % self.module.path)
        self.WriteWithComment(self._GenerateModuleParamsDataHeader(),
                              "%s-params-data.h" % self.module.path)
    else:
      suffix = "-%s" % self.variant if self.variant else ""
      self.WriteWithComment(self._GenerateModuleHeader(),
                            "%s%s.h" % (self.module.path, suffix))
      self.WriteWithComment(self._GenerateModuleForwardHeader(),
                            "%s%s-forward.h" % (self.module.path, suffix))
      self.WriteWithComment(self._GenerateModuleSource(),
                            "%s%s.cc" % (self.module.path, suffix))
      self.WriteWithComment(self._GenerateModuleImportHeadersHeader(),
                            "%s%s-import-headers.h" % (self.module.path,
                                                       suffix))
      self.WriteWithComment(self._GenerateModuleTestUtilsHeader(),
                            "%s%s-test-utils.h" % (self.module.path, suffix))
      self.WriteWithComment(self._GenerateModuleTestUtilsSource(),
                            "%s%s-test-utils.cc" % (self.module.path, suffix))
コード例 #2
0
ファイル: mojom_java_generator.py プロジェクト: xyui/chromium
    def GenerateFiles(self, unparsed_args):
        # TODO(rockot): Support variant output for Java.
        if self.variant:
            raise Exception("Variants not supported in Java bindings.")

        self.module.Stylize(generator.Stylizer())

        parser = argparse.ArgumentParser()
        parser.add_argument('--java_output_directory',
                            dest='java_output_directory')
        args = parser.parse_args(unparsed_args)
        package_path = GetPackage(self.module).replace('.', '/')

        # Generate the java files in a temporary directory and place a single
        # srcjar in the output directory.
        basename = "%s.srcjar" % self.module.path
        zip_filename = os.path.join(self.output_dir, basename)
        with TempDir() as temp_java_root:
            self.output_dir = os.path.join(temp_java_root, package_path)
            self._DoGenerateFiles()
            build_utils.ZipDir(zip_filename, temp_java_root)

        if args.java_output_directory:
            # If requested, generate the java files directly into indicated directory.
            self.output_dir = os.path.join(args.java_output_directory,
                                           package_path)
            self._DoGenerateFiles()
コード例 #3
0
    def GenerateFiles(self, args):
        self.module.Stylize(generator.Stylizer())
        # TODO(mef): Remove this when generated files are not checked in.
        path, module = os.path.split(self.module.path)
        self.module.path = os.path.join(path, "generated", module)

        if self.generate_non_variant_code:
            self.Write(self._GenerateModuleSharedHeader(),
                       "%s-shared.h" % self.module.path)
            self.Write(self._GenerateModuleSharedInternalHeader(),
                       "%s-shared-internal.h" % self.module.path)
            self.Write(self._GenerateModuleSharedSource(),
                       "%s-shared.cc" % self.module.path)
        else:
            suffix = "-%s" % self.variant if self.variant else ""
            self.Write(self._GenerateModuleHeader(),
                       "%s%s_c.h" % (self.module.path, suffix))
            self.Write(self._GenerateModuleInterfaceHeader(),
                       "%s%s_impl_interface.h" % (self.module.path, suffix))
            self.Write(self._GenerateModuleInterfaceSource(),
                       "%s%s_impl_interface.cc" % (self.module.path, suffix))
            self.Write(
                self._GenerateModuleInterfaceUnittest(),
                "%s%s_impl_interface_unittest.cc" % (self.module.path, suffix))
            self.Write(self._GenerateModuleStructHeader(),
                       "%s%s_impl_struct.h" % (self.module.path, suffix))
            self.Write(self._GenerateModuleStructSource(),
                       "%s%s_impl_struct.cc" % (self.module.path, suffix))
            self.Write(
                self._GenerateModuleStructUnittest(),
                "%s%s_impl_struct_unittest.cc" % (self.module.path, suffix))
コード例 #4
0
    def GenerateFiles(self, output_dir=None):
        self.output_dir = output_dir
        self.module.Stylize(generator.Stylizer())
        name = os.path.basename(self.module.path)

        self.Write(self._GenerateModuleHeader(), "%s.objc.h" % name)
        self.Write(self._GeneratePrivateModuleHeader(),
                   "%s.objc+private.h" % name)
        self.Write(self._GenerateModuleSource(), "%s.objc.mm" % name)
コード例 #5
0
    def GenerateFiles(self, args):
        self.module.Stylize(generator.Stylizer())

        if self.generate_non_variant_code:
            self.WriteWithComment(self._GenerateMojolpmProto(),
                                  "%s.mojolpm.proto" % self.module.path)
        else:
            self.WriteWithComment(self._GenerateMojolpmHeader(),
                                  "%s-mojolpm.h" % self.module.path)
            self.WriteWithComment(self._GenerateMojolpmSource(),
                                  "%s-mojolpm.cc" % self.module.path)
コード例 #6
0
    def GenerateFiles(self, output_dir):
        if output_dir is None or len(output_dir) == 0:
            raise Exception("No output directory given to generate files")

        self.module.Stylize(generator.Stylizer())
        name = os.path.basename(self.module.path)

        self.Write(self._GenerateModuleHeader(), output_dir, "%s.objc.h" % name)
        self.Write(self._GeneratePrivateModuleHeader(), output_dir,
                   "%s.objc+private.h" % name)
        self.Write(self._GenerateModuleSource(), output_dir,
                   "%s.objc.mm" % name)
コード例 #7
0
  def GenerateFiles(self, args):
    self.module.Stylize(generator.Stylizer())

    if self.generate_non_variant_code:
      self.Write(self._GenerateModuleSharedHeader(),
                 "%s-shared.h" % self.module.path)
      self.Write(self._GenerateModuleSharedInternalHeader(),
                 "%s-shared-internal.h" % self.module.path)
      self.Write(self._GenerateModuleSharedSource(),
                 "%s-shared.cc" % self.module.path)
    else:
      suffix = "-%s" % self.variant if self.variant else ""
      self.Write(self._GenerateModuleHeader(),
                 "%s%s.h" % (self.module.path, suffix))
      self.Write(self._GenerateModuleSource(),
                 "%s%s.cc" % (self.module.path, suffix))
コード例 #8
0
    def GenerateFiles(self, args):
        self.module.Stylize(generator.Stylizer())

        if self.extra_cpp_template_paths and self.generate_extra_cpp_only:
            suffix = "-%s" % self.variant if self.variant else ""
        elif self.generate_non_variant_code:
            if self.generate_message_ids:
                self.WriteWithComment(
                    self._GenerateModuleSharedMessageIdsHeader(),
                    "%s-shared-message-ids.h" % self.module.path)
            else:
                self.WriteWithComment(self._GenerateModuleSharedHeader(),
                                      "%s-shared.h" % self.module.path)
                self.WriteWithComment(
                    self._GenerateModuleSharedInternalHeader(),
                    "%s-shared-internal.h" % self.module.path)
                self.WriteWithComment(self._GenerateModuleSharedSource(),
                                      "%s-shared.cc" % self.module.path)
                self.WriteWithComment(self._GenerateModuleParamsDataHeader(),
                                      "%s-params-data.h" % self.module.path)
        else:
            suffix = "-%s" % self.variant if self.variant else ""
            self.WriteWithComment(self._GenerateModuleHeader(),
                                  "%s%s.h" % (self.module.path, suffix))
            self.WriteWithComment(
                self._GenerateModuleForwardHeader(),
                "%s%s-forward.h" % (self.module.path, suffix))
            self.WriteWithComment(self._GenerateModuleSource(),
                                  "%s%s.cc" % (self.module.path, suffix))
            self.WriteWithComment(
                self._GenerateModuleImportHeadersHeader(),
                "%s%s-import-headers.h" % (self.module.path, suffix))
            self.WriteWithComment(
                self._GenerateModuleTestUtilsHeader(),
                "%s%s-test-utils.h" % (self.module.path, suffix))
            self.WriteWithComment(
                self._GenerateModuleTestUtilsSource(),
                "%s%s-test-utils.cc" % (self.module.path, suffix))

        if self.extra_cpp_template_paths:
            for cpp_template_path in self.extra_cpp_template_paths:
                path_to_template, filename = os.path.split(cpp_template_path)
                filename_without_tmpl_suffix = filename.rstrip(".tmpl")
                self.WriteWithComment(
                    self._GenerateModuleFromImportedTemplate(
                        path_to_template, filename), "%s%s-%s" %
                    (self.module.path, suffix, filename_without_tmpl_suffix))