Android Question Conditional compilation questions

techknight

Well-Known Member
Licensed User
Longtime User
I have about 40+ apps that are very similar to one another except for layouts, icons, and controls. So I have begun to play around with Build compilations to attempt to unify everything.

But that begs the question, Can you change the VersionCode, and VersionName as well as ApplicationLabel with the Conditial compilation?

I tried adding this, but it did not work:

B4X:
#Region Module Attributes
    #FullScreen: True
    #IncludeTitle: True
    #If BUILD1
        #ApplicationLabel: SM-BK-02ST
        #VersionCode: 6
        #VersionName: 5.21
    #End If
    #SupportedOrientations: Landscape
    #CanInstallToExternalStorage: True
#End Region

And of course the APK file is labeled the same as my B4A project file. Currently the only build is BUILD1, there are no others yet.

thoughts?
 

techknight

Well-Known Member
Licensed User
Longtime User
Nevermind. I actually had to add the conditional symbol to the build configuration, and not leave it blank. DOH!

However, I do have a problem though. I am using the robocopy example Erel has posted elsewhere to copy my specific files to the Files folder, I had to remove them all from the Files tab of the IDE or I got compile errors.

but in doing so, none of my layout scripts are running anymore! thoughts?

B4X:
#If BK02ST
   #CustomBuildAction: 1, c:\windows\system32\robocopy.exe, ..\Models\BK02ST ..\files /MIR
   #CustomBuildAction: 1, c:\windows\system32\cmd.exe, /c copy ..\Models\BK02ST\BasketballGreen.png res\drawable\icon.png
#End If
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
However, I do have a problem though. I am using the robocopy example Erel has posted elsewhere to copy my specific files to the Files folder, I had to remove them all from the Files tab of the IDE or I got compile errors.
Which errors?

If you are using the command line builder then you can copy the files before compilation starts.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
If you are using the command line builder
yesterday i showed him the link to the commandline builder tutorial as answer to his question if the compiler is scriptable.
So i guess as of now he was not using the cmdBuilder :)
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
I am not using the command line builder YET.... For now, I am choosing the build configuration from the dropdown box in the corner. But if the BAL files are not in the "Files" section of the IDE (which they are different for each build configuration), then the app will not compile in the Designer Scripts. they get left out. Bug? The layouts will show up because of the robocopy, but the scripts do NOT.

thats the issue I am having currently.

All my apps have a different control layout, so I have multiple layout files. if I add the files into the Files tab the IDE, and they are NOT in the files folder, I get an error of course. But if I remove them from the Files tab, and the Files folder, everything is fine as long as I copy the layout files to the Files folder prior or during the compile, as indicated with my robocopy statement I have above. But, the side-effect is I lose the Designer Script. it doesnt get included into the compiled binary.
 
Last edited:
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Because I am trying to merge all my apps into 1 project that I can pick/choose the build configuration and build a different app.

I am trying to avoid finding a bug, and then opening each and every single 40+ apps to fix the bug and recompile. that takes way too much of my time these days. I would rather have a single project with the 40 different configurations, edit and fix the bug ONCE, and compile 40+ times.

80% of the code base between the apps are the same. The difference is the layout, the specific controls/labels, and some code blocks in one of the services that associate specifically to that app. if I can take all that and define it explicitly through the build configurations, Ic an leave everything else alone.

But I don't want every single layout file for each app in the files folder at the same time, I want to copy the specific layout files for that particular build configuration. That's the goal I am trying to achieve here.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
The way I am trying to structure it, is have a separate files folder for each build configuration. When I chose a specific configuration, robocopy mirrors that folder into the main files folder during the compile. You can see my attempt in my 2nd post on that issue. Overall this works, except for that one little issue.

The last thing I want is every bal file for every app in the same Files folder at the same time during compile, because then I get a ton of irrelevant to the build config layouts in my Assets folder.

All I am trying to say here is, if the bal file isnt in the "Files" tab of the IDE, then its Designer Script never gets compiled into the app whether the bal file is present or not. Obviously if its not present the load layout crash will happen of course.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
For now, I am choosing the build configuration from the dropdown box in the corner. But if the BAL files are not in the "Files" section of the IDE (which they are different for each build configuration), then the app will not compile in the Designer Scripts. they get left out. Bug? The layouts will show up because of the robocopy, but the scripts do NOT.
Not a bug. The IDE needs the layout files before compilation starts.

You should use the command line builder.
 
Upvote 0
Top