B4J Question Simple Library Compiler, Exclude a class

stevel05

Expert
Licensed User
Longtime User
Is it possible to exclude a class from compiled the jar file using the Simple Library Compiler tool?

I want to do this as I am writing a listview CellFactory helper. The library includes a dummy class (in a seperate file) that is required to compile the library. Using Eclipse, I can export the jar without that class. The class is then replaced when the B4j project is compiled with a B4j class module with the same name, which does the work.

Because the cellfactory uses typed variables, a different class name (and separate library) is required for each listview instance, it would make it easy to make the changes and recompile the library with SLC.

I realize that this is a bit of a hack and there are probably a thousand reasons why it shouldn't be done. But it makes it pretty straightforward to manage the cellfactory updates within B4j code.

I am not entirely sure what the -b4aignore field can be used for. But I think I need to be able to add an excludes attribute to javac to accomplish this.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
I've just found a way to use the same Cell Factory library for multiple lists, but this functionality would still be useful as the package name of the library needs to match that of the B4j app, and it would potentially be cleaner.

Thanks
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
-b4aignore will not help here. This will only exclude the class from the doclet tool (xml generator).

There is no simple way to reference a source code file and not include it.
Two possible ways:
1. Delete it from the zip file (jar file).
2. Compile the file to a jar and then reference the jar from the main library.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Thanks Erel, manually deleting from the jar file works a treat.
 
Upvote 0
Top