From 4a888debe480a31f0b2d47183d5d66eec6e5fcbc Mon Sep 17 00:00:00 2001
From: "Bernhard J. Berger" <bernhard.berger@uni-bremen.de>
Date: Fri, 3 Feb 2023 12:58:06 +0100
Subject: [PATCH] Reorganised repository to move scripts for executing stuff to
 their corresponding projects.

---
 ci/create-release.sh                          | 10 +++++++++-
 .../scripts/run-arff-to-ddl.sh                | 20 +++++++++++++++++++
 src/core/de.evoal.core/scripts/paths.env      |  2 ++
 .../de.evoal.core/scripts}/run-search.sh      |  6 ++----
 .../scripts}/debug-generator.sh               |  6 ++----
 .../scripts}/run-generator.sh                 |  6 ++----
 .../scripts}/debug-search-with-surrogate.sh   |  6 ++----
 .../scripts}/debug-training.sh                |  6 ++----
 .../scripts}/run-search-with-surrogate.sh     |  6 ++----
 .../scripts}/run-training.sh                  |  6 ++----
 10 files changed, 45 insertions(+), 29 deletions(-)
 create mode 100755 src/core/de.evoal.core.arff/scripts/run-arff-to-ddl.sh
 create mode 100644 src/core/de.evoal.core/scripts/paths.env
 rename src/{release => core/de.evoal.core/scripts}/run-search.sh (85%)
 rename src/{release => core/de.evoal.generator.main/scripts}/debug-generator.sh (79%)
 rename src/{release => core/de.evoal.generator.main/scripts}/run-generator.sh (77%)
 rename src/{release => core/de.evoal.surrogate.api/scripts}/debug-search-with-surrogate.sh (88%)
 rename src/{release => core/de.evoal.surrogate.api/scripts}/debug-training.sh (79%)
 rename src/{release => core/de.evoal.surrogate.api/scripts}/run-search-with-surrogate.sh (88%)
 rename src/{release => core/de.evoal.surrogate.api/scripts}/run-training.sh (77%)

diff --git a/ci/create-release.sh b/ci/create-release.sh
index f50f4e78..6ca37e52 100755
--- a/ci/create-release.sh
+++ b/ci/create-release.sh
@@ -39,4 +39,12 @@ popd
 rm -rf xtext-merge
 
 # let's copy the scripts to the correct location
-cp ../src/release/* .
+mkdir bin
+
+for NAME in $RELEASE_PLUGINS; do
+    echo "Copying scripts of plugin $NAME"
+
+    if [ -e src/core/de.evoal.$NAME/scripts ]; then
+      cp -r src/core/de.evoal.$NAME/scripts/* bin
+    fi
+done
\ No newline at end of file
diff --git a/src/core/de.evoal.core.arff/scripts/run-arff-to-ddl.sh b/src/core/de.evoal.core.arff/scripts/run-arff-to-ddl.sh
new file mode 100755
index 00000000..7340a40e
--- /dev/null
+++ b/src/core/de.evoal.core.arff/scripts/run-arff-to-ddl.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+source paths.env
+
+if [ "$#" -ne 3 ]; then
+    echo "Usage: $0 <execution-folder> <input.arff> <output.ddl>"
+    exit 1
+fi
+
+cd $1
+
+set -x
+java -Dorg.jboss.logging.provider=slf4j\
+     --module-path "${EVOALPATH}/modules/:$PLUGIN_PATHS" \
+     --add-modules ALL-MODULE-PATH \
+     --add-opens java.base/java.lang=guice \
+     -m de.evoal.core/de.evoal.core.main.Evoal \
+     -Bcore:main=extract-data-definition-from-arff \
+     -Barff:input=$2 \
+     -Barff:output=$3
diff --git a/src/core/de.evoal.core/scripts/paths.env b/src/core/de.evoal.core/scripts/paths.env
new file mode 100644
index 00000000..a5824f56
--- /dev/null
+++ b/src/core/de.evoal.core/scripts/paths.env
@@ -0,0 +1,2 @@
+EVOALPATH="$( cd -- "$(dirname "$0/..")" >/dev/null 2>&1 ; pwd -P )"
+PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
diff --git a/src/release/run-search.sh b/src/core/de.evoal.core/scripts/run-search.sh
similarity index 85%
rename from src/release/run-search.sh
rename to src/core/de.evoal.core/scripts/run-search.sh
index dc5df848..3356f396 100755
--- a/src/release/run-search.sh
+++ b/src/core/de.evoal.core/scripts/run-search.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 3 ]; then
     echo "Usage: $0 <execution-folder> <eal-file> <output-folder>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      --module-path "${EVOALPATH}/modules/:$PLUGIN_PATHS" \
diff --git a/src/release/debug-generator.sh b/src/core/de.evoal.generator.main/scripts/debug-generator.sh
similarity index 79%
rename from src/release/debug-generator.sh
rename to src/core/de.evoal.generator.main/scripts/debug-generator.sh
index 9155fdb3..b03ec59a 100755
--- a/src/release/debug-generator.sh
+++ b/src/core/de.evoal.generator.main/scripts/debug-generator.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 2 ]; then
     echo "Usage: $0 <execution-folder> <generator-file>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044\
diff --git a/src/release/run-generator.sh b/src/core/de.evoal.generator.main/scripts/run-generator.sh
similarity index 77%
rename from src/release/run-generator.sh
rename to src/core/de.evoal.generator.main/scripts/run-generator.sh
index b79476d4..ea70931a 100755
--- a/src/release/run-generator.sh
+++ b/src/core/de.evoal.generator.main/scripts/run-generator.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 2 ]; then
     echo "Usage: $0 <execution-folder> <generator-file>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      --module-path "${EVOALPATH}/modules/:$PLUGIN_PATHS" \
diff --git a/src/release/debug-search-with-surrogate.sh b/src/core/de.evoal.surrogate.api/scripts/debug-search-with-surrogate.sh
similarity index 88%
rename from src/release/debug-search-with-surrogate.sh
rename to src/core/de.evoal.surrogate.api/scripts/debug-search-with-surrogate.sh
index fb93028c..3e0ea934 100755
--- a/src/release/debug-search-with-surrogate.sh
+++ b/src/core/de.evoal.surrogate.api/scripts/debug-search-with-surrogate.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 7 ]; then
     echo "Usage: $0 <execution-folder> <ea-file> <mll-file> <pre-trained.pson> <training-points.json> <output> <constraint-folder>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044\
diff --git a/src/release/debug-training.sh b/src/core/de.evoal.surrogate.api/scripts/debug-training.sh
similarity index 79%
rename from src/release/debug-training.sh
rename to src/core/de.evoal.surrogate.api/scripts/debug-training.sh
index 86a8aa51..e6a24e51 100755
--- a/src/release/debug-training.sh
+++ b/src/core/de.evoal.surrogate.api/scripts/debug-training.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 2 ]; then
     echo "Usage: $0 <execution-folder> <mll-file>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044\
diff --git a/src/release/run-search-with-surrogate.sh b/src/core/de.evoal.surrogate.api/scripts/run-search-with-surrogate.sh
similarity index 88%
rename from src/release/run-search-with-surrogate.sh
rename to src/core/de.evoal.surrogate.api/scripts/run-search-with-surrogate.sh
index 10abbeab..b1cafeb9 100755
--- a/src/release/run-search-with-surrogate.sh
+++ b/src/core/de.evoal.surrogate.api/scripts/run-search-with-surrogate.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 7 ]; then
     echo "Usage: $0 <execution-folder> <ea-file> <mll-file> <pre-trained.pson> <training-points.json> <output> <constraint-folder>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      --module-path "${EVOALPATH}/modules/:$PLUGIN_PATHS" \
diff --git a/src/release/run-training.sh b/src/core/de.evoal.surrogate.api/scripts/run-training.sh
similarity index 77%
rename from src/release/run-training.sh
rename to src/core/de.evoal.surrogate.api/scripts/run-training.sh
index 0e88fe76..7c8572e8 100755
--- a/src/release/run-training.sh
+++ b/src/core/de.evoal.surrogate.api/scripts/run-training.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
 
+source paths.env
+
 if [ "$#" -ne 2 ]; then
     echo "Usage: $0 <execution-folder> <mll-file>"
     exit 1
 fi
 
-EVOALPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
-
 cd $1
 
-PLUGIN_PATHS=`ls -d "${EVOALPATH}/plugins"/* | tr '\n' ':'`
-
 set -x
 java -Dorg.jboss.logging.provider=slf4j\
      --module-path "${EVOALPATH}/modules/:$PLUGIN_PATHS" \
-- 
GitLab