Sometimes you simply want to build your application (but not run) as you ready it for source archiving, packaging, and distribution. Today there is no "compile only" option offered in the B4X tool chain.
Here's how you can implement a "compile only" feature in B4J with the assistance of a helper tool and a custom build action.
Follow this link to download the "compile only" helper tool.
http://www.macthomasengineering.com/b4x/mte_compileonly_v101.zip
Installation
1. Unzip the contents of MTE_COMPILEONLY_V101.ZIP
2. Copy COMPILEONLY.EXE to your favorite tools folder. (e.g. c:\Tools)
Usage
1. Create two build configurations: 'Compile_Only' and 'Compile_and_Run' in the project.
2. Add the conditional symbol COMPILE_ONLY to the 'Compile_Only' configuration
Compile Only Configuration
Compile and Run Configuration
3. Add this custom build action to the project. ** Important ** Make sure to specify the full path (e.g. c:\tools\compileonly.exe) and a comma after compileonly.exe
4. Note when you choose between build configurations the "compile only" action grays.
Compile_Only build selected
Compile_and_Run build selected
Build the project
1. Select the 'Compile_Only' configuration then Project->Compile & Run
2. Build exits after the .JAR is created.
How it works
Compileonly.exe simply returns an errorlevel to the B4J IDE. This prompts the IDE to cancel the build. The net effect is a compile only build.
Here's how you can implement a "compile only" feature in B4J with the assistance of a helper tool and a custom build action.
Follow this link to download the "compile only" helper tool.
http://www.macthomasengineering.com/b4x/mte_compileonly_v101.zip
Installation
1. Unzip the contents of MTE_COMPILEONLY_V101.ZIP
2. Copy COMPILEONLY.EXE to your favorite tools folder. (e.g. c:\Tools)
Usage
1. Create two build configurations: 'Compile_Only' and 'Compile_and_Run' in the project.
2. Add the conditional symbol COMPILE_ONLY to the 'Compile_Only' configuration
Compile Only Configuration

Compile and Run Configuration

3. Add this custom build action to the project. ** Important ** Make sure to specify the full path (e.g. c:\tools\compileonly.exe) and a comma after compileonly.exe
B4X:
#if RELEASE
#if COMPILE_ONLY
#CustomBuildAction: 2, c:\Tools\compileonly.exe,
#end if
#end if
4. Note when you choose between build configurations the "compile only" action grays.
Compile_Only build selected

Compile_and_Run build selected

Build the project
1. Select the 'Compile_Only' configuration then Project->Compile & Run
2. Build exits after the .JAR is created.

How it works
Compileonly.exe simply returns an errorlevel to the B4J IDE. This prompts the IDE to cancel the build. The net effect is a compile only build.
Last edited: