lib/buildr/java/commands.rb in vic-buildr-1.3.1 vs lib/buildr/java/commands.rb in vic-buildr-1.3.3
- old
+ new
@@ -45,11 +45,11 @@
cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
options[:properties].each { |k, v| cmd_args << "-D#{k}=#{v}" } if options[:properties]
cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split).flatten
cmd_args += args.flatten.compact
unless Buildr.application.options.dryrun
- puts "Running #{name}" if verbose
+ info "Running #{name}"
block = lambda { |ok, res| fail "Failed to execute #{name}, see errors above" unless ok } unless block
puts cmd_args.join(' ') if Buildr.application.options.trace
cmd_args = cmd_args.map(&:inspect).join(' ') if Util.win_os?
system(*cmd_args).tap do |ok|
block.call ok, $?
@@ -81,17 +81,16 @@
else
cmd_args << '-nocompile' << '-s' << options[:output].to_s
end
cmd_args << '-source' << options[:source] if options[:source]
classpath = classpath_from(options)
- tools = File.expand_path('lib/tools.jar', ENV['JAVA_HOME']) if ENV['JAVA_HOME']
- classpath << tools if tools && File.exist?(tools)
+ Java.tools_jar { |tools| classpath << tools }
cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
cmd_args += files
unless Buildr.application.options.dryrun
- puts 'Running apt' if verbose
- puts (['apt'] + cmd_args).join(' ') if Buildr.application.options.trace
+ info 'Running apt'
+ trace (['apt'] + cmd_args).join(' ')
Java.load
Java.com.sun.tools.apt.Main.process(cmd_args.to_java(Java.java.lang.String)) == 0 or
fail 'Failed to process annotations, see errors above'
end
end
@@ -122,12 +121,12 @@
cmd_args << '-sourcepath' << options[:sourcepath].join(File::PATH_SEPARATOR) if options[:sourcepath]
cmd_args << '-d' << options[:output].to_s if options[:output]
cmd_args += options[:javac_args].flatten if options[:javac_args]
cmd_args += files
unless Buildr.application.options.dryrun
- puts "Compiling #{files.size} source files in #{name}" if verbose
- puts (['javac'] + cmd_args).join(' ') if Buildr.application.options.trace
+ info "Compiling #{files.size} source files in #{name}"
+ trace (['javac'] + cmd_args).join(' ')
Java.load
Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String)) == 0 or
fail 'Failed to compile, see errors above'
end
end
@@ -172,11 +171,11 @@
end
end
cmd_args += args.flatten.uniq
name = options[:name] || Dir.pwd
unless Buildr.application.options.dryrun
- puts "Generating Javadoc for #{name}" if verbose
- puts (['javadoc'] + cmd_args).join(' ') if Buildr.application.options.trace
+ info "Generating Javadoc for #{name}"
+ trace (['javadoc'] + cmd_args).join(' ')
Java.load
Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String)) == 0 or
fail 'Failed to generate Javadocs, see errors above'
end
end