Compare commits

..
Author SHA1 Message Date
mlangkabel 70092378c2 test 2021-02-01 18:01:15 +01:00
mlangkabel f76c1773ae test 2021-02-01 17:12:51 +01:00
mlangkabel 997a0ff1e7 test 2021-02-01 15:22:47 +01:00
mlangkabel f0a143a85e test 2021-02-01 14:28:43 +01:00
mlangkabel 7b7c6f4794 add more logging 2021-02-01 13:56:43 +01:00
mlangkabel 9ad9fd8980 Revert "test"
This reverts commit 6ad1b1ce52.
2021-02-01 13:56:34 +01:00
mlangkabel 6ad1b1ce52 test 2021-01-27 22:25:54 +01:00
mlangkabel 4750791a6a test 2021-01-27 22:01:37 +01:00
mlangkabel 6894f9b608 test for ninja 2021-01-27 21:26:45 +01:00
mlangkabel c23dbfb9f9 test 2021-01-26 08:03:22 +01:00
mlangkabel 47fd6af759 install swig for building SourcetrailDB python bindings 2021-01-25 22:24:19 +01:00
mlangkabel 351399ee9e fetch submodule of submodule in appveyor script 2021-01-25 22:06:02 +01:00
mlangkabel 86b5efbd76 fetch submodules in appveyor script 2021-01-25 22:00:42 +01:00
mlangkabel b0c43ce94f remove download_python_indexer call from appveyor script 2021-01-25 21:48:15 +01:00
mlangkabel c28260a0fa update SourcetrailPythonIndexer submodule 2021-01-25 21:19:29 +01:00
mlangkabel b6a92d0825 fix python indexer call in tests 2021-01-25 21:18:08 +01:00
mlangkabel cd0f4e8fc0 fix cmake to copy correct files for python indexer 2021-01-25 20:43:50 +01:00
mlangkabel 146487b760 update SourcetrailPythonIndexer submodule 2021-01-25 20:43:21 +01:00
mlangkabel 197e127035 update usage of python indexer to call run.py 2021-01-25 20:43:00 +01:00
mlangkabel ecfa1b7920 split command line args for IndexerCommandCustom usages
* this seems to be required when using the new QProcess API.
* this also required to remove quotes that were added to path args because otherwise the Python indexer would mistake absolute paths for relative paths.
2021-01-25 20:36:42 +01:00
mlangkabel 093261232c create python environment instead of using pyinstaller 2021-01-25 18:45:27 +01:00
mlangkabel fd05f0fbc5 add SourcetrailPythonIndexer as submodule 2021-01-25 13:47:22 +01:00
mlangkabel e3c0ed9349 Revert "test: fix expected output for CXX indexer tests"
This reverts commit ce1d5e8443.
2021-01-12 07:49:05 +01:00
mlangkabel ce1d5e8443 test: fix expected output for CXX indexer tests 2021-01-11 19:54:02 +01:00
Malte LangkabelandGitHub 281dfd7fac docs: update language support version numbers in docu 2021-01-11 16:23:40 +01:00
Malte LangkabelandGitHub f18bef7f73 build: make Java tests run on Linux CI (#1127) 2021-01-11 14:34:28 +01:00
Eberhard Graether 2fbe3d68ea res: Updated SPONSORS.md - January 2021 2021-01-06 23:20:31 +01:00
Eberhard Graether 27262d20b4 res: Changelog for 2020.4.35 2021-01-06 23:14:18 +01:00
32 changed files with 423 additions and 214 deletions
+1
View File
@@ -26,6 +26,7 @@ build-*
.DS_Store
.idea
.vscode
__pycache__
/ide_plugins/vs/vs2015/SourcetrailPlugin/SourcetrailExtension/bin
/ide_plugins/vs/vs2015/SourcetrailPlugin/SourcetrailExtension/obj
+3
View File
@@ -0,0 +1,3 @@
[submodule "submodules/SourcetrailPythonIndexer"]
path = submodules/SourcetrailPythonIndexer
url = https://github.com/CoatiSoftware/SourcetrailPythonIndexer.git
+2 -2
View File
@@ -1,7 +1,7 @@
### Changelog
#### 2020.4.32 (beta)
released 2020-12-16
#### 2020.4.35
released 2021-01-06
* Build: Add compatibility layer for Qt versions ([#1118](https://github.com/CoatiSoftware/Sourcetrail/issues/1118))
* C/C++: Updated to LLVM/Clang 11.0.0 (issue [#1088](https://github.com/CoatiSoftware/Sourcetrail/issues/1088)) ([#1116](https://github.com/CoatiSoftware/Sourcetrail/issues/1116))
+46 -8
View File
@@ -482,10 +482,39 @@ else()
endif()
string(REGEX REPLACE "/" "\\\\" BACKSLASHED_CMAKE_BINARY_DIR ${CMAKE_BINARY_DIR})
string(REGEX REPLACE "/" "\\\\" BACKSLASHED_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
# Lib Python ---------------------------------------------------------------------
if (BUILD_PYTHON_LANGUAGE_PACKAGE)
file (STRINGS "${CMAKE_SOURCE_DIR}/submodules/SourcetrailPythonIndexer/SourcetrailDB/version.txt" VERSION_STRING)
string(REGEX REPLACE "v([0-9]+)\\..*" "\\1" INTERFACE_VERSION "${VERSION_STRING}")
string(REGEX REPLACE "v[0-9]+\\.db([0-9]+)\\..*" "\\1" DATABASE_VERSION "${VERSION_STRING}")
string(REGEX REPLACE "v[0-9]+\\.db[0-9]+\\.p([0-9]+).*" "\\1" PATCH_VERSION "${VERSION_STRING}")
set(VERSION_STRING_UNDERSCORE "v${INTERFACE_VERSION}_db${DATABASE_VERSION}_p${PATCH_VERSION}")
message(STATUS "SourcetrailDB Version: ${VERSION_STRING}")
message(STATUS "Interface Version: ${INTERFACE_VERSION}")
message(STATUS "Database Version: ${DATABASE_VERSION}")
message(STATUS "Patch Version: ${PATCH_VERSION}")
set(LIB_CORE_TARGET_NAME "SourcetrailDB_core_lib")
add_subdirectory(
"${CMAKE_SOURCE_DIR}/submodules/SourcetrailPythonIndexer/SourcetrailDB/core"
"${CMAKE_BINARY_DIR}/SourcetrailPythonIndexer/SourcetrailDB/core")
set(PYTHON_BINDING_TARGET_NAME "bindings_python")
set(PYTHON_BINDING_OUTPUT_DIR "")
add_subdirectory(
"${CMAKE_SOURCE_DIR}/submodules/SourcetrailPythonIndexer/SourcetrailDB/bindings_python"
"${CMAKE_BINARY_DIR}/SourcetrailPythonIndexer/SourcetrailDB/bindings_python")
add_library(${LIB_PYTHON_PROJECT_NAME} ${LIB_PYTHON_FILES})
create_source_groups(${LIB_PYTHON_FILES})
@@ -502,14 +531,26 @@ if (BUILD_PYTHON_LANGUAGE_PACKAGE)
#link_directories(${Boost_LIBRARY_DIRS})
target_link_libraries(${LIB_PYTHON_PROJECT_NAME} ${LIB_UTILITY_PROJECT_NAME} ${LIB_PROJECT_NAME})
add_dependencies(${LIB_PYTHON_PROJECT_NAME} _${PYTHON_BINDING_TARGET_NAME})
string(REGEX REPLACE "\\\\" "/" FORWARDSLASHED_PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
set(PYTHON_ENVIRONMENT_DIR "${BACKSLASHED_CMAKE_SOURCE_DIR}\\bin\\app\\data\\python\\environment")
set(PYTHON_INDEXER_DIR "${BACKSLASHED_CMAKE_SOURCE_DIR}\\bin\\app\\data\\python\\indexer")
execute_process(
COMMAND "cmd.exe" "/k" "rmdir" "/s" "/q" "${PYTHON_ENVIRONMENT_DIR}" & "${PYTHON_INCLUDE_DIR}/../python.exe" "-m" "venv" "--clear" "--copies" "${PYTHON_ENVIRONMENT_DIR}" & "${PYTHON_ENVIRONMENT_DIR}/Scripts/pip" "install" "-r" "${CMAKE_SOURCE_DIR}/submodules/SourcetrailPythonIndexer/requirements.txt" & exit
)
execute_process(
COMMAND "cmd.exe" "/k" "rmdir" "/s" "/q" "${PYTHON_INDEXER_DIR}" & exit
)
add_custom_command(
TARGET ${LIB_PYTHON_PROJECT_NAME}
PRE_BUILD
COMMAND ${PROJECT_SOURCE_DIR}/script/download_python_indexer.sh
COMMENT "download python indexer"
COMMAND ${PROJECT_SOURCE_DIR}/script/update_python_indexer.sh
COMMENT "updating python indexer scripts"
)
else()
message(STATUS "Building the Python indexer will be skipped. You can enable building this target by setting 'BUILD_PYTHON_LANGUAGE_PACKAGE' to 'ON'.")
@@ -695,9 +736,6 @@ if (WIN32)
TARGET ${APP_PROJECT_NAME}
PROPERTY VS_DEBUGGER_WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}/bin/app")
string(REGEX REPLACE "/" "\\\\" BACKSLASHED_CMAKE_BINARY_DIR ${CMAKE_BINARY_DIR})
string(REGEX REPLACE "/" "\\\\" BACKSLASHED_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
else ()
add_executable(${APP_PROJECT_NAME} ${APP_FILES})
endif ()
@@ -864,7 +902,7 @@ if (UNIX)
COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" "${CMAKE_SOURCE_DIR}/bin/app/user" "${CMAKE_BINARY_DIR}/app/user"
COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" "${CMAKE_SOURCE_DIR}/bin/test/data" "${CMAKE_BINARY_DIR}/test/data"
)
elseif(WIN32)
elseif (WIN32)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
if (EXISTS "${BACKSLASHED_CMAKE_BINARY_DIR}\\${OUTPUTCONFIG}")
execute_process(
-1
View File
@@ -50,7 +50,6 @@ Sponsors [via Patreon](https://www.patreon.com/sourcetrail).
* Stephan Roslen
* Thorsten Dahlheimer
* Tomi Joki-Korpela
* Tony Hong
* Werner de Groot
* X. Xu
* Yacob Cohen-Arazi
+24 -17
View File
@@ -2,24 +2,27 @@ version: 0.0.0.{build}
image: Visual Studio 2017
install:
############################################################################
# Install Ninja
############################################################################
- set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip"
- appveyor DownloadFile %NINJA_URL% -FileName ninja.zip
- 7z x ninja.zip -oC:\projects\deps\ninja > nul
- set PATH=C:\projects\deps\ninja;%PATH%
- ninja --version
############################################################################
# Install Ninja
############################################################################
- set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip"
- appveyor DownloadFile %NINJA_URL% -FileName ninja.zip
- 7z x ninja.zip -oC:\projects\deps\ninja > nul
- set PATH=C:\projects\deps\ninja;%PATH%
- ninja --version
# Install SWIG by Choco
- ps: choco install -y --no-progress swig --version 4.0.1
before_build:
- git submodule init
- git submodule update
- cd submodules/SourcetrailPythonIndexer
- git submodule init
- git submodule update
- cd ../..
- mkdir build
- cd build
- mkdir temp
- cd ../
- cd script
- cmd: "\"C:/Program Files/Git/usr/bin/bash.exe\" download_python_indexer.sh"
- cd ../
- cd build
- mkdir win64
- cd win64
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
@@ -31,7 +34,11 @@ build_script:
- ninja
- cd ../../
test_script:
- cd bin/test
- ..\..\build\win64\Release\test\Sourcetrail_test.exe
- cd ../../
artifacts:
- path: bin
name: bin
type: zip
- path: build
name: build
type: zip
@@ -1,6 +1,15 @@
SourceFilePath: "src/a.txt"
Custom Command: "echo "Hello World""
SourceFilePath: "src/b.txt"
Custom Command: "echo "Hello World""
SourceFilePath: "src/included/a.txt"
Custom Command: "echo "Hello World""
IndexerCommandCustom
SourceFilePath: "src/a.txt"
Custom Command: "echo"
Arguments:
"Hello World"
IndexerCommandCustom
SourceFilePath: "src/b.txt"
Custom Command: "echo"
Arguments:
"Hello World"
IndexerCommandCustom
SourceFilePath: "src/included/a.txt"
Custom Command: "echo"
Arguments:
"Hello World"
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<config>
<application>
<window_base_width>500</window_base_width>
<window_base_height>500</window_base_height>
</application>
<indexing>
<java>
<java_path>/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-1.el7_9.x86_64/jre/lib/amd64/server/libjvm.so</java_path>
</java>
<indexer_thread_count>0</indexer_thread_count>
</indexing>
<user>
<recent_projects>
<recent_project>./projects/tutorial/tutorial.srctrlprj</recent_project>
<recent_project>./projects/tictactoe_cpp/tictactoe_cpp.srctrlprj</recent_project>
<recent_project>./projects/tictactoe_py/tictactoe_py.srctrlprj</recent_project>
<recent_project>./projects/javaparser/javaparser.srctrlprj</recent_project>
</recent_projects>
</user>
<version>8</version>
</config>
@@ -1,5 +1,13 @@
FROM coatisoftware/centos7_64_qt_llvm:qt5126-llvm1100
WORKDIR /home/builder
RUN mkdir .config && \
cd .config && \
mkdir sourcetrail
COPY ApplicationSettings.xml /home/builder/.config/sourcetrail/ApplicationSettings.xml
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+5 -5
View File
@@ -100,21 +100,21 @@
<li><strong>Code:</strong> The Code view displays all source locations of the currently selected symbol in a list of code snippets. Clicking on a different source location allows you to change the selection and dig deeper.</li>
</ul>
<p>Note: Sourcetrail currently supports the languages C/C++ and Java. Much of the UI design is therefore based on these languages and might change as soon as other languages are supported. For more information have a look at <a href="#SupportedLanguages">supported languages</a>.</p>
<p>Note: Sourcetrail currently supports the languages C/C++, Java and Python. Much of the UI design is therefore based on these languages and might change as soon as other languages are supported. For more information have a look at <a href="#SupportedLanguages">supported languages</a>.</p>
<h2>Supported Languages</h2>
<h3>C</h3>
<p>C support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 10.0.0</a>. For issues loading C code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<p>C support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 11.0.0</a>. For issues loading C code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<h3>C++</h3>
<p>C++ support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 10.0.0</a>. For more Information please visit <a href="https://clang.llvm.org/cxx_status.html" target="_blank">Clang C++ Status</a>. For issues loading C++ code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<p>C++ support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 11.0.0</a>. For more Information please visit <a href="https://clang.llvm.org/cxx_status.html" target="_blank">Clang C++ Status</a>. For issues loading C++ code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<h3>Java</h3>
<p>Sourcetrail includes support for Java 10 and lower which is powered by <a href="https://github.com/eclipse/eclipse.jdt.core" target="_blank">Eclipse JDT</a>. If you encounter any issues while using Sourcetrail on a Java project, please let us know by providing a minimal example in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<p>Sourcetrail includes support for Java 12 and lower which is powered by <a href="https://github.com/eclipse/eclipse.jdt.core" target="_blank">Eclipse JDT</a>. If you encounter any issues while using Sourcetrail on a Java project, please let us know by providing a minimal example in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<h3>Python</h3>
<p>Sourcetrail includes beta support for Python 2 and Python 3 which is powered by our open-source <a href="https://github.com/CoatiSoftware/SourcetrailPythonIndexer" target="_blank">SourcetrailPythonIndexer</a>. If you encounter any issues while using Sourcetrail on a Python project, please let us know by providing a minimal example in our <a href="https://github.com/CoatiSoftware/SourcetrailPythonIndexer/issues">bug tracker</a>.</p>
<p>Sourcetrail includes support for Python 2 and Python 3 which is powered by our open-source <a href="https://github.com/CoatiSoftware/SourcetrailPythonIndexer" target="_blank">SourcetrailPythonIndexer</a>. If you encounter any issues while using Sourcetrail on a Python project, please let us know by providing a minimal example in our <a href="https://github.com/CoatiSoftware/SourcetrailPythonIndexer/issues">bug tracker</a>.</p>
<div class="row" style="height:80px;"></div>
-101
View File
@@ -1,101 +0,0 @@
#!/bin/bash
SOURCETRAIL_PYTHON_INDEXER_VERSION="v1_db25_p5"
# Determine current platform
PLATFORM='unknown'
if [ "$(uname)" == "Darwin" ]; then
PLATFORM='osx'
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
PLATFORM='linux'
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
PLATFORM='windows'
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
PLATFORM='windows'
elif [ "$OSTYPE" == "msys" ]; then
PLATFORM='windows'
fi
PACKAGE_NAME="SourcetrailPythonIndexer_${SOURCETRAIL_PYTHON_INDEXER_VERSION}-${PLATFORM}"
PACKAGE_FILE_NAME="${PACKAGE_NAME}.zip"
PACKAGE_URL="https://github.com/CoatiSoftware/SourcetrailPythonIndexer/releases/download/${SOURCETRAIL_PYTHON_INDEXER_VERSION}/${PACKAGE_FILE_NAME}"
TEMP_PATH="build/temp"
TARGET_PATH="bin/app/data/python"
ABORT="\033[31mAbort:\033[00m"
SUCCESS="\033[32mSuccess:\033[00m"
INFO="\033[33mInfo:\033[00m"
if [ $PLATFORM == "windows" ]; then
SCRIPT=`realpath $0`
if [ "$SCRIPT" == "" ]; then
ORIGINAL_PATH_TO_SCRIPT="${0}"
CLEANED_PATH_TO_SCRIPT="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
SCRIPT_DIR=${CLEANED_PATH_TO_SCRIPT%/*}
else
ORIGINAL_PATH_TO_SCRIPT=`dirname $SCRIPT`
SCRIPT_DIR="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
fi
else
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
fi
echo "This script is running in: $SCRIPT_DIR"
# Enter main directory
cd $SCRIPT_DIR/
cd ..
BINARY_PATH="$TARGET_PATH/SourcetrailPythonIndexer"
if [ $PLATFORM == "windows" ]; then
BINARY_PATH="${BINARY_PATH}.exe"
fi
if [ -e "${BINARY_PATH}" ]; then
echo -e $INFO "SourcetrailPythonIndexer already exists, checking version..."
INSTALLED_VERSION="$(${BINARY_PATH} --version)"
INSTALLED_VERSION=${INSTALLED_VERSION#* }
INSTALLED_VERSION="${INSTALLED_VERSION//./$'_'}"
if [ "$INSTALLED_VERSION" == "$SOURCETRAIL_PYTHON_INDEXER_VERSION" ]; then
echo -e $INFO "Nothing to update. Target version of SourcetrailPythonIndexer is already installed."
exit
fi
fi
mkdir -p $TEMP_PATH
echo -e $INFO "starting to download $PACKAGE_FILE_NAME"
if [ $PLATFORM == "linux" ]; then
wget -O $TEMP_PATH/$PACKAGE_FILE_NAME $PACKAGE_URL
elif [ $PLATFORM == "osx" ]; then
wget -O $TEMP_PATH/$PACKAGE_FILE_NAME $PACKAGE_URL
elif [ $PLATFORM == "windows" ]; then
certutil.exe -urlcache -split -f $PACKAGE_URL $TEMP_PATH/$PACKAGE_FILE_NAME
fi
echo -e $INFO "finished downloading $PACKAGE_FILE_NAME"
if [ $PLATFORM == "linux" ]; then
unzip -d $TEMP_PATH $TEMP_PATH/$PACKAGE_FILE_NAME
elif [ $PLATFORM == "osx" ]; then
unzip -d $TEMP_PATH $TEMP_PATH/$PACKAGE_FILE_NAME
elif [ $PLATFORM == "windows" ]; then
7z x $TEMP_PATH/$PACKAGE_FILE_NAME -o$TEMP_PATH
fi
echo -e $INFO "clearing $TARGET_PATH"
rm -rf $TARGET_PATH
mkdir -p $TARGET_PATH
cp -r $TEMP_PATH/$PACKAGE_NAME/* $TARGET_PATH
echo -e $INFO "clearing temporary data at $TEMP_PATH"
rm -rf $TEMP_PATH
+70
View File
@@ -0,0 +1,70 @@
#!/bin/bash
# Determine current platform
PLATFORM='unknown'
if [ "$(uname)" == "Darwin" ]; then
PLATFORM='osx'
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
PLATFORM='linux'
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
PLATFORM='windows'
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
PLATFORM='windows'
elif [ "$OSTYPE" == "msys" ]; then
PLATFORM='windows'
fi
INPUT_DIR="submodules/SourcetrailPythonIndexer"
OUTPUT_DIR="bin/app/data/python/indexer"
ABORT="\033[31mAbort:\033[00m"
SUCCESS="\033[32mSuccess:\033[00m"
INFO="\033[33mInfo:\033[00m"
if [ $PLATFORM == "windows" ]; then
SCRIPT=`realpath $0`
if [ "$SCRIPT" == "" ]; then
ORIGINAL_PATH_TO_SCRIPT="${0}"
CLEANED_PATH_TO_SCRIPT="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
SCRIPT_DIR=${CLEANED_PATH_TO_SCRIPT%/*}
else
ORIGINAL_PATH_TO_SCRIPT=`dirname $SCRIPT`
SCRIPT_DIR="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
fi
else
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
fi
echo "This script is running in: $SCRIPT_DIR"
# Enter main directory
cd $SCRIPT_DIR/
cd ..
echo "create $OUTPUT_DIR"
if [ $PLATFORM == "windows" ]; then
mkdir "$OUTPUT_DIR"
dir
mkdir bin
cd bin
mkdir app
cd app
mkdir data
cd data
mkdir python
cd python
dir
mkdir indexer
cd ../../../../
else
mkdir -p $OUTPUT_DIR
fi
echo "Copy python indexer files to $OUTPUT_DIR"
cp $INPUT_DIR/_version.py $OUTPUT_DIR
cp $INPUT_DIR/run.py $OUTPUT_DIR
cp $INPUT_DIR/indexer.py $OUTPUT_DIR
cp $INPUT_DIR/shallow_indexer.py $OUTPUT_DIR
echo "Done updating Python indexer"
+12 -2
View File
@@ -37,12 +37,22 @@ FilePath ResourcePaths::getJavaPath()
return AppPath::getSharedDataPath().concatenate(L"data/java/");
}
FilePath ResourcePaths::getPythonPath()
FilePath ResourcePaths::getPythonEnvironmentFilePath()
{
return AppPath::getSharedDataPath().concatenate(L"data/python/");
return ResourcePaths::getPythonPath().concatenate(L"environment/Scripts/python");
}
FilePath ResourcePaths::getPythonIndexerFilePath()
{
return ResourcePaths::getPythonPath().concatenate(L"indexer/run.py");
}
FilePath ResourcePaths::getCxxCompilerHeaderPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/cxx/include/").getCanonical();
}
FilePath ResourcePaths::getPythonPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/python/");
}
+5 -1
View File
@@ -15,8 +15,12 @@ public:
static FilePath getGuiPath();
static FilePath getLicensePath();
static FilePath getJavaPath();
static FilePath getPythonPath();
static FilePath getPythonEnvironmentFilePath();
static FilePath getPythonIndexerFilePath();
static FilePath getCxxCompilerHeaderPath();
private:
static FilePath getPythonPath();
};
#endif // RESOURCE_PATHS_H
+37 -16
View File
@@ -11,7 +11,8 @@ IndexerCommandType IndexerCommandCustom::getStaticIndexerCommandType()
}
IndexerCommandCustom::IndexerCommandCustom(
const std::wstring& customCommand,
const std::wstring& command,
const std::vector<std::wstring>& arguments,
const FilePath& projectFilePath,
const FilePath& databaseFilePath,
const std::wstring& databaseVersion,
@@ -19,7 +20,8 @@ IndexerCommandCustom::IndexerCommandCustom(
bool runInParallel)
: IndexerCommand(sourceFilePath)
, m_type(getStaticIndexerCommandType())
, m_customCommand(customCommand)
, m_command(command)
, m_arguments(arguments)
, m_projectFilePath(projectFilePath)
, m_databaseFilePath(databaseFilePath)
, m_databaseVersion(databaseVersion)
@@ -29,7 +31,8 @@ IndexerCommandCustom::IndexerCommandCustom(
IndexerCommandCustom::IndexerCommandCustom(
IndexerCommandType type,
const std::wstring& customCommand,
const std::wstring& command,
const std::vector<std::wstring>& arguments,
const FilePath& projectFilePath,
const FilePath& databaseFilePath,
const std::wstring& databaseVersion,
@@ -37,7 +40,8 @@ IndexerCommandCustom::IndexerCommandCustom(
bool runInParallel)
: IndexerCommand(sourceFilePath)
, m_type(type)
, m_customCommand(customCommand)
, m_command(command)
, m_arguments(arguments)
, m_projectFilePath(projectFilePath)
, m_databaseFilePath(databaseFilePath)
, m_databaseVersion(databaseVersion)
@@ -67,19 +71,19 @@ void IndexerCommandCustom::setDatabaseFilePath(const FilePath& databaseFilePath)
m_databaseFilePath = databaseFilePath;
}
std::wstring IndexerCommandCustom::getCustomCommand() const
std::wstring IndexerCommandCustom::getCommand() const
{
std::wstring command = m_customCommand;
return replaceVariables(m_command);
}
command = utility::replace(
command, L"%{PROJECT_FILE_PATH}", L'\"' + m_projectFilePath.wstr() + L'\"');
command = utility::replace(
command, L"%{DATABASE_FILE_PATH}", L'\"' + m_databaseFilePath.wstr() + L'\"');
command = utility::replace(command, L"%{DATABASE_VERSION}", L'\"' + m_databaseVersion + L'\"');
command = utility::replace(
command, L"%{SOURCE_FILE_PATH}", L'\"' + getSourceFilePath().wstr() + L'\"');
return command;
std::vector<std::wstring> IndexerCommandCustom::getArguments() const
{
std::vector<std::wstring> args;
for (const std::wstring& argument: m_arguments)
{
args.push_back(replaceVariables(argument));
}
return args;
}
bool IndexerCommandCustom::getRunInParallel() const
@@ -92,7 +96,15 @@ QJsonObject IndexerCommandCustom::doSerialize() const
QJsonObject jsonObject = IndexerCommand::doSerialize();
{
jsonObject["custom_command"] = QString::fromStdWString(m_customCommand);
jsonObject["command"] = QString::fromStdWString(m_command);
}
{
QJsonArray argumentsArray;
for (const std::wstring& argument: m_arguments)
{
argumentsArray.append(QString::fromStdWString(argument));
}
jsonObject["arguments"] = argumentsArray;
}
{
jsonObject["run_in_parallel"] = m_runInParallel;
@@ -100,3 +112,12 @@ QJsonObject IndexerCommandCustom::doSerialize() const
return jsonObject;
}
std::wstring IndexerCommandCustom::replaceVariables(std::wstring s) const
{
s = utility::replace(s, L"%{PROJECT_FILE_PATH}", m_projectFilePath.wstr());
s = utility::replace(s, L"%{DATABASE_FILE_PATH}", m_databaseFilePath.wstr());
s = utility::replace(s, L"%{DATABASE_VERSION}", m_databaseVersion);
s = utility::replace(s, L"%{SOURCE_FILE_PATH}", getSourceFilePath().wstr());
return s;
}
+10 -4
View File
@@ -12,7 +12,8 @@ public:
static IndexerCommandType getStaticIndexerCommandType();
IndexerCommandCustom(
const std::wstring& customCommand,
const std::wstring& command,
const std::vector<std::wstring>& arguments,
const FilePath& projectFilePath,
const FilePath& databaseFilePath,
const std::wstring& databaseVersion,
@@ -21,7 +22,8 @@ public:
IndexerCommandCustom(
IndexerCommandType type,
const std::wstring& customCommand,
const std::wstring& command,
const std::vector<std::wstring>& arguments,
const FilePath& projectFilePath,
const FilePath& databaseFilePath,
const std::wstring& databaseVersion,
@@ -34,15 +36,19 @@ public:
FilePath getDatabaseFilePath() const;
void setDatabaseFilePath(const FilePath& databaseFilePath);
std::wstring getCustomCommand() const;
std::wstring getCommand() const;
std::vector<std::wstring> getArguments() const;
bool getRunInParallel() const;
protected:
QJsonObject doSerialize() const override;
private:
std::wstring replaceVariables(std::wstring s) const;
IndexerCommandType m_type;
std::wstring m_customCommand;
std::wstring m_command;
std::vector<std::wstring> m_arguments;
FilePath m_projectFilePath;
FilePath m_databaseFilePath;
std::wstring m_databaseVersion;
@@ -465,9 +465,12 @@ void TaskExecuteCustomCommands::runIndexerCommand(
indexedSourceFileCount + 1, indexedSourceFileCount, m_indexerCommandCount, {sourcePath});
MessageIndexingStatus(true, indexedSourceFileCount * 100 / m_indexerCommandCount).dispatch();
const std::wstring command = indexerCommand->getCustomCommand();
const std::wstring command = indexerCommand->getCommand();
const std::vector<std::wstring> arguments = indexerCommand->getArguments();
LOG_INFO("Start processing command \"" + utility::encodeToUtf8(command) + "\"");
LOG_INFO(
"Start processing command \"" +
utility::encodeToUtf8(command + L" " + utility::join(arguments, L" ")) + "\"");
const ErrorCountInfo previousErrorCount = storage ? storage->getErrorCount()
: ErrorCountInfo();
@@ -475,7 +478,7 @@ void TaskExecuteCustomCommands::runIndexerCommand(
LOG_INFO("Starting to index");
std::wstring errorMessage;
const int result = utility::executeProcessAndGetExitCode(
command, {}, m_projectDirectory, -1, true, &errorMessage);
command, arguments, m_projectDirectory, -1, true, &errorMessage);
LOG_INFO("Finished indexing");
if (storage)
@@ -508,8 +511,9 @@ void TaskExecuteCustomCommands::runIndexerCommand(
}
else
{
std::wstring statusText = L"command \"" + indexerCommand->getCustomCommand() +
L"\" returned";
std::wstring statusText = L"command \"" + indexerCommand->getCommand() + L" " +
utility::join(arguments, L" ") + L"\" returned";
if (result != 0)
{
statusText += L" code \"" + std::to_wstring(result) + L"\"";
+63 -2
View File
@@ -42,7 +42,67 @@ std::set<FilePath> SourceGroupCustomCommand::getAllSourceFilePaths() const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCustomCommand::getIndexerCommands(
const RefreshInfo& info) const
{
const std::wstring customCommand = m_settings->getCustomCommand();
std::vector<std::wstring> parts;
{
const std::wstring customCommand = m_settings->getCustomCommand();
std::wstring tmp;
int quoteCount = 0;
bool inQuote = false;
// handle quoting. tokens can be surrounded by double quotes
// "hello world". three consecutive double quotes represent
// the quote character itself.
for (int i = 0; i < customCommand.size(); ++i)
{
if (customCommand.at(i) == L'"')
{
++quoteCount;
if (quoteCount == 3) // third consecutive quote
{
quoteCount = 0;
tmp += customCommand.at(i);
}
continue;
}
if (quoteCount)
{
if (quoteCount == 1)
{
inQuote = !inQuote;
}
quoteCount = 0;
}
if (!inQuote && customCommand.at(i) == L' ')
{
if (!tmp.empty())
{
parts.push_back(tmp);
tmp.clear();
}
}
else
{
tmp += customCommand.at(i);
}
}
if (!tmp.empty())
{
parts.push_back(tmp);
}
}
if (parts.empty())
{
return {};
}
const std::wstring command = parts.front();
std::vector<std::wstring> args;
for (size_t i = 1; i < parts.size(); i++)
{
args.push_back(parts[i]);
}
const bool runInParallel = m_settings->getRunInParallel();
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
@@ -51,7 +111,8 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCustomCommand::getIndexe
if (info.filesToIndex.find(sourcePath) != info.filesToIndex.end())
{
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
customCommand,
command,
args,
m_settings->getProjectSettings()->getProjectFilePath(),
m_settings->getProjectSettings()->getTempDBFilePath(),
std::to_wstring(SqliteIndexStorage::getStorageVersion()),
@@ -25,8 +25,9 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
std::string pythonIndexerVersion = " ";
{
std::string str = utility::executeProcess(
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"),
std::vector<std::wstring>{L"--version"},
ResourcePaths::getPythonEnvironmentFilePath().wstr(),
std::vector<std::wstring> {
ResourcePaths::getPythonIndexerFilePath().wstr(), L"--version"},
FilePath(),
5000)
.second;
@@ -63,13 +63,14 @@ void QtProjectWizardContentPathPythonEnvironment::onTextChanged(const QString& t
m_resultLabel->setText("Checking validity of Python environment...");
std::thread([=]() {
std::pair<int, std::string> out = utility::executeProcess(
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"),
std::vector<std::wstring>{
L"check-environment",
L"--environment-path " + utility::getExpandedAndAbsolutePath(
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath())
.wstr()
},
ResourcePaths::getPythonEnvironmentFilePath().wstr(),
std::vector<std::wstring> {
ResourcePaths::getPythonIndexerFilePath().wstr(),
L"check-environment",
L"--environment-path " +
utility::getExpandedAndAbsolutePath(
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath())
.wstr()},
FilePath(),
5000);
m_onQtThread([=]() {
@@ -20,10 +20,12 @@ std::vector<FilePath> CxxVs15HeaderPathDetector::doGetPaths() const
.expandEnvironmentVariables();
if (!expandedPaths.empty())
{
const std::string output =
utility::executeProcess(
expandedPaths[0].wstr(), std::vector<std::wstring> {L"-latest", L"-property installationPath"}, FilePath(), 10000)
.second;
const std::string output = utility::executeProcess(
expandedPaths[0].wstr(),
{L"-latest", L"-property installationPath"},
FilePath(),
10000)
.second;
const FilePath vsInstallPath(output);
if (vsInstallPath.exists())
@@ -14,7 +14,7 @@ std::vector<std::string> getCxxHeaderPaths(const std::string& compilerName)
std::string command = compilerName + " -x c++ -v -E /dev/null";
std::string clangOutput = utility::executeProcess(
utility::decodeFromUtf8(compilerName),
std::vector<std::wstring> {L"-x c++", L"-v", L"-E /dev/null"})
{L"-x c++", L"-v", L"-E /dev/null"})
.second;
std::string standardHeaders = utility::substrBetween<std::string>(
clangOutput, "#include <...> search starts here:\n", "\nEnd of search list");
@@ -54,7 +54,7 @@ std::vector<FilePath> JavaPathDetectorLinux::doGetPaths() const
FilePath JavaPathDetectorLinux::getJavaInPath() const
{
std::string output = utility::executeProcess(L"which", std::vector<std::wstring>{L"java"}).second;
std::string output = utility::executeProcess(L"which", {L"java"}).second;
if (!output.empty())
{
@@ -72,7 +72,7 @@ FilePath JavaPathDetectorLinux::getJavaInPath() const
FilePath JavaPathDetectorLinux::readLink(const FilePath& path) const
{
FilePath javaPath(utility::executeProcess(L"readlink", std::vector<std::wstring>{L"-f " + path.wstr()}).second);
FilePath javaPath(utility::executeProcess(L"readlink", {L"-f " + path.wstr()}).second);
if (!javaPath.empty())
{
return javaPath;
@@ -113,7 +113,7 @@ FilePath JavaPathDetectorLinux::getJavaInJavaHome() const
bool JavaPathDetectorLinux::checkVersion(const FilePath& path) const
{
std::string output = utility::executeProcess(path.wstr(), std::vector<std::wstring>{L"-version"}).second;
std::string output = utility::executeProcess(path.wstr(), {L"-version"}).second;
return output.find(m_javaVersion) != std::string::npos;
}
@@ -14,7 +14,7 @@ std::vector<FilePath> JavaPathDetectorMac::doGetPaths() const
std::vector<FilePath> paths;
FilePath javaPath;
std::string output = utility::executeProcess(L"/usr/libexec/java_home", std::vector<std::wstring>{}).second;
const std::string output = utility::executeProcess(L"/usr/libexec/java_home", {}).second;
if (!output.empty())
{
@@ -7,7 +7,7 @@ MavenPathDetectorUnix::MavenPathDetectorUnix(): PathDetector("Maven for Unix") {
std::vector<FilePath> MavenPathDetectorUnix::doGetPaths() const
{
FilePath mavenPath(utility::executeProcess(L"which", std::vector<std::wstring>{L"mvn"}).second);
FilePath mavenPath(utility::executeProcess(L"which", {L"mvn"}).second);
std::vector<FilePath> paths;
if (mavenPath.exists())
@@ -7,9 +7,7 @@ MavenPathDetectorWindows::MavenPathDetectorWindows(): PathDetector("Maven for Wi
std::vector<FilePath> MavenPathDetectorWindows::doGetPaths() const
{
FilePath mavenPath(
utility::executeProcess(L"cmd", std::vector<std::wstring> {L"\"/c where mvn.cmd && exit\""})
.second);
FilePath mavenPath(utility::executeProcess(L"cmd", {L"\"/c where mvn.cmd && exit\""}).second);
std::vector<FilePath> paths;
if (mavenPath.exists())
+13 -2
View File
@@ -208,13 +208,24 @@ int utility::executeProcessAndGetExitCode(
*errorMessage = L"An unknown error occurred while executing process.";
break;
}
};
}
});
QObject::connect(
&process,
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
[&finished](int exitCode, QProcess::ExitStatus exitStatus) { finished = true; });
[&finished, errorMessage](int exitCode, QProcess::ExitStatus exitStatus) {
finished = true;
if (errorMessage != nullptr)
{
switch (exitStatus)
{
case QProcess::CrashExit:
*errorMessage = L"Process crashed.";
break;
}
}
});
if (!workingDirectory.empty())
@@ -49,25 +49,27 @@ std::set<FilePath> SourceGroupPythonEmpty::getAllSourceFilePaths() const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerCommands(
const RefreshInfo& info) const
{
std::wstring args = L"";
std::vector<std::wstring> args;
args.push_back(L"index");
args += L" --source-file-path=%{SOURCE_FILE_PATH}";
args += L" --database-file-path=%{DATABASE_FILE_PATH}";
args.push_back(L"--source-file-path=%{SOURCE_FILE_PATH}");
args.push_back(L"--database-file-path=%{DATABASE_FILE_PATH}");
if (!m_settings->getEnvironmentPath().empty())
{
args += L" --environment-path=\"" +
m_settings->getEnvironmentPathExpandedAndAbsolute().wstr() + L"\"";
args.push_back(
L"--environment-path=\"" + m_settings->getEnvironmentPathExpandedAndAbsolute().wstr() +
L"\"");
}
if (ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled())
{
args += L" --verbose";
args.push_back(L"--verbose");
}
if (info.shallow)
{
args += L" --shallow";
args.push_back(L"--shallow");
}
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
@@ -77,8 +79,9 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerC
{
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
INDEXER_COMMAND_PYTHON,
L"\"" + ResourcePaths::getPythonPath().wstr() +
L"SourcetrailPythonIndexer\" index" + args,
L"\"" + ResourcePaths::getPythonEnvironmentFilePath().wstr() + L"\" \"" +
ResourcePaths::getPythonIndexerFilePath().wstr() + L"\"",
args,
m_settings->getProjectSettings()->getProjectFilePath(),
m_settings->getProjectSettings()->getTempDBFilePath(),
std::to_wstring(SqliteIndexStorage::getStorageVersion()),
+22 -9
View File
@@ -56,16 +56,24 @@ std::shared_ptr<TestStorage> parseCode(std::string code)
const std::set<FilePathFilter> includeFilters;
const FilePath workingDirectory(L".");
std::wstring args = L"";
args += L" --source-file-path=%{SOURCE_FILE_PATH}";
args += L" --database-file-path=%{DATABASE_FILE_PATH}";
args += L" --shallow";
std::vector<std::wstring> args;
args.push_back(FilePath("../app")
.getConcatenated(ResourcePaths::getPythonIndexerFilePath())
.makeAbsolute()
.wstr());
args.push_back(L"index");
args.push_back(L"--source-file-path=%{SOURCE_FILE_PATH}");
args.push_back(L"--database-file-path=%{DATABASE_FILE_PATH}");
args.push_back(L"--shallow");
std::shared_ptr<IndexerCommandCustom> indexerCommand = std::make_shared<IndexerCommandCustom>(
INDEXER_COMMAND_PYTHON,
L"\"" +
FilePath("../app").getConcatenated(ResourcePaths::getPythonPath()).makeAbsolute().wstr() +
L"SourcetrailPythonIndexer\" index" + args,
FilePath("../app")
.getConcatenated(ResourcePaths::getPythonEnvironmentFilePath())
.makeAbsolute()
.wstr(),
args,
rootPath,
tempDbPath,
std::to_wstring(SqliteIndexStorage::getStorageVersion()),
@@ -74,10 +82,15 @@ std::shared_ptr<TestStorage> parseCode(std::string code)
std::wstring errorMessage;
const int result = utility::executeProcessAndGetExitCode(
indexerCommand->getCustomCommand(), {}, rootPath, -1, true, &errorMessage);
indexerCommand->getCommand(),
indexerCommand->getArguments(),
rootPath,
-1,
true,
&errorMessage);
REQUIRE(result == 0);
REQUIRE(errorMessage.empty());
REQUIRE(result == 0);
}
std::shared_ptr<TestStorage> testStorage;
+8 -2
View File
@@ -148,9 +148,15 @@ std::wstring indexerCommandCustomToString(
std::shared_ptr<const IndexerCommandCustom> indexerCommand, const FilePath& baseDirectory)
{
std::wstring result;
result += L"SourceFilePath: \"" +
result += L"IndexerCommandCustom\n";
result += L"\tSourceFilePath: \"" +
indexerCommand->getSourceFilePath().getRelativeTo(baseDirectory).wstr() + L"\"\n";
result += L"\tCustom Command: \"" + indexerCommand->getCustomCommand() + L"\"\n";
result += L"\tCustom Command: \"" + indexerCommand->getCommand() + L"\"\n";
result += L"\tArguments:\n";
for (const std::wstring& argument: indexerCommand->getArguments())
{
result += L"\t\t\"" + argument + L"\"\n";
}
return result;
}
+11
View File
@@ -43,7 +43,18 @@ struct EventListener: Catch::TestEventListenerBase
if (!paths.empty())
{
ApplicationSettings::getInstance()->setJavaPath(paths.front());
std::cout << "Java path written to settings: "
<< ApplicationSettings::getInstance()->getJavaPath().str() << std::endl;
}
else
{
std::cout << "no Java" << std::endl;
}
}
else
{
std::cout << "Java path read form settings: "
<< ApplicationSettings::getInstance()->getJavaPath().str() << std::endl;
}
#endif
}