Hi Adam,
On Feb 24, 2010, at 4:33 PM, Adam Crain wrote:
I have a 3 project buildfile... a scala executable that depends on two
jars. I am successfully running the scala tests now for project 'fep'
But I can't get the custom task :run to work because project 'fep'
won't
package into a jar like 'fepproto' and 'javadnp3'. Any ideas what it's
not packaging the scala project? The output from buildr is below,
followed by the relevant parts of the buildfile...
I can force the packing to occur if and only if I modify the buildfile
line:
task :run => :compile do
to
task :run => [:compile, :package] do
whereas the java projects package automatically.
If I understand you correctly, you have 'fep' (the scala executable)
which has something like `compile.with project('fepproto'),
project('javadnp3')`. Then the :run task is defined in the scope of
the 'fep' project.
If that understanding is correct, then this is the expected behavior.
'fepproto' and 'javadnp3' are being packaged as a result of fep's
compile dependencies -- compile.with project('foo') expresses a
dependency on foo's package task. 'fep' isn't packaged unless you
have :run express a dependency on fep's package task. (BTW, You can
just say
task :run => :package
because package implies compile.)
Rhett
Thanks, Adam
----------------------
a...@adam-laptop:~/code/scada_bus/frontend$ buildr
(in /home/adam/code/scada_bus/frontend, development)
Building frontend
Compiling frontend:fepproto into
/home/adam/code/scada_bus/frontend/fepproto/target/main/classes
Compiling frontend:javadnp3 into
/home/adam/code/scada_bus/frontend/javadnp3/target/main/classes
Packaging frontend-javadnp3-1.0.0.jar
Packaging frontend-fepproto-1.0.0.jar
Compiling frontend:fep into
/home/adam/code/scada_bus/frontend/fep/target/main/classes
Compiling frontend:fep:test into
/home/adam/code/scada_bus/frontend/fep/target/test/classes
Running tests in frontend:fep
ScalaTest "org.psi.sos.frontend.dnp3.MapGeneratorSuite"
Test Succeeded - MapGeneratorSuite.testEmptyProto
Test Succeeded - MapGeneratorSuite.testSimpleEntries
Run completed. Total number of tests run was: 2
All tests passed.
Completed in 11.225s
--------------------------------------
desc "The scada bus project"
define "frontend", :layout=>my_layout do
project.version = VERSION_NUMBER
project.group = GROUP
manifest["Implementation-Vendor"] = COPYRIGHT
desc "The java proto bindings"
define "fepproto", :layout=>my_layout do
extend JavaProtoc
proto_dirs = ['../proto/scada_types', '../proto/FEPConfig']
generated = get_proto_file_task('target/generated-source',
proto_dirs)
compile.from(generated.to_s).with(PROTOBUF).using(:javac)
package(:jar)
end
desc "dnp3 bindings for java"
define "javadnp3", :layout=>my_layout do
package(:jar)
end
desc "Front end processor in Scala"
define "fep", :layout=>my_layout do
specs = [PROTOBUF, SCALA_TEST]+ALL_QPID_JARS,
projects('javadnp3','fepproto')
compile.with specs
test.using(:scalatest)
desc 'Runs the front end processor'
task :run => :compile, :package do
cp =
Buildr.artifacts(specs).map(&:name).join(File::PATH_SEPARATOR)
sh "java -cp #{cp} org.psi.sos.frontend.FrontEnd"
end
package(:jar)
end
end
----------------------------------------