Hi Alex, Thanks for your feedback on my buildfile. I have it all working now, a little digging in the rdoc showed me that the '_' is a convenience for path_to which makes sense.
I have fleshed out the J2ME preverification section of my buildfile and it is currently working ok. I thought I'd post it here in case someone else finds it useful in their work. There's a good chance that there is a better way to have integrated the preverfication stage with the buildr workflow but this is doing the right job, at least for now. I simply delete the class files which have not been preverified. They aren't much use anyway as the J2ME runtime requires the class files be modified to be compatible with its stripped back pre-verifier. You will need to have either the Sun Wireless Toolkit 2.5.x or the newer Java ME SDK 3.0 bin directory on your path for this to work. Cheers, Damien. ---buildfile--- VERSION_NUMBER = "1.0.0" repositories.remote << "http://www.ibiblio.org/maven2/" def preverify if compile.dependencies.empty? deps = "" else deps = "-classpath #{compile.dependencies}" end puts "[Invoking] preverify #{deps} -d #{path_to(:target, :preverified)} #{path_to(:target, :classes)}" system "preverify #{deps} -d #{path_to(:target, :preverified)} #{path_to(:target, :classes)}" puts "Deleting unverified class files" FileUtils.remove_dir(path_to(:target, :classes)) puts "Moving verified class files" FileUtils.mv(path_to(:target, :preverified), path_to(:target, :classes)) end desc "The Mbws-sib-console project" define "MBWS-SIB-CONSOLE" do project.version = VERSION_NUMBER project.group = "MBWS-SIB-CONSOLE" compile.options.target = '1.1' compile.options.source = '1.3' desc "IM3910 libs" define "IM3910" do compile.from(_('src')) package :jar compile { preverify } end compile.with project('IM3910') compile.from(_('DefaultComponent/DefaultConfig/mbws')) compile { preverify } package(:jar).with(project('IM3910').compile.target) end ---end-buildfile--- Hi Damien, Here's a refactored (working) version of your Buildfile, VERSION_NUMBER = "1.0.0" repositories.remote << "http://www.ibiblio.org/maven2/" def preverify #system 'preverify #{' puts 'need to invoke J2ME preverifier here' end desc "The Mbws-sib-console project" define "MBWS-SIB-CONSOLE" do project.version = VERSION_NUMBER project.group = "MBWS-SIB-CONSOLE" compile.options.target = '1.1' compile.options.source = '1.3' desc "IM3910 libs" define "IM3910" do compile.from(_('IM3910v14')) package :jar compile { preverify } end compile.with project('IM3910') compile.from(_('DefaultComponent/DefaultConfig/mbws')) compile { preverify } end Couple notes, - Use _('path/to/something') for all your paths so they get correctly resoved relative to your project - compile.with project('IM3910)' will use the exported project artifact (in this case the .jar); if you don't generate a jar then you need to do compile.with project('IM3910').compile.target - compile.options are inherited so you don't have to repeat them in sub-projects Hope this helps, alex On Thu, Nov 5, 2009 at 9:01 PM, Damien Cahill <[email protected]>wrote: Hi Guys, I'm having one of those days and apologies in advance if this turns out to be a real dumb question. Ok so I'm using a range of different tools at different stages of development in my work on a J2ME project. I'm at a cross roads of whether to begin to learn Ant or skip ahead and use something cool like Buildr. Personally I'd rather spend the time writing ruby than battling XML. So, I have my J2ME class library from my hardware vendor and I have my three little classes that I've just generated from our UML code generation tool. Now I want Buildr to 1) build the core libs 2) preverify these libs using the Sun Wireless Toolkit (WTK) 3) build my generated classes 4) wrap the final thing into a jar 5) (optional) ftp the whole thing to the dev board on my desk. Now I've managed to get my buildfile to compile the libs just fine. At the moment I'm skipping step 2 and just puts'ing some text for the post compile step. Now when it comes to compile my 3 little basic classes I get a classic classpath issue (shown below) of can't find package. I've done a whole day of reading and I can't quite work out what I'm doing wrong. I figured out how to get around the ./src/main/java issue using the compile.from method. I figured out how to add steps to the compile method (as shown with preverify). I just can't figure out why Buildr isn't setting the classpath to the output of the subproject build task. I've run Buildr using the --trace option and it clearly shows me that it is not setting the classpath correctly (ie, the target/classes directory is not included) when it invokes javac. Apart from the build file shown below I've tried having the projects defined separately (not in the master projects block/closure) and using the compile.with option (as shown in the commented out line) but this also doesn't work. Any and all help will be greatly appreciated. Thanks in advance :) # Generated by Buildr 1.3.5, change to your liking # Version number for this release VERSION_NUMBER = "1.0.0" # Group identifier for your projects GROUP = "MBWS-SIB-CONSOLE" COPYRIGHT = "" # Specify Maven 2.0 remote repositories here, like this: repositories.remote << "http://www.ibiblio.org/maven2/" desc "The Mbws-sib-console project" define "MBWS-SIB-CONSOLE" do project.version = VERSION_NUMBER project.group = GROUP manifest["Implementation-Vendor"] = COPYRIGHT compile.options.target = '1.1' compile.options.source = '1.3' #compile.with project('IM3910') compile.from('DefaultComponent/DefaultConfig/mbws') compile { preverify } desc "IM3910 libs" define "IM3910" do compile.options.target = '1.1' compile.options.source = '1.3' compile.from('IM3910v14') compile.into('target/classes') #package :jar compile { preverify } end end def preverify #system 'preverify #{' puts 'need to invoke J2ME preverifier here' end ---Results---- T:\RahpsodyWorkspace\MBWS-SIB-CONSOLE>buildr build (in T:/RahpsodyWorkspace/MBWS-SIB-CONSOLE, development) Building MBWS-SIB-CONSOLE Compiling MBWS-SIB-CONSOLE:IM3910 into target/classes need to invoke J2ME preverifier here Compiling MBWS-SIB-CONSOLE into T:/RahpsodyWorkspace/MBWS-SIB-CONSOLE/target/cla sses T:\RahpsodyWorkspace\MBWS-SIB-CONSOLE\DefaultComponent\DefaultConfig\mbws\si b\co nsole\SpiDevice.java:16: package se.imsys.comm does not exist import se.imsys.comm.SPI; ^ T:\RahpsodyWorkspace\MBWS-SIB-CONSOLE\DefaultComponent\DefaultConfig\mbws\si b\co nsole\SpiDevice.java:26: cannot find symbol symbol: class SPI public abstract class SpiDevice extends SPI { ^ 2 errors Buildr aborted! Failed to compile, see errors above
smime.p7s
Description: S/MIME cryptographic signature
