build: merge Coati app and Trial to single executable
* removed trial target * updated deploy scripts to exclude trial * cleanup CMakeLists * removed Eigen dependencies * split parser lib into lib_cxx and lib_java * added ProjectFactory and ProjectFactoryModules * removed old installer projects * updated wix installer * updated readme for wix setup * updated to use obfuscated exe * added qt.conf * added indexing dialog images * added jars * added coatidb files of sample projects * added source code of javaparser sample * removed auto-refresh image * intermediate files of windows installer are created in build folder * preselected desktop shortcut * build bat is executed from deploy_windows script
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
#include "data/parser/java/JavaParser.h"
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include "data/parser/java/JavaEnvironmentFactory.h"
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ReferenceKind.h"
|
||||
#include "data/parser/ParserClient.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
JavaParser::JavaParser(ParserClient* client)
|
||||
: Parser(client)
|
||||
, m_id(s_nextParserId++)
|
||||
, m_currentFilePath("")
|
||||
{
|
||||
std::shared_ptr<JavaEnvironmentFactory> factory = JavaEnvironmentFactory::getInstance();
|
||||
if (factory)
|
||||
{
|
||||
m_javaEnvironment = factory->createEnvironment();
|
||||
|
||||
std::vector<JavaEnvironment::NativeMethod> methods;
|
||||
|
||||
methods.push_back({"recordSymbol", "(ILjava/lang/String;IIIIIII)V", (void*)&JavaParser::RecordSymbol});
|
||||
methods.push_back({"recordSymbolWithoutLocation", "(ILjava/lang/String;III)V", (void*)&JavaParser::RecordSymbolWithoutLocation});
|
||||
methods.push_back({"recordSymbolWithScope", "(ILjava/lang/String;IIIIIIIIIII)V", (void*)&JavaParser::RecordSymbolWithScope});
|
||||
methods.push_back({"recordReference", "(IILjava/lang/String;Ljava/lang/String;IIII)V", (void*)&JavaParser::RecordReference});
|
||||
methods.push_back({"recordLocalSymbol", "(ILjava/lang/String;IIII)V", (void*)&JavaParser::RecordLocalSymbol});
|
||||
methods.push_back({"recordComment", "(IIIII)V", (void*)&JavaParser::RecordComment});
|
||||
methods.push_back({"recordError", "(ILjava/lang/String;IIIIII)V", (void*)&JavaParser::RecordError});
|
||||
|
||||
m_javaEnvironment->registerNativeMethods("io/coati/JavaIndexer", methods);
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_parsersMutex);
|
||||
s_parsers[m_id] = this;
|
||||
}
|
||||
}
|
||||
|
||||
JavaParser::~JavaParser()
|
||||
{
|
||||
s_parsers.erase(m_id);
|
||||
}
|
||||
|
||||
void JavaParser::parseFiles(const std::vector<FilePath>& filePaths, const Arguments& arguments)
|
||||
{
|
||||
//m_fileRegister->setFilePaths(filePaths);
|
||||
//setupParsing(arguments);
|
||||
|
||||
//std::vector<std::string> sourcePaths;
|
||||
//for (const FilePath& path : m_fileRegister->getUnparsedSourceFilePaths()) // filter headers
|
||||
//{
|
||||
// sourcePaths.push_back(path.absolute().str());
|
||||
//}
|
||||
|
||||
//runTool(sourcePaths);
|
||||
}
|
||||
|
||||
void JavaParser::parseFile(const FilePath& filePath, std::shared_ptr<TextAccess> textAccess, const Arguments& arguments)
|
||||
{
|
||||
if (m_javaEnvironment)
|
||||
{
|
||||
m_currentFilePath = filePath.str();
|
||||
m_client->onFileParsed(FileSystem::getFileInfoForPath(filePath));
|
||||
std::string classPath = "";
|
||||
for (const FilePath& path: arguments.javaClassPaths)
|
||||
{
|
||||
// the separator used here should be the same as the one used in JavaIndexer.java
|
||||
classPath += path.str() + ";";
|
||||
}
|
||||
|
||||
// remove tabs because they screw with javaparser's location resolver
|
||||
std::string fileContent = utility::replace(textAccess->getText(), "\t", " ");
|
||||
|
||||
m_javaEnvironment->callStaticVoidMethod("io/coati/JavaIndexer", "processFile", m_id, filePath.str(), fileContent, classPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int JavaParser::s_nextParserId = 0;
|
||||
|
||||
std::map<int, JavaParser*> JavaParser::s_parsers;
|
||||
|
||||
std::mutex JavaParser::s_parsersMutex;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void JavaParser::doRecordSymbol(
|
||||
jstring jSymbolName, jint jSymbolType,
|
||||
jint beginLine, jint beginColumn, jint endLine, jint endColumn,
|
||||
jint jAccess, jint jIsImplicit
|
||||
)
|
||||
{
|
||||
AccessKind access = intToAccessKind(jAccess);
|
||||
bool isImplicit = jIsImplicit;
|
||||
|
||||
m_client->recordSymbol(
|
||||
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)),
|
||||
intToSymbolKind(jSymbolType),
|
||||
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
|
||||
access,
|
||||
isImplicit
|
||||
);
|
||||
}
|
||||
|
||||
void JavaParser::doRecordSymbolWithoutLocation(
|
||||
jstring jSymbolName, jint jSymbolType,
|
||||
jint jAccess, jint jIsImplicit
|
||||
)
|
||||
{
|
||||
AccessKind access = intToAccessKind(jAccess);
|
||||
bool isImplicit = jIsImplicit;
|
||||
|
||||
m_client->recordSymbol(
|
||||
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)),
|
||||
intToSymbolKind(jSymbolType),
|
||||
access,
|
||||
isImplicit
|
||||
);
|
||||
}
|
||||
|
||||
void JavaParser::doRecordSymbolWithScope(
|
||||
jstring jSymbolName, jint jSymbolType,
|
||||
jint beginLine, jint beginColumn, jint endLine, jint endColumn,
|
||||
jint scopeBeginLine, jint scopeBeginColumn, jint scopeEndLine, jint scopeEndColumn,
|
||||
jint jAccess, jint jIsImplicit
|
||||
)
|
||||
{
|
||||
AccessKind access = intToAccessKind(jAccess);
|
||||
bool isImplicit = jIsImplicit;
|
||||
|
||||
m_client->recordSymbol(
|
||||
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)),
|
||||
intToSymbolKind(jSymbolType),
|
||||
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
|
||||
ParseLocation(m_currentFilePath, scopeBeginLine, scopeBeginColumn, scopeEndLine, scopeEndColumn),
|
||||
access,
|
||||
isImplicit
|
||||
);
|
||||
}
|
||||
|
||||
void JavaParser::doRecordReference(
|
||||
jint jReferenceKind, jstring jReferencedName, jstring jContextName,
|
||||
jint beginLine, jint beginColumn, jint endLine, jint endColumn
|
||||
)
|
||||
{
|
||||
m_client->recordReference(
|
||||
intToReferenceKind(jReferenceKind),
|
||||
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jReferencedName)),
|
||||
NameHierarchy::deserialize(m_javaEnvironment->toStdString(jContextName)),
|
||||
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn)
|
||||
);
|
||||
}
|
||||
|
||||
void JavaParser::doRecordLocalSymbol(jstring jSymbolName, jint beginLine, jint beginColumn, jint endLine, jint endColumn)
|
||||
{
|
||||
m_client->onLocalSymbolParsed(
|
||||
m_javaEnvironment->toStdString(jSymbolName),
|
||||
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn)
|
||||
);
|
||||
}
|
||||
|
||||
void JavaParser::doRecordComment(
|
||||
jint beginLine, jint beginColumn, jint endLine, jint endColumn
|
||||
)
|
||||
{
|
||||
m_client->onCommentParsed(
|
||||
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn)
|
||||
);
|
||||
}
|
||||
|
||||
void JavaParser::doRecordError(
|
||||
jstring jMessage, jint jFatal, jint jIndexed,
|
||||
jint beginLine, jint beginColumn, jint endLine, jint endColumn
|
||||
)
|
||||
{
|
||||
bool fatal = jFatal;
|
||||
bool indexed = jIndexed;
|
||||
|
||||
m_client->onError(
|
||||
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
|
||||
m_javaEnvironment->toStdString(jMessage),
|
||||
fatal, indexed
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user