Android Question What would be the best way to manage multiple "almost" identical projects?

Sergio Castellari

Active Member
Licensed User
Hello colleagues!!!

First, very Happy beginning of 2022 !!! ... Virtual hugs everyone!
Well, the matter is like this:
I have an APP, which is taking a significant size. This APP is the "base" platform for my clients.
But, for each client, I work with a different DB, with different functionalities and some configuration parameters that are specific.
Currently what I do (in some * .BAS files) specific, "comment" lines of code and "enable" others according to each client ... This at first has been my quick solution, but now it is proving cumbersome.
My question is: how can I make a Project Folder for each Client, but that only the specific client's files reside in said Folder, while the rest of the APP files are shared from a "COMMON" Folder ?. ..
I'm quite a newbie to B4X, and I don't really understand how I should put together the folder structure for a workbench like this.

Well, I hope I have explained well what my wish is and that you can indicate the steps to follow.

Greetings!
Sergio
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Look at the way a B4x and B4xPages apps work.
This is just a meta version of this.

See folder structure below

1641820375833.png


The Build the Master version first.
The custom version would then use "add existing modules" to reference the appropriate files in the master project.
Any specific files are held in the custom version directories.

I would use classes to encapsulate the differences between versions in the same way that classes are used across B4X.

I would also use the conditional symbols in the build configuration. This is also how code works across B4x.

so the code has:

B4X:
#if master
...
#else if custom1
...
#else if custom2
...
#end if
 
Upvote 1

Sergio Castellari

Active Member
Licensed User
Look at the way a B4x and B4xPages apps work.
This is just a meta version of this.

See folder structure below

View attachment 124019

The Build the Master version first.
The custom version would then use "add existing modules" to reference the appropriate files in the master project.
Any specific files are held in the custom version directories.

I would use classes to encapsulate the differences between versions in the same way that classes are used across B4X.

I would also use the conditional symbols in the build configuration. This is also how code works across B4x.

so the code has:

B4X:
#if master
...
#else if custom1
...
#else if custom2
...
#end if
Hello @Andrew (Digitwell)

Ok, I understand that I should create a "tree" for the development "Master" or "Demo" in my case, where all the APP files will be. But should you also create a complete "tree" for each client?
I don't understand how to use "conditioners" ... never use something like this ...

Greetings,
Sergio
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Hi Sergio,
I don't understand how to use "conditioners" ... never use something like this ...

Greetings,
Sergio
Take a look at this thread


conditional symbols are a very useful way to use a single source code base for multiple results.

There is also a post I made on a similar subject which demonstrates the use of conditional symbols and different build configurations.


Personally I would have a complete tree for each client. Not all files will appear in each tree as most of the files will appear in the Master Tree and be linked into each project with "Add Existing module",

Assets in the FIles folder do need to appear in each tree.

You can also use
#CustomBuildActions to copy over assets from the master tree to each of the custom trees.

for example to copy over png image files, you could use

B4X:
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\..\master\b4a\files" "..\Files" *.png
 
Upvote 0

Sergio Castellari

Active Member
Licensed User
Hi Sergio,

Take a look at this thread


conditional symbols are a very useful way to use a single source code base for multiple results.

There is also a post I made on a similar subject which demonstrates the use of conditional symbols and different build configurations.


Personally I would have a complete tree for each client. Not all files will appear in each tree as most of the files will appear in the Master Tree and be linked into each project with "Add Existing module",

Assets in the FIles folder do need to appear in each tree.

You can also use
#CustomBuildActions to copy over assets from the master tree to each of the custom trees.

for example to copy over png image files, you could use

B4X:
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\..\master\b4a\files" "..\Files" *.png
Personally I would have a complete tree for each client. Not all files will appear in each tree as most of the files will appear in the Master Tree and be linked into each project with "Add Existing module",

Assets in the FIles folder do need to appear in each tree.
@Andrew (Digitwell)
Exactly what you say there is what I want to implement. Thank you so much!
Now I have to see the links that you gave me and analyze how I should do it with my project!

Total hugs
 
Upvote 0

Sergio Castellari

Active Member
Licensed User
Hello @Andrew (Digitwell) , @Erel ,

Sticking with the topic, when I want to use "shared" folders, the IDE supports * .BAS files from different "folders", and I can tell you that I want a "link - absolute path".
But for the Designer files ... don't you have this possibility?

Hope Google Translate is clear
Greetings and thanks!
Sergio
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I would avoid using absolute path and use relative paths, that way if you need to move things around (another machine / directory etc) it will still work.

In my experience you need to have copies of the designer files in each project.

A way of making this easier is the put the shared parts in .b4xlib files which are then shared as this packages up the designer files as well so that there is only one copy.
 
Upvote 0

Sergio Castellari

Active Member
Licensed User
I would avoid using absolute path and use relative paths, that way if you need to move things around (another machine / directory etc) it will still work.

In my experience you need to have copies of the designer files in each project.

A way of making this easier is the put the shared parts in .b4xlib files which are then shared as this packages up the designer files as well so that there is only one copy.
THANK YOU for your prompt help. It is invaluable to me !!!

a) I understand ... I am at the stage of testing the ability to "share" folders for multiple projects. For now with absolute paths.
b) hmm ... so it seems the "designer" doesn't support absolute or relative paths ...
c) This point is very interesting, but I have no idea how to make a b4xlib file, I think that is several levels higher than my knowledge!

I will wait for what Erel says regarding point b), but if the designer does NOT support absolute or relative paths, I will not be able to implement the scheme I had in mind.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
his point is very interesting, but I have no idea how to make a b4xlib file, I think that is several levels higher than my knowledge!
1. Zip the files you want to be included in the library.
2. Change the extension to b4xlib.
3. That's it.

If you want to share layout files then you should build a b4xlib.
 
Upvote 0

Sergio Castellari

Active Member
Licensed User
1. Zip the files you want to be included in the library.
2. Change the extension to b4xlib.
3. That's it.

If you want to share layout files then you should build a b4xlib.
Hello @Erel and @klaus ,

Thank you first for your help.
I have carefully followed the steps indicated by Erel.
I have also read Klaus' post carefully.

Obviously I am doing something wrong, it does not work.

Steps I have taken:
1. Generate a ZIP with the files contained in the "FILES" folder of my master project.
2. Change the extension to * .b4xlib.
3.-Copy the * .b4xlib file to the B4A "additional libraries" folder.
4.-I open a project with the IDE, I go to the tab "manage libraries", I select * .b4xlib. So far everything OK, no errors.
5.- When I open the "Designer" I can't find any files !!! ...

Where can my mistake be?

Greetings
 
Upvote 0
Top