diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-08-14 16:18:42 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-08-14 16:18:42 +0200 |
commit | 187c114987572f5492722b4d66b76366e3e50365 (patch) | |
tree | bc2bff3a99b333433f09537bc0b9c5fc709057e0 | |
parent | 6144279d346670130e0ecdfaf789beaa44cd6755 (diff) | |
parent | adc28c434853cf0fa17e95cc207e5a1c6eb761de (diff) |
Merge 1.9 into master
Change-Id: I6da76b0a53bf87105c4e7b48724d9760cb68e831
68 files changed, 642 insertions, 252 deletions
diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index 9cdb19f7a..9f3919e2f 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -72,6 +72,18 @@ \endlist \li \l{How-tos} \li \l{Reference} + \list + \li \l{List of All Items} + \list + \li \l{List of Language Items} + \li \l{List of Convenience Items} + \endlist + \li \l{List of Built-in Services} + \li \l{List of Command-line Tools} + \li \l{List of Modules} + \li \l{Command and JavaScriptCommand} + \endlist + \li \l{Appendix A: Building Qbs} \endlist */ diff --git a/examples/code-generator/code-generator.qbs b/examples/code-generator/code-generator.qbs index ebdb50bb4..df15dec5e 100644 --- a/examples/code-generator/code-generator.qbs +++ b/examples/code-generator/code-generator.qbs @@ -53,8 +53,8 @@ Project { // A code generator that outputs a "Hello World" C++ program. CppApplication { name: "hwgen" + consoleApplication: true files: ["hwgen.cpp"] - bundle.isBundle: false } // Generate and build a hello-world application. diff --git a/examples/install-bundle/install-bundle.qbs b/examples/install-bundle/install-bundle.qbs index 5659f3c72..3151f5517 100644 --- a/examples/install-bundle/install-bundle.qbs +++ b/examples/install-bundle/install-bundle.qbs @@ -8,7 +8,8 @@ Project { Depends { name: "Qt"; submodules: ["core", "gui", "widgets"] } name: "window" - targetName: bundle.isBundle ? "Window" : "window" + property bool isBundle: qbs.targetOS.contains("darwin") && bundle.isBundle + targetName: isBundle ? "Window" : "window" files: [ "main.cpp", "assetcatalog1.xcassets", @@ -19,9 +20,9 @@ Project { ] Group { - fileTagsFilter: bundle.isBundle ? ["bundle.content"] : ["application"] + fileTagsFilter: isBundle ? ["bundle.content"] : ["application"] qbs.install: true - qbs.installDir: bundle.isBundle ? "Applications" : (qbs.targetOS.contains("windows") ? "" : "bin") + qbs.installDir: isBundle ? "Applications" : (qbs.targetOS.contains("windows") ? "" : "bin") qbs.installSourceBase: product.buildDirectory } } @@ -30,13 +31,14 @@ Project { Depends { name: "cpp" } name: "coreutils" - targetName: bundle.isBundle ? "CoreUtils" : "coreutils" + property bool isBundle: qbs.targetOS.contains("darwin") && bundle.isBundle + targetName: isBundle ? "CoreUtils" : "coreutils" files: ["coreutils.cpp", "coreutils.h"] Group { - fileTagsFilter: bundle.isBundle ? ["bundle.content"] : ["dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_import"] + fileTagsFilter: isBundle ? ["bundle.content"] : ["dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_import"] qbs.install: true - qbs.installDir: bundle.isBundle ? "Library/Frameworks" : (qbs.targetOS.contains("windows") ? "" : "lib") + qbs.installDir: isBundle ? "Library/Frameworks" : (qbs.targetOS.contains("windows") ? "" : "lib") qbs.installSourceBase: product.buildDirectory } } diff --git a/qbs-resources/imports/QbsLibrary.qbs b/qbs-resources/imports/QbsLibrary.qbs index b459b4c8c..3b884ed5d 100644 --- a/qbs-resources/imports/QbsLibrary.qbs +++ b/qbs-resources/imports/QbsLibrary.qbs @@ -2,7 +2,6 @@ import qbs QbsProduct { Depends { name: "cpp" } - Depends { name: "bundle" } version: qbsversion.version type: Qt.core.staticBuild ? "staticlibrary" : "dynamiclibrary" targetName: (qbs.enableDebugCode && qbs.targetOS.contains("windows")) ? (name + 'd') : name @@ -13,7 +12,6 @@ QbsProduct { //cpp.soVersion: version.replace(/\.\d+$/, '') cpp.visibility: "minimal" cpp.cxxLanguageVersion: "c++11" - bundle.isBundle: false property bool visibilityType: Qt.core.staticBuild ? "static" : "dynamic" property string headerInstallPrefix: "/include/qbs" Group { @@ -27,6 +25,11 @@ QbsProduct { qbs.installDir: qbsbuildconfig.importLibInstallDir } + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } + Export { Depends { name: "cpp" } Depends { name: "Qt"; submodules: ["core"] } diff --git a/share/qbs/modules/cli/CLIModule.qbs b/share/qbs/modules/cli/CLIModule.qbs index 3b4ce8693..5c708a482 100644 --- a/share/qbs/modules/cli/CLIModule.qbs +++ b/share/qbs/modules/cli/CLIModule.qbs @@ -5,9 +5,11 @@ import qbs.ModUtils import "cli.js" as CLI Module { - Depends { name: "bundle" } - - bundle.isBundle: false + Depends { name: "bundle"; condition: qbs.targetOS.contains("darwin") } + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } condition: false diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs index 317d9d782..ec36f960d 100644 --- a/share/qbs/modules/cpp/DarwinGCC.qbs +++ b/share/qbs/modules/cpp/DarwinGCC.qbs @@ -181,14 +181,14 @@ UnixGCC { // Set the corresponding environment variable even if the minimum OS version is undefined, // because this indicates the default deployment target for that OS - if (qbs.targetOS.contains("ios")) - env["IPHONEOS_DEPLOYMENT_TARGET"] = minimumIosVersion || ""; - if (qbs.targetOS.contains("macos")) - env["MACOSX_DEPLOYMENT_TARGET"] = minimumMacosVersion || ""; - if (qbs.targetOS.contains("watchos")) - env["WATCHOS_DEPLOYMENT_TARGET"] = minimumWatchosVersion || ""; - if (qbs.targetOS.contains("tvos")) - env["TVOS_DEPLOYMENT_TARGET"] = minimumTvosVersion || ""; + if (qbs.targetOS.contains("ios") && minimumIosVersion) + env["IPHONEOS_DEPLOYMENT_TARGET"] = minimumIosVersion; + if (qbs.targetOS.contains("macos") && minimumMacosVersion) + env["MACOSX_DEPLOYMENT_TARGET"] = minimumMacosVersion; + if (qbs.targetOS.contains("watchos") && minimumWatchosVersion) + env["WATCHOS_DEPLOYMENT_TARGET"] = minimumWatchosVersion; + if (qbs.targetOS.contains("tvos") && minimumTvosVersion) + env["TVOS_DEPLOYMENT_TARGET"] = minimumTvosVersion; if (xcode.present) env["TARGETED_DEVICE_FAMILY"] = DarwinTools.targetedDeviceFamily(xcode.targetDevices); diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 722ac7438..638882aa7 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -46,7 +46,7 @@ CppModule { Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath - names: [compilerName] + names: [toolchainPrefix ? toolchainPrefix + compilerName : compilerName] } // Find the version as early as possible in case other things depend on it, diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs index 1b19bb06b..fec31cf3f 100644 --- a/share/qbs/modules/cpp/windows-mingw.qbs +++ b/share/qbs/modules/cpp/windows-mingw.qbs @@ -53,13 +53,13 @@ GenericGCC { property path windresPath: { return toolchainPathPrefix + windresName } setupBuildEnvironment: { - var v = new ModUtils.EnvironmentVariable("PATH", ";", true); + var v = new ModUtils.EnvironmentVariable("PATH", qbs.pathListSeparator, true); v.prepend(toolchainInstallPath); v.set(); } setupRunEnvironment: { - var v = new ModUtils.EnvironmentVariable("PATH", ";", true); + var v = new ModUtils.EnvironmentVariable("PATH", qbs.pathListSeparator, true); v.prepend(toolchainInstallPath); v.set(); } diff --git a/src/3rdparty/python/lib/python2.7/site-packages/biplist/__init__.py b/src/3rdparty/python/lib/python2.7/site-packages/biplist/__init__.py index 9cab05ec3..17d35178d 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/biplist/__init__.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/biplist/__init__.py @@ -507,6 +507,9 @@ class StringWrapper(object): else: return len(self.encodedValue)//2 + def __lt__(self, other): + return self.encodedValue < other.encodedValue + @property def encodingMarker(self): if self.encoding == 'ascii': @@ -770,7 +773,7 @@ class PlistWriter(object): output += proc_variable_length(0b1010, len(obj)) objectsToWrite = [] - for objRef in obj: + for objRef in sorted(obj) if isinstance(obj, set) else obj: (isNew, output) = self.writeObjectReference(objRef, output) if isNew: objectsToWrite.append(objRef) @@ -781,7 +784,7 @@ class PlistWriter(object): keys = [] values = [] objectsToWrite = [] - for key, value in iteritems(obj): + for key, value in sorted(iteritems(obj)): keys.append(key) values.append(value) for key in keys: diff --git a/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json index 6b0df2d21..266e9dd89 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json +++ b/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json @@ -5,8 +5,8 @@ "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "biplist is a library for reading/writing binary plists.", "Homepage": "https://bitbucket.org/wooster/biplist", - "Version": "1.0.1", - "License": "BSD 3-clause "New" or "Revised" License", + "Version": "1.0.2", + "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", "Copyright": "Copyright (c) 2010, Andrew Wooster" diff --git a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py index 91f5e6c24..9ffcd3790 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py @@ -127,8 +127,9 @@ def load_json(filename, settings): settings['symlinks'] = symlinks settings['icon_locations'] = icon_locations -def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDPI=True): - settings = { +def build_dmg(filename, volume_name, settings_file=None, settings={}, + defines={}, lookForHiDPI=True): + options = { # Default settings 'filename': filename, 'volume_name': volume_name, @@ -199,26 +200,30 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP if settings_file: # We now support JSON settings files using appdmg's format if settings_file.endswith('.json'): - load_json(settings_file, settings) + load_json(settings_file, options) else: - load_settings(settings_file, settings) + load_settings(settings_file, options) + + # Add any overrides + options.update(settings) # Set up the finder data - bounds = settings['window_rect'] + bounds = options['window_rect'] + bounds_string = '{{%s, %s}, {%s, %s}}' % (bounds[0][0], + bounds[0][1], + bounds[1][0], + bounds[1][1]) bwsp = { - b'ShowStatusBar': settings['show_status_bar'], - b'WindowBounds': b'{{%s, %s}, {%s, %s}}' % (bounds[0][0], - bounds[0][1], - bounds[1][0], - bounds[1][1]), - b'ContainerShowSidebar': False, - b'PreviewPaneVisibility': False, - b'SidebarWidth': settings['sidebar_width'], - b'ShowTabView': settings['show_tab_view'], - b'ShowToolbar': settings['show_toolbar'], - b'ShowPathbar': settings['show_pathbar'], - b'ShowSidebar': settings['show_sidebar'] + 'ShowStatusBar': options['show_status_bar'], + 'WindowBounds': bounds_string.encode('utf-8'), + 'ContainerShowSidebar': False, + 'PreviewPaneVisibility': False, + 'SidebarWidth': options['sidebar_width'], + 'ShowTabView': options['show_tab_view'], + 'ShowToolbar': options['show_toolbar'], + 'ShowPathbar': options['show_pathbar'], + 'ShowSidebar': options['show_sidebar'] } arrange_options = { @@ -233,25 +238,25 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP } icvp = { - b'viewOptionsVersion': 1, - b'backgroundType': 0, - b'backgroundColorRed': 1.0, - b'backgroundColorGreen': 1.0, - b'backgroundColorBlue': 1.0, - b'gridOffsetX': float(settings['grid_offset'][0]), - b'gridOffsetY': float(settings['grid_offset'][1]), - b'gridSpacing': float(settings['grid_spacing']), - b'arrangeBy': str(arrange_options.get(settings['arrange_by'], 'none')), - b'showIconPreview': settings['show_icon_preview'] == True, - b'showItemInfo': settings['show_item_info'] == True, - b'labelOnBottom': settings['label_pos'] == 'bottom', - b'textSize': float(settings['text_size']), - b'iconSize': float(settings['icon_size']), - b'scrollPositionX': float(settings['scroll_position'][0]), - b'scrollPositionY': float(settings['scroll_position'][1]) + 'viewOptionsVersion': 1, + 'backgroundType': 0, + 'backgroundColorRed': 1.0, + 'backgroundColorGreen': 1.0, + 'backgroundColorBlue': 1.0, + 'gridOffsetX': float(options['grid_offset'][0]), + 'gridOffsetY': float(options['grid_offset'][1]), + 'gridSpacing': float(options['grid_spacing']), + 'arrangeBy': str(arrange_options.get(options['arrange_by'], 'none')), + 'showIconPreview': options['show_icon_preview'] == True, + 'showItemInfo': options['show_item_info'] == True, + 'labelOnBottom': options['label_pos'] == 'bottom', + 'textSize': float(options['text_size']), + 'iconSize': float(options['icon_size']), + 'scrollPositionX': float(options['scroll_position'][0]), + 'scrollPositionY': float(options['scroll_position'][1]) } - background = settings['background'] + background = options['background'] columns = { 'name': 'name', @@ -293,25 +298,25 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP } lsvp = { - b'viewOptionsVersion': 1, - b'sortColumn': columns.get(settings['list_sort_by'], 'name'), - b'textSize': float(settings['list_text_size']), - b'iconSize': float(settings['list_icon_size']), - b'showIconPreview': settings['show_icon_preview'], - b'scrollPositionX': settings['list_scroll_position'][0], - b'scrollPositionY': settings['list_scroll_position'][1], - b'useRelativeDates': settings['list_use_relative_dates'], - b'calculateAllSizes': settings['list_calculate_all_sizes'], + 'viewOptionsVersion': 1, + 'sortColumn': columns.get(options['list_sort_by'], 'name'), + 'textSize': float(options['list_text_size']), + 'iconSize': float(options['list_icon_size']), + 'showIconPreview': options['show_icon_preview'], + 'scrollPositionX': options['list_scroll_position'][0], + 'scrollPositionY': options['list_scroll_position'][1], + 'useRelativeDates': options['list_use_relative_dates'], + 'calculateAllSizes': options['list_calculate_all_sizes'], } lsvp['columns'] = {} cndx = {} - for n, column in enumerate(settings['list_columns']): + for n, column in enumerate(options['list_columns']): cndx[column] = n - width = settings['list_column_widths'].get(column, + width = options['list_column_widths'].get(column, default_widths[column]) - asc = 'ascending' == settings['list_column_sort_directions'].get(column, + asc = 'ascending' == options['list_column_sort_directions'].get(column, default_sort_directions[column]) lsvp['columns'][columns[column]] = { @@ -322,7 +327,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP 'ascending': asc } - n = len(settings['list_columns']) + n = len(options['list_columns']) for k in iterkeys(columns): if cndx.get(k, None) is None: cndx[k] = n @@ -339,7 +344,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP n += 1 - default_view = settings['default_view'] + default_view = options['default_view'] views = { 'icon-view': b'icnv', 'column-view': b'clmv', @@ -350,14 +355,14 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP icvl = (b'type', views.get(default_view, 'icnv')) include_icon_view_settings = default_view == 'icon-view' \ - or settings['include_icon_view_settings'] not in \ + or options['include_icon_view_settings'] not in \ ('auto', 'no', 0, False, None) include_list_view_settings = default_view in ('list-view', 'coverflow') \ - or settings['include_list_view_settings'] not in \ + or options['include_list_view_settings'] not in \ ('auto', 'no', 0, False, None) - filename = settings['filename'] - volume_name = settings['volume_name'] + filename = options['filename'] + volume_name = options['volume_name'] # Construct a writeable image to start with dirname, basename = os.path.split(os.path.realpath(filename)) @@ -366,7 +371,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP writableFile = tempfile.NamedTemporaryFile(dir=dirname, prefix='.temp', suffix=basename) - total_size = settings['size'] + total_size = options['size'] if total_size == None: # Start with a size of 128MB - this way we don't need to calculate the # size of the background image, volume icon, and .DS_Store file (and @@ -377,7 +382,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP def roundup(x, n): return x if x % n == 0 else x + n - x % n - for path in settings['files']: + for path in options['files']: if isinstance(path, tuple): path = path[0] @@ -389,7 +394,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP else: total_size += roundup(os.lstat(path).st_size, 4096) - for name,target in iteritems(settings['symlinks']): + for name,target in iteritems(options['symlinks']): total_size += 4096 total_size = str(max(total_size / 1024, 1024)) + 'K' @@ -420,9 +425,9 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP device = info['dev-entry'] mount_point = info['mount-point'] - icon = settings['icon'] + icon = options['icon'] if badge: - badge_icon = settings['badge_icon'] + badge_icon = options['badge_icon'] else: badge_icon = None icon_target_path = os.path.join(mount_point, '.VolumeIcon.icns') @@ -491,7 +496,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP 'resources/' + background + '.tiff') path_in_image = os.path.join(mount_point, '.background.tiff') - with open(path_in_image, 'w') as f: + with open(path_in_image, 'wb') as f: f.write(tiffdata) else: raise ValueError('background file "%s" not found' % background) @@ -502,7 +507,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP icvp['backgroundType'] = 2 icvp['backgroundImageAlias'] = biplist.Data(alias.to_bytes()) - for f in settings['files']: + for f in options['files']: if isinstance(f, tuple): f_in_image = os.path.join(mount_point, f[1]) f = f[0] @@ -513,13 +518,13 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP # use system ditto command to preserve code signing, etc. subprocess.call(['/usr/bin/ditto', f, f_in_image]) - for name,target in iteritems(settings['symlinks']): + for name,target in iteritems(options['symlinks']): name_in_image = os.path.join(mount_point, name) os.symlink(target, name_in_image) - userfn = settings.get('create_hook', None) + userfn = options.get('create_hook', None) if callable(userfn): - userfn(mount_point, settings) + userfn(mount_point, options) image_dsstore = os.path.join(mount_point, '.DS_Store') @@ -534,7 +539,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP d['.']['lsvp'] = lsvp d['.']['icvl'] = icvl - for k,v in iteritems(settings['icon_locations']): + for k,v in iteritems(options['icon_locations']): d[k]['Iloc'] = v # Delete .Trashes, if it gets created @@ -561,30 +566,30 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP raise DMGError('Unable to shrink') key_prefix = {'UDZO': 'zlib', 'UDBZ': 'bzip2', 'ULFO': 'lzfse'} - compression_level = settings['compression_level'] - if settings['format'] in key_prefix and compression_level: + compression_level = options['compression_level'] + if options['format'] in key_prefix and compression_level: compression_args = [ '-imagekey', - key_prefix[settings['format']] + '-level=' + str(compression_level) + key_prefix[options['format']] + '-level=' + str(compression_level) ] else: compression_args = [] ret, output = hdiutil('convert', writableFile.name, - '-format', settings['format'], + '-format', options['format'], '-ov', '-o', filename, *compression_args) if ret: raise DMGError('Unable to convert') - if settings['license']: + if options['license']: ret, output = hdiutil('unflatten', '-quiet', filename, plist=False) if ret: raise DMGError('Unable to unflatten to add license') - licensing.add_license(filename, settings['license']) + licensing.add_license(filename, options['license']) ret, output = hdiutil('flatten', '-quiet', filename, plist=False) diff --git a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json index 9f318e6d2..d9f97ae2c 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json +++ b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json @@ -4,8 +4,8 @@ "QDocModule": "qbs", "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "macOS command line utility to build disk images", - "Homepage": "https://bitbucket.org/al45tair/dmgbuild", - "Version": "1.3.0~16", + "Homepage": "https://github.com/al45tair/dmgbuild", + "Version": "1.3.1", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py index a94ab6e22..320768cd3 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py @@ -158,7 +158,7 @@ class Allocator(object): count = self._root.read('>I')[0] for n in range(count): nlen = self._root.read('B')[0] - name = str(self._root.read(nlen)) + name = bytes(self._root.read(nlen)) value = self._root.read('>I')[0] self._toc[name] = value @@ -347,9 +347,8 @@ class Allocator(object): block.write('>I', len(keys)) for k in keys: - b = k.encode('utf-8') - block.write('B', len(b)) - block.write(b) + block.write('B', len(k)) + block.write(k) block.write('>I', self._toc[k]) # Free list @@ -445,17 +444,23 @@ class Allocator(object): def __getitem__(self, key): if not isinstance(key, (str, unicode)): raise TypeError('Keys must be of string type') + if not isinstance(key, bytes): + key = key.encode('latin_1') return self._toc[key] def __setitem__(self, key, value): if not isinstance(key, (str, unicode)): raise TypeError('Keys must be of string type') + if not isinstance(key, bytes): + key = key.encode('latin_1') self._toc[key] = value self._dirty = True def __delitem__(self, key): if not isinstance(key, (str, unicode)): raise TypeError('Keys must be of string type') + if not isinstance(key, bytes): + key = key.encode('latin_1') del self._toc[key] self._dirty = True @@ -464,7 +469,7 @@ class Allocator(object): def keys(self): return iterkeys(self._toc) - + def __iter__(self): return iterkeys(self._toc) diff --git a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json index dda98b937..a4854d1ed 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json +++ b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json @@ -4,8 +4,8 @@ "QDocModule": "qbs", "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "Manipulate Finder .DS_Store files from Python", - "Homepage": "https://bitbucket.org/al45tair/ds_store", - "Version": "1.1.0", + "Homepage": "https://github.com/al45tair/ds_store", + "Version": "1.1.2", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py index bf680d77a..b6f805b24 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py @@ -55,12 +55,12 @@ class BookmarkCodec(object): # .DS_Store file. This is really a convenience, and we currently only # support a tiny subset of the possible entry types. codecs = { - 'Iloc': ILocCodec, - 'bwsp': PlistCodec, - 'lsvp': PlistCodec, - 'lsvP': PlistCodec, - 'icvp': PlistCodec, - 'pBBk': BookmarkCodec + b'Iloc': ILocCodec, + b'bwsp': PlistCodec, + b'lsvp': PlistCodec, + b'lsvP': PlistCodec, + b'icvp': PlistCodec, + b'pBBk': BookmarkCodec } class DSStoreEntry(object): @@ -76,6 +76,10 @@ class DSStoreEntry(object): def __init__(self, filename, code, typecode, value=None): if str != bytes and type(filename) == bytes: filename = filename.decode('utf-8') + + if not isinstance(code, bytes): + code = code.encode('latin_1') + self.filename = filename self.code = code self.type = typecode @@ -187,25 +191,28 @@ class DSStoreEntry(object): utf16 = self.filename.encode('utf-16be') l = 4 + len(utf16) + 8 - if isinstance(self.type, (str, unicode)): + if isinstance(self.type, unicode): + entry_type = self.type.encode('latin_1') + value = self.value + elif isinstance(self.type, (bytes, str)): entry_type = self.type value = self.value else: - entry_type = 'blob' + entry_type = b'blob' value = self.type.encode(self.value) - if entry_type == 'bool': + if entry_type == b'bool': l += 1 - elif entry_type == 'long' or entry_type == 'shor': + elif entry_type == b'long' or entry_type == b'shor': l += 4 - elif entry_type == 'blob': + elif entry_type == b'blob': l += 4 + len(value) - elif entry_type == 'ustr': + elif entry_type == b'ustr': utf16 = value.encode('utf-16be') l += 4 + len(utf16) - elif entry_type == 'type': + elif entry_type == b'type': l += 4 - elif entry_type == 'comp' or entry_type == 'dutc': + elif entry_type == b'comp' or entry_type == b'dutc': l += 8 else: raise ValueError('Unknown type code "%s"' % entry_type) @@ -218,33 +225,38 @@ class DSStoreEntry(object): w = block.insert else: w = block.write - - if isinstance(self.type, (str, unicode)): + + if isinstance(self.type, unicode): + entry_type = self.type.encode('latin_1') + value = self.value + elif isinstance(self.type, (bytes, str)): entry_type = self.type value = self.value else: - entry_type = 'blob' + entry_type = b'blob' value = self.type.encode(self.value) - + utf16 = self.filename.encode('utf-16be') w(b'>I', len(utf16) // 2) w(utf16) - w(b'>4s4s', self.code.encode('utf-8'), entry_type.encode('utf-8')) + w(b'>4s4s', self.code, entry_type) - if entry_type == 'bool': + if entry_type == b'bool': w(b'>?', value) - elif entry_type == 'long' or entry_type == 'shor': + elif entry_type == b'long' or entry_type == b'shor': w(b'>I', value) - elif entry_type == 'blob': + elif entry_type == b'blob': w(b'>I', len(value)) w(value) - elif entry_type == 'ustr': + elif entry_type == b'ustr': utf16 = value.encode('utf-16be') w(b'>I', len(utf16) // 2) w(utf16) - elif entry_type == 'type': - w(b'>4s', value.encode('utf-8')) - elif entry_type == 'comp' or entry_type == 'dutc': + elif entry_type == b'type': + if isinstance(value, unicode): + value = value.encode('latin_1') + w(b'>4s', value) + elif entry_type == b'comp' or entry_type == b'dutc': w(b'>Q', value) else: raise ValueError('Unknown type code "%s"' % entry_type) @@ -1134,6 +1146,8 @@ class DSStore(object): # Find implementation def _find(self, node, filename_lc, code=None): + if not isinstance(code, bytes): + code = code.encode('latin_1') with self._get_block(node) as block: next_node, count = block.read(b'>II') if next_node: @@ -1189,14 +1203,17 @@ class DSStore(object): def __getitem__(self, code): if code is None: raise KeyError('no such key - [%s][None]' % self._filename) - + + if not isinstance(code, bytes): + code = code.encode('latin_1') + try: item = next(self._store.find(self._filename, code)) except StopIteration: raise KeyError('no such key - [%s][%s]' % (self._filename, code)) - if not isinstance(item.type, (str, unicode)): + if not isinstance(item.type, (bytes, str, unicode)): return item.value return (item.type, item.value) @@ -1205,6 +1222,9 @@ class DSStore(object): if code is None: raise KeyError('bad key - [%s][None]' % self._filename) + if not isinstance(code, bytes): + code = code.encode('latin_1') + codec = codecs.get(code, None) if codec: entry_type = codec diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py index b35f4029b..512d2221b 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py @@ -14,6 +14,11 @@ import sys if sys.platform == 'darwin': from . import osx +try: + long +except NameError: + long = int + from .utils import * ALIAS_KIND_FILE = 0 @@ -30,6 +35,16 @@ ALIAS_EJECTABLE_DISK = 5 ALIAS_NO_CNID = 0xffffffff +def encode_utf8(s): + if isinstance(s, bytes): + return s + return s.encode('utf-8') + +def decode_utf8(s): + if isinstance(s, bytes): + return s.decode('utf-8') + return s + class AppleShareInfo (object): def __init__(self, zone=None, server=None, user=None): #: The AppleShare zone @@ -323,6 +338,8 @@ class Alias (object): """Create an :class:`Alias` that points at the specified file.""" if sys.platform != 'darwin': raise Exception('Not implemented (requires special support)') + + path = encode_utf8(path) a = Alias() @@ -337,7 +354,7 @@ class Alias (object): volinfo = osx.getattrlist(vol_path, attrs, 0) vol_crtime = volinfo[0] - vol_name = volinfo[1] + vol_name = encode_utf8(volinfo[1]) # Also grab various attributes of the file attrs = [(osx.ATTR_CMN_OBJTYPE @@ -357,7 +374,7 @@ class Alias (object): dirname, filename = os.path.split(path) - if dirname == '' or dirname == '.': + if dirname == b'' or dirname == b'.': dirname = os.getcwd() foldername = os.path.basename(dirname) @@ -382,10 +399,10 @@ class Alias (object): rel_path = os.path.relpath(path, vol_path) # Leave off the initial '/' if vol_path is '/' (no idea why) - if vol_path == '/': + if vol_path == b'/': a.target.posix_path = rel_path else: - a.target.posix_path = '/' + rel_path + a.target.posix_path = b'/' + rel_path # Construct the Carbon and CNID paths carbon_path = [] @@ -398,10 +415,11 @@ class Alias (object): attrs = [osx.ATTR_CMN_FILEID, 0, 0, 0, 0] info = osx.getattrlist(os.path.join(vol_path, head), attrs, 0) cnid_path.append(info[0]) - carbon_tail = tail.replace(':','/') + carbon_tail = tail.replace(b':',b'/') carbon_path.insert(0, carbon_tail) head, tail = os.path.split(head) - carbon_path = vol_name + ':' + ':\0'.join(carbon_path) + + carbon_path = vol_name + b':' + b':\0'.join(carbon_path) a.target.carbon_path = carbon_path a.target.cnid_path = cnid_path @@ -413,8 +431,8 @@ class Alias (object): pos = b.tell() b.write(struct.pack(b'>4shh', self.appinfo, 0, self.version)) - carbon_volname = self.volume.name.replace(':','/').encode('utf-8') - carbon_filename = self.target.filename.replace(':','/').encode('utf-8') + carbon_volname = encode_utf8(self.volume.name).replace(b':',b'/') + carbon_filename = encode_utf8(self.target.filename).replace(b':',b'/') voldate = (self.volume.creation_date - mac_epoch).total_seconds() crdate = (self.target.creation_date - mac_epoch).total_seconds() @@ -422,13 +440,13 @@ class Alias (object): # (so doing so is ridiculous, and nothing could rely on it). b.write(struct.pack(b'>h28pI2shI64pII4s4shhI2s10s', self.target.kind, - carbon_volname, voldate, + carbon_volname, int(voldate), self.volume.fs_type, self.volume.disk_type, self.target.folder_cnid, carbon_filename, self.target.cnid, - crdate, + int(crdate), self.target.creator_code, self.target.type_code, self.target.levels_from, @@ -439,8 +457,8 @@ class Alias (object): # Excuse the odd order; we're copying Finder if self.target.folder_name: - carbon_foldername = self.target.folder_name.replace(':','/')\ - .encode('utf-8') + carbon_foldername = encode_utf8(self.target.folder_name)\ + .replace(b':',b'/') b.write(struct.pack(b'>hh', TAG_CARBON_FOLDER_NAME, len(carbon_foldername))) b.write(carbon_foldername) @@ -461,7 +479,7 @@ class Alias (object): b.write(cnid_path) if self.target.carbon_path: - carbon_path=self.target.carbon_path.encode('utf-8') + carbon_path=encode_utf8(self.target.carbon_path) b.write(struct.pack(b'>hh', TAG_CARBON_PATH, len(carbon_path))) b.write(carbon_path) @@ -490,7 +508,7 @@ class Alias (object): b.write(b'\0') if self.volume.driver_name: - driver_name = self.volume.driver_name.encode('utf-8') + driver_name = encode_utf8(self.volume.driver_name) b.write(struct.pack(b'>hh', TAG_DRIVER_NAME, len(driver_name))) b.write(driver_name) @@ -511,20 +529,22 @@ class Alias (object): if len(self.volume.network_mount_info) & 1: b.write(b'\0') - utf16 = self.target.filename.replace(':','/').encode('utf-16-be') + utf16 = decode_utf8(self.target.filename)\ + .replace(':','/').encode('utf-16-be') b.write(struct.pack(b'>hhh', TAG_UNICODE_FILENAME, len(utf16) + 2, len(utf16) // 2)) b.write(utf16) - utf16 = self.volume.name.replace(':','/').encode('utf-16-be') + utf16 = decode_utf8(self.volume.name)\ + .replace(':','/').encode('utf-16-be') b.write(struct.pack(b'>hhh', TAG_UNICODE_VOLUME_NAME, len(utf16) + 2, len(utf16) // 2)) b.write(utf16) if self.target.posix_path: - posix_path = self.target.posix_path.encode('utf-8') + posix_path = encode_utf8(self.target.posix_path) b.write(struct.pack(b'>hh', TAG_POSIX_PATH, len(posix_path))) b.write(posix_path) @@ -532,7 +552,7 @@ class Alias (object): b.write(b'\0') if self.volume.posix_path: - posix_path = self.volume.posix_path.encode('utf-8') + posix_path = encode_utf8(self.volume.posix_path) b.write(struct.pack(b'>hh', TAG_POSIX_PATH_TO_MOUNTPOINT, len(posix_path))) b.write(posix_path) diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py index 41b9acf35..0de6b9404 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py @@ -4,7 +4,7 @@ # for the old-fashioned alias format. The details of this format were # reverse engineered; some things are still not entirely clear. # -from __future__ import unicode_literals +from __future__ import unicode_literals, print_function import struct import uuid @@ -13,11 +13,26 @@ import os import sys import pprint -from urlparse import urljoin +try: + from urlparse import urljoin +except ImportError: + from urllib.parse import urljoin if sys.platform == 'darwin': from . import osx +def iteritems(x): + return x.iteritems() + +try: + unicode +except NameError: + unicode = str + long = int + xrange = range + def iteritems(x): + return x.items() + from .utils import * BMK_DATA_TYPE_MASK = 0xffffff00 @@ -144,7 +159,7 @@ kBookmarkFileCreationDate = 0x1040 # = 0x1055 # ? # = 0x1056 # ? # = 0x1101 # ? -# = 0x1102 # ? +# = 0x1102 #Â ? kBookmarkTOCPath = 0x2000 # A list of (TOC id, ?) pairs kBookmarkVolumePath = 0x2002 kBookmarkVolumeURL = 0x2005 @@ -292,23 +307,23 @@ class Bookmark (object): elif dtype == BMK_NULL: return None - print 'Unknown data type %08x' % typecode + print('Unknown data type %08x' % typecode) return (typecode, databytes) @classmethod def from_bytes(cls, data): """Create a :class:`Bookmark` given byte data.""" - if isinstance(data, bytearray): - data = bytes(data) - if len(data) < 16: raise ValueError('Not a bookmark file (too short)') + if isinstance(data, bytearray): + data = bytes(data) + magic,size,dummy,hdrsize = struct.unpack(b'<4sIII', data[0:16]) - if magic != 'book': - raise ValueError('Not a bookmark file (bad magic)') + if magic != b'book': + raise ValueError('Not a bookmark file (bad magic) %r' % magic) if hdrsize < 16: raise ValueError('Not a bookmark file (header size too short)') @@ -445,7 +460,7 @@ class Bookmark (object): ioffset = offset + 8 + len(item) * 8 result = [struct.pack(b'<II', len(item) * 8, BMK_DICT | BMK_ST_ONE)] enc = [] - for k,v in item.iteritems(): + for k,v in iteritems(item): result.append(struct.pack(b'<I', ioffset)) ioffset, ienc = cls._encode_item(k, ioffset) enc.append(ienc) @@ -479,8 +494,8 @@ class Bookmark (object): for tid,toc in self.tocs: entries = [] - for k,v in toc.iteritems(): - if isinstance(k, basestring): + for k,v in iteritems(toc): + if isinstance(k, (str, unicode)): noffset = offset voffset, enc = self._encode_item(k, offset) result.append(enc) @@ -513,7 +528,7 @@ class Bookmark (object): 0xfffffffe, tid, next_offset, - len(data) / 12)) + len(data) // 12)) result.append(data) offset += 20 + len(data) @@ -536,7 +551,7 @@ class Bookmark (object): # Find the filesystem st = osx.statfs(path) - vol_path = st.f_mntonname + vol_path = st.f_mntonname.decode('utf-8') # Grab its attributes attrs = [osx.ATTR_CMN_CRTIME, @@ -638,8 +653,8 @@ class Bookmark (object): result = ['Bookmark(['] for tid,toc in self.tocs: result.append('(0x%x, {\n' % tid) - for k,v in toc.iteritems(): - if isinstance(k, basestring): + for k,v in iteritems(toc): + if isinstance(k, (str, unicode)): kf = repr(k) else: kf = '0x%04x' % k diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py index bdd5d09e9..d4af65d75 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py +++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py @@ -434,7 +434,7 @@ def _datetime_from_timespec(ts): return unix_epoch + td def _decode_utf8_nul(sz): - nul = sz.find('\0') + nul = sz.find(b'\0') if nul > -1: sz = sz[:nul] return sz.decode('utf-8') @@ -757,6 +757,8 @@ def _get_errno(): return __error().contents.value def getattrlist(path, attrs, options): + if not isinstance(path, bytes): + path = path.encode('utf-8') attrs = list(attrs) if attrs[1]: attrs[1] |= ATTR_VOL_INFO @@ -805,6 +807,8 @@ def fgetattrlist(fd, attrs, options): return _decode_attrlist_result(buf, attrs, options) def statfs(path): + if not isinstance(path, bytes): + path = path.encode('utf-8') result = struct_statfs() ret = _statfs(path, byref(result)) if ret < 0: diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json index 562440cd6..968b6318c 100644 --- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json +++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json @@ -4,8 +4,8 @@ "QDocModule": "qbs", "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "Generate/parse Mac OS Alias records from Python", - "Homepage": "https://bitbucket.org/al45tair/mac_alias", - "Version": "2.0.1", + "Homepage": "https://github.com/al45tair/mac_alias", + "Version": "2.0.6", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/python/update.sh b/src/3rdparty/python/update.sh index 2eb3138c9..6d6ade63f 100755 --- a/src/3rdparty/python/update.sh +++ b/src/3rdparty/python/update.sh @@ -1,3 +1,7 @@ #!/bin/bash -pip install -U --isolated --prefix=$PWD --no-binary :all: --no-compile --no-deps biplist dmgbuild ds_store mac_alias +repos=(biplist.git@v1.0.2 dmgbuild.git@v1.3.1 ds_store@v1.1.2 mac_alias.git@v2.0.6) +for repo in "${repos[@]}" ; do + pip install -U --isolated "--prefix=$PWD" --no-binary :all: --no-compile --no-deps \ + "git+git://github.com/qbs/$repo" +done rm lib/python2.7/site-packages/dmgbuild/resources/*.tiff diff --git a/src/app/config-ui/config-ui.qbs b/src/app/config-ui/config-ui.qbs index 33fe36eae..2222e6a17 100644 --- a/src/app/config-ui/config-ui.qbs +++ b/src/app/config-ui/config-ui.qbs @@ -26,6 +26,8 @@ QbsApp { cpp.frameworks: ["ApplicationServices", "Cocoa"] } - Depends { name: "bundle" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp index 4105a5bd2..33e8af7d3 100644 --- a/src/app/qbs/parser/commandlineparser.cpp +++ b/src/app/qbs/parser/commandlineparser.cpp @@ -391,7 +391,7 @@ static QString extractToolDescription(const QString &tool, const QString &output QString CommandLineParser::CommandLineParserPrivate::generalHelp() const { QString help = Tr::tr("Usage: qbs [command] [command parameters]\n"); - help += Tr::tr("Internal commands:\n"); + help += Tr::tr("Built-in commands:\n"); const int rhsIndentation = 30; // Sorting the commands by name is nicer for the user. diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp index 7af5eca2c..ba0e11430 100644 --- a/src/lib/corelib/buildgraph/buildgraphloader.cpp +++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp @@ -1044,7 +1044,7 @@ void BuildGraphLoader::rescueOldBuildData(const ResolvedProductConstPtr &restore const ChildrenInfo &childrenInfo = childLists.value(oldArtifact); for (Artifact * const child : qAsConst(childrenInfo.children)) { rad.children << RescuableArtifactData::ChildData(child->product->name, - child->product->profile, child->filePath(), + child->product->multiplexConfigurationId, child->filePath(), childrenInfo.childrenAddedByScanner.contains(child)); } newlyResolvedProduct->buildData->rescuableArtifactData.insert( diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index 30fc7b4c8..1c50f7234 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -741,7 +741,7 @@ void Executor::rescueOldBuildData(Artifact *artifact, bool *childrenAdded = 0) ResolvedProductPtr pseudoProduct = ResolvedProduct::create(); for (const RescuableArtifactData::ChildData &cd : qAsConst(rad.children)) { pseudoProduct->name = cd.productName; - pseudoProduct->profile = cd.productProfile; + pseudoProduct->multiplexConfigurationId = cd.productMultiplexId; Artifact * const child = lookupArtifact(pseudoProduct, m_project->buildData.data(), cd.childFilePath, true); if (artifact->children.contains(child)) diff --git a/src/lib/corelib/buildgraph/rescuableartifactdata.h b/src/lib/corelib/buildgraph/rescuableartifactdata.h index b64c2a590..d1d9ae12b 100644 --- a/src/lib/corelib/buildgraph/rescuableartifactdata.h +++ b/src/lib/corelib/buildgraph/rescuableartifactdata.h @@ -66,15 +66,15 @@ public: struct ChildData { - ChildData(const QString &n = QString(), const QString &p = QString(), + ChildData(const QString &n = QString(), const QString &m = QString(), const QString &c = QString(), bool byScanner = false) - : productName(n), productProfile(p), childFilePath(c), addedByScanner(byScanner) + : productName(n), productMultiplexId(m), childFilePath(c), addedByScanner(byScanner) {} void load(PersistentPool &pool) { pool.load(productName); - pool.load(productProfile); + pool.load(productMultiplexId); pool.load(childFilePath); pool.load(addedByScanner); } @@ -82,13 +82,13 @@ public: void store(PersistentPool &pool) const { pool.store(productName); - pool.store(productProfile); + pool.store(productMultiplexId); pool.store(childFilePath); pool.store(addedByScanner); } QString productName; - QString productProfile; + QString productMultiplexId; QString childFilePath; bool addedByScanner; }; diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index 988e7489e..f2ace583d 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -1180,14 +1180,18 @@ void SourceWildCards::expandPatterns(Set<QString> &result, const GroupConstPtr & QDirIterator it(baseDir, QStringList(filePattern), itFilters, itFlags); while (it.hasNext()) { const QString filePath = it.next(); - if (it.fileInfo().dir().path().startsWith(buildDir)) + const QString parentDir = it.fileInfo().dir().path(); + if (parentDir.startsWith(buildDir)) continue; // See above. if (!isDir && it.fileInfo().isDir() && !it.fileInfo().isSymLink()) continue; - if (isDir) + if (isDir) { expandPatterns(result, group, changed_parts, filePath, buildDir); - else + } else { + if (parentDir != baseDir) + dirTimeStamps.push_back({parentDir, FileInfo(baseDir).lastModified()}); result += QDir::cleanPath(filePath); + } } } diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 29c24a09e..06cf10fc3 100755 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -1842,10 +1842,8 @@ void ModuleLoader::adjustDefiningItemsInGroupModuleInstances(const Item::Module bool hasDefiningItem = false; for (ValueConstPtr v = propValue; v && !hasDefiningItem; v = v->next()) hasDefiningItem = v->definingItem(); - if (!hasDefiningItem) { - QBS_CHECK(decl.isScalar() || instanceWithProperty == modulePrototype); + if (!hasDefiningItem) continue; - } const ValuePtr clonedValue = propValue->clone(); for (ValuePtr v = clonedValue; v; v = v->next()) { diff --git a/src/lib/corelib/language/modulemerger.cpp b/src/lib/corelib/language/modulemerger.cpp index ea79d6562..9dc066bf1 100644 --- a/src/lib/corelib/language/modulemerger.cpp +++ b/src/lib/corelib/language/modulemerger.cpp @@ -223,11 +223,8 @@ void ModuleMerger::insertProperties(Item::PropertyMap *dst, Item *srcItem, Prope for (Item::PropertyMap::const_iterator it = srcItem->properties().constBegin(); it != srcItem->properties().constEnd(); ++it) { const ValuePtr &srcVal = it.value(); - if (srcVal->type() == Value::ItemValueType - || it.key() == QLatin1String("_qbs_sourceDir")) { + if (srcVal->type() != Value::JSSourceValueType) continue; - } - const PropertyDeclaration srcDecl = srcItem->propertyDeclaration(it.key()); if (!srcDecl.isValid() || srcDecl.isScalar() != (type == ScalarProperties)) continue; diff --git a/tests/auto/api/testdata/app-without-sources/app-without-sources.qbs b/tests/auto/api/testdata/app-without-sources/app-without-sources.qbs index 726726337..f12a28fe6 100644 --- a/tests/auto/api/testdata/app-without-sources/app-without-sources.qbs +++ b/tests/auto/api/testdata/app-without-sources/app-without-sources.qbs @@ -24,6 +24,7 @@ Project { CppApplication { name: "appWithoutSources" + consoleApplication: true // HACK: cpp.entryPoint currently not working 100% with gcc Properties { @@ -31,7 +32,6 @@ Project { cpp.entryPoint: "main" } cpp.entryPoint: undefined - bundle.isBundle: false Depends { name: "a" } Depends { name: "b" } diff --git a/tests/auto/api/testdata/change-dependent-lib/change-dependent-lib.qbs b/tests/auto/api/testdata/change-dependent-lib/change-dependent-lib.qbs index 4037ae869..f52c90055 100644 --- a/tests/auto/api/testdata/change-dependent-lib/change-dependent-lib.qbs +++ b/tests/auto/api/testdata/change-dependent-lib/change-dependent-lib.qbs @@ -18,7 +18,11 @@ Project { } Depends { name: "cpp" } cpp.defines: ["XXXX"] - bundle.isBundle: false + + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/api/testdata/disabled_install_group/disabled_install_group.qbs b/tests/auto/api/testdata/disabled_install_group/disabled_install_group.qbs index 6364506b4..b80af6e8a 100644 --- a/tests/auto/api/testdata/disabled_install_group/disabled_install_group.qbs +++ b/tests/auto/api/testdata/disabled_install_group/disabled_install_group.qbs @@ -1,11 +1,11 @@ import qbs CppApplication { + consoleApplication: true files: "main.cpp" Group { condition: false qbs.install: true fileTagsFilter: product.type } - bundle.isBundle: false } diff --git a/tests/auto/api/testdata/export-item-with-group/export-item-with-group.qbs b/tests/auto/api/testdata/export-item-with-group/export-item-with-group.qbs index 2dffc2803..30f1868cb 100644 --- a/tests/auto/api/testdata/export-item-with-group/export-item-with-group.qbs +++ b/tests/auto/api/testdata/export-item-with-group/export-item-with-group.qbs @@ -11,7 +11,7 @@ Project { Application { name: "app" - bundle.isBundle: false + consoleApplication: true Depends { name: "dep" } } } diff --git a/tests/auto/api/testdata/export-simple/export-simple.qbs b/tests/auto/api/testdata/export-simple/export-simple.qbs index 6eca71e89..d07bb0d1a 100644 --- a/tests/auto/api/testdata/export-simple/export-simple.qbs +++ b/tests/auto/api/testdata/export-simple/export-simple.qbs @@ -44,7 +44,10 @@ Project { files : [ "lib1.cpp" ] } Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/api/testdata/is-runnable/is-runnable.qbs b/tests/auto/api/testdata/is-runnable/is-runnable.qbs index 47e217a6a..2883328ed 100644 --- a/tests/auto/api/testdata/is-runnable/is-runnable.qbs +++ b/tests/auto/api/testdata/is-runnable/is-runnable.qbs @@ -6,6 +6,9 @@ Project { } DynamicLibrary { name: "lib" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/api/testdata/link-dynamiclibs-staticlibs/link-dynamiclibs-staticlibs.qbs b/tests/auto/api/testdata/link-dynamiclibs-staticlibs/link-dynamiclibs-staticlibs.qbs index 2020752e6..8fec45700 100644 --- a/tests/auto/api/testdata/link-dynamiclibs-staticlibs/link-dynamiclibs-staticlibs.qbs +++ b/tests/auto/api/testdata/link-dynamiclibs-staticlibs/link-dynamiclibs-staticlibs.qbs @@ -13,7 +13,10 @@ Project { files : [ "dynamic1.cpp" ] Depends { name: "cpp" } Depends { name: "static1" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } StaticLibrary { @@ -29,7 +32,10 @@ Project { Depends { name: "cpp" } Depends { name: "static2" } cpp.visibility: 'hidden' - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } StaticLibrary { diff --git a/tests/auto/api/testdata/link-dynamiclibs/link-dynamiclibs.qbs b/tests/auto/api/testdata/link-dynamiclibs/link-dynamiclibs.qbs index e0f1fc553..d6047060c 100644 --- a/tests/auto/api/testdata/link-dynamiclibs/link-dynamiclibs.qbs +++ b/tests/auto/api/testdata/link-dynamiclibs/link-dynamiclibs.qbs @@ -18,7 +18,10 @@ Project { } Depends { name: "cpp" } Depends { name: "lib2" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } DynamicLibrary { @@ -29,7 +32,10 @@ Project { } Depends { name: "cpp" } Depends { name: "lib3" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } DynamicLibrary { @@ -39,7 +45,10 @@ Project { files : [ "lib3.cpp" ] } Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } DynamicLibrary { @@ -50,7 +59,10 @@ Project { files : [ "lib4.h", "lib4.cpp" ] } Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } Export { Depends { name: "cpp" } diff --git a/tests/auto/api/testdata/link-staticlibs-dynamiclibs/link-staticlibs-dynamiclibs.qbs b/tests/auto/api/testdata/link-staticlibs-dynamiclibs/link-staticlibs-dynamiclibs.qbs index 6704a9188..eafa764ba 100644 --- a/tests/auto/api/testdata/link-staticlibs-dynamiclibs/link-staticlibs-dynamiclibs.qbs +++ b/tests/auto/api/testdata/link-staticlibs-dynamiclibs/link-staticlibs-dynamiclibs.qbs @@ -20,7 +20,10 @@ Project { files : [ "dynamic1.cpp" ] Depends { name: "cpp" } Depends { name: "static2" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } StaticLibrary { @@ -35,7 +38,10 @@ Project { files: [ "dynamic2.cpp" ] Depends { name: "cpp" } cpp.visibility: 'hidden' - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/api/testdata/new-output-artifact-in-dependency/new-output-artifact-in-dependency.qbs b/tests/auto/api/testdata/new-output-artifact-in-dependency/new-output-artifact-in-dependency.qbs index 2695a8085..8b50cce2a 100644 --- a/tests/auto/api/testdata/new-output-artifact-in-dependency/new-output-artifact-in-dependency.qbs +++ b/tests/auto/api/testdata/new-output-artifact-in-dependency/new-output-artifact-in-dependency.qbs @@ -5,7 +5,10 @@ Project { //Depends { name: "cpp" } name: "lib" files: "lib.cpp" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } CppApplication { diff --git a/tests/auto/api/testdata/productNameWithDots/productNameWithDots.qbs b/tests/auto/api/testdata/productNameWithDots/productNameWithDots.qbs index f0cf5813c..5e3427793 100644 --- a/tests/auto/api/testdata/productNameWithDots/productNameWithDots.qbs +++ b/tests/auto/api/testdata/productNameWithDots/productNameWithDots.qbs @@ -1,13 +1,10 @@ import qbs Project { - Product { - Depends { name: "cpp" } - Depends { name: "bundle" } - type: ["application"] + CppApplication { name: "myapp" + consoleApplication: true Depends { name: "foo.bar.bla" } files: ["app.cpp"] - bundle.isBundle: false } StaticLibrary { Depends { name: "cpp" } diff --git a/tests/auto/api/testdata/qt5-plugin/qt5-plugin.qbs b/tests/auto/api/testdata/qt5-plugin/qt5-plugin.qbs index 834c386ad..204711625 100644 --- a/tests/auto/api/testdata/qt5-plugin/qt5-plugin.qbs +++ b/tests/auto/api/testdata/qt5-plugin/qt5-plugin.qbs @@ -7,7 +7,10 @@ DynamicLibrary { Depends { name: "Qt.core" } Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } Group { condition: Qt.core.versionMajor >= 5 diff --git a/tests/auto/api/testdata/rename-product/rename.qbs b/tests/auto/api/testdata/rename-product/rename.qbs index 137de27a7..18eb5ee6c 100644 --- a/tests/auto/api/testdata/rename-product/rename.qbs +++ b/tests/auto/api/testdata/rename-product/rename.qbs @@ -12,6 +12,9 @@ Project { Depends { name: "cpp" } cpp.defines: "MY_EXPORT=EXPORT" files: "lib.cpp" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/api/testdata/rename-target-artifact/rename.qbs b/tests/auto/api/testdata/rename-target-artifact/rename.qbs index 27f91841a..a3e811c29 100644 --- a/tests/auto/api/testdata/rename-target-artifact/rename.qbs +++ b/tests/auto/api/testdata/rename-target-artifact/rename.qbs @@ -13,6 +13,9 @@ Project { Depends { name: "cpp" } cpp.defines: "MY_EXPORT=EXPORT" files: "lib.cpp" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/blackbox/testdata-java/java/vehicles.qbs b/tests/auto/blackbox/testdata-java/java/vehicles.qbs index 2e048c634..56a5f3d37 100644 --- a/tests/auto/blackbox/testdata-java/java/vehicles.qbs +++ b/tests/auto/blackbox/testdata-java/java/vehicles.qbs @@ -5,7 +5,10 @@ Project { DynamicLibrary { Depends { name: "cpp" } Depends { name: "car_jar" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } name: "native" files: ["engine.c"] diff --git a/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs b/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs index 0d623a739..b91b8799e 100644 --- a/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs +++ b/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs @@ -24,7 +24,10 @@ Project { Depends { name: "cpp" } Depends { name: "Qt.core" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } cpp.defines: [Qt.core.staticBuild ? "QT_STATICPLUGIN" : "QT_PLUGIN"] cpp.cxxLanguageVersion: "c++11" cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined diff --git a/tests/auto/blackbox/testdata/assembly/assembly.qbs b/tests/auto/blackbox/testdata/assembly/assembly.qbs index 39ecc021c..7dd82731a 100644 --- a/tests/auto/blackbox/testdata/assembly/assembly.qbs +++ b/tests/auto/blackbox/testdata/assembly/assembly.qbs @@ -32,21 +32,30 @@ Project { files : [ "testa.s" ] Depends { name: "cpp" } condition: qbs.toolchain.contains("gcc") - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } StaticLibrary { name : "testb" files : [ "testb.S" ] Depends { name: "cpp" } condition: qbs.toolchain.contains("gcc") - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } StaticLibrary { name : "testc" files : [ "testc.sx" ] Depends { name: "cpp" } condition: qbs.toolchain.contains("gcc") - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } StaticLibrary { name: "testd" @@ -57,7 +66,10 @@ Project { Depends { name: "cpp" } condition: qbs.toolchain.contains("msvc") && (qbs.architecture === "x86" || qbs.architecture === "x86_64") - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } } diff --git a/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/change-tracking-and-multiplexing.qbs b/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/change-tracking-and-multiplexing.qbs new file mode 100644 index 000000000..78bd8abda --- /dev/null +++ b/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/change-tracking-and-multiplexing.qbs @@ -0,0 +1,13 @@ +import qbs + +StaticLibrary { + name: "l" + + Depends { condition: qbs.targetOS.contains("darwin"); name: "bundle" } + Properties { condition: qbs.targetOS.contains("darwin"); bundle.isBundle: false } + + multiplexByQbsProperties: ["buildVariants"] + qbs.buildVariants: ["debug", "release"] + Depends { name: "cpp" } + files: ["lib.cpp"] +} diff --git a/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/lib.cpp b/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/lib.cpp new file mode 100644 index 000000000..9a6145659 --- /dev/null +++ b/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/lib.cpp @@ -0,0 +1 @@ +void l() {} diff --git a/tests/auto/blackbox/testdata/clean/clean.qbs b/tests/auto/blackbox/testdata/clean/clean.qbs index 8221d0544..28ebe91f0 100644 --- a/tests/auto/blackbox/testdata/clean/clean.qbs +++ b/tests/auto/blackbox/testdata/clean/clean.qbs @@ -6,7 +6,10 @@ Project { version: "1.1.0" name: "dep" files: "dep.cpp" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } CppApplication { diff --git a/tests/auto/blackbox/testdata/command-file/command-file.qbs b/tests/auto/blackbox/testdata/command-file/command-file.qbs index fb4943fb0..fb46a0712 100644 --- a/tests/auto/blackbox/testdata/command-file/command-file.qbs +++ b/tests/auto/blackbox/testdata/command-file/command-file.qbs @@ -5,7 +5,10 @@ Project { name: "theLib" destinationDirectory: project.buildDirectory Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } files: ["lib.cpp"] } CppApplication { diff --git a/tests/auto/blackbox/testdata/external-libs/external-libs.qbs b/tests/auto/blackbox/testdata/external-libs/external-libs.qbs index 2ea2e988d..d2e983c3e 100644 --- a/tests/auto/blackbox/testdata/external-libs/external-libs.qbs +++ b/tests/auto/blackbox/testdata/external-libs/external-libs.qbs @@ -7,7 +7,10 @@ Project { name: "lib1" destinationDirectory: project.libDir Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } files: ["lib1.cpp"] } StaticLibrary { @@ -15,7 +18,10 @@ Project { destinationDirectory: project.libDir Depends { name: "cpp" } Depends { name: "lib1" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } files: ["lib2.cpp"] } CppApplication { diff --git a/tests/auto/blackbox/testdata/ld/ld.qbs b/tests/auto/blackbox/testdata/ld/ld.qbs index d19603511..f95157012 100644 --- a/tests/auto/blackbox/testdata/ld/ld.qbs +++ b/tests/auto/blackbox/testdata/ld/ld.qbs @@ -6,10 +6,9 @@ Project { name: "coreutils" targetName: "qbs can handle any file paths, even the crazy ones! ;)" files: ["coreutils.cpp", "coreutils.h"] - bundle.isBundle: false - Properties { condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false cpp.sonamePrefix: "@rpath" } diff --git a/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs b/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs index a3327454d..44d0cec37 100644 --- a/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs +++ b/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs @@ -3,8 +3,10 @@ import qbs Project { LoadableModule { Depends { name: "cpp" } - Depends { name: "bundle" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } name: "CoolPlugIn" files: ["exported.cpp", "exported.h"] @@ -17,8 +19,7 @@ Project { CppApplication { Depends { name: "cpp" } Depends { name: "CoolPlugIn"; cpp.link: false } - Depends { name: "bundle" } - bundle.isBundle: false + consoleApplication: true name: "CoolApp" files: ["main.cpp"] diff --git a/tests/auto/blackbox/testdata/overrideProjectProperties/helper_lib.qbs b/tests/auto/blackbox/testdata/overrideProjectProperties/helper_lib.qbs index 16c68064e..b26b0f31f 100644 --- a/tests/auto/blackbox/testdata/overrideProjectProperties/helper_lib.qbs +++ b/tests/auto/blackbox/testdata/overrideProjectProperties/helper_lib.qbs @@ -4,5 +4,8 @@ DynamicLibrary { name: "helperLib" files: "helperlib.cpp" Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } diff --git a/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbs b/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbs index ebfc45d3f..d6cba15dd 100644 --- a/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbs +++ b/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbs @@ -29,7 +29,10 @@ Project { Depends { name: "cpp" } name: "lib-product" files: "main.cpp" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } CppApplication { diff --git a/tests/auto/blackbox/testdata/propertyChanges/propertyChanges.qbs b/tests/auto/blackbox/testdata/propertyChanges/propertyChanges.qbs index 5574c5fb4..da9a862c5 100644 --- a/tests/auto/blackbox/testdata/propertyChanges/propertyChanges.qbs +++ b/tests/auto/blackbox/testdata/propertyChanges/propertyChanges.qbs @@ -27,7 +27,10 @@ Project { Depends { name: "cpp" } name: "library" files: "lib.cpp" - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } } Product { diff --git a/tests/auto/blackbox/testdata/recursive_wildcards/recursive_wildcards.qbs b/tests/auto/blackbox/testdata/recursive_wildcards/recursive_wildcards.qbs index a1970e1c4..703a65e0e 100644 --- a/tests/auto/blackbox/testdata/recursive_wildcards/recursive_wildcards.qbs +++ b/tests/auto/blackbox/testdata/recursive_wildcards/recursive_wildcards.qbs @@ -1,7 +1,43 @@ +import qbs +import qbs.TextFile + Product { + type: ["txt.out"] Group { files: "dir/**" qbs.install: true qbs.installDir: "dir" } + FileTagger { + patterns: ["*.txt"] + fileTags: ["txt.in"] + } + Rule { + multiplex: true + requiresInputs: false + explicitlyDependsOn: ["txt.in"] + Artifact { + filePath: "output.txt" + fileTags: product.type + qbs.install: true + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Creating " + output.fileName; + cmd.sourceCode = function() { + var inputList = explicitlyDependsOn["txt.in"]; + var fileNameList = []; + for (var i = 0; i < inputList.length; ++i) + fileNameList.push(inputList[i].fileName); + fileNameList.sort(); + var f = new TextFile(output.filePath, TextFile.WriteOnly); + try { + f.write(fileNameList.join('')); + } finally { + f.close(); + } + }; + return [cmd]; + } + } } diff --git a/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs b/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs index 1ecbe0f36..b28d7b822 100644 --- a/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs +++ b/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs @@ -77,7 +77,7 @@ Project { name: "app4" type: ["application"] files: ["main.cpp"] - bundle.isBundle: false + consoleApplication: true cpp.separateDebugInformation: true } DynamicLibrary { @@ -85,14 +85,20 @@ Project { name: "foo4" type: ["dynamiclibrary"] files: ["foo.cpp"] - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } cpp.separateDebugInformation: true } LoadableModule { Depends { name: "cpp" } name: "bar4" files: ["foo.cpp"] - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } cpp.separateDebugInformation: true } @@ -100,7 +106,10 @@ Project { name: "app5" type: ["application"] files: ["main.cpp"] - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.contains("darwin") @@ -112,7 +121,10 @@ Project { name: "foo5" type: ["dynamiclibrary"] files: ["foo.cpp"] - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.contains("darwin") @@ -123,7 +135,10 @@ Project { Depends { name: "cpp" } name: "bar5" files: ["foo.cpp"] - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.contains("darwin") diff --git a/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs b/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs index 95adaa4ba..a95d6015e 100644 --- a/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs +++ b/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs @@ -39,11 +39,13 @@ Project { } DynamicLibrary { - Depends { name: "bundle" } Depends { name: "cpp" } Depends { name: "indirect"; cpp.symbolLinkMode: "reexport" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } name: "functions" files: ["lib.cpp"] cpp.cxxLanguageVersion: "c++11" @@ -80,10 +82,12 @@ Project { } DynamicLibrary { - Depends { name: "bundle" } Depends { name: "cpp" } - bundle.isBundle: false + Properties { + condition: qbs.targetOS.contains("darwin") + bundle.isBundle: false + } name: "indirect" files: ["indirect.cpp"] cpp.cxxLanguageVersion: "c++11" diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index ea12221a1..5ed2eac21 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -609,6 +609,19 @@ void TestBlackbox::changeInImportedFile() QVERIFY2(!m_qbsStdout.contains("output"), m_qbsStdout.constData()); } +void TestBlackbox::changeTrackingAndMultiplexing() +{ + QDir::setCurrent(testDataDir + "/change-tracking-and-multiplexing"); + QCOMPARE(runQbs(QStringList("modules.cpp.staticLibraryPrefix:prefix1")), 0); + QCOMPARE(m_qbsStdout.count("compiling lib.cpp"), 2); + QCOMPARE(m_qbsStdout.count("creating prefix1l"), 2); + QCOMPARE(runQbs(QbsRunParameters("resolve", + QStringList("modules.cpp.staticLibraryPrefix:prefix2"))), 0); + QCOMPARE(runQbs(), 0); + QCOMPARE(m_qbsStdout.count("compiling lib.cpp"), 0); + QCOMPARE(m_qbsStdout.count("creating prefix2l"), 2); +} + static QJsonObject findByName(const QJsonArray &objects, const QString &name) { for (const QJsonValue v : objects) { @@ -1536,6 +1549,28 @@ void TestBlackbox::recursiveWildcards() QCOMPARE(runQbs(QbsRunParameters("install")), 0); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file1.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file2.txt").exists()); + QFile outputFile(defaultInstallRoot + "/output.txt"); + QVERIFY2(outputFile.open(QIODevice::ReadOnly), qPrintable(outputFile.errorString())); + QCOMPARE(outputFile.readAll(), QByteArray("file1.txtfile2.txt")); + outputFile.close(); + WAIT_FOR_NEW_TIMESTAMP(); + QFile newFile("dir/subdir/file3.txt"); + QVERIFY2(newFile.open(QIODevice::WriteOnly), qPrintable(newFile.errorString())); + newFile.close(); + QCOMPARE(runQbs(QbsRunParameters("install")), 0); + QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file3.txt").exists()); + QVERIFY2(outputFile.open(QIODevice::ReadOnly), qPrintable(outputFile.errorString())); + QCOMPARE(outputFile.readAll(), QByteArray("file1.txtfile2.txtfile3.txt")); + outputFile.close(); + WAIT_FOR_NEW_TIMESTAMP(); + QVERIFY2(newFile.remove(), qPrintable(newFile.errorString())); + QVERIFY2(!newFile.exists(), qPrintable(newFile.fileName())); + QCOMPARE(runQbs(QbsRunParameters("install", QStringList{ "--clean-install-root"})), 0); + QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file1.txt").exists()); + QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file2.txt").exists()); + QVERIFY(!QFileInfo(defaultInstallRoot + "/dir/file3.txt").exists()); + QVERIFY2(outputFile.open(QIODevice::ReadOnly), qPrintable(outputFile.errorString())); + QCOMPARE(outputFile.readAll(), QByteArray("file1.txtfile2.txt")); } void TestBlackbox::referenceErrorInExport() diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 097891560..f3f0621f0 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -53,6 +53,7 @@ private slots: void changedFiles(); void changeInDisabledProduct(); void changeInImportedFile(); + void changeTrackingAndMultiplexing(); void checkProjectFilePath(); void clean(); void cli(); diff --git a/tests/auto/language/testdata/module-property-overrides-per-product.qbs b/tests/auto/language/testdata/module-property-overrides-per-product.qbs index e58f563a0..3ff811080 100644 --- a/tests/auto/language/testdata/module-property-overrides-per-product.qbs +++ b/tests/auto/language/testdata/module-property-overrides-per-product.qbs @@ -4,13 +4,16 @@ Project { Product { Depends { name: "dummy" } name: "a" + property stringList rpaths: dummy.rpaths } Product { Depends { name: "dummy" } name: "b" + property stringList rpaths: dummy.rpaths } Product { Depends { name: "dummy" } name: "c" + property stringList rpaths: dummy.rpaths } } diff --git a/tests/auto/language/testdata/modulepropertiesingroups.qbs b/tests/auto/language/testdata/modulepropertiesingroups.qbs index 7a0a99b3e..5a1e75ab8 100644 --- a/tests/auto/language/testdata/modulepropertiesingroups.qbs +++ b/tests/auto/language/testdata/modulepropertiesingroups.qbs @@ -70,4 +70,16 @@ Project { } } } + Product { + name: "grouptest2" + Depends { name: "gmod.gmod1" } + Group { + name: "g1" + gmod.gmod1.gmod1_list2: ["G1"] + Group { + name: "g1.1" + gmod.gmod1.gmod1_string: "G1.1" + } + } + } } diff --git a/tests/auto/language/testdata/modules/multiple-backends/backend1.qbs b/tests/auto/language/testdata/modules/multiple-backends/backend1.qbs new file mode 100644 index 000000000..011f96af8 --- /dev/null +++ b/tests/auto/language/testdata/modules/multiple-backends/backend1.qbs @@ -0,0 +1,6 @@ +import qbs + +Module { + condition: qbs.targetOS.contains("os1") + property string prop: "backend 1" +} diff --git a/tests/auto/language/testdata/modules/multiple-backends/backend2.qbs b/tests/auto/language/testdata/modules/multiple-backends/backend2.qbs new file mode 100644 index 000000000..1d2d817f7 --- /dev/null +++ b/tests/auto/language/testdata/modules/multiple-backends/backend2.qbs @@ -0,0 +1,6 @@ +import qbs + +Module { + condition: qbs.targetOS.contains("os2") + property string prop: "backend 2" +} diff --git a/tests/auto/language/testdata/overridden-properties-and-prototypes.qbs b/tests/auto/language/testdata/overridden-properties-and-prototypes.qbs new file mode 100644 index 000000000..d87611d7c --- /dev/null +++ b/tests/auto/language/testdata/overridden-properties-and-prototypes.qbs @@ -0,0 +1,6 @@ +import qbs + +Product { + name: "p" + Depends { name: "multiple-backends" } +} diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp index 78a8caf1a..2d9c52615 100644 --- a/tests/auto/language/tst_language.cpp +++ b/tests/auto/language/tst_language.cpp @@ -1360,7 +1360,7 @@ void TestLanguage::modulePropertiesInGroups() TopLevelProjectPtr project = loader->loadProject(defaultParameters); QVERIFY(!!project); const QHash<QString, ResolvedProductPtr> products = productsFromProject(project); - const ResolvedProductPtr product = products.value("grouptest"); + ResolvedProductPtr product = products.value("grouptest"); QVERIFY(!!product); GroupConstPtr g1; GroupConstPtr g11; @@ -1537,6 +1537,27 @@ void TestLanguage::modulePropertiesInGroups() QEXPECT_FAIL(0, "re-eval not triggered", Continue); QCOMPARE(g211Gmod2List, QStringList() << "g2.1.1" << "commonName_in_gmod1" << "g2.1.1_gmod4_g2.1.1_gmod3" << "g2.1.1_gmod3" << "gmod2_list_proto"); + + product = products.value("grouptest2"); + QVERIFY(!!product); + g1.reset(); + g11.reset(); + foreach (const GroupConstPtr &g, product->groups) { + if (g->name == "g1") + g1= g; + else if (g->name == "g1.1") + g11 = g; + } + QVERIFY(!!g1); + QVERIFY(!!g11); + QCOMPARE(moduleProperty(g1->properties->value(), "gmod.gmod1", "gmod1_list2") + .toStringList(), QStringList({"G1"})); + QCOMPARE(moduleProperty(g11->properties->value(), "gmod.gmod1", "gmod1_list2") + .toStringList(), + moduleProperty(g1->properties->value(), "gmod.gmod1", "gmod1_list2") + .toStringList()); + QCOMPARE(moduleProperty(g11->properties->value(), "gmod.gmod1", "gmod1_string").toString(), + QString("G1.1")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); @@ -1550,9 +1571,11 @@ void TestLanguage::modulePropertyOverridesPerProduct() try { SetupProjectParameters params = defaultParameters; params.setOverriddenValues({ + std::make_pair("modules.dummy.rpaths", QStringList({"/usr/lib"})), std::make_pair("modules.dummy.someString", "m"), std::make_pair("products.b.dummy.someString", "b"), - std::make_pair("products.c.dummy.someString", "c") + std::make_pair("products.c.dummy.someString", "c"), + std::make_pair("products.c.dummy.rpaths", QStringList({"/home", "/tmp"})) }); params.setProjectFilePath( testProject("module-property-overrides-per-product.qbs")); @@ -1567,14 +1590,28 @@ void TestLanguage::modulePropertyOverridesPerProduct() const ResolvedProductConstPtr c = products.value("c"); QVERIFY(!!c); - const auto propertyValue = [](const ResolvedProductConstPtr &p) -> QString + const auto stringPropertyValue = [](const ResolvedProductConstPtr &p) -> QString { return p->moduleProperties->moduleProperty("dummy", "someString").toString(); }; + const auto listPropertyValue = [](const ResolvedProductConstPtr &p) -> QStringList + { + return p->moduleProperties->moduleProperty("dummy", "rpaths").toStringList(); + }; + const auto productPropertyValue = [](const ResolvedProductConstPtr &p) -> QStringList + { + return p->productProperties.value("rpaths").toStringList(); + }; - QCOMPARE(propertyValue(a), QString("m")); - QCOMPARE(propertyValue(b), QString("b")); - QCOMPARE(propertyValue(c), QString("c")); + QCOMPARE(stringPropertyValue(a), QString("m")); + QCOMPARE(stringPropertyValue(b), QString("b")); + QCOMPARE(stringPropertyValue(c), QString("c")); + QCOMPARE(listPropertyValue(a), QStringList({"/usr/lib"})); + QCOMPARE(listPropertyValue(b), QStringList({"/usr/lib"})); + QCOMPARE(listPropertyValue(c), QStringList({"/home", "/tmp"})); + QCOMPARE(listPropertyValue(a), productPropertyValue(a)); + QCOMPARE(listPropertyValue(b), productPropertyValue(b)); + QCOMPARE(listPropertyValue(c), productPropertyValue(c)); } catch (const ErrorInfo &e) { exceptionCaught = true; @@ -1779,6 +1816,36 @@ void TestLanguage::outerInGroup() QCOMPARE(exceptionCaught, false); } +void TestLanguage::overriddenPropertiesAndPrototypes() +{ + bool exceptionCaught = false; + try { + QFETCH(QString, osName); + QFETCH(QString, backendName); + SetupProjectParameters params = defaultParameters; + params.setProjectFilePath(testProject("overridden-properties-and-prototypes.qbs")); + params.setOverriddenValues({std::make_pair("modules.qbs.targetOS", osName)}); + TopLevelProjectConstPtr project = loader->loadProject(params); + QVERIFY(!!project); + QCOMPARE(project->products.count(), 1); + QCOMPARE(project->products.first()->moduleProperties->moduleProperty( + "multiple-backends", "prop").toString(), backendName); + } + catch (const ErrorInfo &e) { + exceptionCaught = true; + qDebug() << e.toString(); + } + QCOMPARE(exceptionCaught, false); +} + +void TestLanguage::overriddenPropertiesAndPrototypes_data() +{ + QTest::addColumn<QString>("osName"); + QTest::addColumn<QString>("backendName"); + QTest::newRow("first backend") << "os1" << "backend 1"; + QTest::newRow("second backend") << "os2" << "backend 2"; +} + void TestLanguage::parameterTypes() { bool exceptionCaught = false; diff --git a/tests/auto/language/tst_language.h b/tests/auto/language/tst_language.h index 38954079a..24e1b8850 100644 --- a/tests/auto/language/tst_language.h +++ b/tests/auto/language/tst_language.h @@ -124,6 +124,8 @@ private slots: void nonRequiredProducts(); void nonRequiredProducts_data(); void outerInGroup(); + void overriddenPropertiesAndPrototypes(); + void overriddenPropertiesAndPrototypes_data(); void parameterTypes(); void pathProperties(); void productConditions(); diff --git a/tests/auto/shared.h b/tests/auto/shared.h index 36a15ca74..6a0caaa3c 100644 --- a/tests/auto/shared.h +++ b/tests/auto/shared.h @@ -123,14 +123,19 @@ inline void waitForNewTimestamp(const QString &testDir) if (!f1.open()) qFatal("Failed to open temp file"); const QDateTime initialTime = QFileInfo(f1).lastModified(); - while (true) { - QTest::qWait(50); + int totalMsPassed = 0; + while (totalMsPassed <= 2000) { + static const int increment = 50; + QTest::qWait(increment); + totalMsPassed += increment; QTemporaryFile f2(nameTemplate); if (!f2.open()) qFatal("Failed to open temp file"); if (QFileInfo(f2).lastModified() > initialTime) - break; + return; } + qWarning("Got no new timestamp after two seconds, going ahead anyway. Subsequent " + "test failure might not be genuine."); } } |