1.1. How To Build Sunflower with Maven

Author:Jim Klo <jim.klo@sri.com>
Date:2018-09-07

1.1.1. Prerequisites

  1. Apache Maven http://maven.apache.org/
  2. Java SDK 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html

update your ~/.mavenrc set the JAVA_HOME environment variable to the Java SDK 1.8 location if Java 1.8 is NOT your default JAVA SDK.

1.1.2. Configure Maven with Artifactory

There are two ways use maven with Artifactory. If you are only using Artifactory with Sunflower, you may wish to configure Maven globally.

You may use this maven-settings.xml as a sample or merge with an existing maven settings file located at ~/.m2/settings.xml.

If you use Maven with other repositories and wish to avoid conflicts, instead of copying the maven-settings.xml into your .m2 folder, use -s src-root/build/maven-settings.xml as an additional argument to maven.

Note

Further instructions in this document will assume a globally configured Maven using ~/.m2/settings.xml.

1.1.2.1. Artifactory Credentials

You should use your own user credentials when using the SRI Artifactory server within Maven. To configure this login to Artifactory

Artifactory Login Page

Artifactory Login Page

Once logged into Artifactory, click on your username in the upper right corner to visit the User Profile page.

Click on your username in the upper right.

Click on your username in the upper right.

From the User Profile page, enter your password into the Current Password field and click Unlock.

Enter your password into the *Current Password* field and click *Unlock*

Enter your password into the Current Password field and click Unlock

This should now have unlocked your Encrypted Password. Scroll to the bottom of the page, and you will see a section titled Authentication Settings. Click the clipboard icon to the right of the Encrypted Password field to copy the password for pasting into your Maven settings.xml file.

Click the clipboard icon to the right of the Encrypted Password field to copy the password for your Maven ``settings.xml``

Select the segment of XML and copy this into your Maven settings.xml

Add the following server element into the servers element your settings.xml if it does not exist. Update the username element from [your username] to your Artifactory username and the password element from [your encrypted password] to you Artifactory encrypted password that you copied from above.

1
2
3
4
5
6
7
<servers>
    <server>
        <id>sunflower</id>
        <username>[your username]</username>
        <password>[your encrypted password]</password>
    </server>
</servers>

1.1.3. Quickstart Builds

In order to build all packages required from source for Sunflower Studio without any prior requisite artifacts ever being installed you must run each of the following Quickstart Builds in the order presented.

  1. Sunflower Foundation
  2. Sunflower Studio

For all builds, start out by creating a root source directory for all of your Sunflower development (modify this step for your platform).

mkdir /Users/username/sunflower/source
cd /Users/username/sunflower/source

Note

Throughout the rest of this guide, we will refer to this root source directory as src-root within instructions and code snippets.

1.1.4. Quickstart Build: Sunflower Foundation

  1. Check out the source for Sunflower Foundation substituting your LDAP login for USERNAME
git clone https://USERNAME@scm.sri.com/scm/git/ROR/sunflower-foundation sunflower-foundation
  1. Go to the sunflower-foundation folder and build and install modules into your local .m2 cache.
cd /src-root/sunflower-foundation
mvn clean install

Note

If the mvn command fails due to a JUnit test failing, you may add the following option, -DskipTests to disable the execution of unit tests during the build.

Example for above step:

mvn clean install -DskipTests

1.1.5. Quickstart Build: Sunflower Studio

  1. Check out the source for Sunflower Studio substituting your LDAP login for USERNAME
cd /src-root
git clone https://USERNAME@scm.sri.com/scm/git/ROR/sunflower-studio sunflower-studio
  1. Go to the bootstrap module and build Sunflower Studio
cd /src-root/sunflower-studio/sunflower-bootstrap

3. There are two varieties of Sunflower Studio, CE and Tasks. For source licenses that can build CE, use the following

mvn verify -DbuildType=core

For source licenses that can build Tasks, use the following

mvn verify -DBuildType=tasks

Warning

This step retrieves many dependencies from the Internet. Depending upon your network connectivity and computer speed, this step can take approximately 30 minutes to an hour to complete the first time.

Note

If the mvn command fails due to a JUnit test failing, you may add the following option, -DskipTests to disable the execution of unit tests during the build.

Example for above steps:

mvn verify -DbuildType=core -DskipTests

mvn verify -DbuildType=tasks -DskipTests

Built artifacts will be located:

Sub Project Artifact Path
Sunflower Studio Tasks src-root/sunflower-studio/sunflower-sri/com.sri.sunflower.distrib.tasks/target/products
Sunflower Studio CE src-root/sunflower-studio/sunflower-open/com.sri.sunflower.distrib.core/target/products
Floralib src-root/sunflower-foundation/floralib/target
Floralib External src-root/sunflower-foundation/floralib-ext/target

1.1.6. Maven Notes

Artifacts within the following locations should NOT be mvn install‘ed:

src-root/sunflower-studio

Artifacts within the following locations SHOULD be mvn install’ed:

src-root/sunflower-foundation

1.1.7. More Advanced Builds

The following scenarios assume you have already checked out the source.

1.1.7.1. Make Only Sunflower Foundation Tasks

The following will only bulid the sunflower-tasks.jar file in the target directory and then install them into the .m2 repository. This is used by Sunflower Studio Tasks edition, and is only needed if building and developing the Tasks edition.

If you are editing Sunflower Foundation Tasks and Sunflower Studio Tasks, this module should be built after Sunflower Foundation and before Sunflower Studio.

  1. Check out the source for Sunflower Foundations Tasks from GIT
cd src-root
git clone https://USERNAME@scm.sri.com/scm/git/ROR/sunflower-foundation-tasks sunflower-foundation-tasks
  1. Build and install the module.
cd src-root/sunflower-foundation-tasks/sunflower-tasks
mvn -DskipTests install

1.1.7.2. Make The Floralib Eclipse bundle

When debugging the the Sunflower IDE (either core or tasks version), you will need an updated Floralib Eclipse bundle built before you can launch Sunflower from the debugger.

cd src-root/sunflower-studio/sunflower-bootstrap
mvn verify -DbuildType=floralib-bundle

Note

If this does NOT work, add “clean” before “verify”.

mvn clean verify -DbuildType=floralib-bundle

If this does not work due to a unit test failure. Add -DskipTests at the end.

mvn clean verify -DbuildType=floralib-bundle -DskipTests

1.1.7.3. Make the Floralib and Tasks Eclipse bundles

When debugging the the Sunflower IDE (tasks version), you will need an updated Floralib and Tasks Eclipse bundle built before you can launch Sunflower from the debugger.

cd src-root/sunflower-studio/sunflower-bootstrap
mvn verify -DbuildType=tasks-bundle

Note

If this does NOT work, add “clean” before “verify”.

mvn clean verify -DbuildType=tasks-bundle

If this does not work due to a unit test failure. Add -DskipTests at the end.

mvn clean verify -DbuildType=tasks-bundle -DskipTests

1.1.7.4. Make Sunflower Core and Floralib

This would be a typical core build of the Sunflower IDE assuming that JRE and XSB/Flora artifacts have been previously installed.

cd src-root/sunflower-studio/sunflower-bootstrap
mvn verify -DbuildType=core

Note

If this does NOT work, add “clean” before “verify”.

mvn clean verify -DbuildType=core

If this does not work due to a unit test failure. Add -DskipTests at the end.

mvn clean verify -DbuildType=core -DskipTests

1.1.8. Building Without SRI Artifactory Access

It is possible to build Sunflower without access to the Maven repository. To do this you must first build and install the dependencies into your local .m2 repository.

1.1.8.1. floralib-thalamus

This contains dependencies that are used by floralib-ext. These are pre-built unmanaged artifacts, that only need to be installed. To install to your local .m2,

cd src-root/sunflower-foundation/floralib-thalamus
mvn install

1.1.8.2. XSB and Flora

You can build the XSB and Flora dependencies if you have Vagrant and Virtualbox available on an OS X host.

You will need access to the SRI intranet to access the Vagrant box images the first time. Currently there is no solution for non-OS X hosts.

  1. Clone the Sunflower Native repository from GIT
cd src-root
git clone https://USERNAME@scm.sri.com/scm/git/ROR/sunflower-native sunflower-native
  1. Change directory to the build directory
cd src-root/sunflower-native/build
  1. Execute the builder script, this will take a VERY long time:
../sunflower-native-build/jenkins-build-all-platforms-cpp.sh "" ../sunflower-native
  1. Install the artifacts:
cd sunflower-native-build/floralib.artifacts
mvn install

Note

There is a way to build only a single native platform, however currently there is no method to package artifacts for a single platform.

There are 3 versions, osx, linux, windows. To do this the structure of the command is:

cd src-root/sunflower-native/build
../sunflower-native-build/jenkins-build-all-platforms-cpp.sh <OS_VERSION> <SRC_PATH>

Where the values for

<OS_VERSION> :- osx | linux | windows
<SRC_PATH> :- "Relative path to src-root/sunflower-foundation-native/sunflower-native"

For OS X:

cd src-root/sunflower-native/build
../sunflower-native-build/jenkins-build-all-platforms-cpp.sh osx ../sunflower-native

For Linux:

cd src-root/sunflower-native/build
../sunflower-native-build/jenkins-build-all-platforms-cpp.sh linux ../sunflower-native

For Windows:

cd src-root/sunflower-native/build
../sunflower-native-build/jenkins-build-all-platforms-cpp.sh windows ../sunflower-native