Pom-O-Matic Solve your Build troubles with Pom-O-Matic!
The FOAM build is a node tool which executes Javascript methods (Tasks) against Project Object Model (POM)(or a more lighthearted acronym expansion: Pom-O-Matic) files.
The build manages options and tasks:
POMs are JSON files which identify source code, application configuration, and build instructions. They are hierarchical and can exist at any level of a code repository.
There are two types of POMs
all when no tasks are specified on the command line. (see JavaTooling)There are three distinct build phases:
foam.POM({
...
envs: {
appName: 'foam',
},
...
tasks: [
function javacParameters() {
JAVA_RELEASE = 21;
},
function buildJavaOpts() {
JAVA_OPTS += `` -DGO_HOME=${APP_HOME}``;
}
Three input styles are supported
The word style arguments can be listed individually or comma seperated.
Build examples for each Tooling feature is available with task usage
$ node foam3/tools/build.js --usage
Build help is generated by the help option and can be invoked in a number of ways:
$ node foam3/tools/build.js --help$ node foam3/tools/build.js -h$ node foam3/tools/build.js -?Help output is broken in three sections: options, tasks, environment variables (envs). Help can display just one of the sections by passing an argument to help.
For example, the following will only output the environment variables.
$ node foam3/tools/build.js --help:envs
Help can also output the usage or information of a single option, task, or environment variable.
$ node foam3/tools/build.js --help:topic
For example, the following will only output usage of help itself
$ node foam3/tools/build.js --help:help
Help will output partial matches when an exact match for the help topic is not found.
Option –show-envs will cause the build to output the final value of all options at the point of exit on error, or just before start CORE.
POMs are hierarchical and a POM is responsible for the files in it’s directory and child directories which themselves do not contain a POM.
TODO
foam.POM({
name: 'foam',
...
foam.POM({
name: 'foam-full',
...
envs: {
appName: 'foam'
},
foam.POM({
...
version: '1.0.0',
TODO
The build looks for tooling poms in:
tools/foam3/tools/For example, Custom tooling located in tools/CustomTooling.pom can be added into the build with:
-T+Custom
NOTE The tooling directive -T must proceed all other build arguments.
TODO
TODO
TODO
Option –flags:test will include all source and configuration flagged as test to allow using test and benchmark logic form a normally built application.
./build.sh -T+setup/Project --appName:example --package:com.foamdev --adminPassword:badpassword
# then build with
./build.sh deployment/demo/run.sh
# login with demo user - username: demo, password: demopassword
# or admin user - username: admin, password: badpassword
#
# Run the test cases with
./build.sh --server-tests:ExampleTest
doc/guides/Deployment.md./build.sh -ckJhttps
./build.sh -TStandard,Java,RemoteInstall –user:foam user-id:3636 –backup:false –remote-hostname:moosehead ```
eslint.md
```
# Run check on default src/ directory:
./build.sh -TESLint# see ussage with ./build.sh -TESLint –usage ```
Third party repositories can be built from source with the addition of a small pom file.
Create a pom file at the root of your project with a name matching the the repository, ThirdParty-pom.js for example. In it, specify javaFiles, resources, licenses, and javaDependencies. Note the paths are relative to your root project.
Example:
```
foam.POM({
name: 'ThirdParty',
javaFiles: [
{ '../ThirdParty/src/main/java/*' }
],
copy: [
{ source: '../ThirdParty/src/main/resources' }
],
licenses: `
// Add license header
`,
javaDependencies: [
...
]
})
```
Add this pom file to your root project pom projects section.
```
foam.POM({
...
projects: [
...
{ name: 'ThirdParty-pom' }
],
...
})
```
Build as you would normally for your project.
Java Preview Features can be specified as such in a pom:
```
foam.POM({
...
tasks: [
function buildJavaOps() {
JAVA_OPTS += ` --add-modules jdk.incubator.vector --enable-preview`;
}
],
```