Project layout for application for several platforms

32 views
Skip to first unread message

Dmitry Trunikov

unread,
Nov 29, 2013, 11:30:16 AM11/29/13
to codenameone...@googlegroups.com
Hi ALL :)

This is a question about best layout for a project.
My application is targetted for several platforms.
Because application needs in invokations of native platform APIs I created project for each targetted platform
and a project of type 'CodenameOne Library' that contains business logic.
The library is shared by platform dependent projects.
Dependencies between projects can be described by following diagram:

A ---+
    +---> C
B ---+

Where A - project for J2ME, B - project  for Android, C - shared 'CodenameOne Library' with business logic.

This schema works but it has one big disadvantage. The library C is in flux and changed very often.
And after any change in the library I must do following steps:
  1. Rebuild the library.
  2. Copy built library from (C)/dist/*.cn1lib to (A)/lib.
  3. In NetBeans IDE rigth click on project A and select menu item 'Refresh Libs'.
  4. Copy built library from (C)/dist/*.cn1lib to (B)/lib
  5. In NetBeans IDE rigth click on project B and select menu item 'Refresh Libs'.
Obviously this routine is tedious and error prone.
So the question is -- Is there any way to automate this process? Or should I use an another approach?

TIA
Dmitry

Francis Perreault

unread,
Nov 29, 2013, 12:41:31 PM11/29/13
to codenameone...@googlegroups.com
Since the actions called "Clean", or "Clean and Build" are in fact executing Ant tasks (see the build.xml created by NetBeans), I would suggest you create a "post-compile" task that uses the "Copy" task (ref http://ant.apache.org/manual/Tasks/copy.html).

That should do the trick!

Francis

Shai Almog

unread,
Nov 29, 2013, 1:31:55 PM11/29/13
to codenameone...@googlegroups.com
Codename One is designed not to do such hacks, the whole idea of the native interfaces we provide is that those are 100% portable.

Regardless the refresh libs is just an ant task which you can see in the ant script. Just edit the script to automate the process of copying the lib and refreshing.

Dmitry Trunikov

unread,
Dec 2, 2013, 5:15:31 AM12/2/13
to codenameone...@googlegroups.com
My natural inattention and weak english did the dirty on me :)
I have found the exact answer on my question in an example demo application -- NativeDemo.

P.S. IMHO chapter "Native Interfaces" is abit intricated. It contains too many words "native" in different sences. I missed word "native" in sense of directory (where located platform-dependent implementations). It could be nice if this chapter will be rewritten with showing directory structure.

P.S. 2. Despite on some bugs which I found in the CodenameOne framework I found it wonderful  and extremely valuable tool for mobile app development. Especially hepful I found quick help of community in this forum. Thanks a lot.

Shai Almog

unread,
Dec 2, 2013, 12:43:54 PM12/2/13
to
Thanks.
I will take those under advisement.
Reply all
Reply to author
Forward
0 new messages