Other [b4xlib] Creation and Management

udg

Expert
Licensed User
Longtime User
Hi all,
today I was in the process of cleaning up my Development directory tree and stumbled on what I named long ago MyLibs directory.
It used to contain directories dedicated to each one of my libs.

Now, since the advent of the new format (b4xlib) I have a few dirs containing just the *.bas files, the manifest.txt and the Files dir. Creating a lib from this material is a matter of seconds.
But what about the updating of that code?
Launching the IDE and trying to open/access the code of a b4xlib, it seems not possible since the IDE looks for a project file (e.g. *.b4a).

What I did was to create a "File/New/Default project" (IDE menu) so to have a "fake" project in my dir. Then I added to this projects all the *.bas files that make up the b4xlib to manage (i.e. update) and substituted the default Files dir with the one from my lib. Finally I removed the reference to the Layout.bal file and commented both the Activity.Loadlayout and the Button1_Click code.
Now I can open my fake project and update the code belonging to the lib.

This was because I already had the lib but missed the "create a fake project" step when I first wrote it.

For a new b4xlib I could start with the creation of a fake project like described above, but a much better way will be to make use of a "project template" so to create just what is needed.

I share this because I couldn't find any similar advice in the Forum.

Update: to make this post more complete, please find attached a "b4xlib" template based on the above description. Put it in your Additional Lib directory in the B4A folder (I quickly prepared it for B4A only)
 

Attachments

  • B4XLib.b4xtemplate
    9.4 KB · Views: 219
Last edited:

udg

Expert
Licensed User
Longtime User
Something like:
- main lib directory
--- dir containing *bas, manifest, Files
--- dir for the demo project (using files in the other dir instead of the compiled lib)

Is this as you set up for the creation of a new lib? This is how I used to do too.
But expanding the template way exercises some attraction now.. :)
At worst I had the opportunity to experiment a bit and learn something new.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
My structure for the and b4xlibs Classes is:

A general D:\B4X\Classes\MyClass
Which, in the latest developments, is a B4XPAges project. It contains the MyClass.bas file.
In older projects like the xChart project I had three folders, one for each platform and later a fourth one with a B4XPages project using the b4xlib. But this was before B4XPages.

And another folder:
D:\B4X\B4XLibaries\MyClass
Which contains the MyClass.bas file, the manifest.txt file and the Files folder if needed. And I zip the MyClass.b4xlib there in.
Of course, for each update, I need to copy the MyClass.bas file from the previous folder to this one, and change the manifest.txt file.
And, I use a new version folder for each new version.

Then, I copy the MyClass.b4xlib file to my B4X\AdditionalLibraries\B4X folder.
And I create a MyClass.xml file for me and copy it to B4X\AdditionalLibraries\B4XlibXMLFiles folder for my B4X Help Viewer.
And update the forum .
I admit, it is a bit cumbersome, but that is how I do it, at least til now.
 
Upvote 0
Top