Lexical Tools

Lexical Tools - build Processes

This pages describes the build, development and test procedures on Lexical Tools annual releases:

  • I. Development local build (Ant) & test
    • Ant Build:
      CommandsetupOperation results
      shell> ant cleanbuild.xml
      • remove ./classes
      shell> antbuild.xml
      • create ./classes
      • create ./lib/lvg${YEAR}api.jar
      shell> ant distbuild.xml
      • create ./classes
      • create ./lib/lvg${YEAR}api.jar
      • create ./lib/lvg${YEAR}dist.jar
      shell> ant releasebuild.xml
      • create ./classes
      • create ./lib/lvg${YEAR}api.jar
      • create ./lib/lvg${YEAR}dist.jar
      • create ./lib/lvg${YEAR}lite.tgz
      shell> packLvgFull ${YEAR}use ./lib/lvg${YEAR}dist.jarcreate ./lvg${year}.tgz
      shell> packLvgLite ${YEAR}use ./lib/lvg${YEAR}dist.jarcreate ./lvg${year}lite.tgz
    • Test:
      Test TypesetupOperation results
      unit testinstall ./lvg${YEAR}.tgz to ${PROJECT}check results on all flows and options
      lite testunzip ./lib/lvg${YEAR}Lite.tgzCheck all scripts
  • II. Production Ci-Cd build (mvn) & test
    • pom.xml:
      • version:
        • use ${YEAR}.0-SNAPSHOT for snapshot build
          => for snapshot development build, multiple versions is ok
        • use ${YEAR}.0 for official release build
          only 1 version is allowed in Nexus.
          => delete artifact (*.jar) of ${YEAR}.0 in Nexus -> lhc-lexicon-maven-release -> gov -> nih -> nlm -> lvg -> ${YEAR}.0 (before use mvn for release build)
    • Maven & pom.xml updates:
      Use the latest version on Maven Central Repository
      groupIdartifactIdversionNotes
      gov.nih.nlmlvg
      • ${YEAR}.0-SNAPSHOT
      • ${YEAR}.0
      SNAPSHOT is used for development.
      com.ibm.icuicu4j73.2Unicode package
      org.hsqldbhsqldb2.7.2HsqlDb database (use jdk8)
      junitjunit4.13.2for unit tests
      org.apache.maven.pluginsmaven-compiler-plugin3.11.0maven compiler
      org.apache.maven.pluginsmaven-jar-plugin3.3.0Maven manifest
      Profile
      org.apache.maven.pluginsmaven-assembly-plugin3.6.0mvn package -Psingle
      generates ./target/lvg-${YEAR}.0-jar-with-depednencies.jar
      org.apache.maven.pluginsmaven-resources-plugin3.3.1copy resource files
      org.apache.maven.pluginsmaven-shade-plugin3.5.1
      • pack all dependecies into one artifact (uber-jar).
      • mvn package -Pshade
        generates ./target/lvg-${YEAR}.0-shade.jar
      • mvn deploy -Pshade-attached
        attached (not replace) the original artifact
      • need to exclude META-INF/MANIFEST.MF from all artifacts to avoid duplciates warning
      org.apache.maven.pluginsmaven-javadoc-plugin3.6.0mvn package -P javadoc
      generate ./target/apidocs/* (not used in the release)
      org.apache.maven.pluginsmaven-source-plugin3.3.0mvn package -P source
      generates lvg-{YEAR}.0-sources.jar (include source)
    • Maven basic cycle:
      CommandsetupOperation results
      shell> mvn cleanpom.xml
      • remove ./target
      shell> mvn validatepom.xml
      • validate maven setup
      shell> mvn compilepom.xml
      • create ./target
      shell> mvn testpom.xml
      ./test/java/*.java
      • test junit
      shell> mvn packagepom.xml
      • create ./target/lvg-${YEAR}.0.SNAPSHOT.jar or
      • create ./target/lvg-${YEAR}.0.jar
      shell> mvn installpom.xml
      • publish artifacts to maven local repository
        ./lib/*.jar to ~/.m2/repository/..
      shell> mvn deploypom.xml
      • publish artifacts to maven remote repository (LHC)
        ./lib/*.jar to https://lhc-nexus.nlm.nih.gov/repository/..
    • Maven Ci-Cd commands:
      CommandsetupOperation results
      shell> mvn deploy -Pshadepom.xml
      • create lvg-${YEAR}.0-SNAPSHOT-shaded.jar
      • publish artifacts to maven remote repository (LHC)
        ./lib/*.jar to https://lhc-nexus.nlm.nih.gov/repository/..
      shell> packLvgFull ${YEAR} TRUEuse ./target/lvg-${YEAR}.0-shaded.jar to replace ./lib/lvg${YEAR}dist.jar
      • create ./lvg${year}.tgz
      shell> packLvgLite ${YEAR} TRUEuse ./target/lvg-${YEAR}.0-shaded.jar to replace ./lib/lvg${YEAR}dist.jar
      • create ./lvg${year}lite.tgz
    • Test:
      Test TypesetupOperation results
      unit testinstall lvg to ${PROJECT}check results on all flows and options
      lite testunzip lvgLiteCheck all scripts
  • III. Ci-Cd preprocess - Makefile
    • .gitlab-ci.yml
      => defines CI-CD pipeline process - build, packLite, packFull
    • Makefile
      => a file called by ./gitlab-ci to define tasks on all phases in the CI-CD pipeline
      variableoperations
      loginlogin to docker
      builduse maven to build and deploy lvg artifacts to LHC-Nexus
      packLitepack lite (min.) Lvg to ./lvgLite${YEAR}.tgz
      packFullpack full Lvg to ./lvg${YEAR}.tgz
    • packLite & packFull:
      • Variable defintion:
        Variable namefunctionNotes
        ${VERSION}lvg versionupdated in the Makefile
        ${LVG_PACK}pack lvg${YEAR}lite.tgz and lvg${YEAR}.tgz
        • TRUE: default
        ${LVG_UPLOAD}upload to Nexus
        • FALSE: development (default)
        • TRUE: release
        • Used for Website download and WebLvg
          • if the *.tgz files exist in the Nexus, the upload will be failed.
          • delete artifact (*.tgz) of ${YEAR} in Nexus -> lhc-lexicon-raw -> www -> lvg -> ${YEAR} (before use mvn for release build)
          • delete artifacts of the *.jar (release files) for deploying the same release version.
          • for snapshot development build is ok
        ${LVG_MVN_SNAPSHOT}snapshot build
        • TRUE: development (default)
        • FALSE: release
        ${LVG_MVN_JAR}Use mvn to build
        • TRUE: maven build
        • FALSE: ant build (default)
      • The above variables are used in Git and CiCd. They are deinfed in the environment variables (for linux) or in Git-> Lexicon -> Setting -> CI/CD -> Variables -> Reveal Values
      • Quick variable setup table:
        Variable nameDev - AntMaven/PreProcessProduction
        ${YEAR}yearyearyear
        ${LVG_PACK}TRUETRUETRUE
        ${LVG_UPLOAD}FALSEFALSETRUE
        ${LVG_MVN_SNAPSHOT}TRUETRUEFALSE
        ${LVG_MVN_JAR}FALSETRUETRUE
    • IV. Ci-Cd pipleline - Git
      • Development & Test - Git
          • develope and test on version of ${YEAR}.0-SNAPSHOT in pom.xml
          • after complete above, update version to ${YEAR}.0 in pom.xml for final deploy version)
        • Git commands:
          commanddesciptionnotes
          git branchcheck which branch is on
          git checkout developUse "develop" for developmentdevelopment uses snapshot build
          • git add -Ai
          • git commit -m "LEX_xxx, msg
          • git push origin
          save software changes to Git remote
          git tagshow all tagstag is used to start the Ci-Cd build
          git tag -a v.${YEAR}.0 -m "msg"tag the current version
          git push origin tagNamepush a tag to remote originA new tag will start the Ci-Cd pipleline
          git push origin -- tagspushshow all tags to remote origin
        • Tests:
          => use script downloadFiles ${YEAR} TRUE to download *.tgz from LHC-nexus to ./download
            • lvg${YEAR}.tgz => unit test, platform test, performance test, etc.
            • lvgLite${YEAR}.tgz => lite test
            Test TypesetupOperation results
            unit testinstall lvg to ${PROJECT}check results on all flows and options
            lite testunzip lvgLiteCheck all scripts
            GUI Lexical Tool testunzip lvgLiteCheck all scripts
            Perfromance testunzip lvgLiteCheck all scripts
            Other testsunzip lvgLiteCheck all scripts
      • Production release
        • For the release, need to remove the following assets (if they exists) in the Nexus before a new (final) Ci-Cd build
          • LVG package (annual release)
            ${NEXUS_URL}/repository/lhc-lexicon-maven-releases/gov/nih/nlm/lvg/${YEAR}.0/
            • lvg-${YEAR}.0.jar
            • ...
          • LVG artifacts (used by WebLvg)
            ${NEXUS_URL}/repository/lhc-lexicon-raw/www/lvg/${YEAR}/
            • lvg${YEAR}.tgz
            • lvg${YEAR}lite.tgz
        • Git commands:
          • update the pom.xml for mvn build to spanshot sand ${LVG_MVN_SANPSHOT)=TRUE if release is already build in develop.
          • update ${LVG_UPDLOAD}=FALSE if release is already uploaded to Nexus in develop.
          Git commandDescriptionsNotes
          git checkout masterswitch to master
          git merge developmerge changes in dev to master
          git tagshow all tags
          git tag -a v.${YEAR}.01 -m "msg"tag the current versiontag is used to save the official release (not to start a Ci-Cd pipeline).
        • Tests: unit tests, lite test, GUI Lexical Tool test, Platform test.