Sha256: 80d72b77c1676885efe9ea2879f7dd18bb4e7429967a8a2f55e00de82a8f97b0

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

require "fileutils"

module Rscons
  # Class to hold an object that knows how to build a certain type of file.
  class Builder
    # Return a set of default variable values for the Environment to use
    # unless the user overrides any.
    # @param env [Environment] The Environment.
    def default_variables(env)
      {}
    end

    # Return whether this builder object is capable of producing a given target
    # file name from a given source file name.
    # @param target [String] The target file name.
    # @param source [String, Array] The source file name(s).
    # @param env [Environment] The Environment.
    def produces?(target, source, env)
      false
    end

    # Check if the cache is up to date for the target and if not execute the
    # build command.
    # Return the name of the target or false on failure.
    def standard_build(short_cmd_string, target, command, sources, env, cache)
      unless cache.up_to_date?(target, command, sources)
        cache.mkdir_p(File.dirname(target))
        FileUtils.rm_f(target)
        return false unless env.execute(short_cmd_string, command)
        cache.register_build(target, command, sources)
      end
      target
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rscons-0.2.2 lib/rscons/builder.rb
rscons-0.2.1 lib/rscons/builder.rb
rscons-0.2.0 lib/rscons/builder.rb
rscons-0.1.0 lib/rscons/builder.rb
rscons-0.0.14 lib/rscons/builder.rb
rscons-0.0.13 lib/rscons/builder.rb
rscons-0.0.12 lib/rscons/builder.rb
rscons-0.0.11 lib/rscons/builder.rb
rscons-0.0.10 lib/rscons/builder.rb
rscons-0.0.9 lib/rscons/builder.rb
rscons-0.0.8 lib/rscons/builder.rb