<commit_before>#!/bin/bash
#
# Function for creating the Maven settings file for the CI process, storing it in the
# ~/settings.xml path.
#
# It will take care of two pieces of data:
# - Servers settings
# - Active profile
#
# Server settings will be read by Maven from the environmental variables, and this
# file will tell him so.
#
# The active profile will depend on the type of version the current code is for.
# Depending on if this is a release or a development version.
#
# REMEMBER: For security reasons the data stored in the generated file should not be
# shared. Never print it on the console or let it be accessed in any way.
#
# --- SERVERS ---
#
# A total of four servers will be set:
# - releases: for deploying release artifacts
# - site: for deploying the Maven site for the release version
# - snapshots: for deploying snapshot artifacts
# - site-development: for deploying the Maven site for the development version
#
# --- PROFILES ---
#
# One of two profiles may be set, depending on the type of version, which is read from
# the VERSION_TYPE environmental variable.
#
# By default these profiles are:
#
# - deployment-release: for setting up the release deployment
# - deployment-development: for setting up the development deployment
#
# They can be changed through the parameters.
#
# -- PARAMETERS --
#
# The function expects the following parameters:
# $1: A string, one of release|develop, otherwise it is ignored.
# $2: A string, the name of the profile with the release deployment configuration.
# $3: A string, the name of the profile with the snapshot deployment configuration.
#
# --- ENVIRONMENTAL VARIABLES ---
#
# The following environmental variables are required by the script, but read by Maven:
#
# - DEPLOY_USER: string, user for the releases repo
# - DEPLOY_PASSWORD: string, password for the releases repo
#
# - DEPLOY_DEVELOP_USER: string, user for the development repo
# - DEPLOY_DEVELOP_PASSWORD: string, password for the development repo
#
# - DEPLOY_DOCS_USER: string, user for the releases documentation site repo
# - DEPLOY_DOCS_PASSWORD: string, password for the releases documentation site repo
#
# - DEPLOY_DOCS_DEVELOP_USER: string, user for the development documentation site repo
# - DEPLOY_DOCS_DEVELOP_PASSWORD: string, password for the development documentation site repo
#
# - DEPLOY_SITE: string, path for deploying the Maven site
# - DEPLOY_DEVELOP_SITE: string, path for deploying the development Maven site
#

# Fails if any used variable is not set
set -o nounset
# Fails if any commands returns a non-zero value
set -e

v_type=${1:-}
profile_release=${2:-"deployment-release"}
profile_develop=${3:-"deployment-development"}

# The contents of the file are created
{
   echo "<settings>";

   # ----------------
   # Servers settings
   # ----------------

   echo "<servers>";

   # Release artifacts server
   if [ -v "${DEPLOY_USER}" ]; then
      echo "<server>";
         echo "<id>releases</id>";
         echo "<username>\${DEPLOY_USER}</username>";
         echo "<password>\${DEPLOY_PASSWORD}</password>";
      echo "</server>";
   fi
   # Release site server
   if [ -v "${DEPLOY_DOCS_USER}" ]; then
      echo "<server>";
         echo "<id>site</id>";
         echo "<username>\${DEPLOY_DOCS_USER}</username>";
         echo "<password>\${DEPLOY_DOCS_PASSWORD}</password>";
      echo "</server>";
   fi

   # Development artifacts server
   if [ -v "${DEPLOY_DEVELOP_USER}" ]; then
      echo "<server>";
         echo "<id>snapshots</id>";
         echo "<username>\${DEPLOY_DEVELOP_USER}</username>";
         echo "<password>\${DEPLOY_DEVELOP_PASSWORD}</password>";
      echo "</server>";
   fi
   # Development site server
   if [ -v "${DEPLOY_DOCS_DEVELOP_USER}" ]; then
      echo "<server>";
         echo "<id>site-development</id>";
         echo "<username>\${DEPLOY_DOCS_DEVELOP_USER}</username>";
         echo "<password>\${DEPLOY_DOCS_DEVELOP_PASSWORD}</password>";
      echo "</server>";
   fi

   echo "</servers>";
   
   # --------
   # Profiles
   # --------
   
   echo "<profiles>";
   
      echo "<profile>";
         echo "<id>deployment_site</id>"
         # This profile is used to define the deployment site URL
         echo "<properties>"
            if [ "${v_type}" == "release" ]; then
               # Release site
               echo "<property>${DEPLOY_SITE}</property>"
            elif [ "${v_type}" == "develop" ]; then
               # Development site
               echo "<property>${DEPLOY_DEVELOP_SITE}</property>"
            fi
         echo "</properties>"
      echo "</profile>";

   echo "</profiles>";

   # --------------
   # Active profile
   # --------------

   # These profiles are used to set configuration specific to a version type
   echo "<activeProfiles>"
      if [ "${v_type}" == "release" ]; then
         # Release version
         echo "<activeProfile>${profile_release}</activeProfile>"
      elif [ "${v_type}" == "develop" ]; then
         # Development version
         echo "<activeProfile>${profile_develop}</activeProfile>"
      fi
      echo "<activeProfile>deployment_site</activeProfile>"<commit_msg>Corrected properties<commit_after>#!/bin/bash
#
# Function for creating the Maven settings file for the CI process, storing it in the
# ~/settings.xml path.
#
# It will take care of two pieces of data:
# - Servers settings
# - Active profile
#
# Server settings will be read by Maven from the environmental variables, and this
# file will tell him so.
#
# The active profile will depend on the type of version the current code is for.
# Depending on if this is a release or a development version.
#
# REMEMBER: For security reasons the data stored in the generated file should not be
# shared. Never print it on the console or let it be accessed in any way.
#
# --- SERVERS ---
#
# A total of four servers will be set:
# - releases: for deploying release artifacts
# - site: for deploying the Maven site for the release version
# - snapshots: for deploying snapshot artifacts
# - site-development: for deploying the Maven site for the development version
#
# --- PROFILES ---
#
# One of two profiles may be set, depending on the type of version, which is read from
# the VERSION_TYPE environmental variable.
#
# By default these profiles are:
#
# - deployment-release: for setting up the release deployment
# - deployment-development: for setting up the development deployment
#
# They can be changed through the parameters.
#
# -- PARAMETERS --
#
# The function expects the following parameters:
# $1: A string, one of release|develop, otherwise it is ignored.
# $2: A string, the name of the profile with the release deployment configuration.
# $3: A string, the name of the profile with the snapshot deployment configuration.
#
# --- ENVIRONMENTAL VARIABLES ---
#
# The following environmental variables are required by the script, but read by Maven:
#
# - DEPLOY_USER: string, user for the releases repo
# - DEPLOY_PASSWORD: string, password for the releases repo
#
# - DEPLOY_DEVELOP_USER: string, user for the development repo
# - DEPLOY_DEVELOP_PASSWORD: string, password for the development repo
#
# - DEPLOY_DOCS_USER: string, user for the releases documentation site repo
# - DEPLOY_DOCS_PASSWORD: string, password for the releases documentation site repo
#
# - DEPLOY_DOCS_DEVELOP_USER: string, user for the development documentation site repo
# - DEPLOY_DOCS_DEVELOP_PASSWORD: string, password for the development documentation site repo
#
# - DEPLOY_SITE: string, path for deploying the Maven site
# - DEPLOY_DEVELOP_SITE: string, path for deploying the development Maven site
#

# Fails if any used variable is not set
set -o nounset
# Fails if any commands returns a non-zero value
set -e

v_type=${1:-}
profile_release=${2:-"deployment-release"}
profile_develop=${3:-"deployment-development"}

# The contents of the file are created
{
   echo "<settings>";

   # ----------------
   # Servers settings
   # ----------------

   echo "<servers>";

   # Release artifacts server
   if [ -v "${DEPLOY_USER}" ]; then
      echo "<server>";
         echo "<id>releases</id>";
         echo "<username>\${DEPLOY_USER}</username>";
         echo "<password>\${DEPLOY_PASSWORD}</password>";
      echo "</server>";
   fi
   # Release site server
   if [ -v "${DEPLOY_DOCS_USER}" ]; then
      echo "<server>";
         echo "<id>site</id>";
         echo "<username>\${DEPLOY_DOCS_USER}</username>";
         echo "<password>\${DEPLOY_DOCS_PASSWORD}</password>";
      echo "</server>";
   fi

   # Development artifacts server
   if [ -v "${DEPLOY_DEVELOP_USER}" ]; then
      echo "<server>";
         echo "<id>snapshots</id>";
         echo "<username>\${DEPLOY_DEVELOP_USER}</username>";
         echo "<password>\${DEPLOY_DEVELOP_PASSWORD}</password>";
      echo "</server>";
   fi
   # Development site server
   if [ -v "${DEPLOY_DOCS_DEVELOP_USER}" ]; then
      echo "<server>";
         echo "<id>site-development</id>";
         echo "<username>\${DEPLOY_DOCS_DEVELOP_USER}</username>";
         echo "<password>\${DEPLOY_DOCS_DEVELOP_PASSWORD}</password>";
      echo "</server>";
   fi

   echo "</servers>";
   
   # --------
   # Profiles
   # --------
   
   echo "<profiles>";
   
      echo "<profile>";
         echo "<id>deployment_site</id>"
         # This profile is used to define the deployment site URL
         echo "<properties>"
            # Release site
            echo "<site.release.url>${DEPLOY_SITE}</site.release.url>"
            # Development site
            echo "<site.develop.url>${DEPLOY_DEVELOP_SITE}</site.develop.url>"
         echo "</properties>"
      echo "</profile>";

   echo "</profiles>";

   # --------------
   # Active profile
   # --------------

   # These profiles are used to set configuration specific to a version type
   echo "<activeProfiles>"
      if [ "${v_type}" == "release" ]; then
         # Release version
         echo "<activeProfile>${profile_release}</activeProfile>"
      elif [ "${v_type}" == "develop" ]; then
         # Development version
         echo "<activeProfile>${profile_develop}</activeProfile>"
      fi
      echo "<activeProfile>deployment_site</activeProfile>"
{'fraction_non_alphanumeric': 0.12807978099335157, 'fraction_numerical': 0.0011732499022291747, 'mean_word_length': 3.0066588327457895, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1866070', 'n_tokens_mistral': 2969, 'n_tokens_neox': 2837, 'n_words': 1027}