forked from qt-creator/qt-creator
QbsProjectManager: Provide classpath data to Java language server
Change-Id: Idf09ae566139a752184defe26fee082af8be31aa Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -291,16 +291,29 @@ void JLSClient::updateProjectFiles()
|
||||
return;
|
||||
const FilePath packageSourceDir = FilePath::fromVariant(
|
||||
node->data(Constants::AndroidPackageSourceDir));
|
||||
FilePath sourceDir = packageSourceDir.pathAppended("src");
|
||||
if (!sourceDir.exists())
|
||||
return;
|
||||
|
||||
FilePath sourceDir = packageSourceDir.pathAppended("src/main/java");
|
||||
if (!sourceDir.exists()) {
|
||||
sourceDir = packageSourceDir.pathAppended("src");
|
||||
if (!sourceDir.exists()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sourceDir = sourceDir.relativeChildPath(projectDir);
|
||||
|
||||
const QStringList classPaths = node->data(Constants::AndroidClassPaths).toStringList();
|
||||
|
||||
const FilePath &sdkLocation = AndroidConfigurations::currentConfig().sdkLocation();
|
||||
const QString &targetSDK = AndroidManager::buildTargetSDK(m_currentTarget);
|
||||
const FilePath androidJar = sdkLocation / QString("platforms/%2/android.jar")
|
||||
.arg(targetSDK);
|
||||
FilePaths libs = {androidJar};
|
||||
libs << packageSourceDir.pathAppended("libs").dirEntries({{"*.jar"}, QDir::Files});
|
||||
|
||||
for (const QString &path : classPaths)
|
||||
libs << FilePath::fromString(path);
|
||||
|
||||
generateProjectFile(projectDir, qtSrc, project()->displayName());
|
||||
generateClassPathFile(projectDir, sourceDir, libs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user