logic: Added "Empty Python" Sourcegroup to project setup
The respective release of the SourcetrailPythonIndexer project is automatically downloaded from GitHub when the setup script is executed.
This commit is contained in:
+2
-1
@@ -2,8 +2,9 @@
|
||||
/distr/
|
||||
/deps/
|
||||
|
||||
/bin/app/data/projects/ignored/
|
||||
/bin/app/data/java/lib/
|
||||
/bin/app/data/projects/ignored/
|
||||
/bin/app/data/python/
|
||||
/bin/app/user/log/
|
||||
/bin/app/user/ApplicationSettings.xml
|
||||
/bin/app/user/window_settings.ini
|
||||
|
||||
+46
-2
@@ -38,6 +38,7 @@ set(LIB_UTILITY_PROJECT_NAME "${PROJECT_NAME}_lib_utility")
|
||||
set(LIB_GUI_PROJECT_NAME "${PROJECT_NAME}_lib_gui")
|
||||
set(LIB_CXX_PROJECT_NAME "${PROJECT_NAME}_lib_cxx")
|
||||
set(LIB_JAVA_PROJECT_NAME "${PROJECT_NAME}_lib_java")
|
||||
set(LIB_PYTHON_PROJECT_NAME "${PROJECT_NAME}_lib_python")
|
||||
set(LIB_PROJECT_NAME "${PROJECT_NAME}_lib")
|
||||
set(LICENSE_GENERATOR_PROJECT_NAME "${PROJECT_NAME}_license_generator")
|
||||
set(TEST_PROJECT_NAME "${PROJECT_NAME}_test")
|
||||
@@ -241,6 +242,7 @@ add_subdirectory(src/lib)
|
||||
add_subdirectory(src/lib_cxx)
|
||||
add_subdirectory(src/lib_gui)
|
||||
add_subdirectory(src/lib_java)
|
||||
add_subdirectory(src/lib_python)
|
||||
add_subdirectory(src/lib_license)
|
||||
add_subdirectory(src/lib_utility)
|
||||
add_subdirectory(src/license_generator)
|
||||
@@ -406,6 +408,30 @@ add_custom_command(
|
||||
)
|
||||
|
||||
|
||||
# Lib Python ---------------------------------------------------------------------
|
||||
|
||||
add_library(${LIB_PYTHON_PROJECT_NAME} ${LIB_PYTHON_FILES})
|
||||
|
||||
create_source_groups(${LIB_PYTHON_FILES})
|
||||
|
||||
set_property(
|
||||
TARGET ${LIB_PYTHON_PROJECT_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${LIB_PYTHON_INCLUDE_PATHS}"
|
||||
"${LIB_UTILITY_INCLUDE_PATHS}"
|
||||
"${LIB_INCLUDE_PATHS}"
|
||||
# "${LIB_GUI_INCLUDE_PATHS}"
|
||||
)
|
||||
|
||||
#target_include_directories(${LIB_PYTHON_PROJECT_NAME} SYSTEM
|
||||
# PUBLIC ${Boost_INCLUDE_DIRS}
|
||||
#)
|
||||
|
||||
#link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
||||
target_link_libraries(${LIB_PYTHON_PROJECT_NAME} ${LIB_UTILITY_PROJECT_NAME} ${LIB_PROJECT_NAME})
|
||||
|
||||
|
||||
# Lib Gui ----------------------------------------------------------------------
|
||||
|
||||
# Find includes in corresponding build directories
|
||||
@@ -449,6 +475,7 @@ set_property(
|
||||
"${LIB_INCLUDE_PATHS}"
|
||||
"${LIB_CXX_INCLUDE_PATHS}"
|
||||
"${LIB_JAVA_INCLUDE_PATHS}"
|
||||
"${LIB_PYTHON_INCLUDE_PATHS}" # required for QtProjectWizzardContentPathsSource::getFilePaths()
|
||||
"${LIB_LICENSE_INCLUDE_PATHS}"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_gui"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_license"
|
||||
@@ -510,7 +537,14 @@ endif ()
|
||||
|
||||
create_source_groups(${INDEXER_FILES})
|
||||
|
||||
target_link_libraries(${APP_INDEXER_NAME} ${LIB_GUI_PROJECT_NAME} ${LIB_CXX_PROJECT_NAME} ${LIB_JAVA_PROJECT_NAME} ${LIB_PROJECT_NAME})
|
||||
target_link_libraries(
|
||||
${APP_INDEXER_NAME}
|
||||
${LIB_PROJECT_NAME}
|
||||
${LIB_GUI_PROJECT_NAME}
|
||||
${LIB_CXX_PROJECT_NAME}
|
||||
${LIB_JAVA_PROJECT_NAME}
|
||||
${LIB_PYTHON_PROJECT_NAME}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
find_library(CORE_FOUNDATION CoreFoundation)
|
||||
@@ -527,6 +561,7 @@ set_property(
|
||||
"${LIB_LICENSE_INCLUDE_PATHS}"
|
||||
"${LIB_CXX_INCLUDE_PATHS}"
|
||||
"${LIB_JAVA_INCLUDE_PATHS}"
|
||||
"${LIB_PYTHON_INCLUDE_PATHS}"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_gui"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_license"
|
||||
)
|
||||
@@ -571,7 +606,15 @@ endif ()
|
||||
|
||||
create_source_groups(${APP_FILES})
|
||||
|
||||
target_link_libraries(${APP_PROJECT_NAME} ${LIB_GUI_PROJECT_NAME} ${LIB_CXX_PROJECT_NAME} ${LIB_JAVA_PROJECT_NAME} ${LIB_PROJECT_NAME} ${LIB_LICENSE_PROJECT_NAME})
|
||||
target_link_libraries(
|
||||
${APP_PROJECT_NAME}
|
||||
${LIB_PROJECT_NAME}
|
||||
${LIB_GUI_PROJECT_NAME}
|
||||
${LIB_LICENSE_PROJECT_NAME}
|
||||
${LIB_CXX_PROJECT_NAME}
|
||||
${LIB_JAVA_PROJECT_NAME}
|
||||
${LIB_PYTHON_PROJECT_NAME}
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET ${APP_PROJECT_NAME}
|
||||
@@ -583,6 +626,7 @@ set_property(
|
||||
"${LIB_LICENSE_INCLUDE_PATHS}"
|
||||
"${LIB_CXX_INCLUDE_PATHS}"
|
||||
"${LIB_JAVA_INCLUDE_PATHS}"
|
||||
"${LIB_PYTHON_INCLUDE_PATHS}"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_gui"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_license"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ yum -y install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils \
|
||||
gperftools gperf libicu-devel boost-devel \
|
||||
libxslt-devel docbook-style-xsl.noarch python27 \
|
||||
xz mesa-libEGL-devel mesa-libGL-devel glib-devel \
|
||||
java-1.8.0-openjdk-devel ccache re2c ImageMagick vim lftp && \
|
||||
java-1.8.0-openjdk-devel ccache re2c ImageMagick vim lftp unzip && \
|
||||
yum clean all
|
||||
|
||||
# CMake and Maven
|
||||
|
||||
@@ -15,7 +15,7 @@ yum -y install wget devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils
|
||||
gperftools.x86_64 gperf.x86_64 libicu-devel.x86_64 boost-devel.x86_64 \
|
||||
libxslt-devel.x86_64 python27.x86_64 \
|
||||
xz mesa-libEGL-devel mesa-libGL-devel glib-devel git19 \
|
||||
java-1.8.0-openjdk-devel re2c ccache ImageMagick vim lftp && \
|
||||
java-1.8.0-openjdk-devel re2c ccache ImageMagick vim lftp unzip && \
|
||||
yum clean all
|
||||
|
||||
# CMake
|
||||
|
||||
@@ -54,23 +54,22 @@ DATA_COLOR_SCHEMES_DIR=$ROOT_DIR/bin/app/data/color_schemes
|
||||
DATA_CXX_DIR=$ROOT_DIR/bin/app/data/cxx
|
||||
DATA_FALLBACK_DIR=$ROOT_DIR/bin/app/data/fallback
|
||||
DATA_FONTS_DIR=$ROOT_DIR/bin/app/data/fonts
|
||||
|
||||
DATA_GUI_DIR=$ROOT_DIR/bin/app/data/gui
|
||||
DATA_JAVA_DIR=$ROOT_DIR/bin/app/data/java
|
||||
DATA_PYTHON_DIR=$ROOT_DIR/bin/app/data/python
|
||||
DATA_SYNTAX_HIGHLIGHTING_RULES_DIR=$ROOT_DIR/bin/app/data/syntax_highlighting_rules
|
||||
|
||||
|
||||
heat.exe dir $DATA_COLOR_SCHEMES_DIR -cg DataColorSchemesComponentGroup -var var.DataColorSchemesSourceDir -out build/dataColorSchemes.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
heat.exe dir $DATA_CXX_DIR -cg DataCxxComponentGroup -var var.DataCxxSourceDir -out build/dataCxx.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
heat.exe dir $DATA_FALLBACK_DIR -cg DataFallbackComponentGroup -var var.DataFallbackSourceDir -out build/dataFallback.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
heat.exe dir $DATA_FONTS_DIR -cg DataFontsComponentGroup -var var.DataFontsSourceDir -out build/dataFonts.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
|
||||
|
||||
heat.exe dir $DATA_GUI_DIR -cg DataGuiComponentGroup -var var.DataGuiSourceDir -out build/dataGui.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
heat.exe dir $DATA_JAVA_DIR -cg DataJavaComponentGroup -var var.DataJavaSourceDir -out build/dataJava.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
heat.exe dir $DATA_PYTHON_DIR -cg DataPythonComponentGroup -var var.DataPythonSourceDir -out build/dataPython.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
heat.exe dir $DATA_SYNTAX_HIGHLIGHTING_RULES_DIR -cg DataSyntaxHighlightingRulesComponentGroup -var var.DataSyntaxHighlightingRulesSourceDir -out build/dataSyntaxHighlightingRules.wxs -gg -sfrag -g1 -dr LieutenantCommanderData -t $SCRIPT_DIR/HeatTransform.xslt
|
||||
|
||||
|
||||
|
||||
candle.exe -dProductVersion="$VERSION_STRING" -dProductGuid="$PRODUCT_GUID" -dWin64="$WIN_64" -arch $X_ARCH -out build/ \
|
||||
-dSampleJavaparserSourceDir="$SAMPLE_JAVAPARSER_DIR" build/sampleJavaparser.wxs \
|
||||
-dSampleTictactoeSourceDir="$SAMPLE_TICTACTOE_DIR" build/sampleTictactoe.wxs \
|
||||
@@ -81,6 +80,7 @@ candle.exe -dProductVersion="$VERSION_STRING" -dProductGuid="$PRODUCT_GUID" -dWi
|
||||
-dDataFontsSourceDir="$DATA_FONTS_DIR" build/dataFonts.wxs \
|
||||
-dDataGuiSourceDir="$DATA_GUI_DIR" build/dataGui.wxs \
|
||||
-dDataJavaSourceDir="$DATA_JAVA_DIR" build/dataJava.wxs \
|
||||
-dDataPythonSourceDir="$DATA_PYTHON_DIR" build/dataPython.wxs \
|
||||
-dDataSyntaxHighlightingRulesSourceDir="$DATA_SYNTAX_HIGHLIGHTING_RULES_DIR" build/dataSyntaxHighlightingRules.wxs \
|
||||
sourcetrail.wxs customActions.wxs dialogShortcuts.wxs installDir.wxs appDataDir.wxs \
|
||||
> build/compileLog.txt
|
||||
@@ -96,6 +96,7 @@ light.exe -ext WixUIExtension \
|
||||
build/dataFonts.wixobj \
|
||||
build/dataGui.wixobj \
|
||||
build/dataJava.wixobj \
|
||||
build/dataPython.wixobj \
|
||||
build/dataSyntaxHighlightingRules.wixobj \
|
||||
build/sourcetrail.wixobj build/customActions.wixobj build/dialogShortcuts.wixobj build/installDir.wixobj build/appDataDir.wixobj -out build/sourcetrail.msi \
|
||||
> build/linkLog.txt
|
||||
|
||||
@@ -254,9 +254,9 @@
|
||||
<ComponentGroupRef Id='DataCxxComponentGroup' Primary="yes"/>
|
||||
<ComponentGroupRef Id='DataFallbackComponentGroup' Primary="yes"/>
|
||||
<ComponentGroupRef Id='DataFontsComponentGroup' Primary="yes"/>
|
||||
|
||||
<ComponentGroupRef Id='DataGuiComponentGroup' Primary="yes"/>
|
||||
<ComponentGroupRef Id='DataJavaComponentGroup' Primary="yes"/>
|
||||
<ComponentGroupRef Id='DataPythonComponentGroup' Primary="yes"/>
|
||||
<ComponentGroupRef Id='DataSyntaxHighlightingRulesComponentGroup' Primary="yes"/>
|
||||
|
||||
<ComponentRef Id='UninstallBat'/>
|
||||
|
||||
+2
-1
@@ -24,7 +24,7 @@ fi
|
||||
|
||||
ROOT_DIR=$ROOT_DIR/..
|
||||
|
||||
# Enter masterproject directory
|
||||
# Enter sourcetrail root directory
|
||||
cd $ROOT_DIR/
|
||||
|
||||
if [ $PLATFORM == "Windows" ]; then
|
||||
@@ -41,6 +41,7 @@ if [ $PLATFORM == "Windows" ]; then
|
||||
fi
|
||||
|
||||
# Remove folders and contents
|
||||
rm -rf bin/app/data/python
|
||||
rm -rf java_indexer/bin
|
||||
rm -rf build
|
||||
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
SOURCETRAIL_PYTHON_INDEXER_VERSION="v0_db23_p2"
|
||||
|
||||
# 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'
|
||||
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
|
||||
ORIGINAL_PATH_TO_SCRIPT="${0}"
|
||||
CLEANED_PATH_TO_SCRIPT="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
|
||||
ROOT_DIR=`dirname "$CLEANED_PATH_TO_SCRIPT"`
|
||||
else
|
||||
ROOT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
fi
|
||||
|
||||
ROOT_DIR=$ROOT_DIR/..
|
||||
|
||||
# Enter main directory
|
||||
cd $ROOT_DIR/
|
||||
|
||||
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
|
||||
winrar x $TEMP_PATH/$PACKAGE_FILE_NAME $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
|
||||
+9
-4
@@ -34,10 +34,9 @@ echo -e $INFO "install git settings"
|
||||
|
||||
git config commit.template setup/git/git_commit_template.txt
|
||||
git config color.ui true
|
||||
if [ -d ".git/hooks" ]
|
||||
then
|
||||
cp setup/git/git_pre_commit_hook.sh .git/hooks/pre-commit
|
||||
cp setup/git/git_pre_push_hook.sh .git/hooks/pre-push
|
||||
if [ -d ".git/hooks" ]; then
|
||||
cp setup/git/git_pre_commit_hook.sh .git/hooks/pre-commit
|
||||
cp setup/git/git_pre_push_hook.sh .git/hooks/pre-push
|
||||
fi
|
||||
|
||||
# Create Debug and Release folders
|
||||
@@ -102,6 +101,12 @@ else
|
||||
mkdir -p build/Release/test
|
||||
fi
|
||||
|
||||
if [ $PLATFORM == "Windows" ]; then
|
||||
sh script/download_python_indexer.sh
|
||||
else
|
||||
MY_PATH=`dirname "$0"`
|
||||
$MY_PATH/download_python_indexer.sh
|
||||
fi
|
||||
|
||||
if [ $PLATFORM == "Windows" ]; then
|
||||
echo -e $INFO "creating program icon"
|
||||
|
||||
@@ -75,6 +75,7 @@ cp -R ../../../bin/app/data/syntax_highlighting_rules $RES_DIR/data/syntax_highl
|
||||
cp -R ../../../bin/app/data/fonts $RES_DIR/data/fonts
|
||||
cp -R ../../../bin/app/data/gui $RES_DIR/data/gui
|
||||
cp -R ../../../bin/app/data/java $RES_DIR/data/java
|
||||
cp -R ../../../bin/app/data/python $RES_DIR/data/python
|
||||
cp -R ../../../bin/app/data/fallback $RES_DIR/data/fallback
|
||||
cp -R ../../../bin/app/user/projects $RES_DIR/data/fallback/projects
|
||||
|
||||
|
||||
+3
-2
@@ -9,6 +9,7 @@
|
||||
#include "SourceGroupFactory.h"
|
||||
#include "SourceGroupFactoryModuleCxx.h"
|
||||
#include "SourceGroupFactoryModuleJava.h"
|
||||
#include "SourceGroupFactoryModulePython.h"
|
||||
#include "SourceGroupFactoryModuleCustom.h"
|
||||
#include "QtNetworkFactory.h"
|
||||
#include "QtApplication.h"
|
||||
@@ -46,7 +47,6 @@ void setupLogging()
|
||||
LogManager* logManager = LogManager::getInstance().get();
|
||||
|
||||
std::shared_ptr<ConsoleLogger> consoleLogger = std::make_shared<ConsoleLogger>();
|
||||
// consoleLogger->setLogLevel(Logger::LOG_WARNINGS | Logger::LOG_ERRORS);
|
||||
consoleLogger->setLogLevel(Logger::LOG_ALL);
|
||||
logManager->addLogger(consoleLogger);
|
||||
|
||||
@@ -186,10 +186,11 @@ void addLanguagePackages()
|
||||
{
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleCxx>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleJava>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModulePython>());
|
||||
SourceGroupFactory::getInstance()->addModule(std::make_shared<SourceGroupFactoryModuleCustom>());
|
||||
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageJava>());
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageCxx>());
|
||||
LanguagePackageManager::getInstance()->addPackage(std::make_shared<LanguagePackageJava>());
|
||||
}
|
||||
|
||||
QCoreApplication* createApplication(int &argc, char *argv[], bool noGUI = false)
|
||||
|
||||
@@ -360,6 +360,8 @@ add_files(
|
||||
settings/SourceGroupSettingsJavaMaven.h
|
||||
settings/SourceGroupSettingsJavaSonargraph.cpp
|
||||
settings/SourceGroupSettingsJavaSonargraph.h
|
||||
settings/SourceGroupSettingsPythonEmpty.cpp
|
||||
settings/SourceGroupSettingsPythonEmpty.h
|
||||
settings/SourceGroupSettingsWithClasspath.cpp
|
||||
settings/SourceGroupSettingsWithClasspath.h
|
||||
settings/SourceGroupSettingsWithCppStandard.cpp
|
||||
|
||||
@@ -8,6 +8,8 @@ std::string indexerCommandTypeToString(IndexerCommandType type)
|
||||
return "indexer_command_cxx";
|
||||
case INDEXER_COMMAND_JAVA:
|
||||
return "indexer_command_java";
|
||||
case INDEXER_COMMAND_PYTHON:
|
||||
return "indexer_command_python";
|
||||
case INDEXER_COMMAND_CUSTOM:
|
||||
return "indexer_command_custom";
|
||||
default:
|
||||
@@ -20,6 +22,7 @@ IndexerCommandType stringToIndexerCommandType(const std::string& s)
|
||||
{
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_CXX)) return INDEXER_COMMAND_CXX;
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_JAVA)) return INDEXER_COMMAND_JAVA;
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_PYTHON)) return INDEXER_COMMAND_PYTHON;
|
||||
if (s == indexerCommandTypeToString(INDEXER_COMMAND_CUSTOM)) return INDEXER_COMMAND_CUSTOM;
|
||||
return INDEXER_COMMAND_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ enum IndexerCommandType
|
||||
INDEXER_COMMAND_UNKNOWN,
|
||||
INDEXER_COMMAND_CXX,
|
||||
INDEXER_COMMAND_JAVA,
|
||||
INDEXER_COMMAND_PYTHON,
|
||||
INDEXER_COMMAND_CUSTOM
|
||||
};
|
||||
|
||||
|
||||
@@ -499,7 +499,8 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
|
||||
{
|
||||
if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
|
||||
{
|
||||
if (sourceGroup->getType() == SOURCE_GROUP_CUSTOM_COMMAND)
|
||||
if (sourceGroup->getType() == SOURCE_GROUP_CUSTOM_COMMAND ||
|
||||
sourceGroup->getType() == SOURCE_GROUP_PYTHON_EMPTY)
|
||||
{
|
||||
customIndexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ std::string languageTypeToString(LanguageType t)
|
||||
return "C++";
|
||||
case LANGUAGE_JAVA:
|
||||
return "Java";
|
||||
case LANGUAGE_PYTHON:
|
||||
return "Python";
|
||||
case LANGUAGE_CUSTOM:
|
||||
return "Custom";
|
||||
case LANGUAGE_UNKNOWN:
|
||||
@@ -20,19 +22,23 @@ std::string languageTypeToString(LanguageType t)
|
||||
|
||||
LanguageType stringToLanguageType(std::string s)
|
||||
{
|
||||
if (s == "C")
|
||||
if (s == languageTypeToString(LANGUAGE_C))
|
||||
{
|
||||
return LANGUAGE_C;
|
||||
}
|
||||
else if (s == "C++")
|
||||
else if (s == languageTypeToString(LANGUAGE_CPP))
|
||||
{
|
||||
return LANGUAGE_CPP;
|
||||
}
|
||||
else if (s == "Java")
|
||||
else if (s == languageTypeToString(LANGUAGE_JAVA))
|
||||
{
|
||||
return LANGUAGE_JAVA;
|
||||
}
|
||||
else if (s == "Custom")
|
||||
else if (s == languageTypeToString(LANGUAGE_PYTHON))
|
||||
{
|
||||
return LANGUAGE_PYTHON;
|
||||
}
|
||||
else if (s == languageTypeToString(LANGUAGE_CUSTOM))
|
||||
{
|
||||
return LANGUAGE_CUSTOM;
|
||||
}
|
||||
@@ -63,6 +69,8 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return LANGUAGE_JAVA;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return LANGUAGE_PYTHON;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return LANGUAGE_CUSTOM;
|
||||
default:
|
||||
|
||||
@@ -10,6 +10,7 @@ enum LanguageType
|
||||
LANGUAGE_CPP,
|
||||
LANGUAGE_C,
|
||||
LANGUAGE_JAVA,
|
||||
LANGUAGE_PYTHON,
|
||||
LANGUAGE_CUSTOM,
|
||||
LANGUAGE_UNKNOWN
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
#include "utilityUuid.h"
|
||||
@@ -196,6 +197,9 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
settings = std::make_shared<SourceGroupSettingsJavaSonargraph>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsPythonEmpty>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
settings = std::make_shared<SourceGroupSettingsCustomCommand>(id, this);
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "FilePath.h"
|
||||
|
||||
SourceGroupSettingsPythonEmpty::SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettings(id, SOURCE_GROUP_PYTHON_EMPTY, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsPythonEmpty::createCopy() const
|
||||
{
|
||||
return std::make_shared<SourceGroupSettingsPythonEmpty>(*this);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsPythonEmpty::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettings::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::load(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsPythonEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettings::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsPythonEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> otherJava = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(other);
|
||||
|
||||
return (
|
||||
otherJava &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherJava)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsPythonEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
L".py"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
|
||||
#define SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
|
||||
|
||||
#include "SourceGroupSettings.h"
|
||||
#include "SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsPythonEmpty
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings);
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> createCopy() const override;
|
||||
|
||||
void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
|
||||
@@ -24,6 +24,8 @@ std::string sourceGroupTypeToString(SourceGroupType v)
|
||||
return "Java Source Group from Gradle";
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return "Java from Sonargraph";
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return "Python Source Group";
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return "Custom Command Source Group";
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
@@ -56,6 +58,8 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
return "Java Source Group from Gradle";
|
||||
case SOURCE_GROUP_JAVA_SONARGRAPH:
|
||||
return "Java from Sonargraph";
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return "Empty Python Source Group";
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
return "Custom Command Source Group";
|
||||
case SOURCE_GROUP_UNKNOWN:
|
||||
@@ -106,6 +110,10 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
return SOURCE_GROUP_JAVA_SONARGRAPH;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_PYTHON_EMPTY))
|
||||
{
|
||||
return SOURCE_GROUP_PYTHON_EMPTY;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CUSTOM_COMMAND))
|
||||
{
|
||||
return SOURCE_GROUP_CUSTOM_COMMAND;
|
||||
|
||||
@@ -15,6 +15,7 @@ enum SourceGroupType
|
||||
SOURCE_GROUP_JAVA_MAVEN,
|
||||
SOURCE_GROUP_JAVA_GRADLE,
|
||||
SOURCE_GROUP_JAVA_SONARGRAPH,
|
||||
SOURCE_GROUP_PYTHON_EMPTY,
|
||||
SOURCE_GROUP_CUSTOM_COMMAND,
|
||||
SOURCE_GROUP_UNKNOWN
|
||||
};
|
||||
|
||||
@@ -32,6 +32,11 @@ FilePath ResourcePaths::getJavaPath()
|
||||
return AppPath::getAppPath().concatenate(L"data/java/");
|
||||
}
|
||||
|
||||
FilePath ResourcePaths::getPythonPath()
|
||||
{
|
||||
return AppPath::getAppPath().concatenate(L"data/python/");
|
||||
}
|
||||
|
||||
FilePath ResourcePaths::getCxxCompilerHeaderPath()
|
||||
{
|
||||
return AppPath::getAppPath().concatenate(L"data/cxx/include/").getCanonical();
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
static FilePath getFontsPath();
|
||||
static FilePath getGuiPath();
|
||||
static FilePath getJavaPath();
|
||||
static FilePath getPythonPath();
|
||||
static FilePath getCxxCompilerHeaderPath();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
|
||||
#include "CxxIndexerCommandProvider.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "CxxIndexerCommandProvider.h"
|
||||
#include "FileManager.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "SourceGroupSettingsCEmpty.h"
|
||||
#include "SourceGroupSettingsCppEmpty.h"
|
||||
#include "SourceGroupSettingsWithCppStandard.h"
|
||||
#include "SourceGroupSettingsWithCStandard.h"
|
||||
#include "FileManager.h"
|
||||
#include "utility.h"
|
||||
|
||||
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaSonargraph.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "MessageLoadProject.h"
|
||||
#include "MessageStatus.h"
|
||||
#include "ResourcePaths.h"
|
||||
@@ -404,6 +405,22 @@ namespace
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsPythonEmpty>> getSourceGroupWizzardPages<SourceGroupSettingsPythonEmpty>()
|
||||
{
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsPythonEmpty>> pages;
|
||||
{
|
||||
QtSourceGroupWizzardPage<SourceGroupSettingsPythonEmpty> page("Indexed Paths", 750, 600);
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentPathsSource>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentPathsExclude>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
page.addContentCreatorWithSettings<QtProjectWizzardContentExtensions>(WIZZARD_CONTENT_CONTEXT_ALL);
|
||||
pages.push_back(page);
|
||||
}
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
template<>
|
||||
std::vector<QtSourceGroupWizzardPage<SourceGroupSettingsCustomCommand>> getSourceGroupWizzardPages<SourceGroupSettingsCustomCommand>()
|
||||
{
|
||||
@@ -656,7 +673,7 @@ void QtProjectWizzard::executeSourceGroupSetup(std::shared_ptr<SettingsType> set
|
||||
settings,
|
||||
std::bind(&QtProjectWizzard::cancelSourceGroup, this),
|
||||
std::bind(&QtProjectWizzard::createSourceGroup, this, std::placeholders::_1)
|
||||
);
|
||||
);
|
||||
|
||||
for (const QtSourceGroupWizzardPage<SettingsType>& page : getSourceGroupWizzardPages<SettingsType>())
|
||||
{
|
||||
@@ -842,6 +859,10 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(group))
|
||||
{
|
||||
fillSummary(summary, settings, this);
|
||||
@@ -1100,6 +1121,12 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
executeSourceGroupSetup<SourceGroupSettingsJavaSonargraph>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::make_shared<SourceGroupSettingsPythonEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
executeSourceGroupSetup<SourceGroupSettingsPythonEmpty>(settings);
|
||||
}
|
||||
break;
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::make_shared<SourceGroupSettingsCustomCommand>(sourceGroupId, m_projectSettings.get());
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "SourceGroupCustomCommand.h"
|
||||
#include "SourceGroupCxxEmpty.h"
|
||||
#include "SourceGroupJavaEmpty.h"
|
||||
#include "SourceGroupPythonEmpty.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "SourceGroupSettingsCustomCommand.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "SourceGroupSettingsJavaEmpty.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "SourceGroupSettingsWithClasspath.h"
|
||||
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "SourceGroupSettingsWithExcludeFilters.h"
|
||||
@@ -261,6 +263,10 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
|
||||
{
|
||||
allSourceFilePaths = SourceGroupJavaEmpty(settings).getAllSourceFilePaths();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsPythonEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupPythonEmpty(settings).getAllSourceFilePaths();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCustomCommand> settings = std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(m_settings))
|
||||
{
|
||||
allSourceFilePaths = SourceGroupCustomCommand(settings).getAllSourceFilePaths();
|
||||
|
||||
@@ -47,6 +47,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_GRADLE));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_PYTHON].push_back(SourceGroupInfo(SOURCE_GROUP_PYTHON_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_CUSTOM].push_back(SourceGroupInfo(SOURCE_GROUP_CUSTOM_COMMAND));
|
||||
|
||||
// define which icons should be used for which kind of source group
|
||||
@@ -60,6 +61,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_MAVEN] = L"mvn_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_GRADLE] = L"gradle_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_SONARGRAPH] = L"sonargraph_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_PYTHON_EMPTY] = L"empty_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CUSTOM_COMMAND] = L"empty_icon";
|
||||
|
||||
// define descriptions for each kind of Source Group
|
||||
@@ -85,6 +87,8 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_GRADLE] = "Create a new Source Group from an existing Gradle project.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_SONARGRAPH] =
|
||||
"Create a new Source Group from an existing <a href=\"https://www.hello2morrow.com/products/sonargraph\">Sonargraph</a> project file.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_PYTHON_EMPTY] = "Create a new Sourcetrail Source Group by defining which Python files will be indexed. Note "
|
||||
"that this Source Group type uses the <a href=\"https://github.com/CoatiSoftware/SourcetrailPythonIndexer\">SourcetrailPythonIndexer</a> in the background.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CUSTOM_COMMAND] = "Create a new Source Group executing a custom command on each source file. "
|
||||
"This Source Group type can be used on <a href=\"https://github.com/CoatiSoftware/SourcetrailDB\">SourcetrailDB</a> binaries that add "
|
||||
"custom language support to Sourcetrail.<br /><br />Current Database Version: " + std::to_string(SqliteIndexStorage::getStorageVersion());
|
||||
|
||||
@@ -8,9 +8,9 @@ IndexerJava::~IndexerJava()
|
||||
}
|
||||
|
||||
void IndexerJava::doIndex(
|
||||
std::shared_ptr<IndexerCommandJava> indexerCommand,
|
||||
std::shared_ptr<ParserClientImpl> parserClient,
|
||||
std::shared_ptr<IndexerStateInfo> m_indexerStateInfo
|
||||
std::shared_ptr<IndexerCommandJava> indexerCommand,
|
||||
std::shared_ptr<ParserClientImpl> parserClient,
|
||||
std::shared_ptr<IndexerStateInfo> m_indexerStateInfo
|
||||
){
|
||||
JavaParser(parserClient, m_indexerStateInfo).buildIndex(indexerCommand);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
add_files(
|
||||
LIB_PYTHON
|
||||
|
||||
project/SourceGroupFactoryModulePython.h
|
||||
project/SourceGroupFactoryModulePython.cpp
|
||||
project/SourceGroupPythonEmpty.h
|
||||
project/SourceGroupPythonEmpty.cpp
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "SourceGroupFactoryModulePython.h"
|
||||
|
||||
#include "SourceGroupPythonEmpty.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
|
||||
bool SourceGroupFactoryModulePython::supports(SourceGroupType type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroup> SourceGroupFactoryModulePython::createSourceGroup(std::shared_ptr<SourceGroupSettings> settings) const
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup;
|
||||
if (std::shared_ptr<SourceGroupSettingsPythonEmpty> pythonSettings = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupPythonEmpty(pythonSettings));
|
||||
}
|
||||
return sourceGroup;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef SOURCE_GROUP_FACTORY_MODULE_PYTHON_H
|
||||
#define SOURCE_GROUP_FACTORY_MODULE_PYTHON_H
|
||||
|
||||
#include "SourceGroupFactoryModule.h"
|
||||
|
||||
class SourceGroupFactoryModulePython: public SourceGroupFactoryModule
|
||||
{
|
||||
public:
|
||||
bool supports(SourceGroupType type) const override;
|
||||
std::shared_ptr<SourceGroup> createSourceGroup(std::shared_ptr<SourceGroupSettings> settings) const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_FACTORY_MODULE_PYTHON_H
|
||||
@@ -0,0 +1,66 @@
|
||||
#include "SourceGroupPythonEmpty.h"
|
||||
|
||||
#include "FileManager.h"
|
||||
#include "IndexerCommandCustom.h"
|
||||
#include "ProjectSettings.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "SqliteIndexStorage.h"
|
||||
#include "utility.h"
|
||||
|
||||
SourceGroupPythonEmpty::SourceGroupPythonEmpty(std::shared_ptr<SourceGroupSettingsPythonEmpty> settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupPythonEmpty::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return SourceGroup::filterToContainedFilePaths(
|
||||
filePaths,
|
||||
std::set<FilePath>(),
|
||||
utility::toSet(m_settings->getSourcePathsExpandedAndAbsolute()),
|
||||
m_settings->getExcludeFiltersExpandedAndAbsolute()
|
||||
);
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupPythonEmpty::getAllSourceFilePaths() const
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
m_settings->getSourcePathsExpandedAndAbsolute(),
|
||||
m_settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
m_settings->getSourceExtensions()
|
||||
);
|
||||
return fileManager.getAllSourceFilePaths();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (const FilePath& sourceFilePath : getAllSourceFilePaths())
|
||||
{
|
||||
if (filesToIndex.find(sourceFilePath) != filesToIndex.end())
|
||||
{
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
|
||||
L"\"" + ResourcePaths::getPythonPath().wstr() + L"SourcetrailPythonIndexer\" --source-file-path=%{SOURCE_FILE_PATH} --database-file-path=%{DATABASE_FILE_PATH}",
|
||||
m_settings->getProjectSettings()->getProjectFilePath(),
|
||||
m_settings->getProjectSettings()->getTempDBFilePath(),
|
||||
std::to_wstring(SqliteIndexStorage::getStorageVersion()),
|
||||
sourceFilePath,
|
||||
true
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupPythonEmpty::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SourceGroupSettings> SourceGroupPythonEmpty::getSourceGroupSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef SOURCE_GROUP_PYTHON_EMPTY_H
|
||||
#define SOURCE_GROUP_PYTHON_EMPTY_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "SourceGroup.h"
|
||||
|
||||
class SourceGroupSettingsPythonEmpty;
|
||||
|
||||
class SourceGroupPythonEmpty: public SourceGroup
|
||||
{
|
||||
public:
|
||||
SourceGroupPythonEmpty(std::shared_ptr<SourceGroupSettingsPythonEmpty> settings);
|
||||
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
|
||||
std::set<FilePath> getAllSourceFilePaths() const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsPythonEmpty> m_settings;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_PYTHON_EMPTY_H
|
||||
Reference in New Issue
Block a user