# Gradle Instructions
1. To convert the current NeXtMidas to a gradle formatted project (full restructure), run the convert script.
  PREREQUISITE = define NMROOT - the script is located in the root directory of NeXtMidas and uses the NMROOT to run.
                 If NMROOT is not defined, it will use the script file location as the working directory
  on Linux -   convertgradle.sh  (supported)
  on Windows - convertgradle.bat (still at beta stage)
  This script also runs a gradle build without tests and it converts it to an eclipse project.
  If you want to cancel that, comment out the last few lines of the conversion script relative to your OS.
1b. LINUX ONLY: Alternatively, NeXtMidas can also be converted to a gradle formatted project using softlinks.
  Same instructions as full restructure Gradle build on Linux, except run the following instead:
  on Linux -   linkgradle.sh
2. To convert current option trees, run the option tree conversion script in the path to option tree.
Example path = /home/user/optiontrees/nxm/optiontree
note: the current format of option tree should be <location on disk>/nxm/optiontree - this will not work if it is formatted differently
  on Linux for external option tree: convertoptgradle-external.sh (-l) path/to/optiontree path/to/outputdir ('-l' is for using softlinks, optional)
  older scripts have been moved to gradle/legacy_scripts and need updates to be fully functional
    on Linux   - convertoptgradle.sh path/to/optiontree 
    on Windows - convertoptgradle.bat path/to/optiontree
3. Once this is complete, run a gradle build
  with tests: (May take a while)  gradle build
  without tests: gradle build -x test
4. to make this an eclipse compatible project
  gradle eclipse
5. to make the main jar slim, add options to the gradle build
  possible options -Pcfg -Pdat -Pdocs -Pexp

  gradle build -Pcfg -Pdat -Pdocs -Pexp

  To use all commands with one option, use -Pminimal

  gradle build -Pminimal

  warning - cfg is necessary if you need to run any predefined commands. 
  note: if these are ever needed after the build, you can add the test jar to the classpath. They are always included in the test jar.

6. to make a release version, add the release variable to the build

  gradle build -Prelease 

7. To publish to repo
  snapshot:
  gradle publish

  release:
  gradle publish -Prelease

  For detailed instructions on defining the necessary repos in the gradle.properties, please find the README-PROPERTIES.TXT

8. There is a script (runNextmidas.sh)
  This script will run nextmidas will both the main and test jars in the classpath and some core option trees on the nm path
  you can use that as reference for building an executable.

Converting and Building User External Option Tree

1. To convert separate option tree, run the convertoptgradle-external.sh. Example - /codebase/nxm/optname
   (Note: the -l option "restructures" using softlinks, rather than physically creating new directories and moving files)
2. To build the code now, go to /codebase/nxm and there will not be a gradle project build here.
   Update the gradle.properties to have the correct version for the option tree.
   run 
      gradle build -Pexternal -Prelease 
   This will generate release jars.

3. To publish - you will need the nexususer nexuspassword and nexusurl variables determined in the gradle.properties 
   Note: you may need to change to certificate base. I think to do that you just delete the username/passsword from the repository config in the common.gradle and add the certificate to the jvm in the build.properties
   then run 
      gradle publish -Prelease
   This will publish the option tree to the url provided. If you publish snapshots, simply drop the -Prelease
