Module: Gaudi::PlatformOperations

Included in:
ArtifactAdapters::Build, StandardPaths
Defined in:
lib/gaudi/helpers/operations.rb

Overview

Functions that return platform dependent information

The most basic of these is the extensions used for the various build artifacts.

To add support for a new platform create a PlatformOperation::Name module with a class method extensions that returns [object,library,executable]

See PlatformOperations::MS or PlatformOperations::GCC for an example

Instance Method Summary collapse

Instance Method Details

#is_assembly?(filename) ⇒ Boolean

Returns:

  • (Boolean)

31
32
33
34
35
# File 'lib/gaudi/helpers/operations.rb', line 31

def is_assembly? filename
  filename.downcase.end_with?('.asm') || 
  filename.downcase.end_with?('.src') ||
  filename.downcase.end_with?('.s')
end

#is_exe?(filename, system_config, platform) ⇒ Boolean

Returns true if the file given is a library for the given platform

Returns:

  • (Boolean)

17
18
19
20
# File 'lib/gaudi/helpers/operations.rb', line 17

def is_exe? filename,system_config,platform
  obj,lib,exe=*system_config.extensions(platform)
  return filename.end_with?(exe)
end

#is_header?(filename) ⇒ Boolean

Returns:

  • (Boolean)

37
38
39
40
41
# File 'lib/gaudi/helpers/operations.rb', line 37

def is_header? filename
  filename.downcase.end_with?('.h') ||
  filename.downcase.end_with?('.hh') ||
  filename.downcase.end_with?('.hpp')
end

#is_library?(filename, system_config, platform) ⇒ Boolean

Returns true if the file given is a library for the given platform

Returns:

  • (Boolean)

12
13
14
15
# File 'lib/gaudi/helpers/operations.rb', line 12

def is_library? filename,system_config,platform
  obj,lib,exe=*system_config.extensions(platform)
  return filename.end_with?(lib)
end

#is_source?(filename) ⇒ Boolean

Returns true if the file is a recognized source file

Doesn't mean we can actually work with all of them

Returns:

  • (Boolean)

24
25
26
27
28
29
# File 'lib/gaudi/helpers/operations.rb', line 24

def is_source? filename
  filename.downcase.end_with?('.c') ||
  filename.downcase.end_with?('.cc') ||
  filename.downcase.end_with?('.cpp') ||
  is_assembly?(filename)
end