README-dev-env.txt 5.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
SVAROG DEVELOPERS' GUIDE
========================

This guide is targeted for users of Ubuntu Linux 16.04 and it is meant
to facilitate installation of developers' environment for Svarog,
allowing for preparation and testing of application's JAR files.


I. Preparation
----------------

1. Download Svarog's repository from:
  git@gitlab.com:braintech/svarog2.git

15 16 17
2. Run (as root) script “install-dev-env.sh” from scripts catalogue
(you should at least look at it before you run it). The script will
install NetBeans IDE, as well as all dependencies required to develop
18
Svarog, including Java JDK (e.g. OpenJDK 8 and OpenJFX).
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77


II. Generating JAR files
--------------------------

ATTENTION: during the first compilation, maven will download a large
number of Svarog's dependencies (libraries). Depending of your network
connection, this process may take some time.

In project's main directory, run

  mvn clean package

whereas in case of minor changes "clean" may be omitted.

The command will generate Svarog's runnable JAR file into directory
svarog-standalone/target, as well as plugins' JAR files in separate
directories PLUGIN-NAME/target. To run generated JAR, execute

  java -jar svarog-standalone/target/svarog-standalone-*.jar


III. IDE configuration
----------------------

1. Build Svarog from command line according to the instructions in
section II. If you omit this point, NetBeans IDE will not be able to
find all automatically required files and will display an error.

2. Run already installed application NetBeans, got into Tools → Plugins
menu, open tab Settings and mark as checked all three available plugin
sources. Go to Available Plugins, and after having refreshed the plugin
list (Check for Newest) choose Maven from list and install it.
NetBeans will ask to be restarted after this step.

3. You can now choose File → Open Projects… and navigate to the path
of Svarog repository and/or subdirectory "svarog" inside it.
Svarog consists of several connected Maven packages:

* Svarog-top, which is the top-most project, which, when built, builds
the entire Svarog with all dependencies
* Svarog, which is the main part of Svarog

Most of the source code of Svarog's main part is in directory

  svarog/src/main/java

which is included in the project's CLASSPATH. It means that the hierarchy
of subdirectories inside this directory directly corresponds to
the structure of Java packages. Each source file contains directly
one class, with the same name as the file.

For example, svarog/src/main/java/org/signalml/app/SvarogApplication.java
file contains the SvarogApplication class. The first line of this file
defines the package, to which this class belongs:

  package org.signalml.app;


78 79 80
IV. Working with translations
-----------------------------

81 82
The first step is to generate *.pot files from Svarog's source code.
It is done by executing
83 84 85

  mvn gettext:gettext

86
in the "svarog" directory.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110

The resulting *.pot file can be used to initialize a new translation
by the use of "msginit" command. This will create an empty *.po
(translation) file suited to the given language. These files should be
edited either by hand or with the help of some GUI. Finished translation
files (e.g. "pl.po") should be added to the directory

  svarog/src/main/resources/org/signalml/app/resource/i18n/

and will be automatically included in the JAR file. Also, every available
language should be added to list LANGUAGES in file SvarogI18n.java.

Translating help files, however, is mostly manual. Help files are stored
in a versioned directory

  svarog/src/main/resources/org/signalml/help/

where the subdirectories (e.g. "en") mark the different language versions.
To create the help files for another language, simply create a directory for
a given language, and put the translations with the same names as original
versions.


V. Modifying Svarog version
111 112 113 114 115 116 117
---------------------------

Svarog's version number is automatically created by Maven based on
the most recent tags in git repository, as returned by

  git describe --tags

Marian Dovgialo's avatar
Marian Dovgialo committed
118 119 120 121 122 123
with

  mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$(git describe --tags)

command (Which CI runs by itself).

124 125 126
therefore, to create JAR with a new version number, it is necessary to:


Marian Dovgialo's avatar
Marian Dovgialo committed
127
1. Commit the changes and create a git tag with the new version number:
128 129 130

  git tag VERSION

Marian Dovgialo's avatar
Marian Dovgialo committed
131
2. You can now build the JAR file; it will have the new version number.
132 133


134 135
VI. Creating ZIP file for github Releases
-----------------------------------------
136 137 138 139 140 141 142 143 144 145

ZIP package consists of:
a) Svarog's JAR file
c) executable script run_svarog.sh
d) an example signal wakeEEG.bin with corresponding XML file
e) binary executables of MP5 and empi

The most recent ZIP file can be used to provide all the files except
a) and b). Afterwards, it is necessary to:

146
* replace Svarog's JAR file, if it has changed
147 148 149
* replace version number in run_svarog.sh
* make a ZIP file with the new name (check if the name of the package
  corresponds to the package's main directory)
150 151


152 153
VII. Known problems
-------------------
154 155 156 157 158 159 160 161 162 163 164 165

It is known that sometimes, especially when working in virtual machine
environment, any change of the display resolution or energy-saving
transition (e.g. computer sleep/wakeup) triggers the following error:

  message: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
  class java.lang.ClassCastException

This is a known bug in the current version of Java, and can be avoided
by starting Svarog from JAR file with the command-line option

  -Dsun.java2d.xrender=false