Commit 9b1e2cb4 authored by Eike Ziller's avatar Eike Ziller Committed by Eike Ziller

Add script to create a "dev" package, and allow building against it

Collects all the needed data from a source and build directory,
which then can be used instead of a source directory in combination
with an installed Qt Creator, to build plugins.

On Windows and OS X the plugin can still only built in the same
mode (release or debug) as the used Qt Creator install.

Change-Id: I21119cc0681f1a5f657c969f5d1e7a23d69aedfe
Reviewed-by: default avatarMarco Benelli <marco.benelli@qt.io>
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
parent 9efdfde0
......@@ -88,7 +88,10 @@ IDE_APP_PATH = $$IDE_BUILD_TREE/bin
osx {
IDE_APP_TARGET = "Qt Creator"
IDE_APP_BUNDLE = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app
# check if IDE_BUILD_TREE is actually an existing Qt Creator.app,
# for building against a binary package
exists($$IDE_BUILD_TREE/Contents/MacOS/Qt Creator): IDE_APP_BUNDLE = $$IDE_BUILD_TREE
else: IDE_APP_BUNDLE = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app
# set output path if not set manually
isEmpty(IDE_OUTPUT_PATH): IDE_OUTPUT_PATH = $$IDE_APP_BUNDLE/Contents
......@@ -145,10 +148,17 @@ osx {
}
INCLUDEPATH += \
$$IDE_BUILD_TREE/src \ # for <app/app_version.h>
$$IDE_BUILD_TREE/src \ # for <app/app_version.h> in case of actual build directory
$$IDE_SOURCE_TREE/src \ # for <app/app_version.h> in case of binary package with dev package
$$IDE_SOURCE_TREE/src/libs \
$$IDE_SOURCE_TREE/tools
win32:exists($$IDE_SOURCE_TREE/lib/qtcreator) {
# for .lib in case of binary package with dev package
LIBS *= -L$$IDE_SOURCE_TREE/lib/qtcreator
LIBS *= -L$$IDE_SOURCE_TREE/lib/qtcreator/plugins
}
QTC_PLUGIN_DIRS_FROM_ENVIRONMENT = $$(QTC_PLUGIN_DIRS)
QTC_PLUGIN_DIRS += $$split(QTC_PLUGIN_DIRS_FROM_ENVIRONMENT, $$QMAKE_DIRLIST_SEP)
QTC_PLUGIN_DIRS += $$IDE_SOURCE_TREE/src/plugins
......
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# 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 https://www.qt.io/terms-conditions. For further
# information use the contact form at https://www.qt.io/contact-us.
#
# GNU General Public License Usage
# Alternatively, this file may be used under the terms of the GNU
# General Public License version 3 as published by the Free Software
# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
# included in the packaging of this file. Please review the following
# information to ensure the GNU General Public License requirements will
# be met: https://www.gnu.org/licenses/gpl-3.0.html.
#
############################################################################
import argparse
import os
import re
import subprocess
import sys
import common
# ========= COMMAND LINE ARGUMENTS ========
def parse_arguments():
parser = argparse.ArgumentParser(description="Create Qt Creator development package.")
parser.add_argument('--source', '-s', help='path to the Qt Creator sources', required=True,
metavar='<path>')
parser.add_argument('--build', '-b', help='path to the Qt Creator build', required=True,
metavar='<path>')
parser.add_argument('--verbose', '-v', help='verbose output', action='store_true', default=False)
parser.add_argument('--7z', help='path to 7z binary',
default='7z.exe' if common.is_windows_platform() else '7z',
metavar='<7z_binary>', dest='sevenzip')
parser.add_argument('--7z_out', '-o', help='output 7z file to create', metavar='<filename>',
dest='sevenzip_target')
parser.add_argument('target_directory')
return parser.parse_args()
# ========= PATTERNS TO INCLUDE ===========
# slash at the end matches directories, no slash at the end matches files
source_include_patterns = [
# directories
r"^scripts/.*$", # everything under scripts/
r"^src/(.*/)?$", # all directories under src/
# files
r"^HACKING$",
r"^LICENSE.*$",
r"^README.md$",
r"^qtcreator.pri$",
r"^qtcreatordata.pri$",
r"^src/qtcreatorplugin.pri$",
r"^src/qtcreatorlibrary.pri$",
r"^src/qtcreatortool.pri$",
r"^src/rpath.pri$",
r"^.*\.h$",
r"^.*_dependencies.pri$",
]
build_include_patterns = [
# directories
r"^src/$",
r"^src/app/$",
# files
r"^src/app/app_version.h$"
]
if common.is_windows_platform():
build_include_patterns.extend([
r"^lib/(.*/)?$", # consider all directories under lib/
r"^lib/.*\.lib$"
])
# =========================================
def copy_regexp(regexp, source_directory, target_directory, verbose):
def ignore(directory, filenames):
relative_dir = os.path.relpath(directory, source_directory)
file_target_dir = os.path.join(target_directory, relative_dir)
ignored = []
for filename in filenames:
relative_file_path = os.path.normpath(os.path.join(relative_dir, filename))
relative_file_path = relative_file_path.replace(os.sep, '/')
if os.path.isdir(os.path.join(directory, filename)):
relative_file_path += '/' # let directories end with slash
if not regexp.match(relative_file_path):
ignored.append(filename)
elif verbose and os.path.isfile(os.path.join(directory, filename)):
print(os.path.normpath(os.path.join(file_target_dir, filename)))
return ignored
common.copytree(source_directory, target_directory, symlinks=True, ignore=ignore)
def sanity_check_arguments(arguments):
if not os.path.isfile(os.path.join(arguments.source, 'qtcreator.pri')):
print('error: did not find qtcreator.pri at "{0}"'.format(arguments.source))
return False
if not os.path.isfile(os.path.join(arguments.build, 'src', 'app', 'app_version.h')):
print('error: did not find src/app/app_version.h at "{0}"'.format(arguments.build))
return False
if os.path.exists(arguments.target_directory) and (os.path.isfile(arguments.target_directory)
or len(os.listdir(arguments.target_directory)) > 0):
print('error: target directory "{0}" exists and is not empty'.format(arguments.target_directory))
return False
return True
def main():
arguments = parse_arguments()
if not sanity_check_arguments(arguments):
sys.exit(1)
source_include_regexp = re.compile('(' + ')|('.join(source_include_patterns) + ')')
build_include_regexp = re.compile('(' + ')|('.join(build_include_patterns) + ')')
copy_regexp(source_include_regexp, arguments.source, arguments.target_directory, arguments.verbose)
copy_regexp(build_include_regexp, arguments.build, arguments.target_directory, arguments.verbose)
if arguments.sevenzip_target:
subprocess.check_call([arguments.sevenzip, 'a', '-mx9', arguments.sevenzip_target,
os.path.join(arguments.target_directory, '*')])
if __name__ == "__main__":
main()
......@@ -10,13 +10,15 @@ HEADERS += %PluginName:l%plugin.%CppHeaderSuffix% \
# Qt Creator linking
## set the QTC_SOURCE environment variable to override the setting here
QTCREATOR_SOURCES = $$(QTC_SOURCE)
isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=%QtCreatorSources%
## Either set the IDE_SOURCE_TREE when running qmake,
## or set the QTC_SOURCE environment variable, to override the default setting
isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE)
isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = "%QtCreatorSources%"
## set the QTC_BUILD environment variable to override the setting here
IDE_BUILD_TREE = $$(QTC_BUILD)
isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=%QtCreatorBuild%
## Either set the IDE_BUILD_TREE when running qmake,
## or set the QTC_BUILD environment variable, to override the default setting
isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD)
isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = "%QtCreatorBuild%"
## uncomment to build plugin into user config directory
## <localappdata>/plugins/<ideversion>
......@@ -42,4 +44,4 @@ QTC_PLUGIN_RECOMMENDS += \
###### End _dependencies.pri contents ######
include($$QTCREATOR_SOURCES/src/qtcreatorplugin.pri)
include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment