The problem is that the Scala compiler is really bad at figuring out
what files need recompilation. So, rather than risking false
negatives, scalac recompiles everything every time. We do try to
mitigate this somewhat by looking at file modifications, but we can
only do it if all of the files contain one and only one class/trait of
the same name as the file (Java-style). Objects also break the trick,
so it's really not worth striving for.
I have looked at porting the incremental compilation detection from
SBT, but unfortunately it is a non-trivial task which I don't have
time for right now.
Daniel
On Feb 19, 2010, at 6:49 AM, "Oliver Frommel"
<[email protected]> wrote:
Hi there,
after some try and error I managed to create a buildfile for a small
Scala project that uses some artifacts from Maven repo and some local
libs. However every time I am running buildr it compiles the source
code
files again, even if nothing has changed. Is this the default
behaviour
or is there anything I can do to change it?
Please point me to anything else I can improve in my buildfile, too :)
This is my buildfile:
require 'buildr/scala'
repositories.remote << 'http://www.ibiblio.org/maven2'
SLF4JJDK = artifact('org.slf4j:slf4j-jdk14:jar:1.5.8')
SLF4JAPI = artifact('org.slf4j:slf4j-api:jar:1.5.8')
LOG4J = artifact('log4j:log4j:jar:1.2.15')
configgy_jar = file('libs/configgy-1.5.jar')
CONFIGGY = artifact('configgy:configgy:jar:1.5').from(configgy_jar)
mina_jar= file('libs/mina-core.jar')
MINA = artifact('mina:mina:jar:2.0-M6').from(mina_jar)
specs_jar= file('libs/specs-1.6.2.jar')
SPECS = artifact('specs:specs:jar:1.6.2').from(specs_jar)
naggati_jar= file('libs/naggati-0.7.2.jar')
NAGGATI = artifact('naggati:naggati:jar:0.7.2').from(naggati_jar)
define 'smtpd' do
project.version = '0.1.0'
compile.from('src').with SLF4JAPI, SLF4JJDK, MINA, CONFIGGY, NAGGATI,
SPECS, LOG4J
package(:jar).with :manifest=>_('MANIFEST.MF')
task :run => :compile do
command = "scala -cp
target/classes:#{CONFIGGY}:#{MINA}:#{SPECS}:#{NAGGATI}:#{SLF4JJDK}:#
{SLF4JAPI}
com.programmingscala.smtpd.Main"
print "executing #{command}"
system command
end
end
Thanks for your help
Oliver