Return-Path: Delivered-To: apmail-buildr-commits-archive@www.apache.org Received: (qmail 61688 invoked from network); 21 Mar 2010 02:44:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Mar 2010 02:44:26 -0000 Received: (qmail 23690 invoked by uid 500); 21 Mar 2010 02:44:26 -0000 Delivered-To: apmail-buildr-commits-archive@buildr.apache.org Received: (qmail 23663 invoked by uid 500); 21 Mar 2010 02:44:26 -0000 Mailing-List: contact commits-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@buildr.apache.org Delivered-To: mailing list commits@buildr.apache.org Received: (qmail 23656 invoked by uid 99); 21 Mar 2010 02:44:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Mar 2010 02:44:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Mar 2010 02:44:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DF84E2388A02; Sun, 21 Mar 2010 02:44:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r925717 - /buildr/trunk/lib/buildr/scala/compiler.rb Date: Sun, 21 Mar 2010 02:44:02 -0000 To: commits@buildr.apache.org From: djspiewak@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100321024402.DF84E2388A02@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: djspiewak Date: Sun Mar 21 02:44:02 2010 New Revision: 925717 URL: http://svn.apache.org/viewvc?rev=925717&view=rev Log: Added support for the scalac's -dependencyfile option under Scala 2.8 * Shouldn't even *attempt* incremental compilation if we're doing a joint compilation * Include target directory on the classpath whenever we compile with dependency tracing Modified: buildr/trunk/lib/buildr/scala/compiler.rb Modified: buildr/trunk/lib/buildr/scala/compiler.rb URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/compiler.rb?rev=925717&r1=925716&r2=925717&view=diff ============================================================================== --- buildr/trunk/lib/buildr/scala/compiler.rb (original) +++ buildr/trunk/lib/buildr/scala/compiler.rb Sun Mar 21 02:44:02 2010 @@ -47,6 +47,19 @@ module Buildr::Scala DEFAULT_VERSION # TODO return the version installed from Maven repo end end + + def compatible_28? + md = version.match /^(\d)\.(\d)/ + unless md.nil? + if md[1].to_i == 2 + md[2].to_i >= 8 + else + md[1].to_i > 2 + end + else + false + end + end end # Scalac compiler: @@ -136,12 +149,27 @@ module Buildr::Scala def compile(sources, target, dependencies) #:nodoc: check_options options, OPTIONS + java_sources = java_sources(sources) + enable_dep_tracing = Scala.compatible_28? && java_sources.empty? + + dependencies.unshift target if enable_dep_tracing + cmd_args = [] cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) 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.expand_path(target) cmd_args += scalac_args + + if enable_dep_tracing + dep_dir = File.expand_path(target) + Dir.mkdir dep_dir unless File.exists? dep_dir + + cmd_args << '-make:transitivenocp' + cmd_args << '-dependencyfile' + cmd_args << File.expand_path('.scala-deps', dep_dir) + end + cmd_args += files_from_sources(sources) unless Buildr.application.options.dryrun @@ -160,7 +188,6 @@ module Buildr::Scala fail 'Failed to compile, see errors above' if Java.scala.tools.nsc.Main.reporter.hasErrors end - java_sources = java_sources(sources) unless java_sources.empty? trace 'Compiling mixed Java/Scala sources'