Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified
Accepted Solution

Multiple distributions from one source

Hi everyone.  I am trying to use one source tree and make two apps for the same device but branded slightly different.  I am using the rapc preprocessor to modify the source based on the distribution along with ant and Eclipse (with bb plugin).  For the most part I have it working.  The problem is when I am simulating only one app will work since they are fighting over the persistant store. I tried just renaming the apps based on their brand but that just gets them onto the simulator. 

 

The only fix I can see is to use the preprocessor to conditionally name the package. Is there some other way such as some jad magic? I have to say that the Eclipse plugin is quickly becoming usless for any real project.

Highlighted
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Multiple distributions from one source

How about you make these two apps use different ID in the persistent/runtime stores?
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Multiple distributions from one source

I've found it easier to use the c++ preprocessor but in any case you can use on single persistent hashtable with fixed guid and make a different

entry for each app. Alternatively, it maybe better to just define a symbol to use as the po guid. I'm not sure what

the rapc preprocessor supports  but they have uses beyond build variants (#if RIM_OS_TGT>40300) etc and I routinely

use __LINE__ in place of stack trace info and use the c++ TIMESTAMP( IIRC, cant remember exactly) for keeping

track of builds.

 

 

Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: Multiple distributions from one source

Good idea about the c preprocessor.  I used to use the c preprocessor when doing Playstation 2 assembly.  Man I would have thought that there would be a better way in this day and age.  Even C# has methods for conditional compiles. I am tempted to just drop the whole Eclipse thing and use an editor but it's hard to leave refactoring and code completionbehind Smiley Sad

 

Thanks for the responses.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Multiple distributions from one source

BlackBerry JDE as well as the BlackBerry Eclipse Plug-In support conditional compilation. They also feature a simple built-in preprocessor (C style). Just search this forum or Google for it.
Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: Multiple distributions from one source

Unless I am mistaken, they may support a preprocessor to a certain point, but they don't allow for build configurations.  Right now my defines are stored in ant files as properties and get included based on targets.  The Eclipse plugin has no way of knowing which defines are active.  Also Eclipse doesn't know anything about the preprocessor as all the directives start with comments, so Eclipse ignores them and can show false errors in the code. 

 

Antenna has been the closest thing I have found since it will comment the original code on the fly in Eclipse but there is not support for build configurations.

 

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Multiple distributions from one source

I don't use the BlackBerry Eclipse plug-in myself either. One of the main reasons being exactly the reason you mentioned -- it can't deal with multiple configurations. I still use Eclipse as the text editor though (just create a normal Java project, and replace the J2SE JAR with the net_rim_jde.jar). I build using external scripts and use the JDE for debugging/profiling.
Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: Multiple distributions from one source

Does anyone have an ant target that calls a preprocessor (gcc or vc) per source file?  I am new to ant and I am having some trouble with it.

 

 

<target name="preprocess"> <apply executable="cl.exe" dest="D:/temp" parallel="false"> <arg value="-E"/> <srcfile/> <arg value=">"/> <targetfile/> <fileset refid="source.files"/> <mapper type="glob" from="*.java" to="*.jxx"/> </apply> </target>