build: make Windows CI build and test Java language support (#1156)
This commit is contained in:
+10
-2
@@ -56,6 +56,14 @@ else ()
|
||||
set(PLATFORM_INCLUDE "includesLinux.h")
|
||||
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 ----------------------------------------------------------------------
|
||||
|
||||
@@ -471,7 +479,7 @@ if (BUILD_JAVA_LANGUAGE_PACKAGE)
|
||||
add_custom_command(
|
||||
TARGET ${LIB_JAVA_PROJECT_NAME}
|
||||
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"
|
||||
)
|
||||
|
||||
@@ -506,7 +514,7 @@ if (BUILD_PYTHON_LANGUAGE_PACKAGE)
|
||||
add_custom_command(
|
||||
TARGET ${LIB_PYTHON_PROJECT_NAME}
|
||||
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"
|
||||
)
|
||||
|
||||
|
||||
+5
-4
@@ -16,14 +16,11 @@ before_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
|
||||
- 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 ../../
|
||||
|
||||
build_script:
|
||||
@@ -32,6 +29,10 @@ build_script:
|
||||
- cd ../../
|
||||
|
||||
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
|
||||
- ..\..\build\win64\Release\test\Sourcetrail_test.exe
|
||||
- cd ../../
|
||||
|
||||
BIN
Binary file not shown.
Vendored
+1
-2
@@ -1,6 +1,5 @@
|
||||
#Thu Mar 01 09:01:25 CST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
|
||||
|
||||
+40
-21
@@ -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"`
|
||||
|
||||
# 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.
|
||||
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\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
@@ -138,27 +154,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
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
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
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.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
@@ -49,7 +65,6 @@ goto fail
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@@ -60,11 +75,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+1
-2
@@ -1,6 +1,5 @@
|
||||
#Thu Mar 01 09:01:25 CST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
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"`
|
||||
|
||||
# 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.
|
||||
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\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
@@ -138,27 +154,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
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
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
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.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
@@ -49,7 +65,6 @@ goto fail
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@@ -60,11 +75,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
@@ -11,21 +11,33 @@ if [ "$(uname)" == "Darwin" ]; then
|
||||
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||
PLATFORM='Linux'
|
||||
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
|
||||
|
||||
if [ $PLATFORM == "Windows" ]; then
|
||||
if [ $PLATFORM == "windows" ]; then
|
||||
SCRIPT=`realpath $0`
|
||||
if [ "$SCRIPT" == "" ]; then
|
||||
|
||||
ORIGINAL_PATH_TO_SCRIPT="${0}"
|
||||
CLEANED_PATH_TO_SCRIPT="${ORIGINAL_PATH_TO_SCRIPT//\\//}"
|
||||
ROOT_DIR=`dirname "$CLEANED_PATH_TO_SCRIPT"`
|
||||
SCRIPT_DIR=${CLEANED_PATH_TO_SCRIPT%/*}
|
||||
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
|
||||
|
||||
ROOT_DIR=$ROOT_DIR/..
|
||||
echo "This script is running in: $SCRIPT_DIR"
|
||||
|
||||
# Enter main directory
|
||||
cd $ROOT_DIR/
|
||||
cd $SCRIPT_DIR/
|
||||
cd ..
|
||||
|
||||
cd java_indexer
|
||||
|
||||
|
||||
@@ -7,8 +7,11 @@
|
||||
#include "utilityApp.h"
|
||||
#include "utilityString.h"
|
||||
|
||||
JavaPathDetectorWindows::JavaPathDetectorWindows(const std::string javaVersion)
|
||||
: JavaPathDetector("Java " + javaVersion + " for Windows", javaVersion)
|
||||
JavaPathDetectorWindows::JavaPathDetectorWindows(const std::string javaVersion, bool isJre)
|
||||
: 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\\";
|
||||
|
||||
if (m_isJre)
|
||||
{
|
||||
if (utility::isPrefix(std::string("1."), m_javaVersion))
|
||||
{
|
||||
key += ("Java Runtime Environment\\" + m_javaVersion).c_str();
|
||||
@@ -32,16 +37,39 @@ std::vector<FilePath> JavaPathDetectorWindows::doGetPaths() const
|
||||
key += ("JRE\\" + m_javaVersion).c_str();
|
||||
}
|
||||
|
||||
QSettings expressKey(
|
||||
key, QSettings::NativeFormat); // NativeFormat means from Registry on Windows.
|
||||
QString value = expressKey.value("RuntimeLib").toString();
|
||||
// NativeFormat means from Registry on Windows.
|
||||
QSettings settings(key, QSettings::NativeFormat);
|
||||
const QString value = settings.value("RuntimeLib").toString();
|
||||
|
||||
FilePath path(value.toStdWString());
|
||||
|
||||
std::vector<FilePath> paths;
|
||||
const FilePath path(value.toStdWString());
|
||||
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
|
||||
{
|
||||
public:
|
||||
JavaPathDetectorWindows(const std::string javaVersion);
|
||||
JavaPathDetectorWindows(const std::string javaVersion, bool isJre);
|
||||
|
||||
private:
|
||||
virtual std::vector<FilePath> doGetPaths() const override;
|
||||
bool m_isJre;
|
||||
};
|
||||
|
||||
#endif // JAVA_PATH_DETECTOR_WINDOWS_H
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
#include "JavaPathDetectorWindows.h"
|
||||
|
||||
JreSystemLibraryPathDetectorWindows::JreSystemLibraryPathDetectorWindows(const std::string javaVersion)
|
||||
: JreSystemLibraryPathDetector(std::make_shared<JavaPathDetectorWindows>(javaVersion))
|
||||
: JreSystemLibraryPathDetector(std::make_shared<JavaPathDetectorWindows>(javaVersion, true))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ std::shared_ptr<CombinedPathDetector> utility::getJavaRuntimePathDetector()
|
||||
switch (utility::getOsType())
|
||||
{
|
||||
case OS_WINDOWS:
|
||||
combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("1.8"));
|
||||
combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("9"));
|
||||
combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("1.8", true));
|
||||
combinedDetector->addDetector(std::make_shared<JavaPathDetectorWindows>("9", true));
|
||||
break;
|
||||
case OS_MAC:
|
||||
combinedDetector->addDetector(std::make_shared<JavaPathDetectorMac>("1.8"));
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#if BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
|
||||
# include <fstream>
|
||||
# include <iostream>
|
||||
|
||||
# include "ApplicationSettings.h"
|
||||
# include "FileRegister.h"
|
||||
@@ -107,7 +106,7 @@ void processSourceFile(
|
||||
expectedOutputFilePath);
|
||||
REQUIRE_MESSAGE(
|
||||
("Output does not match the expected line count for file " + sourceFilePath.str() +
|
||||
" in project " + projectName)
|
||||
" in project " + projectName + ". Output was: " + output->getText())
|
||||
.c_str(),
|
||||
expectedOutput->getLineCount() == output->getLineCount());
|
||||
if (expectedOutput->getLineCount() == output->getLineCount())
|
||||
|
||||
@@ -241,7 +241,7 @@ void generateAndCompareExpectedOutput(
|
||||
expectedOutputFilePath);
|
||||
REQUIRE_MESSAGE(
|
||||
("Output does not match the expected line count for project \"" +
|
||||
utility::encodeToUtf8(projectName) + "\".")
|
||||
utility::encodeToUtf8(projectName) + "\". Output was: " + output->getText())
|
||||
.c_str(),
|
||||
expectedOutput->getLineCount() == output->getLineCount());
|
||||
if (expectedOutput->getLineCount() == output->getLineCount())
|
||||
|
||||
Reference in New Issue
Block a user