B4J Tutorial Using CustomBuildAction with WinRAR

We can use #CustomBuildAction to archive some files and folders into a ZIP or RAR file (if you have WinRAR installed).

B4X:
#If RELEASE
#CustomBuildAction: 2, C:\Program Files\WinRAR\WinRAR.exe, a upload.zip www *.jar *.ini *.db help.html help.js comments.txt
#End If

You can change upload.zip to other file name such as publish.rar and WinRAR will automatically archive the file using the format specified in the extension.
You may however explicitly specify the file format using "-afzip" for zip file but it is optional.

RAR format produces a bit smaller file size and allows us to add comments to the archive from a text file.

B4X:
#If RELEASE
#CustomBuildAction: 2, C:\Program Files\WinRAR\WinRAR.exe, a -afrar publish.rar www *.jar *.ini *.db help.html help.js -czcomments.txt
#End If

You may want to read the WinRAR manual for the full commands list.

Thanks to @tchart for a great tutorial on CustomBuildAction for B4J
https://www.b4x.com/android/forum/threads/using-custombuildaction-to-your-advantage.72945/
 
Last edited:

aeric

Expert
Licensed User
Longtime User

aeric

Expert
Licensed User
Longtime User
With a few minutes trial-and-error:

B4X:
'Click to create Publish.zip: ide://run?file=%JAVABIN%\jar.exe&WorkingDirectory=../Objects&Args=-cMf&Args=Publish.zip&Args=www&Args=*.jar&Args=*.ini&Args=*.db&Args=help.html&Args=help.js&Args=comments.txt

Thanks @Erel ?
Using the comment link, WinRAR is not required. ;)
 
Top