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: 578
Last edited:

stevel05

Expert
Licensed User
Longtime User
It appears that there can be a discrepancy between java versions when running the app from powershell or command on windows or just double clicking the jar, if you are seeing JDK NOT available and you have JDK installed, please download it again. I have added an extra check.
 

stevel05

Expert
Licensed User
Longtime User
I'm already working on version 1.1, I have figured out a better way to implement multiple projects, I have a few other non programming things to do this week so hopefully it'll be ready by early next week.
 

stevel05

Expert
Licensed User
Longtime User
Version 1.1 is now available to download in the first post, a bit sooner than expected.
 

Star-Dust

Expert
Licensed User
Longtime User
Thanks Stevel05, it's an interesting project. I wanted to create it myself but I didn't have the time.
But the best thing if such a thing @Erel integrated it into the IDE.

Thank you for your great work
 

stevel05

Expert
Licensed User
Longtime User
You haven't thought about integrating Erel's tool, for the generation of XML documentation?

Thanks Jorge
I hadn't seen that one, it's early days for the project, I'll add it to my things to look at list and see what's possible.
 

stevel05

Expert
Licensed User
Longtime User
Update v 1.2

Bugfix see post#1
 

stevel05

Expert
Licensed User
Longtime User
Update v 1.3
  • Bug Fix Module Target specific folders not remembered
  • Added select target folder for files
 

stevel05

Expert
Licensed User
Longtime User
Update v 1.4
  • Added create XML from deployed library using Erel's 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
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Waiting for debugger to connect...
Program started.
Error occurred on line: 479 (Main)
java.lang.RuntimeException: Object should first be initialized (List).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
at anywheresoftware.b4a.objects.collections.List.Clear(List.java:57)
at com.stevel05.b4xlibdeploy.main._updategui(main.java:2774)

B4X:
Private Sub UpdateGUI
  
  
    ModuleCBList.Clear ' <---

Right after adding a folder
(which is the reason why, momentarily, I downloaded your project, because I wanted to write a joking comment - see below - and I wanted to be sure of its operation.

The joking comment:
"Steve, you could use this Drag & Drop library, to add folders; maybe you don't know it"
https://www.b4x.com/android/forum/threads/jdraganddrop2-drag-and-drop.76168/#content
(It's a... @stevel05's library ?)
 

stevel05

Expert
Licensed User
Longtime User
Error occurred on line: 479 (Main)
Thanks for reporting it, can you download and try it again, I will look at adding drag and drop, good idea.
 

stevel05

Expert
Licensed User
Longtime User
Ah OK, I think I have a KVS with encryption disabled, I will include the module in the next release and remove the dependency on the library.
 
Top