class RBT::BuildDetector
Constants
- DEFAULT_BUILD_TYPE
#¶ ↑
DEFAULT_BUILD_TYPE
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
do_guess_build_type()
click to toggle source
#¶ ↑
RBT::BuildDetector.do_guess_build_type
¶ ↑
This method can be used to guess the build type of a target archive. Prefer to use the method RBT.build_type?
instead, though, since it is more convenient.
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 244 def self.do_guess_build_type new.build_type? end
Public Instance Methods
build_type?()
click to toggle source
determine_build_type( use_this_as_target_directory = base_dir? )
click to toggle source
#¶ ↑
determine_build_type
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 154 def determine_build_type( use_this_as_target_directory = base_dir? ) files_from_pwd = Dir[use_this_as_target_directory+'*'] files_from_pwd_but_only_their_filenames = files_from_pwd.map { |entry| File.basename(entry) } # ======================================================================= # # Check for cmake build types first # ======================================================================= # if files_from_pwd_but_only_their_filenames.include? 'CMakeLists.txt' is_cmake_build_type # ======================================================================= # # Next, check for meson build types # ======================================================================= # elsif files_from_pwd_but_only_their_filenames.include?('meson.build') is_meson_build_type # ======================================================================= # # Next, check for waf-based build types # ======================================================================= # elsif files_from_pwd_but_only_their_filenames.include?('waf') or files_from_pwd_but_only_their_filenames.include?('wscript') is_waf_build_type # ======================================================================= # # Next, scheck for "scons"-based build types # ======================================================================= # elsif files_from_pwd_but_only_their_filenames.include?('SConscript') and files_from_pwd_but_only_their_filenames.include?('SConstruct') is_scons_build_type # ======================================================================= # # Next, GNU configure-based scripts # ====================================================================== # elsif files_from_pwd_but_only_their_filenames.include?('configure') is_configure_build_type # ====================================================================== # # Else we do not know the build-type. # ====================================================================== # else # This is the default value. set_build_type end end
determine_whether_the_input_is_an_existing_directory()
click to toggle source
#¶ ↑
determine_whether_the_input_is_an_existing_directory
¶ ↑
By default, this class will use the current directory as the input directory that is to be checked.
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 70 def determine_whether_the_input_is_an_existing_directory if File.exist? @input and File.directory? @input # ===================================================================== # # In this case, use that input as directory. # ===================================================================== # set_main_dir(@input) end end
input?()
click to toggle source
is_cmake_build_type()
click to toggle source
is_configure_build_type()
click to toggle source
is_meson_build_type()
click to toggle source
is_scons_build_type()
click to toggle source
is_waf_build_type()
click to toggle source
report()
click to toggle source
#¶ ↑
report (report tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 215 def report # ======================================================================= # # The build type is stored in the variable called @build_type. # ======================================================================= # e "#{rev}The guessed build type is `#{sfancy(@build_type)}`." end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/build_detector.rb, line 55 def reset super() # ======================================================================= # # === @build_type # ======================================================================= # @build_type = DEFAULT_BUILD_TYPE set_use_this_base_directory end
run()
click to toggle source
set_build_type(i = DEFAULT_BUILD_TYPE)
click to toggle source
set_input(i = '')
click to toggle source
set_use_this_base_directory( i = return_pwd )
click to toggle source
#¶ ↑
set_use_this_base_directory
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 99 def set_use_this_base_directory( i = return_pwd ) unless i.end_with? '/' i = i.dup if i.frozen? i << '/' end @use_this_base_directory = i end
Also aliased as: set_main_dir