Ejemplo n.º 1
0
def write_tool_android_mk(target_dir, var_dict, place_in_local_tmp):
    """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
    place_in_local_tmp: If True, the executable will be synced to
      /data/local/tmp.
  """
    target_file = os.path.join(target_dir, 'Android.mk')
    with open(target_file, 'w') as f:
        f.write(makefile_writer.AUTOGEN_WARNING)

        if place_in_local_tmp:
            f.write('local_target_dir := $(TARGET_OUT_DATA)/local/tmp\n')

        makefile_writer.write_local_path(f)
        makefile_writer.write_clear_vars(f)

        makefile_writer.write_local_vars(f, var_dict, False, None)

        if place_in_local_tmp:
            f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n')

        makefile_writer.write_include_stlport(f)
        f.write('include $(BUILD_EXECUTABLE)\n')
def write_tool_android_mk(target_dir, var_dict, place_in_local_tmp):
  """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
    place_in_local_tmp: If True, the executable will be synced to
      /data/local/tmp.
  """
  target_file = os.path.join(target_dir, 'Android.mk')
  with open(target_file, 'w') as f:
    f.write(makefile_writer.AUTOGEN_WARNING)

    if place_in_local_tmp:
      f.write('local_target_dir := $(TARGET_OUT_DATA)/local/tmp\n')

    makefile_writer.write_local_path(f)
    makefile_writer.write_clear_vars(f)

    makefile_writer.write_local_vars(f, var_dict, False, None)

    if place_in_local_tmp:
      f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n')

    f.write('include $(BUILD_EXECUTABLE)\n')
Ejemplo n.º 3
0
  def test_write_local_vars(self):
    vars_dict = generate_dummy_vars_dict(None)

    # Call variations of write_local_vars.
    for append in [ True, False ]:
      for name in [ None, 'arm', 'foo' ]:
        # Now write to a temporary file.
        fd, outfile = tempfile.mkstemp()
        with open(outfile, 'w') as f:
          makefile_writer.write_local_vars(f, vars_dict, append, name)
        os.close(fd)

        # Compare to the expected file.
        filename = 'write_local_vars'
        if append:
          filename += '_append'
        else:
          filename += '_no_append'
        if name:
          filename += '_' + name
        else:
          filename += '_no_name'
        self.__compare_files(outfile, filename)

        # KNOWN_TARGETS is always a part of the input VarsDict, but it should
        # not be written to the resulting file.
        # Note that this assumes none of our dummy entries is 'KNOWN_TARGETS'.
        known_targets_name = 'KNOWN_TARGETS'
        self.assertEqual(len(vars_dict[known_targets_name]), 1)

        with open(outfile, 'r') as f:
          self.assertNotIn(known_targets_name, f.read())
        os.remove(outfile)
Ejemplo n.º 4
0
def rebaseline():
  generate_dummy_makefile(utils.EXPECTATIONS_DIR)

  vars_dict = generate_dummy_vars_dict(None)
  for (filename, append, name) in generate_write_local_vars_params():
    with open(os.path.join(utils.EXPECTATIONS_DIR, filename), 'w') as f:
      makefile_writer.write_local_vars(f, vars_dict, append, name)
Ejemplo n.º 5
0
def rebaseline():
    generate_dummy_makefile(utils.EXPECTATIONS_DIR)

    vars_dict = generate_dummy_vars_dict(None)
    for (filename, append, name) in generate_write_local_vars_params():
        with open(os.path.join(utils.EXPECTATIONS_DIR, filename), 'w') as f:
            makefile_writer.write_local_vars(f, vars_dict, append, name)

    generate_dummy_tool_makefile(os.path.join(utils.EXPECTATIONS_DIR,
                                              TOOL_DIR))
Ejemplo n.º 6
0
def write_tool_android_mk(target_dir, var_dict):
  """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
  """
  target_file = os.path.join(target_dir, 'Android.mk')
  with open(target_file, 'w') as f:
    f.write(makefile_writer.AUTOGEN_WARNING)
    makefile_writer.write_local_path(f)
    makefile_writer.write_clear_vars(f)

    makefile_writer.write_local_vars(f, var_dict, False, None)

    makefile_writer.write_include_stlport(f)
    f.write('include $(BUILD_EXECUTABLE)\n')
Ejemplo n.º 7
0
def write_tool_android_mk(target_dir, var_dict):
    """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
  """
    target_file = os.path.join(target_dir, 'Android.mk')
    with open(target_file, 'w') as f:
        f.write(makefile_writer.AUTOGEN_WARNING)
        makefile_writer.write_local_path(f)
        makefile_writer.write_clear_vars(f)

        makefile_writer.write_local_vars(f, var_dict, False, None)

        makefile_writer.write_include_stlport(f)
        f.write('include $(BUILD_EXECUTABLE)\n')
Ejemplo n.º 8
0
def write_tool_android_mk(target_dir, var_dict):
  """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
  """
  target_file = os.path.join(target_dir, 'Android.mk')
  with open(target_file, 'w') as f:
    f.write(makefile_writer.AUTOGEN_WARNING)

    f.write(makefile_writer.LOCAL_PATH)
    f.write(makefile_writer.CLEAR_VARS)

    makefile_writer.write_local_vars(f, var_dict, False, None)

    f.write(SKIA_RESOURCES)
    f.write('include $(LOCAL_PATH)/../skia_static_deps.mk\n')
    f.write('include $(BUILD_NATIVE_TEST)\n')
Ejemplo n.º 9
0
def write_tool_android_mk(target_dir, var_dict):
  """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
  """
  target_file = os.path.join(target_dir, 'Android.mk')
  with open(target_file, 'w') as f:
    f.write(makefile_writer.AUTOGEN_WARNING)

    makefile_writer.write_local_path(f)
    makefile_writer.write_clear_vars(f)

    makefile_writer.write_local_vars(f, var_dict, False, None)

    makefile_writer.write_group(f, 'LOCAL_PICKUP_FILES',
                                ['$(LOCAL_PATH)/../resources'], False)

    f.write('include $(BUILD_NATIVE_TEST)\n')
Ejemplo n.º 10
0
def write_tool_android_mk(target_dir, var_dict):
    """Write Android.mk for a Skia tool.

  Args:
    target_dir: Destination for the makefile. Must not be None.
    var_dict: VarsDict containing variables for the makefile.
  """
    target_file = os.path.join(target_dir, 'Android.mk')
    with open(target_file, 'w') as f:
        f.write(makefile_writer.AUTOGEN_WARNING)

        makefile_writer.write_local_path(f)
        makefile_writer.write_clear_vars(f)

        makefile_writer.write_local_vars(f, var_dict, False, None)

        makefile_writer.write_group(f, 'LOCAL_PICKUP_FILES',
                                    ['$(LOCAL_PATH)/../resources'], False)

        f.write('include $(BUILD_NATIVE_TEST)\n')
Ejemplo n.º 11
0
  def test_write_local_vars(self):
    vars_dict = generate_dummy_vars_dict(None)
    # Compare various ways of calling write_local_vars to expectations.
    for (filename, append, name) in generate_write_local_vars_params():
      fd, outfile = tempfile.mkstemp()
      with open(outfile, 'w') as f:
        makefile_writer.write_local_vars(f, vars_dict, append, name)
      os.close(fd)

      # Compare to the expected file.
      utils.compare_to_expectation(outfile, filename, self.assertTrue,
                                   REBASELINE_MSG)

      # KNOWN_TARGETS is always a key in the input VarsDict, but it should not
      # be written to the resulting file.
      # Note that this assumes none of our dummy entries is 'KNOWN_TARGETS'.
      known_targets_name = 'KNOWN_TARGETS'
      self.assertEqual(len(vars_dict[known_targets_name]), 1)

      with open(outfile, 'r') as f:
        self.assertNotIn(known_targets_name, f.read())
      os.remove(outfile)
Ejemplo n.º 12
0
    def test_write_local_vars(self):
        vars_dict = generate_dummy_vars_dict(None)
        # Compare various ways of calling write_local_vars to expectations.
        for (filename, append, name) in generate_write_local_vars_params():
            fd, outfile = tempfile.mkstemp()
            with open(outfile, 'w') as f:
                makefile_writer.write_local_vars(f, vars_dict, append, name)
            os.close(fd)

            # Compare to the expected file.
            utils.compare_to_expectation(outfile, filename, self.assertTrue,
                                         REBASELINE_MSG)

            # KNOWN_TARGETS is always a key in the input VarsDict, but it should not
            # be written to the resulting file.
            # Note that this assumes none of our dummy entries is 'KNOWN_TARGETS'.
            known_targets_name = 'KNOWN_TARGETS'
            self.assertEqual(len(vars_dict[known_targets_name]), 1)

            with open(outfile, 'r') as f:
                self.assertNotIn(known_targets_name, f.read())
            os.remove(outfile)