Build files.
diff --git a/bin/MAVEN-RELEASE.md b/bin/MAVEN-RELEASE.md
new file mode 100644
index 0000000..cac2e7d
--- /dev/null
+++ b/bin/MAVEN-RELEASE.md
@@ -0,0 +1,94 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<img src="https://nlpcraft.apache.org/images/nlpcraft_logo_black.gif" height="80px" alt="">
+
+## 1. Configure Release Environment
+
+### Apache release
+- Configure file `prepare.sh` by setting your local GPG fingerprint `localUser={YOUR_VALUE}`
+
+### Maven release
+- Prepare maven passwords encryption (master and apache passwords) - https://maven.apache.org/guides/mini/guide-encryption.html
+- Encode **gpg.passphrase** for desired user - https://central.sonatype.org/pages/working-with-pgp-signatures.html
+
+As result, you should have the following files in the folder `{USER_HOME}/.m2`:
+- `settings-security.xml` file should contain the following content:
+ ```xml
+ <settingsSecurity>
+ <master>{YOUR_MASTER_PASSWORD}</master>
+ </settingsSecurity>
+ ```
+- `settings.xml` file should contain the following content:
+ ```xml
+ <server>
+ <id>apache.snapshots.https</id>
+ <username>YOUR_APACHE_USERNAME</username>
+ <password>{YOUR_APACHE_PASSWORD}</password>
+ </server>
+
+ <server>
+ <id>apache.releases.https</id>
+ <username>YOUR_APACHE_USERNAME</username>
+ <password>{YOUR_APACHE_PASSWORD}</password>
+ </server>
+
+ <profiles>
+ <profile>
+ <id>gpg</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <gpg.executable>gpg2</gpg.executable>
+ <gpg.passphrase>YOUR_GPG2_PASSPHRASE</gpg.passphrase>
+ <gpg.keyname>YOUR_GPG2_KEY_ID</gpg.keyname>
+ </properties>
+ </profile>
+ </profiles>
+ ```
+ **Note:** encrypted passwords must be in curly brackets.
+## 2. Make Apache Release
+Note that `pom.xml` scm tag should contain actual tag name.
+For example, if version is `0.5.0` and tag name is `v0.5.0` following pom `scm` section should be:
+```xml
+<scm>
+ <url>https://github.com/apache/incubator-nlpcraft.git</url>
+ <connection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</connection>
+ <developerConnection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</developerConnection>
+ <!-- Set actual tag name here -->
+ <tag>v1.0.0</tag>
+</scm>
+```
+
+The following `pom.xml` files should be updates:
+- nlpcraft/pom.xml
+- nlpcraft-stanford/pom.xml
+- nlpcraft-examples/calculator/pom.xml
+- nlpcraft-examples/lightswitch/pom.xml
+- nlpcraft-examples/lightswitch-ru/pom.xml
+- nlpcraft-examples/lightswitch-fr/pom.xml
+- nlpcraft-examples/pizzeria/pom.xml
+- nlpcraft-examples/time/pom.xml
+- pom.xml
+
+## 3. Make Maven Release
+ - `cd <PROJECT_FOLDER>`
+ - `mvn -DskipTests=true clean deploy -P 'stanford-corenlp,examples,release'`
+ - Login into https://repository.apache.org
+ - Look at staging repositories https://repository.apache.org/#stagingRepositories
+ - Find and close `nlpcraft` release, then check its state.
diff --git a/bin/prepare.sh b/bin/prepare.sh
new file mode 100644
index 0000000..94ad25d
--- /dev/null
+++ b/bin/prepare.sh
@@ -0,0 +1,170 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Make sure that maven installed on your PC.
+
+if [[ $1 = "" ]] ; then
+ echo "Version must be set as input parameter."
+ exit 1
+fi
+
+#
+# Change this for your local GPG fingerprint:
+# ===========================================
+localUser=6374898D3A9757F80D3C88B310BABC80DA5CFD15
+
+#
+# Scala version:
+# ===========================================
+scalaVer=3.2.2
+
+zipDir=zips
+tmpDir=apache-nlpcraft
+zipFileBin=apache-nlpcraft-incubating-bin-$1.zip # NOT an official ASF release.
+zipFileSrc=apache-nlpcraft-incubating-$1.zip # An OFFICIAL ASF release.
+coreModule=nlpcraft
+stanfordModule=nlpcraft-stanford
+examples=nlpcraft-examples
+exampleLightswitch=${examples}/lightswitch
+exampleLightswitchRu=${examples}/lightswitch-ru
+exampleLightswitchFr=${examples}/lightswitch-fr
+exampleTime=${examples}/time
+exampleCalculator=${examples}/calculator
+examplePizzeria=${examples}/pizzeria
+
+curDir=$(pwd)
+
+cd ../
+
+mvn clean package -DskipTests=true -P stanford-core,release,examples
+sbt doc
+
+rm -R ${zipDir} 2> /dev/null
+
+mkdir -p ${zipDir}/${tmpDir}/${coreModule}
+mkdir -p ${zipDir}/${tmpDir}/${stanfordModule}
+mkdir -p ${zipDir}/${tmpDir}/${exampleLightswitch}
+mkdir -p ${zipDir}/${tmpDir}/${exampleLightswitchRu}
+mkdir -p ${zipDir}/${tmpDir}/${exampleLightswitchFr}
+mkdir -p ${zipDir}/${tmpDir}/${exampleTime}
+mkdir -p ${zipDir}/${tmpDir}/${exampleCalculator}
+mkdir -p ${zipDir}/${tmpDir}/${examplePizzeria}
+
+mkdir ${zipDir}/${tmpDir}/build
+
+#=====================#
+# Prepare BINARY ZIP. #
+#=====================#
+
+function cpSrc() {
+ rsync -avzq "$1"/src ${zipDir}/${tmpDir}/"$1" --exclude '**/.DS_Store' --exclude '**/*.iml'
+}
+
+function cpCore {
+ rsync -avzq "${coreModule}"/src ${zipDir}/${tmpDir}/"${coreModule}" --exclude '**/.DS_Store' --exclude '**/*.iml' --exclude "main/python/ctxword/data/" --exclude "**/__pycache__/"
+}
+
+cpCore
+cpSrc ${stanfordModule}
+cpSrc ${exampleLightswitch}
+cpSrc ${exampleLightswitchRu}
+cpSrc ${exampleLightswitchFr}
+cpSrc ${exampleTime}
+cpSrc ${exampleCalculator}
+cpSrc ${examplePizzeria}
+
+cp bindist/LICENSE ${zipDir}/${tmpDir}
+cp bindist/NOTICE ${zipDir}/${tmpDir}
+cp DISCLAIMER-WIP ${zipDir}/${tmpDir}
+
+cp ${coreModule}/src/main/resources/log4j2.xml ${zipDir}/${tmpDir}/build
+
+rsync -avzq ${coreModule}/target/*all-deps.jar ${zipDir}/${tmpDir}/build
+rsync -avzq ${coreModule}/target/scala-${scalaVer}/api/** ${zipDir}/${tmpDir}/scaladoc --exclude '**/.DS_Store'
+
+function cpExample() {
+ mkdir -p ${zipDir}/${tmpDir}/build/"$1"
+ rsync -avzq "$1"/target/*.jar ${zipDir}/${tmpDir}/build/"$1" --exclude '*-sources.jar'
+}
+
+rsync -avzq "${stanfordModule}"/target/*.jar ${zipDir}/${tmpDir}/build --exclude '*-sources.jar'
+
+cpExample ${exampleLightswitch}
+cpExample ${exampleLightswitchRu}
+cpExample ${exampleLightswitchFr}
+cpExample ${exampleTime}
+cpExample ${exampleCalculator}
+cpExample ${examplePizzeria}
+
+
+# Prepares bin zip.
+cd ${zipDir} || exit
+zip -rq "${zipFileBin}" ${tmpDir} 2> /dev/null
+echo "Binary zip created: " "${zipFileBin}"
+
+# Deletes some data for src zip
+rm -R ${tmpDir}/build 2> /dev/null
+rm -R ${tmpDir}/scaladoc 2> /dev/null
+
+#=====================#
+# Prepare SOURCE ZIP. #
+#=====================#
+
+# Adds some data for src zip.
+cd ../
+
+function cpPom() {
+ cp "$1"/pom.xml ${zipDir}/${tmpDir}/"$1"
+}
+
+cpPom ${coreModule}
+cpPom ${stanfordModule}
+cpPom ${exampleLightswitch}
+cpPom ${exampleLightswitchRu}
+cpPom ${exampleLightswitchFr}
+cpPom ${exampleTime}
+cpPom ${exampleCalculator}
+cpPom ${examplePizzeria}
+
+cp pom.xml ${zipDir}/${tmpDir}
+cp LICENSE ${zipDir}/${tmpDir}
+cp NOTICE ${zipDir}/${tmpDir}
+cp assembly.xml ${zipDir}/${tmpDir}
+cp README.md ${zipDir}/${tmpDir}
+
+# Prepares src zip.
+cd ${zipDir} || exit
+zip -rq "${zipFileSrc}" ${tmpDir} 2> /dev/null
+echo "Source zip created: " "${zipFileSrc}"
+
+rm -R ${tmpDir} 2> /dev/null
+
+function sign() {
+ shasum -a 256 "$1" > "$1".sha256
+ gpg --local-user ${localUser} --sign --armor --output "$1".asc --detach-sign "$1"
+}
+
+sign "${zipFileBin}"
+sign "${zipFileSrc}"
+
+cd "${curDir}" || exit
+
+echo
+echo "****************************"
+echo "ZIPs are prepared in folder: '${zipDir}'"
+echo "****************************"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0f678d4..984a4ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -99,6 +99,8 @@
<maven.source.plugin.ver>3.0.1</maven.source.plugin.ver>
<maven.clean.plugin.ver>3.1.0</maven.clean.plugin.ver>
<maven.javadoc.plugin.ver>3.2.0</maven.javadoc.plugin.ver>
+ <apache.rat.plugin.ver>0.15</apache.rat.plugin.ver>
+ <maven.gpg.plugin.ver>1.6</maven.gpg.plugin.ver>
<org.antlr4.ver>4.11.1</org.antlr4.ver>
<jline.ver>3.21.0</jline.ver>
<commons.io.ver>2.11.0</commons.io.ver>
@@ -390,5 +392,68 @@
<module>nlpcraft-examples/calculator</module>
</modules>
</profile>
+
+ <profile>
+ <id>release</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>${apache.rat.plugin.ver}</version>
+ <configuration>
+ <excludes>
+ <exclude>.gitignore</exclude>
+ <exclude>build</exclude>
+ <exclude>.idea/**/*</exclude>
+ <exclude>scaladoc/**/*</exclude>
+ <exclude>.git/**/*</exclude>
+ <exclude>venv</exclude>
+ <exclude>*.iml</exclude>
+ <exclude>**/*.txt</exclude>
+ <exclude>idea/**/*</exclude>
+ <exclude>zips/**/*</exclude>
+ <exclude>src/main/resources/moby/*</exclude>
+ <exclude>src/main/scala/org/apache/nlpcraft/internal/makro/antlr4/*</exclude>
+ <exclude>DISCLAIMER-WIP</exclude>
+ </excludes>
+ <numUnapprovedLicenses>0</numUnapprovedLicenses>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>${maven.gpg.plugin.ver}</version>
+ <configuration>
+ <keyname>${gpg.keyname}</keyname>
+ <passphrase>${gpg.passphrase}</passphrase>
+ </configuration>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>