build: make Windows CI build and test Java language support (#1156)

This commit is contained in:
Malte Langkabel
2021-03-03 07:33:29 +01:00
committed by GitHub
parent f1686147c4
commit 33e3f96283
17 changed files with 208 additions and 103 deletions
+10 -2
View File
@@ -56,6 +56,14 @@ else ()
set(PLATFORM_INCLUDE "includesLinux.h") set(PLATFORM_INCLUDE "includesLinux.h")
endif () endif ()
set (BASH "")
if (WIN32)
execute_process(COMMAND CMD /c where bash OUTPUT_VARIABLE BASH)
string(REGEX REPLACE "\n$" "" BASH "${BASH}")
endif ()
message ("bash: '${BASH}'")
# Project ---------------------------------------------------------------------- # Project ----------------------------------------------------------------------
@@ -471,7 +479,7 @@ if (BUILD_JAVA_LANGUAGE_PACKAGE)
add_custom_command( add_custom_command(
TARGET ${LIB_JAVA_PROJECT_NAME} TARGET ${LIB_JAVA_PROJECT_NAME}
PRE_BUILD PRE_BUILD
COMMAND ${PROJECT_SOURCE_DIR}/script/update_java_indexer.sh COMMAND ${BASH} ${PROJECT_SOURCE_DIR}/script/update_java_indexer.sh
COMMENT "updating java indexer jars" COMMENT "updating java indexer jars"
) )
@@ -506,7 +514,7 @@ if (BUILD_PYTHON_LANGUAGE_PACKAGE)
add_custom_command( add_custom_command(
TARGET ${LIB_PYTHON_PROJECT_NAME} TARGET ${LIB_PYTHON_PROJECT_NAME}
PRE_BUILD PRE_BUILD
COMMAND ${PROJECT_SOURCE_DIR}/script/download_python_indexer.sh COMMAND ${BASH} ${PROJECT_SOURCE_DIR}/script/download_python_indexer.sh
COMMENT "download python indexer" COMMENT "download python indexer"
) )
+5 -4
View File
@@ -16,14 +16,11 @@ before_build:
- cd build - cd build
- mkdir temp - mkdir temp
- cd ../ - cd ../
- cd script
- cmd: "\"C:/Program Files/Git/usr/bin/bash.exe\" download_python_indexer.sh"
- cd ../
- cd build - cd build
- mkdir win64 - mkdir win64
- cd win64 - cd win64
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
- cmake -G "Ninja" -DBOOST_ROOT=C:/Libraries/boost_1_69_0 -DQt5_DIR=C:/Qt/5.12.6/msvc2017_64/lib/cmake/Qt5 -DBUILD_PYTHON_LANGUAGE_PACKAGE=ON -DCMAKE_BUILD_TYPE=Release ../../ - cmake -G "Ninja" -DBOOST_ROOT=C:/Libraries/boost_1_69_0 -DQt5_DIR=C:/Qt/5.12.6/msvc2017_64/lib/cmake/Qt5 -DBUILD_JAVA_LANGUAGE_PACKAGE=ON -DBUILD_PYTHON_LANGUAGE_PACKAGE=ON -DCMAKE_BUILD_TYPE=Release ../../
- cd ../../ - cd ../../
build_script: build_script:
@@ -32,6 +29,10 @@ build_script:
- cd ../../ - cd ../../
test_script: test_script:
- cd bin/app
- ..\..\build\win64\Release\app\Sourcetrail.exe config -j "C:/Program Files/Java/jdk1.8.0/jre/bin/server/jvm.dll"
- cd ../../
- ps: copy bin/app/user/ApplicationSettings.xml bin/test/data/TestSettings.xml
- cd bin/test - cd bin/test
- ..\..\build\win64\Release\test\Sourcetrail_test.exe - ..\..\build\win64\Release\test\Sourcetrail_test.exe
- cd ../../ - cd ../../
@@ -1,6 +1,5 @@
#Thu Mar 01 09:01:25 CST 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
+40 -21
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="" DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,27 +154,30 @@ if $cygwin ; then
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=`expr $i + 1`
done done
case $i in case $i in
(0) set -- ;; 0) set -- ;;
(1) set -- "$args0" ;; 1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;; 2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;; 3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules # Escape application args
function splitJvmOpts() { save () {
JVM_OPTS=("$@") for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
} }
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS APP_ARGS=`save "$@"`
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
@@ -49,7 +65,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line
@@ -1,6 +1,5 @@
#Thu Mar 01 09:01:25 CST 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
@@ -1,4 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="" DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,27 +154,30 @@ if $cygwin ; then
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=`expr $i + 1`
done done
case $i in case $i in
(0) set -- ;; 0) set -- ;;
(1) set -- "$args0" ;; 1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;; 2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;; 3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules # Escape application args
function splitJvmOpts() { save () {
JVM_OPTS=("$@") for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
} }
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS APP_ARGS=`save "$@"`
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
@@ -49,7 +65,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line
+18 -6
View File
@@ -11,21 +11,33 @@ if [ "$(uname)" == "Darwin" ]; then
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
PLATFORM='Linux' PLATFORM='Linux'
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
PLATFORM='Windows' PLATFORM='windows'
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
PLATFORM='windows'
elif [ "$OSTYPE" == "msys" ]; then
PLATFORM='windows'
fi fi
if [ $PLATFORM == "Windows" ]; then if [ $PLATFORM == "windows" ]; then
SCRIPT=`realpath $0`
if [ "$SCRIPT" == "" ]; then
ORIGINAL_PATH_TO_SCRIPT="${0}" ORIGINAL_PATH_TO_SCRIPT="${0}"
CLEANED_PATH_TO_SCRIPT="${ORIGINAL_PATH_TO_SCRIPT//\\//}" CLEANED_PATH_TO_SCRIPT="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
ROOT_DIR=`dirname "$CLEANED_PATH_TO_SCRIPT"` SCRIPT_DIR=${CLEANED_PATH_TO_SCRIPT%/*}
else else
ROOT_DIR="$( cd "$( dirname "$0" )" && pwd )" ORIGINAL_PATH_TO_SCRIPT=`dirname $SCRIPT`
SCRIPT_DIR="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
fi
else
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
fi fi
ROOT_DIR=$ROOT_DIR/.. echo "This script is running in: $SCRIPT_DIR"
# Enter main directory # Enter main directory
cd $ROOT_DIR/ cd $SCRIPT_DIR/
cd ..
cd java_indexer cd java_indexer
@@ -7,8 +7,11 @@
#include "utilityApp.h" #include "utilityApp.h"
#include "utilityString.h" #include "utilityString.h"
JavaPathDetectorWindows::JavaPathDetectorWindows(const std::string javaVersion) JavaPathDetectorWindows::JavaPathDetectorWindows(const std::string javaVersion, bool isJre)
: JavaPathDetector("Java " + javaVersion + " for Windows", javaVersion) : JavaPathDetector(
"Java " + std::string(isJre ? "JRE" : "JDK") + " " + javaVersion + " for Windows",
javaVersion)
, m_isJre(isJre)
{ {
} }
@@ -23,6 +26,8 @@ std::vector<FilePath> JavaPathDetectorWindows::doGetPaths() const
key += "JavaSoft\\"; key += "JavaSoft\\";
if (m_isJre)
{
if (utility::isPrefix(std::string("1."), m_javaVersion)) if (utility::isPrefix(std::string("1."), m_javaVersion))
{ {
key += ("Java Runtime Environment\\" + m_javaVersion).c_str(); key += ("Java Runtime Environment\\" + m_javaVersion).c_str();
@@ -32,16 +37,39 @@ std::vector<FilePath> JavaPathDetectorWindows::doGetPaths() const
key += ("JRE\\" + m_javaVersion).c_str(); key += ("JRE\\" + m_javaVersion).c_str();
} }
QSettings expressKey( // NativeFormat means from Registry on Windows.
key, QSettings::NativeFormat); // NativeFormat means from Registry on Windows. QSettings settings(key, QSettings::NativeFormat);
QString value = expressKey.value("RuntimeLib").toString(); const QString value = settings.value("RuntimeLib").toString();
FilePath path(value.toStdWString()); const FilePath path(value.toStdWString());
std::vector<FilePath> paths;
if (path.exists()) if (path.exists())
{ {
paths.push_back(path); return {path};
} }
return paths; }
else
{
key += "JDK";
{
const QSettings settings(key, QSettings::NativeFormat);
for (const QString& child: settings.childGroups())
{
if (child.startsWith(QString::fromStdString(m_javaVersion)))
{
key += "\\" + child;
}
}
}
{
const QSettings settings(key, QSettings::NativeFormat);
const QString value = settings.value("JavaHome").toString();
const FilePath path = FilePath(value.toStdWString()).concatenate(L"bin/server/jvm.dll");
if (path.exists())
{
return {path};
}
}
}
return {};
} }
@@ -6,10 +6,11 @@
class JavaPathDetectorWindows: public JavaPathDetector class JavaPathDetectorWindows: public JavaPathDetector
{ {
public: public:
JavaPathDetectorWindows(const std::string javaVersion); JavaPathDetectorWindows(const std::string javaVersion, bool isJre);
private: private:
virtual std::vector<FilePath> doGetPaths() const override; virtual std::vector<FilePath> doGetPaths() const override;
bool m_isJre;
}; };
#endif // JAVA_PATH_DETECTOR_WINDOWS_H #endif // JAVA_PATH_DETECTOR_WINDOWS_H
@@ -3,6 +3,6 @@
#include "JavaPathDetectorWindows.h" #include "JavaPathDetectorWindows.h"
JreSystemLibraryPathDetectorWindows::JreSystemLibraryPathDetectorWindows(const std::string javaVersion) JreSystemLibraryPathDetectorWindows::JreSystemLibraryPathDetectorWindows(const std::string javaVersion)
: JreSystemLibraryPathDetector(std::make_shared<JavaPathDetectorWindows>(javaVersion)) : JreSystemLibraryPathDetector(std::make_shared<JavaPathDetectorWindows>(javaVersion, true))
{ {
} }
+2 -2
View File
@@ -31,8 +31,8 @@ std::shared_ptr<CombinedPathDetector> utility::getJavaRuntimePathDetector()
switch (utility::getOsType()) switch (utility::getOsType())
{ {
case OS_WINDOWS: case OS_WINDOWS:
combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("1.8")); combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("1.8", true));
combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("9")); combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("9", true));
break; break;
case OS_MAC: case OS_MAC:
combinedDetector->addDetector(std::make_shared<JavaPathDetectorMac>("1.8")); combinedDetector->addDetector(std::make_shared<JavaPathDetectorMac>("1.8"));
@@ -5,7 +5,6 @@
#if BUILD_JAVA_LANGUAGE_PACKAGE #if BUILD_JAVA_LANGUAGE_PACKAGE
# include <fstream> # include <fstream>
# include <iostream>
# include "ApplicationSettings.h" # include "ApplicationSettings.h"
# include "FileRegister.h" # include "FileRegister.h"
@@ -107,7 +106,7 @@ void processSourceFile(
expectedOutputFilePath); expectedOutputFilePath);
REQUIRE_MESSAGE( REQUIRE_MESSAGE(
("Output does not match the expected line count for file " + sourceFilePath.str() + ("Output does not match the expected line count for file " + sourceFilePath.str() +
" in project " + projectName) " in project " + projectName + ". Output was: " + output->getText())
.c_str(), .c_str(),
expectedOutput->getLineCount() == output->getLineCount()); expectedOutput->getLineCount() == output->getLineCount());
if (expectedOutput->getLineCount() == output->getLineCount()) if (expectedOutput->getLineCount() == output->getLineCount())
+1 -1
View File
@@ -241,7 +241,7 @@ void generateAndCompareExpectedOutput(
expectedOutputFilePath); expectedOutputFilePath);
REQUIRE_MESSAGE( REQUIRE_MESSAGE(
("Output does not match the expected line count for project \"" + ("Output does not match the expected line count for project \"" +
utility::encodeToUtf8(projectName) + "\".") utility::encodeToUtf8(projectName) + "\". Output was: " + output->getText())
.c_str(), .c_str(),
expectedOutput->getLineCount() == output->getLineCount()); expectedOutput->getLineCount() == output->getLineCount());
if (expectedOutput->getLineCount() == output->getLineCount()) if (expectedOutput->getLineCount() == output->getLineCount())