Share My Creation Create b4xlib files from projects

Discussion in 'B4J Share Your Creations' started by stevel05, Nov 20, 2019.

  1. stevel05

    stevel05 Expert Licensed User

    This is an attempt to simplify the process of creating b4xlib projects. It will create an archive file from a project file, allowing you to select the modules and files to add to the projects 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:


    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:

    (There is no need to put layout files in specific target folders as they have different file extensions, this is just showing the options)

    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. 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 done with your systems default text editor.

    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 download and a runnable jar is on my dropbox. Download here.
    The project depends on jRandomAccess, KeyvalueStore2, jSQL which I don't think are part of core libraries, so you will need to download those if you haven't already.

    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
    Update v 1.3
    • Bug Fix Module Target specific Modules not remembered
    • Added select target specific folder for files

    Attached Files:

    Last edited: Dec 2, 2019
  2. stevel05

    stevel05 Expert Licensed 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.
    OliverA likes this.
  3. stevel05

    stevel05 Expert Licensed 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.
    OliverA and Johan Hormaza like this.
  4. stevel05

    stevel05 Expert Licensed User

    Version 1.1 is now available to download in the first post, a bit sooner than expected.
    OliverA likes this.
  5. Star-Dust

    Star-Dust Expert Licensed 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 likes this.
  6. stevel05

    stevel05 Expert Licensed User

    Always a possibility.
  7. Jorge M A

    Jorge M A Active Member Licensed User

  8. stevel05

    stevel05 Expert Licensed User

    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.
    Jorge M A likes this.
  9. Roberto P.

    Roberto P. Well-Known Member Licensed User

    great idea and work

    thank you
    stevel05 likes this.
  10. stevel05

    stevel05 Expert Licensed User

    Update v 1.2

    Bugfix see post#1
  11. stevel05

    stevel05 Expert Licensed User

    Update v 1.3
    • Bug Fix Module Target specific folders not remembered
    • Added select target folder for files
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice