module MxxRu

Base class for all targets, which are binary executables, binary shared libraries or binary static libraries.

In version v.1.3 extended by methods lib_path, lib_paths which are user-frendly synonyms for mxx_add_required_lib_path.

Base class for all targets of C/C++ projects.

Constants

Abstract_generator

Base class for all source code generators.

Abstract_method_ex

Exception, thrown on execution of 'pure abstract method'.

Abstract_target

Base class for all targets.

BUILD_ROOT

File name of root project file.

Binary_target

For compatilibily with previous versions.

Binary_unittest_target

For compatibility with previous versions.

Build_ex

Exception, thrown if build commands fail.

Global_option_conflict_ex

Exception, thrown if value conflict for global options such as runtime_mode, rtl_mode, etc is detected

Global_option_disallowed_value_ex

Exception, thrown if anyone tries to set invalid value to global options such as runtime_mode, rtl_mode, etc.

Invalid_cast_ex

Exception, thrown if returned object type is not expected.

Invalid_value_ex

Exception, thrown if some value is invalid in current context.

Makestyle_generator

A Generator, which allows to define simple make rules in a project.

For example, if it's needed to get from ddl file two other files, cpp and hpp, using typegen program, it should be done like that:

generator( MxxRu::MakestyleGenerator.new(
  [ "myfile.cpp", "myfile.hpp" ],
  [ "myfile.ddl" ],
  [ "typegen --from myfile.ddl --cpp myfile.cpp --header myfile.hpp" ] ) )

NOTE: For C++ projects current value of sources_root isn't taken into account.

Missing_depend_file_ex

Exception, thrown if some dependency file is missing.

Target_state

Target status description.

Target_unknown_ex

Exception, thrown if no target object is found for given alias.

Textfile_unittest_target

The class of a target, which is binary unit-test application, which create one or many text files.

Given target performs a build of application, and then runs it and compares results with files which contains correct results.

The basic idea consists in the presence of project file, which controls the build of unit-test application. In that project file, target object is created, inherited from MxxRu::BinaryTarget. To start unit-test it's necessary to create one more file, where target object of MxxRu::TextfileUnittestTarget class is created. For example:

Unit-test application build file:

MxxRu::setup_target(
  MxxRu::Cpp::ExeTarget.new( "test/pack/prj.rb" ) {
    ...
  }
)

File to run unit-test:

MxxRu::setup_target(
  MxxRu::TextfileUnittestTarget.new( 
    "test/pack/pack.ut.rb",
    "test/pack/prj.rb" ) {

    launch( "--loops 16 --out test/pack/out/16.txt",
      [ pair( "test/pack/out/16.txt",
          "test/pack/out/etalon/16.txt" ) ] )

    launch( "--loops 32 --out test/pack/out/32.txt",
      [ pair( "test/pack/out/32.txt",
          "test/pack/out/etalon/32.txt" ) ] )
  }
)

File which is using that unit-test.

MxxRu::setup_target(
  MxxRu::Cpp::CompositeTarget.new( MxxRu::BUILD_ROOT ) {
    required_prj( "some/project/prj.rb" )
    required_prj( "test/pack/prj.ut.rb" )
  }
)
Unsupported_mode_ex

Exception, thrown if some mode is not supported by the toolset.

Unsupported_target_type_ex

For compatibility with previous versions.

Public Class Methods

arch_externals(name, &block) click to toggle source
# File lib/mxx_ru/externals.rb, line 822
def MxxRu.arch_externals(name, &block)
  Externals::ArchiveAsExternals.new(name, &block)
end
enable_show_brief() click to toggle source

Manually enable 'show-brief' mode.

Intended to use in project files:

MxxRu::Cpp::exe_target( 'some.prj' ) {
  ...
  MxxRu::enable_show_brief
  ...
}

'show-brief' is global mode. Once enabled it cannot be disabled form inside another project file.

Call to MxxRu::enable_show_brief ignored if '–mxx-show-brief-disabled' specified in command-line.

# File lib/mxx_ru/util.rb, line 427
def MxxRu.enable_show_brief
  Util::Mode.instance.try_enable_show_brief
end
git_externals(name, &block) click to toggle source
# File lib/mxx_ru/externals.rb, line 814
def MxxRu.git_externals(name, &block)
  Externals::Git.new(name, &block)
end
hg_externals(name, &block) click to toggle source
# File lib/mxx_ru/externals.rb, line 818
def MxxRu.hg_externals(name, &block)
  Externals::Hg.new(name, &block)
end
query_target( prj_alias, mandatory ) click to toggle source
# File lib/mxx_ru/abstract_target.rb, line 168
def MxxRu.query_target( prj_alias, mandatory )
  target = @@defined_targets[ prj_alias ]

  # If target was required, we already should found it.
  # Build should be stopper otherwise.
  if target.nil? && mandatory
    raise TargetUnknownEx.new( prj_alias )
  end

  return target
end
setup_target( target, build_enabled = true ) click to toggle source
# File lib/mxx_ru/abstract_target.rb, line 133
def MxxRu.setup_target( target, build_enabled = true )
  begin
    if !( target_defined_for?( target.prj_alias ) )
      @@defined_targets[ target.prj_alias ] = target;
    end

    if build_enabled && nil != @@first_target_alias &&
      @@first_target_alias == target.prj_alias
      # It is a root project, required to build.

      # If this project is not root project file and root project file
      # exists, then we will load root project file and start build process
      # after that.
      if BUILD_ROOT != target.prj_alias
        if FileTest.exist?( BUILD_ROOT )
          require BUILD_ROOT
        end
      end

      target.clean if MxxRu::Util::Mode.instance.is_clean or
          MxxRu::Util::Mode.instance.is_rebuild

      target.reset if MxxRu::Util::Mode.instance.is_rebuild

      MxxRu::Util::build_call_wrapper( target ) if
          !MxxRu::Util::Mode.instance.is_clean
    end

    return target
  rescue MxxRu::Ex => ex
    $stderr.print "<<<[#{ex.class.name}]\t#{ex}>>>\n"
    exit( -2 )
  end
end
show_brief( message ) click to toggle source

Show a brief message. The message shown only if 'show-brief' mode is on.

# File lib/mxx_ru/util.rb, line 432
def MxxRu.show_brief( message )
  puts message[ 0, 1 ].capitalize << message[ 1..message.size ] << ' ...' if
      Util::Mode.instance.is_brief_desc and message
end
svn_externals(name, &block) click to toggle source
# File lib/mxx_ru/externals.rb, line 810
def MxxRu.svn_externals(name, &block)
  Externals::Svn.new(name, &block)
end
target_defined_for?(prj_alias) click to toggle source
# File lib/mxx_ru/abstract_target.rb, line 180
def MxxRu.target_defined_for?(prj_alias)
  return true if @@defined_targets.has_key?( prj_alias )
  return false
end
try_set_first_target_alias( a_alias ) click to toggle source
# File lib/mxx_ru/abstract_target.rb, line 127
def MxxRu.try_set_first_target_alias( a_alias )
  if nil == @@first_target_alias
    @@first_target_alias = a_alias.clone
  end
end