From 53ce2f6f222d81afb3fc02308bbb237deb807ccd Mon Sep 17 00:00:00 2001
From: Homada Boumedane <homada.boumedane@unige.ch>
Date: Thu, 27 Jun 2019 09:44:07 +0200
Subject: [PATCH] chore(dlcm-portal): build configurable

make build configurable
---
 Jenkinsfile  | 5 ++++-
 package.json | 2 +-
 pom.xml      | 8 ++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 9be140fe8..31e699754 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -44,9 +44,12 @@ pipeline{
     }
 
     stage ('Build & Deploying'){
+      environment {
+        WEB_CONTEXT_ROOT = 'portal'
+      }
       steps {
         withMaven(maven: 'Maven 3.3.9', mavenSettingsConfig: '829b97c1-b457-48ad-a48b-f8140b5a5821', mavenLocalRepo: '.repository'){
-          sh "mvn clean deploy"
+          sh "mvn clean deploy -Dweb.context.root=${WEB_CONTEXT_ROOT}"
         }
       }
     }
diff --git a/package.json b/package.json
index 565a9d413..8054387bf 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
     "start": "ng serve --proxy-config proxy.conf.json",
     "start:nodocker": "ng serve --proxy-config proxy.conf.no-docker.json",
     "start:dlcmtest": "ng serve --proxy-config proxy.conf.dlcmtest.json -c=dlcmtest",
-    "build": "ng build --aot=true --prod=true",
+    "build": "ng build --aot=true --prod=true --source-map=false",
     "test": "ng test",
     "clean": "rm -rf node_modules",
     "lint": "ng lint",
diff --git a/pom.xml b/pom.xml
index 4689e133f..3049f2d73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,6 +10,10 @@
   <version>1.4.0-SNAPSHOT</version>
 
   <properties>
+    <!-- Base web context used for the Angular application -->
+    <web.context.root>undefined</web.context.root>
+    <!-- Specify environment used to build the Angular application -->
+    <environment>production</environment>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
 
@@ -62,6 +66,10 @@
               <arguments>
                 <argument>run</argument>
                 <argument>build</argument>
+                <argument>--</argument>
+                <argument>--configuration=${environment}</argument>
+                <argument>--base-href</argument>
+                <argument>/${web.context.root}/</argument>
               </arguments>
             </configuration>
           </execution>
-- 
GitLab