Class: Buildr::Compiler::ExternalJavac
- Defined in:
- lib/buildr/java/external.rb
Constant Summary collapse
- OPTIONS =
[:jvm, :warnings, :debug, :deprecation, :source, :target, :lint, :other]
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Javac
Methods inherited from Base
applies_to?, #dependencies, dependencies, #initialize, #needed?, specify, to_sym
Constructor Details
This class inherits a constructor from Buildr::Compiler::Javac
Instance Method Details
#compile(sources, target, dependencies) ⇒ Object
:nodoc:
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/buildr/java/external.rb', line 26 def compile(sources, target, dependencies) #:nodoc: , OPTIONS cmd_args = [] # tools.jar contains the Java compiler. dependencies << Java.tools_jar if Java.tools_jar cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty? source_paths = sources.select { |source| File.directory?(source) } cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty? cmd_args << '-d' << File.(target) cmd_args += externaljavac_args Tempfile.open("external") {|tmp| tmp.write files_from_sources(sources).join(' ') cmd_args << "@#{tmp.path}" } unless Buildr.application..dryrun javac_path = File.join([:jvm] || ENV['JAVA_HOME'], "bin", "javac") final_args = cmd_args.insert(0, javac_path).push('2>&1').join(' ') trace(final_args) info %x[#{final_args}] fail 'Failed to compile, see errors above' unless $?.success? end end |