Wish [B4X] New value '#ConditionalSymbol' in the Main module's Project Attributes

walt61

Active Member
Licensed User
Longtime User
I keep all my 'utility' methods in one class, which makes it easy to just include that class in most projects (B4A and B4J in my case) and have the methods I need to my disposal. Some methods have dependencies on certain libraries which means that these libraries must be included in the projects; as there are overlaps (say one method might need libA, another libB, a third both these libraries), segregating them into separate classes by library dependencies wouldn't be practical and would cause code redundancy and all the risks and maintenance issues that accompany it. Having them all in one class means that all library dependencies must be satisfied, which increases the app/program's size.

I am aware of the Conditional Symbols in the Build Configurations and that these could be used to do what I'm wishing here; however, I'd find it significantly more useful and clear if these could be stated in the source instead of the Build Configurations menu and dialog. The objective would be to be able to do something like this in the Main module:

B4X:
#Region Project Attributes
    #ConditionalSymbol: s1, s2
    '#ConditionalSymbol: s3 ' <<< Comment line, so s3 will not be active and 'MySub3' below will be excluded from compilation; libraries on which it depends don't need to be added to the project
#End Region

The utility class would then look like:

B4X:
#If s1
Sub MySub1
...
End Sub
#End If ' s1

#If s2
Sub MySub2
...
End Sub
#End If ' s2

#If s3
Sub MySub3
...
End Sub
#End If ' s3

Thanks for considering it!
 
Top