tridium / summit18-building-niagara

Niagara Summit 2018 example code demonstrating: 1) the process of migrating a module to the Niagara 4.6 build environment and 2) some examples of Niagara Annotation usage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo 1 This project assumes you have Niagar 4.6, Intellij, and a separate JDK installed. Before using any code in this project repository, run the New Module Wizard in workbench to create a new Niagara module. Once the new module wizard completes, you should have a folder structure like the one shown in the presentation slides. Delete the generated module part code folder (e.g. barcode-rt) and copy the three barcode module parts to the same location. Now import the project into Intellij by finding and opening the build.gradle file. Select your JDK to use with Gradle, and select the project to use the Gradle wrapper. Once it is loaded you can set the SDK for the project and compile the module parts to create jar files. Run the 'jar' task under the main 'barcode' project to compile. Run the 'niagaraTest' task to run unit tests. There is an intentionally failing test, so you will need to uncomment the expectedException attribute in the test file in barcode-rt to get all tests to pass. Test results are in the main build folder - open 'index.html' in your browser.

Demo 2 Copy demoAnnotation classes into the barcode-wb module part package com.niagarasummit.barcode. It will be a peer of the existing 'ui' package. Open the dependencies.txt file and copy these lines into the barcode-wb.gradle file. In the Gradle panel on the right side of your Intellij window, open the barcode-wb subtask container and run the 'slotomatic' task to generate the Niagara code in these example classes. After this completes, there is a change to a dependency in BBarcodeMap.java, which has a reference to the default contstructor of BBarcodeType. Edit this to use the factory method, which is commented out in the source file. Now run the 'jar' task to compile these classes. If you like, you can open the module-include.xml file to see the additions automatically generated when these classes are compiled. NOTE: These classes are intended to demonstrate some Niagara Annotations available to developers. They don't really do anything when compiled into module jar files.

About

Niagara Summit 2018 example code demonstrating: 1) the process of migrating a module to the Niagara 4.6 build environment and 2) some examples of Niagara Annotation usage.


Languages

Language:Java 89.0%Language:JavaScript 11.0%