diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-09-06 10:37:06 +0200 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-09-07 18:01:22 +0000 |
commit | e9c1e7dcbaaa792a406b53c8175f5af1f805979a (patch) | |
tree | f1c01379663f5cd9c0219025b303e48de721fe8a /share | |
parent | 3dba9920dccc555f7d7ab445438ba10c6a3842f4 (diff) |
Split off JdkVersionProbe
...because detecting the JDK's location and version in one probe makes
it impossible to set java.jdkPath in a profile.
Change-Id: Ifc2c87f05021551ef4eb3b3d42785f116cd3c551
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/imports/qbs/Probes/JdkProbe.qbs | 8 | ||||
-rw-r--r-- | share/qbs/imports/qbs/Probes/JdkVersionProbe.qbs | 45 | ||||
-rw-r--r-- | share/qbs/modules/java/JavaModule.qbs | 10 |
3 files changed, 55 insertions, 8 deletions
diff --git a/share/qbs/imports/qbs/Probes/JdkProbe.qbs b/share/qbs/imports/qbs/Probes/JdkProbe.qbs index 78443785c..9eaa3c36c 100644 --- a/share/qbs/imports/qbs/Probes/JdkProbe.qbs +++ b/share/qbs/imports/qbs/Probes/JdkProbe.qbs @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. @@ -46,13 +47,8 @@ PathProbe { "/usr/lib/jvm/default" // Arch ] - // Outputs - property var version - configure: { path = JavaUtils.findJdkPath(hostOS, architecture, environmentPaths, platformPaths); - if (path) - version = JavaUtils.findJdkVersion(FileInfo.joinPaths(path, "bin", "javac")); - found = path && version; + found = !!path; } } diff --git a/share/qbs/imports/qbs/Probes/JdkVersionProbe.qbs b/share/qbs/imports/qbs/Probes/JdkVersionProbe.qbs new file mode 100644 index 000000000..299ebbb01 --- /dev/null +++ b/share/qbs/imports/qbs/Probes/JdkVersionProbe.qbs @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +import qbs +import "../../../modules/java/utils.js" as JavaUtils + +Probe { + // Inputs + property string javac + + // Outputs + property var version + + configure: { + version = JavaUtils.findJdkVersion(javac); + found = !!version; + } +} diff --git a/share/qbs/modules/java/JavaModule.qbs b/share/qbs/modules/java/JavaModule.qbs index fce90de3a..252371684 100644 --- a/share/qbs/modules/java/JavaModule.qbs +++ b/share/qbs/modules/java/JavaModule.qbs @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. @@ -43,6 +43,11 @@ Module { environmentPaths: (jdkPath ? [jdkPath] : []).concat(base) } + Probes.JdkVersionProbe { + id: jdkVersionProbe + javac: compilerFilePath + } + property stringList additionalClassPaths property stringList additionalCompilerFlags property stringList additionalJarFlags @@ -58,7 +63,8 @@ Module { property string jdkPath: jdk.path version: compilerVersion - property string compilerVersion: jdk.version ? jdk.version[1] : undefined + property string compilerVersion: jdkVersionProbe.version + ? jdkVersionProbe.version[1] : undefined property var compilerVersionParts: compilerVersion ? compilerVersion.split(/[\._]/).map(function(item) { return parseInt(item, 10); }) : [] property int compilerVersionMajor: compilerVersionParts[0] property int compilerVersionMinor: compilerVersionParts[1] |