Share My Creation Create b4xlib files from projects

This is an attempt to simplify the process of creating b4xlib projects. It will create an archive file from one or more project folders, allowing you to select the modules and files to add to the library and set the structure if the b4xlib file.

It uses the JDK (if installed) to create the zip fiiles, otherwise you will need to install 7Zip. I tried with winzip but it was slow and the results were unreliable so have removed it for now.

Initial Setup:

The first thing you need to do is set up some paths, you only need to do this once.

Click on Options / File Locations:

upload_2019-11-22_0-53-28.png


If you are going to want to create an archive from multiple projects you need to set a directory where manifests for the multiple projects can be stored. Do this using the Path to Multi Manifests button on the right of the option.

If you want to be able to view the created library file from within the app, you will need to set a path to a GUI zip viewing tool. Do this with the Path to Zip Giu Tool button.

You will see if the JDK jar (used to create the zip files by default) is available. If not select your path to 7Zip with the 7Zip option.

You should see the Archive Method set message at the bottom of the screen to your selected Zip tool.

Go back to the main screen:

V1-6.png


Here you need to set the path to the B4xlib folder in which you want to create the library files (Click the open folder button at the top right of the screen).

That's the initial setup complete and the information entered will be remembered on subsequent app starts.

Create deploy data:

You can now add one or more Project folders (Click the + button) that you want to create the library from or drag one or more folders (each of which must contain at least 1 .bas file) from file explorer and drop onto the file list . You will then be presented with a list of modules and files that are contained in the projects. You can identify each module, file or application as belonging to a project by it's colour identifier which you can change by clicking the colour button in the Project Folders list.

The Library name is just a memo field, which will be filled automatically from the project path which you can change if you want to. The Library target is the name for the library you want to create which is initially the same as the Library name, you can change this as well.

Select the Modules and files you want to include and save the Data (File/Save or Ctrl S) somewhere appropriate, but preferably not in the project folder.

Then click Deploy and the library file will be created. If you set up a zip GUI tool in the options menu you can click the view button View attachment 85699 next to the Library target field and the tool will open showing your library. Remember to close it before you try to deploy the library again as the file will be locked.

Additional Info:

When more than 1 project folder is loaded, the Edit Manifest button will automatically edit the Multi Manifest, the Manifests for the individual projects (if there is one) will remain in it's existing location.

You can select a folder for specific targets if a module or file is not appropriate for all (B4a, B4j, B4i).

If you click on an entry in the Apps list, the appropriate B4x version should open and load the project.

Editing of Manifest files is now done in a dialog with just a text area for editing..

The last library loaded will be remembered when you restart the app, to create a new library select File / New DeployData.

As Always, please test this in a safe manner: back up your projects (no code is changed but just in case), set a different target library directory to your main B4x library directory until you are happy that it works as expected.

The project code is in the B4xLibDeploy1.6.zip download and a runnable jar is on my dropbox. Download here.

If you try it, please let me know how you get on with it.

Version 1.1:
  • Improved creating b4xlibs from multiple projects (see flow above)
  • Layout is now responsive.
Version 1.2:
  • Bug fix when deploying lib without creating manifest
Version 1.3
  • Bug Fix Module Target specific Modules not remembered
  • Added select target specific folder for files
Version 1.4
  • Added create XML from deployed library using Erels code from V1.21 : b4xlib2XML
  • Improved manifest management
  • Added manifest Author and Version fields to the Gui
  • Added check for removed folders
  • Small bug fixes
Version 1.5
  • Added Drag & drop folders (Requires DragAndDrop2 b4xlib)
  • Modified XMLGenerator to check for returntype for Subs that do not have parameters.
Version 1.6
  • Added integrated Library documentation viewer with load and Drag and Drop disabled.
  • Internal manifest editor and Improved manifest handling

Depends On:

 

Attachments

  • B4xLibDeploy1-6.zip
    59.3 KB · Views: 472
Last edited:

swChef

Active Member
Licensed User
Longtime User
To get the download to compile, I changed the CustomBuildAction to the following (I don't have a D: drive).

#CustomBuildAction: 2, c:\windows\system32\cmd.exe, /c copy .\B4xLibDeploy.jar ..\..\B4xLibDeploy.jar

Note I arbitrarily chose two folders up for the copied file.
 

swChef

Active Member
Licensed User
Longtime User
When trying this Tool out, it listed under Modules a Starter.bas which had the exclusion attribute
B4X:
    #ExcludeFromLibrary: True

This is a suggestion to not add/list files with that attribute.


If you've made inclusion/checkbox selections, and drop another folder in, the selections are all cleared. Preference would be to retain the selections.

I deleted a (first).dat file. Then re-ran the Tool project, and it recreated the deleted first.dat file. I'd expect it would just warn it was missing, and create a new deploydata unsaved depoydata project. I did a file/new file/saveas with a new .dat name. When I tried to delete the previously deleted file first.dat, Windows said it couldn't, something was holding the file open/locked. I had to stop the running B4xLibDeploy Tool, and restart it, to remove the first.dat.
 
Last edited:
Top