Creating a b4xlib is easy.
You only need a B4X code (class or code module) with .bas file extension compressed into a file with the file extension .b4xlib.
You can add a manifest.txt to show the library version in the IDE.
Now, it is even faster and easier with the following steps, just inside the IDE, without any external tools.
Step 1: Prepare the project folder
From now on, every time you have modified your code and want to update your library immediately, just follow the following steps:
That's all.
You only need a B4X code (class or code module) with .bas file extension compressed into a file with the file extension .b4xlib.
You can add a manifest.txt to show the library version in the IDE.
Now, it is even faster and easier with the following steps, just inside the IDE, without any external tools.
Step 1: Prepare the project folder
- Create a new project
Optional: Create a GitHub repo. You can run the GitHub Desktop macro. - Move the project files into "source" folder
The project files include .b4j or .b4a file and .meta - Create a new "release" folder
- Add the following macros
B4X:#Region Macros '#Macro: Title, Export as zip, ide://run?file=%B4X%\Zipper.jar&Args=%PROJECT_NAME%.zip #Macro: Title, Update Version, ide://run?file=%JAVABIN%\java.exe&Args=-jar&Args=%ADDITIONAL%\..\B4X\manifest-writer.jar&Args=%PROJECT%&Args=%PROJECT%&Args=Version&Args=1.00 #Macro: Title, Create B4xLib, ide://run?file=%JAVABIN%\jar.exe&WorkingDirectory=..&args=-cMf&args=..\release\%PROJECT_NAME%.b4xlib #Macro: Title, Release folder, ide://run?file=%WINDIR%\SysWOW64\explorer.exe&Args=%PROJECT%\..\release #Macro: Title, Copy to AddLibs, ide://run?file=%COMSPEC%&args=/c&args=copy&args=%PROJECT%\..\release\*.b4xlib&args=%ADDITIONAL%\..\B4X #End Region
- Add a new class or code module into your project
- Optional: Create a "Snippets" folder and add some code snippets txt files into the folder
- Optional: Create a manifest.txt file
- Optional: Click the shortcut at the title bar to run the macro for "Update Version".
Edit the macro if you want to change or update the version number.
If this file is not exist, it will be created. - Click the shortcut at the title bar to run the macro for "Create B4xLib".
This is the only required step.
Edit the macro to include additional files or folders. e.g Snippets, manifest.txt or LICENSE
B4X:#Macro: Title, Create B4xLib, ide://run?file=%JAVABIN%\jar.exe&WorkingDirectory=..&args=-cMf&args=..\release\%PROJECT_NAME%.b4xlib&args=Snippets&args=*.bas&args=manifest.txt&args=LICENSE
Optional: You can verify if the file exist by running the macro "Release folder". - Optional: Click the shortcut at the title bar to run the macro for "Copy to AddLibs"
The library will be copied to Additional Libraries\B4X folder.
If it is a platform specific library, edit the macro to:
B4X:#Macro: Title, Copy to AddLibs, ide://run?file=%COMSPEC%&args=/c&args=copy&args=%PROJECT%\..\release\*.b4xlib&args=%ADDITIONAL%
From now on, every time you have modified your code and want to update your library immediately, just follow the following steps:
- Follow Step 4, #1
- Follow Step 4, #2
- Follow Step 4, #3
That's all.