code: def test_generator_added_after_already_building_a_target_of_its_target_type():
      """
        Regression test for a Boost Build bug causing it to not use a generator
      if it got added after already building a target of its target type.
  
      """
      t = BoostBuild.Tester()
  
      t.write("dummy.cpp", "void f() {}\n")
  
      t.write(
          "jamroot.jam",
          """\
  import common ;
  import generators ;
  import type ;
  type.register MY_OBJ : my_obj ;
  generators.register-standard common.copy : CPP : MY_OBJ ;
  
  # Building this dummy target must not cause a later defined CPP target type
  # generator not to be recognized as viable.
  my-obj dummy : dummy.cpp ;
  alias the-other-obj : Other//other-obj ;
  """,
      )
  
      t.write("Other/source.extension", "A dummy source file.")
  
      t.write(
          "Other/mygen.jam",
          """\
  import common ;
  import generators ;
  import type ;
  type.register MY_TYPE : extension ;
  generators.register-standard $(__name__).generate-a-cpp-file : MY_TYPE : CPP ;
  rule generate-a-cpp-file { ECHO Generating a CPP file... ; }
  CREATE-FILE = [ common.file-creation-command ] ;
  actions generate-a-cpp-file { $(CREATE-FILE) "$(<)" }
  """,
      )
  
      t.write(
          "Other/mygen.py",
          """\
  import b2.build.generators as generators
  import b2.build.type as type
  
  from b2.manager import get_manager
  
  import os
  
  type.register('MY_TYPE', ['extension'])
  generators.register_standard('mygen.generate-a-cpp-file', ['MY_TYPE'], ['CPP'])
  if os.name == 'nt':
      action = 'echo void g() {} > "$(<)"'
  else:
      action = 'echo "void g() {}" > "$(<)"'
  def f(*args):
      print "Generating a CPP file..."
  
  get_manager().engine().register_action("mygen.generate-a-cpp-file", action,
      function=f)
  """,
      )
  
      t.write(
          "Other/jamfile.jam",
          """\
  import mygen ;
  my-obj other-obj : source.extension ;
  """,
      )
  
      t.run_build_system()
      t.expect_output_lines("Generating a CPP file...")
      t.expect_addition("bin/dummy.my_obj")
      t.expect_addition("Other/bin/other-obj.cpp")
      t.expect_addition("Other/bin/other-obj.my_obj")
      t.expect_nothing_more()
  
      t.cleanup()
  
label_desc: Use image node_id 1 for calling a global function with example usage: test_generator_added_after_already_building_a_target_of_its_target_type() without return types