logic: Added SourceGroupCustomCommand to use with SourcetrailDB binaries

* Added new Source Group type SourceGroupCustomCommand to UI and ProjectSettings
* The Source Group executes a specified command on every source file
* The variables $SOURCE_PATH, $PROJECT_PATH, $DB_PATH, $STORAGE_VERSION can be passed
* The commands are executed after all other source groups finished indexing
* The command is executed with working directory set to project directory
* Errors during command execution are shown as status update and in the Status View
* SourceGroupCustomCommand cannot be partially cleared, when one file needs clearing the project must be fully re-indexed
This commit is contained in:
Eberhard Graether
2018-12-11 14:05:26 +01:00
parent 21d947ed6c
commit 6d5a3c047d
101 changed files with 1108 additions and 235 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# get absolute path to parent directory of script
MY_PATH=`dirname "$0"`
if [[ "${MY_PATH}" != *\\* ]]
then
cd $MY_PATH
MY_PATH=`pwd`
fi
MY_PATH="${MY_PATH//\\//}"
SRC_PATH=$MY_PATH/data
WORKING_COPY_PATH=$MY_PATH/working_copy
mkdir -p $WORKING_COPY_PATH
cp -a $SRC_PATH/. $WORKING_COPY_PATH
echo "Setup Complete"
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
# get absolute path to parent directory of script
MY_PATH=`dirname "$0"`
if [[ "${MY_PATH}" != *\\* ]]
then
cd $MY_PATH
MY_PATH=`pwd`
fi
MY_PATH="${MY_PATH//\\//}"
WORKING_COPY_PATH=$MY_PATH/working_copy
rm -rf $WORKING_COPY_PATH
echo "Teardown Complete"
@@ -0,0 +1,38 @@
* Run "1_setup.sh"
* Start up Sourcetrail
* Click "New Project"
* Enter a project name
* Set "./working_copy" as project location
* Click "Add Source Group"
* Select "Custom" -> "Custom Command Source Group"
* Click "Next"
* Click "Next"
* Add "python add.py $PROJECT_PATH $DB_PATH $STORAGE_VERSION $SOURCE_PATH" to "Custom Command"
* Add "./src" to "Files & Directories to Index"
* Add "**excl.txt" to "Excluded Files & Directories"
* Add ".txt" to "Source File Extensions"
* Click "Next"
* Click "Create"
* Validate "All files" is the only option selectable
* Validate "source files to index" shows "3"
* Click "Start"
* Validate Project indexed without error
* Click "OK"
* Validate "out.txt" contains 3 lines:
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/a.txt
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/b.txt
<project_path.srctrlprj> <project_db_path.srctrldb_tmp> <storage_version> <source_path>/c.txt
* Press "Refresh" button
* Validate "Updated files" is selected
* Validate "source files to index" shows "3" again
* Click "Cancel"
* Click "Edit Project"
* Change "Custom Command" to "pyt add.py"
* Click "Next"
* Validate "Warning appears that $SOURCE_PATH is not defined in command"
* Change "Custom Command" to "pyt add.py $SOURCE_PATH"
* Click "Refresh" button
* Click "Start"
* Validate "Log View appears showing errors that command execution failed".
* Close Sourcetrail
* Run "2_teardown.sh"
@@ -0,0 +1,6 @@
import sys
# import time
# time.sleep(1)
with open("out.txt", "a") as myfile:
myfile.write(sys.argv[1] + ' ' + sys.argv[2] + ' ' + sys.argv[3] + ' ' + sys.argv[4] + '\n')