aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy202
-rw-r--r--.github/workflows/main.yml63
-rw-r--r--.github/workflows/release.yml4
-rw-r--r--RELEASE.md105
-rw-r--r--VERSION2
-rw-r--r--changelogs/changes-1.23.0.md16
-rw-r--r--changelogs/changes-1.23.1.md19
-rw-r--r--changelogs/changes-1.23.2.md10
-rw-r--r--cmake/QbsBuildConfig.cmake1
-rw-r--r--cmake/QbsDocumentation.cmake22
-rw-r--r--doc/CMakeLists.txt2
-rw-r--r--doc/appendix/json-api.qdoc1
-rw-r--r--doc/man/CMakeLists.txt3
-rw-r--r--doc/reference/cli/builtin/cli-resolve.qdoc1
-rw-r--r--doc/reference/cli/cli-options.qdocinc21
-rw-r--r--doc/reference/items/probe/pkgconfig-probe.qdoc4
-rw-r--r--doc/reference/jsextensions/jsextension-fileinfo.qdoc7
-rw-r--r--doc/reference/jsextensions/jsextension-host.qdoc8
-rw-r--r--doc/reference/modules/cpp-module.qdoc2
-rw-r--r--docker-compose.yml19
-rw-r--r--docker/focal/Dockerfile14
-rw-r--r--docker/focal/test-qt4.Dockerfile4
-rw-r--r--qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs4
-rw-r--r--scripts/address-sanitizer-suppressions.txt1
-rwxr-xr-xscripts/install-ow.sh11
-rwxr-xr-xscripts/install-qt.sh4
-rwxr-xr-xscripts/run-analyzer.sh5
-rw-r--r--share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs22
-rw-r--r--share/qbs/imports/qbs/Probes/ConanfileProbe.qbs3
-rw-r--r--share/qbs/module-providers/Qt/setup-qt.js10
-rw-r--r--share/qbs/module-providers/Qt/templates/core.qbs10
-rw-r--r--share/qbs/module-providers/Qt/templates/qml.js4
-rw-r--r--share/qbs/module-providers/Qt/templates/qml.qbs1
-rw-r--r--share/qbs/module-providers/Qt/templates/qmlcache.qbs3
-rw-r--r--share/qbs/module-providers/Qt/templates/quick.js2
-rw-r--r--share/qbs/module-providers/Qt/templates/quick.qbs2
-rw-r--r--share/qbs/module-providers/Qt/templates/scxml.qbs5
-rw-r--r--share/qbs/module-providers/qbspkgconfig.qbs21
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs4
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs3
-rw-r--r--share/qbs/modules/cpp/cpp.js16
-rw-r--r--share/qbs/modules/cpp/gcc.js20
-rw-r--r--share/qbs/modules/cpp/iar.js4
-rw-r--r--share/qbs/modules/cpp/keil.js2
-rw-r--r--share/qbs/modules/cpp/msvc.js30
-rw-r--r--share/qbs/modules/cpp/sdcc.js12
-rw-r--r--share/qbs/modules/freedesktop/FreeDesktop.qbs8
-rw-r--r--share/qbs/modules/protobuf/protobuf.js1
-rw-r--r--share/qbs/modules/typescript/TypeScriptModule.qbs3
-rw-r--r--src/app/config/configcommandlineparser.cpp4
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp2
-rw-r--r--src/app/qbs-setup-toolchains/clangclprobe.cpp2
-rw-r--r--src/app/qbs-setup-toolchains/dmcprobe.cpp3
-rw-r--r--src/app/qbs-setup-toolchains/msvcprobe.cpp8
-rw-r--r--src/app/qbs-setup-toolchains/sdccprobe.cpp3
-rw-r--r--src/app/qbs-setup-toolchains/watcomprobe.cpp12
-rw-r--r--src/app/qbs-setup-toolchains/watcomprobe.h3
-rw-r--r--src/app/qbs/commandlinefrontend.cpp1
-rw-r--r--src/app/qbs/parser/commandlineoption.cpp35
-rw-r--r--src/app/qbs/parser/commandlineoption.h16
-rw-r--r--src/app/qbs/parser/commandlineoptionpool.cpp9
-rw-r--r--src/app/qbs/parser/commandlineoptionpool.h1
-rw-r--r--src/app/qbs/parser/commandlineparser.cpp5
-rw-r--r--src/app/qbs/parser/commandlineparser.h3
-rw-r--r--src/app/qbs/parser/parsercommand.cpp1
-rw-r--r--src/app/qbs/session.cpp6
-rw-r--r--src/app/qbs/sessionpacket.cpp2
-rw-r--r--src/lib/corelib/CMakeLists.txt2
-rw-r--r--src/lib/corelib/api/internaljobs.cpp2
-rw-r--r--src/lib/corelib/api/qmljsrewriter.cpp3
-rw-r--r--src/lib/corelib/buildgraph/executor.cpp6
-rw-r--r--src/lib/corelib/buildgraph/processcommandexecutor.cpp2
-rw-r--r--src/lib/corelib/corelib.qbs2
-rw-r--r--src/lib/corelib/jsextensions/fileinfoextension.cpp12
-rw-r--r--src/lib/corelib/jsextensions/utilitiesextension.cpp2
-rw-r--r--src/lib/corelib/language/deprecationinfo.h46
-rw-r--r--src/lib/corelib/language/item.cpp26
-rw-r--r--src/lib/corelib/language/item.h3
-rw-r--r--src/lib/corelib/language/itemdeclaration.cpp6
-rw-r--r--src/lib/corelib/language/itemdeclaration.h3
-rw-r--r--src/lib/corelib/language/itemreader.cpp5
-rw-r--r--src/lib/corelib/language/itemreader.h4
-rw-r--r--src/lib/corelib/language/itemreaderastvisitor.cpp22
-rw-r--r--src/lib/corelib/language/itemreadervisitorstate.h5
-rw-r--r--src/lib/corelib/language/language.cpp2
-rw-r--r--src/lib/corelib/language/loader.cpp2
-rw-r--r--src/lib/corelib/language/moduleloader.cpp39
-rw-r--r--src/lib/corelib/language/moduleproviderinfo.h7
-rw-r--r--src/lib/corelib/language/moduleproviderloader.cpp85
-rw-r--r--src/lib/corelib/language/moduleproviderloader.h26
-rw-r--r--src/lib/corelib/language/projectresolver.cpp4
-rw-r--r--src/lib/corelib/language/propertydeclaration.cpp6
-rw-r--r--src/lib/corelib/language/propertydeclaration.h7
-rw-r--r--src/lib/corelib/language/scriptengine.cpp4
-rw-r--r--src/lib/corelib/tools/architectures.cpp2
-rw-r--r--src/lib/corelib/tools/buildoptions.cpp4
-rw-r--r--src/lib/corelib/tools/clangclinfo.cpp2
-rw-r--r--src/lib/corelib/tools/deprecationwarningmode.cpp98
-rw-r--r--src/lib/corelib/tools/deprecationwarningmode.h59
-rw-r--r--src/lib/corelib/tools/installoptions.cpp2
-rw-r--r--src/lib/corelib/tools/msvcinfo.cpp10
-rw-r--r--src/lib/corelib/tools/persistence.cpp2
-rw-r--r--src/lib/corelib/tools/profile.cpp2
-rw-r--r--src/lib/corelib/tools/qbsprocess.cpp2
-rw-r--r--src/lib/corelib/tools/settingscreator.cpp16
-rw-r--r--src/lib/corelib/tools/setupprojectparameters.cpp23
-rw-r--r--src/lib/corelib/tools/setupprojectparameters.h4
-rw-r--r--src/lib/corelib/tools/tools.pri3
-rw-r--r--src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp2
-rw-r--r--src/lib/pkgconfig/pcparser.cpp23
-rw-r--r--src/lib/pkgconfig/pkgconfig.cpp19
-rw-r--r--src/lib/pkgconfig/pkgconfig.h3
-rw-r--r--src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp3
-rw-r--r--src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.cpp54
-rw-r--r--src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.cpp4
-rw-r--r--src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.cpp4
-rw-r--r--src/plugins/scanner/cpp/Lexer.cpp2
-rw-r--r--src/plugins/scanner/cpp/Lexer.h1
m---------src/shared/qtscript0
-rw-r--r--tests/auto/blackbox/CMakeLists.txt1
-rw-r--r--tests/auto/blackbox/blackbox.qbs1
-rw-r--r--tests/auto/blackbox/testdata-baremetal/one-object-application/main.c2
-rw-r--r--tests/auto/blackbox/testdata-baremetal/two-object-application/fun.c2
-rw-r--r--tests/auto/blackbox/testdata/deprecated-property/deprecated-property.qbs2
-rw-r--r--tests/auto/blackbox/testdata/deprecated-property/modules/themodule/m.qbs8
-rw-r--r--tests/auto/blackbox/testdata/maximum-c-language-version/maximum-c-language-version.qbs9
-rw-r--r--tests/auto/blackbox/testdata/qbs-module-properties-in-providers/module-providers/provider_a.qbs9
-rw-r--r--tests/auto/blackbox/testdata/qbs-module-properties-in-providers/qbs-module-properties-in-providers.qbs34
-rw-r--r--tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc6
-rw-r--r--tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs15
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp101
-rw-r--r--tests/auto/blackbox/tst_blackbox.h2
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp1
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.cpp1
-rw-r--r--tests/auto/pkgconfig/testdata/empty-variable.json21
-rw-r--r--tests/auto/pkgconfig/testdata/empty-variable.pc13
-rw-r--r--tests/auto/pkgconfig/tst_pkgconfig.cpp2
137 files changed, 1173 insertions, 591 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 1ae91aafb..6fab186aa 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -2,6 +2,7 @@
Checks: >
-*,
bugprone-*,
+ -bugprone-narrowing-conversions,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-pro-type-cstyle-cast,
cppcoreguidelines-pro-type-member-init,
@@ -42,6 +43,7 @@ Checks: >
modernize-use-transparent-functors,
modernize-use-using,
performance-*,
+ -performance-no-int-to-ptr,
readability-avoid-const-params-in-decls,
readability-container-size-empty,
readability-delete-null-pointer,
@@ -69,205 +71,5 @@ WarningsAsErrors: >
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
CheckOptions:
- - key: bugprone-argument-comment.StrictMode
- value: '0'
- - key: bugprone-assert-side-effect.AssertMacros
- value: assert
- - key: bugprone-assert-side-effect.CheckFunctionCalls
- value: '0'
- - key: bugprone-dangling-handle.HandleClasses
- value: 'std::basic_string_view;std::experimental::basic_string_view'
- - key: bugprone-exception-escape.FunctionsThatShouldNotThrow
- value: ''
- - key: bugprone-exception-escape.IgnoredExceptions
- value: ''
- - key: bugprone-misplaced-widening-cast.CheckImplicitCasts
- value: '0'
- - key: bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant
- value: '1'
- - key: bugprone-sizeof-expression.WarnOnSizeOfConstant
- value: '1'
- - key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression
- value: '0'
- - key: bugprone-sizeof-expression.WarnOnSizeOfThis
- value: '1'
- - key: bugprone-string-constructor.LargeLengthThreshold
- value: '8388608'
- - key: bugprone-string-constructor.WarnOnLargeLength
- value: '1'
- - key: bugprone-suspicious-enum-usage.StrictMode
- value: '0'
- - key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens
- value: '5'
- - key: bugprone-suspicious-missing-comma.RatioThreshold
- value: '0.200000'
- - key: bugprone-suspicious-missing-comma.SizeThreshold
- value: '5'
- - key: bugprone-suspicious-string-compare.StringCompareLikeFunctions
- value: ''
- - key: bugprone-suspicious-string-compare.WarnOnImplicitComparison
- value: '1'
- - key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison
- value: '0'
- - key: bugprone-unused-return-value.CheckedFunctions
- value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty'
- - key: cert-dcl16-c.NewSuffixes
- value: 'L;LL;LU;LLU'
- - key: cppcoreguidelines-no-malloc.Allocations
- value: '::malloc;::calloc'
- - key: cppcoreguidelines-no-malloc.Deallocations
- value: '::free'
- - key: cppcoreguidelines-no-malloc.Reallocations
- value: '::realloc'
- - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
- value: '1'
- - key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
- value: ''
- - key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
- value: '0'
- - key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
- value: '0'
- - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
- value: '0'
- - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
- value: '0'
- - key: google-build-namespaces.HeaderFileExtensions
- value: ',h,hh,hpp,hxx'
- - key: google-global-names-in-headers.HeaderFileExtensions
- value: ',h,hh,hpp,hxx'
- - key: google-readability-braces-around-statements.ShortStatementLines
- value: '1'
- - key: google-readability-function-size.BranchThreshold
- value: '4294967295'
- - key: google-readability-function-size.LineThreshold
- value: '4294967295'
- - key: google-readability-function-size.NestingThreshold
- value: '4294967295'
- - key: google-readability-function-size.ParameterThreshold
- value: '4294967295'
- - key: google-readability-function-size.StatementThreshold
- value: '800'
- - key: google-readability-function-size.VariableThreshold
- value: '4294967295'
- - key: google-readability-namespace-comments.ShortNamespaceLines
- value: '10'
- - key: google-readability-namespace-comments.SpacesBeforeComments
- value: '2'
- - key: google-runtime-int.SignedTypePrefix
- value: int
- - key: google-runtime-int.TypeSuffix
- value: ''
- - key: google-runtime-int.UnsignedTypePrefix
- value: uint
- - key: misc-definitions-in-headers.HeaderFileExtensions
- value: ',h,hh,hpp,hxx'
- - key: misc-definitions-in-headers.UseHeaderFileExtension
- value: '1'
- - key: misc-unused-parameters.StrictMode
- value: '0'
- - key: modernize-loop-convert.MaxCopySize
- value: '16'
- - key: modernize-loop-convert.MinConfidence
- value: reasonable
- - key: modernize-loop-convert.NamingStyle
- value: CamelCase
- - key: modernize-make-shared.IgnoreMacros
- value: '1'
- - key: modernize-make-shared.IncludeStyle
- value: '0'
- - key: modernize-make-shared.MakeSmartPtrFunction
- value: 'std::make_shared'
- - key: modernize-make-shared.MakeSmartPtrFunctionHeader
- value: memory
- - key: modernize-make-unique.IgnoreMacros
- value: '1'
- - key: modernize-make-unique.IncludeStyle
- value: '0'
- - key: modernize-make-unique.MakeSmartPtrFunction
- value: 'std::make_unique'
- - key: modernize-make-unique.MakeSmartPtrFunctionHeader
- value: memory
- - key: modernize-pass-by-value.IncludeStyle
- value: llvm
- - key: modernize-pass-by-value.ValuesOnly
- value: '0'
- - key: modernize-raw-string-literal.ReplaceShorterLiterals
- value: '0'
- - key: modernize-replace-auto-ptr.IncludeStyle
- value: llvm
- - key: modernize-replace-random-shuffle.IncludeStyle
- value: llvm
- - key: modernize-use-auto.MinTypeNameLength
- value: '5'
- - key: modernize-use-auto.RemoveStars
- value: '0'
- - key: modernize-use-emplace.ContainersWithPushBack
- value: '::std::vector;::std::list;::std::deque'
- - key: modernize-use-emplace.SmartPointers
- value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
- - key: modernize-use-emplace.TupleMakeFunctions
- value: '::std::make_pair;::std::make_tuple'
- - key: modernize-use-emplace.TupleTypes
- value: '::std::pair;::std::tuple'
- - key: modernize-use-equals-default.IgnoreMacros
- value: '1'
- - key: modernize-use-equals-delete.IgnoreMacros
- value: '1'
- - key: modernize-use-noexcept.ReplacementString
- value: ''
- - key: modernize-use-noexcept.UseNoexceptFalse
- value: '1'
- - key: modernize-use-nullptr.NullMacros
- value: 'NULL'
- - key: modernize-use-transparent-functors.SafeMode
- value: '0'
- - key: modernize-use-using.IgnoreMacros
- value: '1'
- - key: performance-faster-string-find.StringLikeClasses
- value: 'std::basic_string'
- - key: performance-for-range-copy.AllowedTypes
- value: ''
- - key: performance-for-range-copy.WarnOnAllAutoCopies
- value: '0'
- - key: performance-inefficient-string-concatenation.StrictMode
- value: '0'
- - key: performance-inefficient-vector-operation.VectorLikeClasses
- value: '::std::vector'
- - key: performance-move-const-arg.CheckTriviallyCopyableMove
- value: '1'
- - key: performance-move-constructor-init.IncludeStyle
- value: llvm
- - key: performance-type-promotion-in-math-fn.IncludeStyle
- value: llvm
- - key: performance-unnecessary-copy-initialization.AllowedTypes
- value: ''
- - key: performance-unnecessary-value-param.AllowedTypes
- value: ''
- - key: performance-unnecessary-value-param.IncludeStyle
- value: llvm
- - key: readability-function-size.BranchThreshold
- value: '4294967295'
- - key: readability-function-size.LineThreshold
- value: '4294967295'
- - key: readability-function-size.NestingThreshold
- value: '4294967295'
- - key: readability-function-size.ParameterThreshold
- value: '4294967295'
- - key: readability-function-size.StatementThreshold
- value: '800'
- - key: readability-function-size.VariableThreshold
- value: '4294967295'
- - key: readability-identifier-naming.IgnoreFailedSplit
- value: '0'
- - key: readability-inconsistent-declaration-parameter-name.IgnoreMacros
- value: '1'
- - key: readability-inconsistent-declaration-parameter-name.Strict
- value: '0'
- - key: readability-redundant-smartptr-get.IgnoreMacros
- value: '1'
- - key: readability-simplify-boolean-expr.ChainedConditionalAssignment
- value: '0'
- - key: readability-simplify-boolean-expr.ChainedConditionalReturn
- value: '0'
...
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index bacf90555..811add8cc 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -58,7 +58,7 @@ jobs:
build-linux-extra:
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
- timeout-minutes: 60
+ timeout-minutes: 90
strategy:
fail-fast: false
matrix:
@@ -84,11 +84,11 @@ jobs:
cacheid: 'qmake',
}
- {
- name: 'Build on Linux (gcc, Qt 6)',
+ name: 'Build on Linux (gcc, Qt 6.2)',
image: 'focal-qt6',
script: './scripts/build-qbs-with-qbs.sh',
options: 'modules.cpp.compilerWrapper:ccache
- modules.qbsbuildconfig.enableAddressSanitizer:false
+ products.qbsscriptengine.qbsbuildconfig.enableAddressSanitizer:false
modules.qbs.debugInformation:true
modules.qbsbuildconfig.enableBundledQt:true',
cacheid: 'gcc-qt6',
@@ -122,7 +122,7 @@ jobs:
build-macos:
name: Build on macOS
- runs-on: macos-10.15
+ runs-on: macos-11
timeout-minutes: 60
env:
BUILD_OPTIONS: |
@@ -323,13 +323,13 @@ jobs:
script: './scripts/test-qbs.sh',
}
- {
- name: 'Run Linux tests (gcc, Qt 6.0)',
+ name: 'Run Linux tests (gcc, Qt 6.2)',
image: 'focal-qt6',
profile: 'qt-gcc_64',
script: './scripts/test-qt.sh',
}
- {
- name: 'Run Linux tests (gcc, Qt 6.2 static)',
+ name: 'Run Linux tests (gcc, Qt 6.3 static)',
image: 'focal-qt6-static',
profile: 'qt-gcc_64',
script: './scripts/test-qt.sh',
@@ -613,56 +613,56 @@ jobs:
matrix:
config:
- {
- name: 'Run macOS tests (Xcode 12.5)',
- runner: 'macos-11.0',
+ name: 'Run macOS tests (Xcode 13.4)',
+ runner: 'macos-12',
target: 'desktop',
toolchain: 'clang_64',
- testProfile: 'xcode_12_5_1-macosx-x86_64',
+ testProfile: 'xcode_13_4_1-macosx-x86_64',
qtVersion: '5.15.2',
script: './scripts/test-qbs.sh',
}
- {
- name: 'Run macOS tests (Xcode 12.5, Qt 6.0)',
- runner: 'macos-11.0',
+ name: 'Run macOS tests (Xcode 13.4, Qt 6.3)',
+ runner: 'macos-12',
target: 'desktop',
toolchain: 'clang_64',
- testProfile: 'xcode_12_5_1-macosx-x86_64',
- qtVersion: '6.0.2',
+ testProfile: 'xcode_13_4_1-macosx-x86_64',
+ qtVersion: '6.3.1',
script: './scripts/test-qt.sh',
}
- {
- name: 'Run iOS tests (Xcode 12.5)',
- runner: 'macos-11.0',
+ name: 'Run iOS tests (Xcode 13.4)',
+ runner: 'macos-12',
target: 'ios',
toolchain: 'ios',
- testProfile: 'xcode_12_5_1-iphoneos-arm64',
+ testProfile: 'xcode_13_4_1-iphoneos-arm64',
qtVersion: '5.15.2',
script: './scripts/test-qbs.sh',
}
- {
- name: 'Run iOS-sim tests (Xcode 12.5)',
- runner: 'macos-11.0',
+ name: 'Run iOS-sim tests (Xcode 13.4)',
+ runner: 'macos-12',
target: 'ios',
toolchain: 'ios',
- testProfile: 'xcode_12_5_1-iphonesimulator-x86_64',
+ testProfile: 'xcode_13_4_1-iphonesimulator-x86_64',
qtVersion: '5.15.2',
script: './scripts/test-qbs.sh',
}
- {
- name: 'Run macOS tests (Xcode 11.6)',
- runner: 'macos-10.15',
+ name: 'Run macOS tests (Xcode 12.5)',
+ runner: 'macos-11',
target: 'desktop',
toolchain: 'clang_64',
- testProfile: 'xcode_11_6-macosx-x86_64',
+ testProfile: 'xcode_12_5_1-macosx-x86_64',
qtVersion: '5.15.2',
script: './scripts/test-qbs.sh',
}
- {
- name: 'Run macOS tests (Xcode 10.3)',
- runner: 'macos-10.15',
+ name: 'Run macOS tests (Xcode 11.7)',
+ runner: 'macos-11',
target: 'desktop',
toolchain: 'clang_64',
- testProfile: 'xcode_10_3-macosx-x86_64',
+ testProfile: 'xcode_11_7-macosx-x86_64',
qtVersion: '5.15.2',
script: './scripts/test-qbs.sh',
}
@@ -708,7 +708,7 @@ jobs:
test-windows:
name: ${{ matrix.config.name }}
- runs-on: windows-2019
+ runs-on: windows-2022
timeout-minutes: 60
needs: build-windows
strategy:
@@ -716,18 +716,18 @@ jobs:
matrix:
config:
- {
- name: 'Run Windows tests (MSVC 2019)',
+ name: 'Run Windows tests (MSVC 2022)',
target: 'desktop',
toolchain: 'win64_msvc2019_64',
- testProfile: 'MSVC2019-x64',
+ testProfile: 'MSVC2022-x64',
qtVersion: '5.15.2',
script: './scripts/test-qbs.sh',
}
- {
- name: 'Run Windows tests (MSVC 2019, Qt 6.0.2)',
+ name: 'Run Windows tests (MSVC 2022, Qt 6.0.2)',
target: 'desktop',
toolchain: 'win64_msvc2019_64',
- testProfile: 'MSVC2019-x64',
+ testProfile: 'MSVC2022-x64',
qtVersion: '6.0.2',
script: './scripts/test-qt.sh',
}
@@ -769,6 +769,7 @@ jobs:
run: echo "./release/install-root/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install required packages
run: choco install -y pkgconfiglite --download-checksum=6004df17818f5a6dbf19cb335cc92702
+ continue-on-error: true # pkgconfiglite installation is flaky
- name: Install Qt
uses: ./.github/actions/download-qt
with:
@@ -869,8 +870,6 @@ jobs:
shell: bash
- name: Update PATH
run: echo "./release/install-root/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- - name: Install required packages
- run: choco install -y pkgconfiglite --download-checksum=6004df17818f5a6dbf19cb335cc92702
- name: Install OpenWatcom
uses: ./.github/actions/download-ow
- name: Install DigitalMars
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7c3396a1d..6c99c35df 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -179,6 +179,8 @@ jobs:
needs: [build-linux, build-windows-with-docker]
steps:
- uses: actions/checkout@v1
+ with:
+ submodules: true
- name: Get version name
id: get-version-name
run: echo ::set-output name=version-name::$(cat VERSION)
@@ -187,7 +189,7 @@ jobs:
mkdir release
mkdir tmp
- name: Copy sources
- run: rsync -av --exclude='.git/' --exclude='tmp/' . ./tmp/qbs-src-${{ steps.get-version-name.outputs.version-name }}
+ run: rsync -av --exclude='.git/' --exclude='tmp/' --exclude='src/shared/qtscript/.git' . ./tmp/qbs-src-${{ steps.get-version-name.outputs.version-name }}
- name: Zip Archive
run: |
cd tmp/
diff --git a/RELEASE.md b/RELEASE.md
new file mode 100644
index 000000000..c75069ae1
--- /dev/null
+++ b/RELEASE.md
@@ -0,0 +1,105 @@
+# Release Instructions
+
+This file contains instructions how to publish a Qbs release into various package systems.
+
+## Building packages
+
+Release packages are built automatically by the
+[Build release packages](https://github.com/qbs/qbs/actions/workflows/release.yml) job on GitHub
+actions. The job builds every commit, so you'll need to find a specific run triggered by
+pushing a git tag instead of a commit.
+
+The only interesting artifact is qbs-release-v1.x.y - it contains Windows binary packages as
+well as source packages.
+
+Packages should then be uploaded to the
+[Qt Website](https://download.qt.io/official_releases/qbs/).
+
+## Chocolatey
+
+For updating Qbs in [Chocolatey](https://community.chocolatey.org/packages/qbs), you'll need
+to be a maintainer of the Qbs project. You'll also will need an API key from your
+[account](https://community.chocolatey.org/account) (make sure you have one).
+
+Get the qbs.1.x.y.nupkg file from the qbs-release-v1.x.y.zip archive and run the following command:
+
+```
+choco push --api-key <YOUR_API_KEY> qbs.1.x.y.nupkg"
+```
+
+Choco will upload the file, download binary packages from the Qt Website and publish Qbs
+automatically.
+
+## Homebrew
+
+First, you'll need to [install](https://docs.brew.sh/Installation) Homewbrew.
+
+Second, you'll need to fork the [homebrew-core](https://github.com/Homebrew/homebrew-core) repo
+to you GitHub account.
+
+Next you'll need to add your remote to the existing repo:
+```
+$ brew update
+$ cd "$(brew --repository homebrew/core)"
+$ git remote add github git@github.com:<USERNAME>/homebrew-core.git
+# Create a new git branch for your formula so your pull request is easy to
+# modify if any changes come up during review.
+$ git checkout -b <some-descriptive-name> origin/master
+```
+
+You'll need a SHA-256 sum for the qbs-src-1.x.y.tar.gz source package. SHA-256 sum can be
+found in the sha256sums.txt file from the qbs-release-v1.x.y.zip.
+
+Check if the same upgrade has been already submitted by searching the open pull requests for
+[Qbs](https://github.com/Homebrew/homebrew-core/pulls?q=is%3Apr+is%3Aopen+qbs).
+
+Run the following command, replacing the version and SHA-256 sum:
+```
+$ brew bump-formula-pr --strict qbs \
+ --url https://download.qt.io/official_releases/qbs/1.x.y/qbs-src-1.x.y.tar.gz \
+ --sha256=<SHA-256>
+```
+
+The above can also be done manually by editing the formula source code and creating a pull request.
+
+Some useful commands to build/test formula locally:
+```
+$ brew install --build-from-source qbs
+$ brew test qbs
+$ brew audit --strict qbs
+```
+
+## Mac Ports
+
+Fork [macports-ports](https://github.com/macports/macports-ports) to your GitHub account
+and clone the repo.
+
+Run the following command in the repo dir (must be done only once):
+```
+$ sudo /opt/local/bin/portindex
+```
+
+Make sure that /opt/local/etc/macports/sources.conf contains a line like
+file:///Users/abbapoh/dev/macports-ports [default]
+pointing to your local repo.
+
+Get the qbs-src-1.x.y.tar.gz source package from the archive or from the
+[Qt Website](https://download.qt.io/official_releases/qbs/) and make note of the file size:
+```
+$ ls -l qbs-src-1.x.y.tar.gz
+```
+Get checksums:
+```
+$ openssl sha256 qbs-src-1.x.y.tar.gz
+$ openssl rmd160 qbs-src-1.x.y.tar.gz
+```
+
+Update the devel/qbs/Portfile file with the new url, filesize and checksums.
+
+Build the package:
+```
+$ /opt/local/bin/port lint qbs
+$ sudo /opt/local/bin/port -vst install qbs
+$ /opt/local/bin/qbs --version # Check that this reports the right version
+```
+Commit. Push. Create merge request.
diff --git a/VERSION b/VERSION
index a6c2798a4..53cc1a6f9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.23.0
+1.24.0
diff --git a/changelogs/changes-1.23.0.md b/changelogs/changes-1.23.0.md
new file mode 100644
index 000000000..e8234e3fe
--- /dev/null
+++ b/changelogs/changes-1.23.0.md
@@ -0,0 +1,16 @@
+# C/C++ Support
+* Added new module Sanitizers.address for simple cross-platform ASan configuration.
+
+# Qt Support
+* Add the now-required /permissive- flag for MSVC automatically.
+
+# Android Support
+* Support use of cmdline-tools in addition to SDK tools.
+* Consider .jar files also in the product itself, not just in dependencies.
+
+# Contributors
+* Christian Kandeler
+* Dmitry Shachnev
+* Ivan Komissarov
+* Max Bespalov
+* Orgad Shaneh
diff --git a/changelogs/changes-1.23.1.md b/changelogs/changes-1.23.1.md
new file mode 100644
index 000000000..65536bfeb
--- /dev/null
+++ b/changelogs/changes-1.23.1.md
@@ -0,0 +1,19 @@
+# C/C++ Support
+* Added support for c17 and c2x values in cpp.cLanguageVersion.
+* Added support for cpp.cLanguageVersion for the MSVC toolchain.
+* Fix passing linker scripts to iar and keil toolchains (QBS-1704).
+
+# Qt Support
+* Adapted to new location of qscxmlc in Qt 6.3.
+* Adapted to new location of qhelpgenerator in Qt 6.3.
+* Fixed setting up Qt 6.3 with qbspkgconfig.
+* Added QtScript module to the source tarballs (QBS-1703).
+
+# Other modules
+* Fixed protobuf linking on macOS 11.
+* Fixed handling empty variables in qbspkgconfig (QBS-1702)
+
+# Contributors
+* Christian Kandeler
+* Ivan Komissarov
+* Orgad Shaneh
diff --git a/changelogs/changes-1.23.2.md b/changelogs/changes-1.23.2.md
new file mode 100644
index 000000000..56e8a7862
--- /dev/null
+++ b/changelogs/changes-1.23.2.md
@@ -0,0 +1,10 @@
+# Qt Support
+* Set _ENABLE_EXTENDED_ALIGNED_STORAGE for MSVC
+
+# Documentation
+* Fix installation with cmake
+
+# Contributors
+* Christian Kandeler
+* Ivan Komissarov
+* Marius Gripsgard
diff --git a/cmake/QbsBuildConfig.cmake b/cmake/QbsBuildConfig.cmake
index a29f550f2..cc2db2fb3 100644
--- a/cmake/QbsBuildConfig.cmake
+++ b/cmake/QbsBuildConfig.cmake
@@ -24,6 +24,7 @@ set(QBS_PLUGINS_INSTALL_BASE "${QBS_LIBDIR_NAME}" CACHE STRING "Relative install
set(QBS_RESOURCES_INSTALL_BASE "." CACHE STRING "Relative install location for Qbs resources.")
set(QBS_HEADERS_INSTALL_DIR "include/qbs" CACHE STRING "Relative install location for Qbs headers.")
set(QBS_DOC_INSTALL_DIR "${QBS_RESOURCES_INSTALL_BASE}/share/doc/qbs" CACHE STRING "Relative install location for Qbs documentation.")
+set(QBS_DOC_HTML_DIR_NAME "html" CACHE STRING "The name of the dir with HTML files, appended to QBS_DOC_INSTALL_DIR.")
set(QBS_PLUGINS_INSTALL_DIR "${QBS_PLUGINS_INSTALL_BASE}/qbs/plugins")
set(QBS_RESOURCES_INSTALL_DIR "${QBS_RESOURCES_INSTALL_BASE}/share")
diff --git a/cmake/QbsDocumentation.cmake b/cmake/QbsDocumentation.cmake
index a1ce44057..c8c1635e7 100644
--- a/cmake/QbsDocumentation.cmake
+++ b/cmake/QbsDocumentation.cmake
@@ -1,6 +1,7 @@
# Options:
option(QBS_INSTALL_HTML_DOCS "Whether to install Qbs HTML Documentation" OFF)
option(QBS_INSTALL_QCH_DOCS "Whether to install Qbs QCH Documentation" OFF)
+option(QBS_INSTALL_MAN_PAGE "Whether to install Qbs man page" OFF)
# Get information on directories from qmake
# as this is not yet exported by cmake.
@@ -69,6 +70,11 @@ function(_qbs_setup_doc_targets)
BuildQbsDocumentation ALL COMMENT "Build Qbs documentation")
add_dependencies(BuildQbsDocumentation qbs_html_docs qbs_qch_docs)
endif()
+ if (NOT TARGET qbs_docs)
+ add_custom_target(
+ qbs_docs ALL COMMENT "Build Qbs documentation")
+ add_dependencies(qbs_docs BuildQbsDocumentation)
+ endif()
endfunction()
function(_find_python_module module)
@@ -119,8 +125,6 @@ function(_qbs_setup_qdoc_targets _qdocconf_file _retval)
get_filename_component(_target "${_qdocconf_file}" NAME_WE)
- # message(${_target})
- # set(_html_outputdir "${_arg_HTML_DIR}/${_target}${_arg_POSTFIX}")
set(_html_outputdir "${_arg_HTML_DIR}")
file(MAKE_DIRECTORY "${_html_outputdir}")
@@ -183,6 +187,13 @@ function(_qbs_setup_qdoc_targets _qdocconf_file _retval)
add_custom_target(${_html_target} DEPENDS "${_fixed_html_artifact}")
add_dependencies(qbs_html_docs "${_html_target}")
+ # artifacts might be required for QCH-only installation, so we build them
+ # always, and skip HTML docs installation here
+ if (QBS_INSTALL_HTML_DOCS)
+ install(DIRECTORY "${_html_outputdir}" DESTINATION "${_arg_INSTALL_DIR}"
+ COMPONENT qbs_docs)
+ endif()
+
set("${_retval}" "${_html_outputdir}" PARENT_SCOPE)
endfunction()
@@ -228,9 +239,7 @@ function(_qbs_setup_qhelpgenerator_targets _qdocconf_file _html_outputdir)
add_dependencies(qbs_qch_docs "${_qch_target}")
install(FILES "${_qch_outputdir}/${_target}.qch" DESTINATION "${_arg_INSTALL_DIR}"
- COMPONENT qbs_qch_docs)
- install(DIRECTORY "${_qch_outputdir}/html" DESTINATION "${_arg_INSTALL_DIR}"
- COMPONENT qbs_html_docs)
+ COMPONENT qbs_docs)
endfunction()
# Helper functions:
@@ -285,10 +294,11 @@ function(add_qbs_documentation qdocconf_file)
set(SRCDIR "${Qbs_SOURCE_DIR}/doc")
set(_qch_params)
+ # if QBS_INSTALL_QCH_DOCS is No, qch generation will be skipped entirely
if (QBS_INSTALL_QCH_DOCS)
set(_qch_params QCH QCH_DIR "${CMAKE_CURRENT_BINARY_DIR}")
endif()
- set(_qdoc_params HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
+ set(_qdoc_params HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/${QBS_DOC_HTML_DIR_NAME}")
list(APPEND _qdoc_params INSTALL_DIR "${QBS_DOC_INSTALL_DIR}")
# Set up environment for qdoc:
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 5b8ac7636..04ff12470 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -26,3 +26,5 @@ add_qbs_documentation(
${_DOC_IMAGES_SOURCES}
${_DOC_TARGETS_SOURCES}
)
+
+add_subdirectory(man)
diff --git a/doc/appendix/json-api.qdoc b/doc/appendix/json-api.qdoc
index 68bb644cf..b555825f9 100644
--- a/doc/appendix/json-api.qdoc
+++ b/doc/appendix/json-api.qdoc
@@ -117,6 +117,7 @@
\row \li build-root \li \l FilePath \li yes
\row \li configuration-name \li string \li no
\row \li data-mode \li \l DataMode \li no
+ \row \li deprecation-warning-mode \li string \li no
\row \li dry-run \li bool \li no
\row \li environment \li \l Environment \li no
\row \li error-handling-mode \li string \li no
diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt
new file mode 100644
index 000000000..00d003d7f
--- /dev/null
+++ b/doc/man/CMakeLists.txt
@@ -0,0 +1,3 @@
+if (QBS_INSTALL_MAN_PAGE)
+ install(FILES qbs.1 DESTINATION ${QBS_RESOURCES_INSTALL_DIR}/man/man1 COMPONENT qbs_docs)
+endif()
diff --git a/doc/reference/cli/builtin/cli-resolve.qdoc b/doc/reference/cli/builtin/cli-resolve.qdoc
index 273ce8403..4569980bd 100644
--- a/doc/reference/cli/builtin/cli-resolve.qdoc
+++ b/doc/reference/cli/builtin/cli-resolve.qdoc
@@ -56,6 +56,7 @@
\include cli-options.qdocinc settings-dir
\include cli-options.qdocinc show-progress
\include cli-options.qdocinc no-fallback-module-provider
+ \include cli-options.qdocinc deprecation-warnings
\section1 Parameters
diff --git a/doc/reference/cli/cli-options.qdocinc b/doc/reference/cli/cli-options.qdocinc
index db8eeae48..ecb8f5c3e 100644
--- a/doc/reference/cli/cli-options.qdocinc
+++ b/doc/reference/cli/cli-options.qdocinc
@@ -331,6 +331,27 @@
//! [config-ui-system]
+//! [deprecation-warnings]
+
+ \section2 \c {--deprecation-warnings <mode>}
+
+ Uses the specified deprecation warning mode, which controls what to do when deprecated
+ items or properties are encountered in the project. By default, a warning is emitted
+ if the item or property is scheduled for removal in the next minor version of \QBS.
+ Warnings can also be switched on or off unconditionally, and it can be specified that
+ project resolving should abort if deprecated constructs are present.
+
+ Possible values of \c <mode> are:
+
+ \list
+ \li \c error
+ \li \c on
+ \li \c before-removal (default value)
+ \li \c off
+ \endlist
+
+//! [deprecation-warnings]
+
//! [log-level]
\section2 \c {--log-level <level>}
diff --git a/doc/reference/items/probe/pkgconfig-probe.qdoc b/doc/reference/items/probe/pkgconfig-probe.qdoc
index 15435ede4..22fd510ac 100644
--- a/doc/reference/items/probe/pkgconfig-probe.qdoc
+++ b/doc/reference/items/probe/pkgconfig-probe.qdoc
@@ -110,7 +110,7 @@
\qmlproperty string PkgConfigProbe::exactVersion
The exact version of the required package. If set, pkg-config will ignore packages with
- version greater than the value of this property.
+ version that is not equal to the value of this property.
\nodefaultvalue
*/
@@ -119,7 +119,7 @@
\qmlproperty string PkgConfigProbe::maxVersion
The maximum version of the required package. If set, pkg-config will ignore packages with
- version that is not equal to the value of this property.
+ version greater than the value of this property.
\nodefaultvalue
*/
diff --git a/doc/reference/jsextensions/jsextension-fileinfo.qdoc b/doc/reference/jsextensions/jsextension-fileinfo.qdoc
index cb0eb7c43..d58c1a9e9 100644
--- a/doc/reference/jsextensions/jsextension-fileinfo.qdoc
+++ b/doc/reference/jsextensions/jsextension-fileinfo.qdoc
@@ -164,4 +164,11 @@
\endcode
Returns the host operating system path separator.
\funsince 1.22
+
+ \section2 executableSuffix
+ \code
+ FileInfo.executableSuffix(): string
+ \endcode
+ Returns the host operating system executable suffix.
+ \funsince 1.23
*/
diff --git a/doc/reference/jsextensions/jsextension-host.qdoc b/doc/reference/jsextensions/jsextension-host.qdoc
index 1dda85d17..c011e90eb 100644
--- a/doc/reference/jsextensions/jsextension-host.qdoc
+++ b/doc/reference/jsextensions/jsextension-host.qdoc
@@ -70,7 +70,7 @@
\section2 platform
\code
- Host.platform(): string[]
+ Host.platform(): string
\endcode
Returns the host operating system platform.
@@ -111,21 +111,21 @@
\section2 osVersionMajor
\code
- Host.osVersionMajor(): string[]
+ Host.osVersionMajor(): number
\endcode
Returns the host operating system major version.
\funsince 1.22
\section2 osVersionMinor
\code
- Host.osVersionMinor(): string[]
+ Host.osVersionMinor(): number
\endcode
Returns the host operating system minor version.
\funsince 1.22
\section2 osVersionPatch
\code
- Host.osVersionPatch(): string[]
+ Host.osVersionPatch(): number
\endcode
Returns the host operating system patch level.
\funsince 1.22
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc
index 6eea7d9e3..540516135 100644
--- a/doc/reference/modules/cpp-module.qdoc
+++ b/doc/reference/modules/cpp-module.qdoc
@@ -837,7 +837,7 @@
If the value is left undefined, the compiler default will be used.
If the list contains more than one value, the highest version is chosen.
- Possible values include: \c{"c89"}, \c{"c99"}, \c{"c11"}.
+ Possible values include: \c{"c89"}, \c{"c99"}, \c{"c11"}, \c{"c17"}, \c{"c2x"}.
\nodefaultvalue
*/
diff --git a/docker-compose.yml b/docker-compose.yml
index ed294dfd8..680d1b837 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -18,10 +18,10 @@ x-default-service: &linux
- SYS_PTRACE
services:
- focal:
+ focal-qt5: &focal-qt5
<< : *linux
- hostname: focal
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-5.15.2_1.20.1-1
+ hostname: focal-qt5
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-5.15.2_1.20.1-2
build:
dockerfile: docker/focal/Dockerfile
context: .
@@ -32,23 +32,26 @@ services:
focal-qt6:
<< : *linux
hostname: focal-qt6
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt6-6.2.0_1.20.1-1
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt6-6.2.4_1.20.1-1
build:
dockerfile: docker/focal/Dockerfile
context: .
args:
- QT_VERSION: 6.2.0
+ QT_VERSION: 6.2.4
QTCREATOR_VERSION: 5.0.3
+ focal:
+ << : *focal-qt5
+
focal-qt6-static:
<< : *linux
hostname: focal-qt6-static
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt6-static-6.2.0_1.20.1-1
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt6-static-6.3.1_1.20.1-0
build:
dockerfile: docker/focal/test-qt6-static.Dockerfile
context: .
args:
- QT_VERSION: 6.2.0
+ QT_VERSION: 6.3.1
QTCREATOR_VERSION: 5.0.3
focal-android-513:
@@ -158,7 +161,7 @@ services:
focal-qt4:
<< : *linux
hostname: focal-qt4
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt4-0
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt4-1
build:
dockerfile: docker/focal/test-qt4.Dockerfile
context: .
diff --git a/docker/focal/Dockerfile b/docker/focal/Dockerfile
index df687f3a0..50354431f 100644
--- a/docker/focal/Dockerfile
+++ b/docker/focal/Dockerfile
@@ -40,8 +40,8 @@ RUN apt-get update -qq && \
ca-certificates \
capnproto \
ccache \
- clang-8 \
- clang-tidy-8 \
+ clang-12 \
+ clang-tidy-12 \
cmake \
curl \
flex \
@@ -71,13 +71,13 @@ RUN apt-get update -qq && \
subversion \
unzip \
zip && \
- update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100 && \
- update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100 && \
- update-alternatives --install /usr/bin/clang-check clang-check /usr/bin/clang-check-8 100 && \
+ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 && \
+ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 && \
+ update-alternatives --install /usr/bin/clang-check clang-check /usr/bin/clang-check-12 100 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 100 && \
- pip install beautifulsoup4 lxml protobuf pyyaml
+ pip install beautifulsoup4 lxml protobuf==3.19.1 pyyaml
-ENV LLVM_INSTALL_DIR=/usr/lib/llvm-8
+ENV LLVM_INSTALL_DIR=/usr/lib/llvm-12
#
diff --git a/docker/focal/test-qt4.Dockerfile b/docker/focal/test-qt4.Dockerfile
index c23a664d2..e49e255f9 100644
--- a/docker/focal/test-qt4.Dockerfile
+++ b/docker/focal/test-qt4.Dockerfile
@@ -36,5 +36,5 @@ RUN sudo add-apt-repository ppa:gezakovacs/ppa -y && \
apt-get update -qq && \
apt-get install -qq -y \
build-essential \
- libqt4-dev
-
+ libqt4-dev \
+ qt4-dev-tools
diff --git a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs
index 4a50298fd..28104b55b 100644
--- a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs
+++ b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs
@@ -58,9 +58,11 @@ Module {
function versionAtLeast(v) {
return Utilities.versionCompare(cpp.compilerVersion, v) >= 0;
};
+ if (isClang())
+ flags.push("-Wno-constant-logical-operand");
if ((!isClang() && versionAtLeast("9"))
|| (isClang() && !qbs.hostOS.contains("darwin") && versionAtLeast("10"))) {
- flags.push("-Wno-deprecated-copy", "-Wno-constant-logical-operand");
+ flags.push("-Wno-deprecated-copy");
}
return flags;
}
diff --git a/scripts/address-sanitizer-suppressions.txt b/scripts/address-sanitizer-suppressions.txt
index f3e1980b1..b31f34a05 100644
--- a/scripts/address-sanitizer-suppressions.txt
+++ b/scripts/address-sanitizer-suppressions.txt
@@ -1,3 +1,4 @@
leak:libQt5Script.so.5
+leak:libqbsscriptengine.so
leak:QThreadPrivate::QThreadPrivate
leak:QArrayData::allocate
diff --git a/scripts/install-ow.sh b/scripts/install-ow.sh
index 6b123fab8..c8db30b8f 100755
--- a/scripts/install-ow.sh
+++ b/scripts/install-ow.sh
@@ -38,6 +38,7 @@
##
#############################################################################
set -eu
+set -o pipefail
function show_help() {
cat <<EOF
@@ -114,15 +115,15 @@ DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'ow-tmp'`
VERSION_MAJOR=`echo $VERSION | cut -d. -f1`
VERSION_MINOR=`echo $VERSION | cut -d. -f2`
-OW_URL="https://github.com/open-watcom/open-watcom-v${VERSION_MAJOR}/releases/download/Current-build/ow-snapshot.tar.gz"
-OW_TARGZ="${DOWNLOAD_DIR}/ow.tar.gz"
+OW_URL="https://github.com/open-watcom/open-watcom-v${VERSION_MAJOR}/releases/download/Current-build/ow-snapshot.tar.xz"
+OW_TAR="${DOWNLOAD_DIR}/ow.tar.xz"
echo "Downloading compiler from ${OW_URL}..." >&2
-curl --progress-bar -L -o ${OW_TARGZ} ${OW_URL} >&2
+curl --progress-bar -L -o ${OW_TAR} ${OW_URL} >&2
echo "Unpacking compiler to ${INSTALL_DIR}..." >&2
-7z x "${OW_TARGZ}" -so | 7z x -aoa -si -ttar -o"${INSTALL_DIR}" >/dev/null 2>&1
+7z x "${OW_TAR}" -so | 7z x -aoa -si -ttar -o"${INSTALL_DIR}" >/dev/null 2>&1
echo "${INSTALL_DIR}/${BIN_DIR}"
-rm -f ${OW_TARGZ}
+rm -f ${OW_TAR}
diff --git a/scripts/install-qt.sh b/scripts/install-qt.sh
index 8af82ccbc..2cc895e07 100755
--- a/scripts/install-qt.sh
+++ b/scripts/install-qt.sh
@@ -89,7 +89,7 @@ Options
android
any, android_armv7, android_arm64_v8a
desktop
- clang_64 (default),
+ clang_64 (default)
ios
ios
@@ -348,7 +348,7 @@ for COMPONENT in ${COMPONENTS}; do
SUBDIR="${TOOLCHAIN/win32_/}"
elif [[ "${TOOLCHAIN}" =~ "any" ]] && [[ "${TARGET_PLATFORM}" == "android" ]]; then
SUBDIR="android"
- elif [ "${HOST_OS}" == "mac_x64" ] && [ ! "${VERSION}" \< "6.1.2" ]; then
+ elif [[ "${HOST_OS}" == "mac_x64" ]] && [[ ! "${VERSION}" < "6.1.2" ]] && [[ "${TARGET_PLATFORM}" == "desktop" ]]; then
SUBDIR="macos"
else
SUBDIR="${TOOLCHAIN}"
diff --git a/scripts/run-analyzer.sh b/scripts/run-analyzer.sh
index 4293883a1..a410e8b4c 100755
--- a/scripts/run-analyzer.sh
+++ b/scripts/run-analyzer.sh
@@ -57,7 +57,8 @@ if [ -z "$RUN_CLANG_TIDY" ] || [ -z "$CLANG_TIDY" ]; then
fi
fi
-CPU_COUNT=$("$(dirname "$0")"/cpu-count.sh)
+SCRIPT_DIR=$(dirname "$0")
+CPU_COUNT=$("${SCRIPT_DIR}/cpu-count.sh")
BUILD_OPTIONS="\
${QBS_BUILD_PROFILE:+profile:${QBS_BUILD_PROFILE}} \
@@ -88,7 +89,7 @@ import os
import sys
dbFile = sys.argv[1]
-blacklist = ['json.cpp', 'qmljsgrammar.cpp']
+blacklist = ['json.cpp', 'qmljsgrammar.cpp', 'qmljsparser.cpp']
seenFiles = set()
patched_db = []
with open(dbFile, 'r') as f:
diff --git a/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs b/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs
index 28375a469..5b777d3e2 100644
--- a/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs
@@ -35,7 +35,7 @@ import qbs.Host
import "../../../modules/Android/sdk/utils.js" as SdkUtils
import "../../../modules/Android/android-utils.js" as AndroidUtils
-BinaryProbe {
+PathProbe {
environmentPaths: Environment.getEnv("ANDROID_HOME")
platformSearchPaths: {
if (Host.os().contains("windows"))
@@ -54,21 +54,17 @@ BinaryProbe {
property string platform
configure: {
- var suffixes = nameSuffixes || [""];
var i, allPaths = (environmentPaths || []).concat(platformSearchPaths || []);
candidatePaths = allPaths;
for (i in allPaths) {
- for (var j in suffixes) {
- if (File.exists(FileInfo.joinPaths(allPaths[i],
- "tools", "android" + suffixes[j]))) {
- path = allPaths[i];
- buildToolsVersions = SdkUtils.availableBuildToolsVersions(path)
- buildToolsVersion = buildToolsVersions[buildToolsVersions.length - 1];
- platforms = AndroidUtils.availablePlatforms(path)
- platform = platforms[platforms.length - 1];
- found = true;
- return;
- }
+ if (File.exists(FileInfo.joinPaths(allPaths[i], "build-tools"))) {
+ path = allPaths[i];
+ buildToolsVersions = SdkUtils.availableBuildToolsVersions(path)
+ buildToolsVersion = buildToolsVersions[buildToolsVersions.length - 1];
+ platforms = AndroidUtils.availablePlatforms(path)
+ platform = platforms[platforms.length - 1];
+ found = true;
+ return;
}
}
}
diff --git a/share/qbs/imports/qbs/Probes/ConanfileProbe.qbs b/share/qbs/imports/qbs/Probes/ConanfileProbe.qbs
index 32fbcace2..097b1b6f1 100644
--- a/share/qbs/imports/qbs/Probes/ConanfileProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/ConanfileProbe.qbs
@@ -31,7 +31,6 @@
import qbs.Process
import qbs.File
import qbs.FileInfo
-import qbs.Host
import qbs.TextFile
import qbs.Utilities
@@ -40,7 +39,7 @@ Probe {
property stringList additionalArguments: []
property path conanfilePath
property path packageReference
- property path executable: "conan" + (Host.os().contains("windows") ? ".exe": "")
+ property path executable: "conan" + FileInfo.executableSuffix()
property stringList generators: ["json"]
property var options
property var settings
diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js
index 72b21c395..db3ff67b8 100644
--- a/share/qbs/module-providers/Qt/setup-qt.js
+++ b/share/qbs/module-providers/Qt/setup-qt.js
@@ -48,7 +48,7 @@ var Utilities = require("qbs.Utilities");
function splitNonEmpty(s, c) { return s.split(c).filter(function(e) { return e; }); }
function toNative(p) { return FileInfo.toNativeSeparators(p); }
-function exeSuffix(qbs) { return Host.os().contains("windows") ? ".exe" : ""; }
+function exeSuffix(qbs) { return FileInfo.executableSuffix(); }
function getQmakeFilePaths(qmakeFilePaths, qbs) {
if (qmakeFilePaths && qmakeFilePaths.length > 0)
@@ -281,7 +281,11 @@ function getQtProperties(qmakeFilePath, qbs) {
// QML tools were only moved in Qt 6.2.
qtProps.qmlLibExecPath = Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0
- ? qtProps.libExecPath : qtProps.binaryPath
+ ? qtProps.libExecPath : qtProps.binaryPath;
+
+ // qhelpgenerator was only moved in Qt 6.3.
+ qtProps.helpGeneratorLibExecPath = Utilities.versionCompare(qtProps.qtVersion, "6.3") >= 0
+ ? qtProps.libExecPath : qtProps.binaryPath;
if (!File.exists(qtProps.mkspecBasePath))
throw "Cannot extract the mkspecs directory.";
@@ -763,6 +767,7 @@ function doSetupLibraries(modInfo, qtProps, debugBuild, nonExistingPrlFiles, and
for (i = 0; i < parts.length; ++i) {
var part = parts[i];
part = part.replace("$$[QT_INSTALL_LIBS]", qtProps.libraryPath);
+ part = part.replace("$$[QT_INSTALL_PLUGINS]", qtProps.pluginPath);
part = part.replace("$$[QT_INSTALL_PREFIX]", qtProps.installPrefixPath);
if (part.startsWith("-l")) {
libs.push(part.slice(2));
@@ -1432,6 +1437,7 @@ function replaceSpecialValues(content, module, qtProps, abi) {
pluginPath: ModUtils.toJSLiteral(qtProps.pluginPath),
incPath: ModUtils.toJSLiteral(qtProps.includePath),
docPath: ModUtils.toJSLiteral(qtProps.documentationPath),
+ helpGeneratorLibExecPath: ModUtils.toJSLiteral(qtProps.helpGeneratorLibExecPath),
mkspecName: ModUtils.toJSLiteral(qtProps.mkspecName),
mkspecPath: ModUtils.toJSLiteral(qtProps.mkspecPath),
version: ModUtils.toJSLiteral(qtProps.qtVersion),
diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs
index c3c68164f..b980588ff 100644
--- a/share/qbs/module-providers/Qt/templates/core.qbs
+++ b/share/qbs/module-providers/Qt/templates/core.qbs
@@ -18,7 +18,7 @@ Module {
&& qbs.targetPlatform === targetPlatform + "-simulator"
Depends { name: "cpp" }
- Depends { name: "Sanitizers.address" }
+ Depends { name: "Sanitizers.address"; condition: config.contains("sanitize_address") }
Depends { name: "Qt.android_support"; condition: qbs.targetOS.contains("android") }
Properties {
@@ -57,6 +57,7 @@ Module {
property string qdocName: versionMajor >= 5 ? "qdoc" : "qdoc3"
property stringList qdocEnvironment
property path docPath: @docPath@
+ property string helpGeneratorLibExecPath: @helpGeneratorLibExecPath@
property stringList helpGeneratorArgs: versionMajor >= 5 ? ["-platform", "minimal"] : []
property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int versionMajor: versionParts[0]
@@ -120,8 +121,6 @@ Module {
property stringList moduleConfig: @moduleConfig@
- Sanitizers.address.enabled: config.contains("sanitize_address")
-
Properties {
condition: moduleConfig.contains("use_gold_linker")
cpp.linkerVariant: "gold"
@@ -150,6 +149,8 @@ Module {
if (Utilities.versionCompare(version, "5.6.0") < 0)
defines.push("main=qtmn");
}
+ if (qbs.toolchain.contains("msvc"))
+ defines.push("_ENABLE_EXTENDED_ALIGNED_STORAGE");
return defines;
}
cpp.driverFlags: {
@@ -545,7 +546,8 @@ Module {
args = args.concat(product.Qt.core.helpGeneratorArgs);
args.push("-o");
args.push(output.filePath);
- var cmd = new Command(product.Qt.core.binPath + "/qhelpgenerator", args);
+ var cmd = new Command(
+ product.Qt.core.helpGeneratorLibExecPath + "/qhelpgenerator", args);
cmd.description = 'qhelpgenerator ' + input.fileName;
cmd.highlight = 'filegen';
cmd.stdoutFilterFunction = function(output) {
diff --git a/share/qbs/module-providers/Qt/templates/qml.js b/share/qbs/module-providers/Qt/templates/qml.js
index 36f60f8a3..2a2ff85ab 100644
--- a/share/qbs/module-providers/Qt/templates/qml.js
+++ b/share/qbs/module-providers/Qt/templates/qml.js
@@ -39,7 +39,8 @@ function getPrlRhs(line)
return line.split('=')[1].trim();
}
-function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDir, qtDir)
+function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDir, qtPluginDir,
+ qtDir)
{
if (!pluginData.path)
return "";
@@ -74,6 +75,7 @@ function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDi
otherLibsLine = otherLibsLine.replace(/-l([^ ]+)/g, "$1" + ".lib");
}
otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_LIBS\]/g, qtLibDir);
+ otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PLUGINS\]/g, qtPluginDir);
otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PREFIX\]/g, qtDir);
otherLibs = otherLibs.concat(otherLibsLine.split(' '));
}
diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs
index 747558f10..f15705cc5 100644
--- a/share/qbs/module-providers/Qt/templates/qml.qbs
+++ b/share/qbs/module-providers/Qt/templates/qml.qbs
@@ -175,6 +175,7 @@ QtModule {
product.qbs.targetOS,
product.qbs.toolchain,
product.Qt.core.libPath,
+ product.Qt.core.pluginPath,
product.Qt.core.installPrefixPath);
for (var i = 0; i < libs.length; ++i) {
var lib = libs[i];
diff --git a/share/qbs/module-providers/Qt/templates/qmlcache.qbs b/share/qbs/module-providers/Qt/templates/qmlcache.qbs
index 9a5956884..7047884c0 100644
--- a/share/qbs/module-providers/Qt/templates/qmlcache.qbs
+++ b/share/qbs/module-providers/Qt/templates/qmlcache.qbs
@@ -1,6 +1,5 @@
import qbs.File
import qbs.FileInfo
-import qbs.Host
import qbs.Process
import qbs.Utilities
@@ -11,7 +10,7 @@ Module {
throw "qmlcachegen unsupported for this target";
}
property string qmlCacheGenPath: FileInfo.joinPaths(Qt.core.qmlLibExecPath, "qmlcachegen")
- + (Host.os().contains("windows") ? ".exe" : "")
+ + FileInfo.executableSuffix()
property bool supportsAllArchitectures: Utilities.versionCompare(Qt.core.version, "5.11") >= 0
property string installDir
diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js
index e677143ea..d7e58984f 100644
--- a/share/qbs/module-providers/Qt/templates/quick.js
+++ b/share/qbs/module-providers/Qt/templates/quick.js
@@ -37,7 +37,7 @@ function scanQrc(product, qrcFilePath) {
var result = [];
var process = new Process();
try {
- var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + product.cpp.executableSuffix);
+ var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + FileInfo.executableSuffix());
var exitCode = process.exec(rcc, ["--list", qrcFilePath], true);
for (;;) {
var line = process.readLine();
diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs
index 276246d6d..27f49cbd6 100644
--- a/share/qbs/module-providers/Qt/templates/quick.qbs
+++ b/share/qbs/module-providers/Qt/templates/quick.qbs
@@ -75,7 +75,7 @@ QtModule {
: Qt.core.binPath
property string compilerBaseName: (_compilerIsQmlCacheGen ? "qmlcachegen" : "qtquickcompiler")
property string compilerFilePath: FileInfo.joinPaths(_compilerBaseDir,
- compilerBaseName + product.cpp.executableSuffix)
+ compilerBaseName + FileInfo.executableSuffix())
property bool compilerAvailable: File.exists(compilerFilePath);
property bool useCompiler: compilerAvailable && !_compilerIsQmlCacheGen
diff --git a/share/qbs/module-providers/Qt/templates/scxml.qbs b/share/qbs/module-providers/Qt/templates/scxml.qbs
index fdd11e952..b800dfe70 100644
--- a/share/qbs/module-providers/Qt/templates/scxml.qbs
+++ b/share/qbs/module-providers/Qt/templates/scxml.qbs
@@ -5,6 +5,8 @@ import "../QtModule.qbs" as QtModule
QtModule {
qtModuleName: "Scxml"
+ property string _qscxmlcDir: Utilities.versionCompare(Qt.core.version, "6.3") >= 0
+ ? Qt.core.libExecPath : Qt.core.binPath
property string qscxmlcName: "qscxmlc"
property string className
property string namespace
@@ -26,8 +28,7 @@ QtModule {
prepare: {
var compilerName = product.moduleProperty("Qt.scxml", "qscxmlcName");
- var compilerPath = FileInfo.joinPaths(input.moduleProperty("Qt.core", "binPath"),
- compilerName);
+ var compilerPath = FileInfo.joinPaths(input.Qt.scxml._qscxmlcDir, compilerName);
var args = ["--header", outputs["hpp"][0].filePath,
"--impl", outputs["cpp"][0].filePath];
var cxx98 = input.moduleProperty("cpp", "cxxLanguageVersion") === "c++98";
diff --git a/share/qbs/module-providers/qbspkgconfig.qbs b/share/qbs/module-providers/qbspkgconfig.qbs
index 7c31060f2..bc2c6be46 100644
--- a/share/qbs/module-providers/qbspkgconfig.qbs
+++ b/share/qbs/module-providers/qbspkgconfig.qbs
@@ -40,7 +40,6 @@
import qbs.Environment
import qbs.File
import qbs.FileInfo
-import qbs.Host
import qbs.ModUtils
import qbs.PkgConfig
import qbs.Process
@@ -53,16 +52,12 @@ ModuleProvider {
property stringList extraPaths
property stringList libDirs
property bool staticMode: false
- property path sysroot: {
- if (qbs.targetOS.contains("macos"))
- return "";
- return qbs.sysroot;
- }
+ property path sysroot: qbs.sysroot
property bool mergeDependencies: true
relativeSearchPaths: {
- function exeSuffix(qbs) { return Host.os().contains("windows") ? ".exe" : ""; }
+ function exeSuffix(qbs) { return FileInfo.executableSuffix(); }
// we need Probes in Providers...
function getPkgConfigExecutable(qbs) {
@@ -149,6 +144,8 @@ ModuleProvider {
var options = {};
options.libDirs = libDirs;
options.sysroot = sysroot;
+ if (options.sysroot)
+ options.allowSystemLibraryPaths = true;
options.staticMode = staticMode;
options.mergeDependencies = mergeDependencies;
options.extraPaths = extraPaths;
@@ -177,22 +174,22 @@ ModuleProvider {
if (packageName === "QtCore"
|| packageName === "Qt5Core"
|| packageName === "Qt6Core") {
- var hostBins = pkg.variables["host_bins"];
- if (!hostBins) {
+ var binDir = pkg.variables["bindir"] || pkg.variables["host_bins"];
+ if (!binDir) {
if (packageName === "QtCore") { // Qt4 does not have host_bins
var mocLocation = pkg.variables["moc_location"];
if (!mocLocation) {
console.warn("No moc_location variable in " + packageName);
return;
}
- hostBins = FileInfo.path(mocLocation);
+ binDir = FileInfo.path(mocLocation);
} else {
- console.warn("No host_bins variable in " + packageName);
+ console.warn("No 'bindir' or 'host_bins' variable in " + packageName);
return;
}
}
var suffix = exeSuffix(qbs);
- var qmakePaths = [FileInfo.joinPaths(hostBins, "qmake" + suffix)];
+ var qmakePaths = [FileInfo.joinPaths(binDir, "qmake" + suffix)];
var qtProviderDir = FileInfo.joinPaths(path, "Qt");
SetupQt.doSetup(qmakePaths, outputBaseDir, qtProviderDir, qbs);
}
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index 038de8617..bd1eaa242 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -29,7 +29,7 @@
****************************************************************************/
// base for Cpp modules
-import qbs.Host
+import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
import qbs.WindowsUtils
@@ -217,7 +217,7 @@ Module {
property stringList knownArchitectures: []
property var toolchainDetails
- property string compilerExtension: Host.os().contains("windows") ? ".exe" : ""
+ property string compilerExtension: FileInfo.executableSuffix()
property string linkerMode: "automatic"
PropertyOptions {
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index 81d8bded2..c42d25362 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -110,6 +110,9 @@ UnixGCC {
if (qbs.targetOS.contains("macos")) {
dict["NSPrincipalClass"] = "NSApplication"; // needed for Retina display support
+ // QBS-1670: set this flag by default to avoid extensive GPU usage
+ dict["NSSupportsAutomaticGraphicsSwitching"] = true;
+
if (minimumMacosVersion)
dict["LSMinimumSystemVersion"] = minimumMacosVersion;
}
diff --git a/share/qbs/modules/cpp/cpp.js b/share/qbs/modules/cpp/cpp.js
index 846a4cfad..b93d42f21 100644
--- a/share/qbs/modules/cpp/cpp.js
+++ b/share/qbs/modules/cpp/cpp.js
@@ -220,6 +220,7 @@ function precompiledHeaderOutputArtifacts(input, product, lang, generateObjects)
function collectLibraryDependencies(product) {
var seen = {};
+ var seenObjectFiles = [];
var result = [];
function addFilePath(filePath, wholeArchive, productName) {
@@ -248,16 +249,23 @@ function collectLibraryDependencies(product) {
function sanitizedModuleListProperty(obj, moduleName, propertyName) {
return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName));
}
- function handleExternalLibraries(tag, suffix) {
+ function handleExternalLibraries(tag, libSuffix, objSuffix) {
var externalLibs = sanitizedModuleListProperty(obj, "cpp", tag) || [];
externalLibs.forEach(function(libName) {
- if (!libName.endsWith(suffix) && !libName.startsWith('@'))
- libName += suffix;
+ var isObjectFile = objSuffix && libName.endsWith(objSuffix);
+ if (isObjectFile) {
+ if (seenObjectFiles.contains(libName))
+ return;
+ seenObjectFiles.push(libName);
+ }
+ if (!libName.endsWith(libSuffix) && !isObjectFile && !libName.startsWith('@'))
+ libName += libSuffix;
addFilePath(libName, false);
});
}
handleExternalLibraries("staticLibraries",
- obj.moduleProperty("cpp", "staticLibrarySuffix"));
+ obj.moduleProperty("cpp", "staticLibrarySuffix"),
+ obj.moduleProperty("cpp", "objectSuffix"));
handleExternalLibraries("dynamicLibraries",
obj.moduleProperty("cpp", "dynamicLibraryImportSuffix"));
}
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 7e8e768b0..25fe06861 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -695,6 +695,22 @@ function standardFallbackValueOrDefault(toolchain, compilerVersion, languageVers
{"name": "gcc", "version": "4.7"}
]
},
+ "c17": {
+ "fallback": "c11",
+ "toolchains": [
+ {"name": "xcode", "version": "10.2"},
+ {"name": "clang", "version": "7.0"},
+ {"name": "gcc", "version": "8.1"}
+ ]
+ },
+ "c2x": {
+ "fallback": "c17",
+ "toolchains": [
+ {"name": "xcode", "version": "11.4"},
+ {"name": "clang", "version": "9.0"},
+ {"name": "gcc", "version": "9.0"}
+ ]
+ },
"c++14": {
"fallback": "c++1y",
"toolchains": [
@@ -714,7 +730,7 @@ function standardFallbackValueOrDefault(toolchain, compilerVersion, languageVers
"c++20": {
"fallback": "c++2a",
"toolchains": [
- {"name": "xcode"}, // ??
+ {"name": "xcode", "version": "12.5"},
{"name": "clang", "version": "11.0"},
{"name": "gcc", "version": "10.1"}
]
@@ -884,7 +900,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) {
switch (tag) {
case "c":
case "objc":
- var knownValues = ["c11", "c99", "c90", "c89"];
+ var knownValues = ["c2x", "c17", "c11", "c99", "c90", "c89"];
return Cpp.languageVersion(input.cpp.cLanguageVersion, knownValues, "C");
case "cpp":
case "objcpp":
diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js
index 5f56b79f6..d5f019cbc 100644
--- a/share/qbs/modules/cpp/iar.js
+++ b/share/qbs/modules/cpp/iar.js
@@ -573,7 +573,7 @@ function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
args.push("--c89");
break;
default:
- // Default C language version is C11/C99 that
+ // Default C language version is C18/C11/C99 that
// depends on the IAR version.
break;
}
@@ -682,7 +682,7 @@ function linkerFlags(project, product, inputs, outputs) {
args = args.concat(Cpp.collectLibraryDependenciesArguments(product));
// Linker scripts.
- args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs));
+ args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs, true));
// Silent output generation flag.
args.push(product.cpp.linkerSilentFlag);
diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js
index 3ef416d56..8f3297aa2 100644
--- a/share/qbs/modules/cpp/keil.js
+++ b/share/qbs/modules/cpp/keil.js
@@ -818,7 +818,7 @@ function linkerFlags(project, product, inputs, outputs) {
args = args.concat(Cpp.collectLibraryDependenciesArguments(product));
// Linker scripts.
- args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs));
+ args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs, true));
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js
index b206bd4ba..1b70904c0 100644
--- a/share/qbs/modules/cpp/msvc.js
+++ b/share/qbs/modules/cpp/msvc.js
@@ -102,6 +102,12 @@ function hasCxx20Option(input)
|| (input.qbs.toolchain.contains("clang-cl") && input.cpp.compilerVersionMajor >= 13);
}
+function hasCVerOption(input)
+{
+ return Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30138.0") >= 0
+ || (input.qbs.toolchain.contains("clang-cl") && input.cpp.compilerVersionMajor >= 13);
+}
+
function supportsExternalIncludesOption(input) {
if (input.qbs.toolchain.contains("clang-cl"))
return false; // Exclude clang-cl.
@@ -112,7 +118,7 @@ function supportsExternalIncludesOption(input) {
return Utilities.versionCompare(input.cpp.compilerVersion, "19.16") >= 0;
}
-function addLanguageVersionFlag(input, args) {
+function addCxxLanguageVersionFlag(input, args) {
var cxxVersion = Cpp.languageVersion(input.cpp.cxxLanguageVersion,
["c++23", "c++20", "c++17", "c++14", "c++11", "c++98"], "C++");
if (!cxxVersion)
@@ -138,6 +144,25 @@ function addLanguageVersionFlag(input, args) {
args.push(flag);
}
+function addCLanguageVersionFlag(input, args) {
+ var cVersion = Cpp.languageVersion(input.cpp.cLanguageVersion,
+ ["c17", "c11"], "C");
+ if (!cVersion)
+ return;
+
+ var hasStdOption = hasCVerOption(input);
+ if (!hasStdOption)
+ return;
+
+ var flag;
+ if (cVersion === "c17")
+ flag = "/std:c17";
+ else if (cVersion === "c11")
+ flag = "/std:c11";
+ if (flag)
+ args.push(flag);
+}
+
function handleClangClArchitectureFlags(product, architecture, flags) {
if (product.qbs.toolchain.contains("clang-cl")) {
if (architecture === "x86")
@@ -277,9 +302,10 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
// Language
if (tag === "cpp") {
args.push("/TP");
- addLanguageVersionFlag(input, args);
+ addCxxLanguageVersionFlag(input, args);
} else if (tag === "c") {
args.push("/TC");
+ addCLanguageVersionFlag(input, args);
}
// Whether we're compiling a precompiled header or normal source file
diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js
index 8b502bd8a..928ded5cf 100644
--- a/share/qbs/modules/cpp/sdcc.js
+++ b/share/qbs/modules/cpp/sdcc.js
@@ -286,18 +286,18 @@ function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
// C language version flags.
if (tag === "c") {
- var knownValues = ["c11", "c99", "c89"];
+ var knownValues = ["c2x", "c17", "c11", "c99", "c89"];
var cLanguageVersion = Cpp.languageVersion(
input.cpp.cLanguageVersion, knownValues, "C");
switch (cLanguageVersion) {
+ case "c17":
+ cLanguageVersion = "c11";
+ // fall through
case "c89":
- args.push("--std-c89");
- break;
case "c99":
- args.push("--std-c99");
- break;
case "c11":
- args.push("--std-c11");
+ case "c2x":
+ args.push("--std-" + cLanguageVersion);
break;
}
}
diff --git a/share/qbs/modules/freedesktop/FreeDesktop.qbs b/share/qbs/modules/freedesktop/FreeDesktop.qbs
index c892a2615..dbb6d4151 100644
--- a/share/qbs/modules/freedesktop/FreeDesktop.qbs
+++ b/share/qbs/modules/freedesktop/FreeDesktop.qbs
@@ -33,8 +33,6 @@ import qbs.TextFile
import "freedesktop.js" as Fdo
Module {
- id: fdoModule
-
property string name: product.name
property var desktopKeys
@@ -96,14 +94,14 @@ Module {
}
Group {
- condition: fdoModule._fdoSupported
+ condition: product.freedesktop._fdoSupported
fileTagsFilter: [ "freedesktop.desktopfile" ]
qbs.install: true
qbs.installDir: "share/applications"
}
Group {
- condition: fdoModule._fdoSupported
+ condition: product.freedesktop._fdoSupported
fileTagsFilter: [ "freedesktop.appIcon" ]
qbs.install: true
qbs.installDir: "share/icons/hicolor/scalable/apps"
@@ -115,7 +113,7 @@ Module {
}
Group {
- condition: fdoModule._fdoSupported
+ condition: product.freedesktop._fdoSupported
fileTagsFilter: [ "freedesktop.appstream" ]
qbs.install: true
qbs.installDir: "share/metainfo"
diff --git a/share/qbs/modules/protobuf/protobuf.js b/share/qbs/modules/protobuf/protobuf.js
index abc2c2c4d..60d6f48e4 100644
--- a/share/qbs/modules/protobuf/protobuf.js
+++ b/share/qbs/modules/protobuf/protobuf.js
@@ -75,6 +75,7 @@ function cppArtifact(outputDir, input, tags, suffix) {
filePath: FileInfo.joinPaths(outputDir, FileInfo.baseName(input.fileName) + suffix),
cpp: {
includePaths: [].concat(input.cpp.includePaths, outputDir),
+ defines: ["NDEBUG"],
warningLevel: "none",
}
};
diff --git a/share/qbs/modules/typescript/TypeScriptModule.qbs b/share/qbs/modules/typescript/TypeScriptModule.qbs
index c8ca270e0..76df529c2 100644
--- a/share/qbs/modules/typescript/TypeScriptModule.qbs
+++ b/share/qbs/modules/typescript/TypeScriptModule.qbs
@@ -30,7 +30,6 @@
import qbs.File
import qbs.FileInfo
-import qbs.Host
import qbs.ModUtils
import qbs.Probes
import qbs.Process
@@ -130,7 +129,7 @@ Module {
var preValidator = new ModUtils.PropertyValidator("nodejs");
preValidator.addCustomValidator("interpreterFileName", nodejs.interpreterFileName, function (value) {
- return value === "node" + (Host.os().contains("windows") ? ".exe" : "");
+ return value === "node" + FileInfo.executableSuffix();
}, interpreterMessage);
preValidator.addCustomValidator("interpreterFilePath", nodejs.interpreterFilePath, function (value) {
return value.endsWith(nodejs.interpreterFileName);
diff --git a/src/app/config/configcommandlineparser.cpp b/src/app/config/configcommandlineparser.cpp
index f4d0a142f..173676d6d 100644
--- a/src/app/config/configcommandlineparser.cpp
+++ b/src/app/config/configcommandlineparser.cpp
@@ -126,8 +126,8 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine)
throw Error(Tr::tr("Profile properties must be provided."));
if (m_command.varNames.size() % 2 != 0)
throw Error(Tr::tr("Profile properties must be key/value pairs."));
- for (int i = 0; i < m_command.varNames.size(); ++i) {
- if (m_command.varNames.at(i).isEmpty())
+ for (const auto &varName : qAsConst(m_command.varNames)) {
+ if (varName.isEmpty())
throw Error(Tr::tr("Property names must not be empty."));
}
break;
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index 08caec657..bac766482 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -156,7 +156,7 @@ static QString archFromDirName(const QString &dir)
const std::string dirString = dir.toStdString();
if (!std::regex_match(dirString, match, regexp))
return {};
- const QString arch = QString::fromStdString(match[1]);
+ QString arch = QString::fromStdString(match[1]);
if (arch == QLatin1String("32"))
return QStringLiteral("x86");
if (arch == QLatin1String("64"))
diff --git a/src/app/qbs-setup-toolchains/clangclprobe.cpp b/src/app/qbs-setup-toolchains/clangclprobe.cpp
index c9c5a428c..094f8aa14 100644
--- a/src/app/qbs-setup-toolchains/clangclprobe.cpp
+++ b/src/app/qbs-setup-toolchains/clangclprobe.cpp
@@ -85,7 +85,7 @@ Profile createProfileHelper(
QString findClangCl()
{
const auto compilerName = HostOsInfo::appendExecutableSuffix(QStringLiteral("clang-cl"));
- const auto compilerFromPath = findExecutable(compilerName);
+ auto compilerFromPath = findExecutable(compilerName);
if (!compilerFromPath.isEmpty())
return compilerFromPath;
diff --git a/src/app/qbs-setup-toolchains/dmcprobe.cpp b/src/app/qbs-setup-toolchains/dmcprobe.cpp
index cbe113dfd..097b1caed 100644
--- a/src/app/qbs-setup-toolchains/dmcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/dmcprobe.cpp
@@ -105,8 +105,7 @@ static QStringList dumpOutput(const QFileInfo &compiler, const QStringList &flag
p.waitForFinished(3000);
fakeIn.remove();
static QRegularExpression re(QLatin1String("\\r?\\n"));
- const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()).split(re);
- return lines;
+ return QString::fromUtf8(p.readAllStandardOutput()).split(re);
}
static std::optional<Target> dumpDmcTarget(const QFileInfo &compiler, const QStringList &flags)
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp
index a0fa7cee6..e189dd164 100644
--- a/src/app/qbs-setup-toolchains/msvcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp
@@ -164,10 +164,10 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles)
qbsInfo() << Tr::tr("Detecting build environment...");
std::vector<MSVC *> msvcPtrs;
- msvcPtrs.resize(winSDKs.size() + msvcs.size());
- std::transform(winSDKs.begin(), winSDKs.end(), msvcPtrs.begin(),
+ msvcPtrs.reserve(winSDKs.size() + msvcs.size());
+ std::transform(winSDKs.begin(), winSDKs.end(), std::back_inserter(msvcPtrs),
[] (WinSDK &sdk) -> MSVC * { return &sdk; });
- std::transform(msvcs.begin(), msvcs.end(), msvcPtrs.begin() + winSDKs.size(),
+ std::transform(msvcs.begin(), msvcs.end(), std::back_inserter(msvcPtrs),
[] (MSVC &msvc) -> MSVC * { return &msvc; });
VsEnvironmentDetector envDetector;
@@ -195,7 +195,7 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles)
// a new group of compilers of the same version incrementing the set size
msvcVersions.insert(msvc.vcInstallPath);
// index is the number of specific vcInstallPaths (e.g. compiler versions) seen so far
- const qsizetype index = msvcVersions.size() - 1;
+ const size_t index = msvcVersions.size() - 1;
const QString suffix = index == 0 ? QString() : QStringLiteral("-%1").arg(index);
const QString name = QLatin1String("MSVC") + msvc.version + suffix + QLatin1Char('-')
+ msvc.architecture;
diff --git a/src/app/qbs-setup-toolchains/sdccprobe.cpp b/src/app/qbs-setup-toolchains/sdccprobe.cpp
index b53615218..25a3d9751 100644
--- a/src/app/qbs-setup-toolchains/sdccprobe.cpp
+++ b/src/app/qbs-setup-toolchains/sdccprobe.cpp
@@ -84,8 +84,7 @@ static QStringList dumpOutput(const QFileInfo &compiler, const QString &targetFl
}
static QRegularExpression re(QStringLiteral("\\r?\\n"));
- const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()).split(re);
- return lines;
+ return QString::fromUtf8(p.readAllStandardOutput()).split(re);
}
static bool supportsSdccArchitecture(const QFileInfo &compiler, QStringView flag)
diff --git a/src/app/qbs-setup-toolchains/watcomprobe.cpp b/src/app/qbs-setup-toolchains/watcomprobe.cpp
index dd60a21a5..cc9fee2b4 100644
--- a/src/app/qbs-setup-toolchains/watcomprobe.cpp
+++ b/src/app/qbs-setup-toolchains/watcomprobe.cpp
@@ -115,11 +115,11 @@ static QStringList dumpOutput(const QFileInfo &compiler, QStringView flag,
if (!flag.isEmpty())
args.push_back(flag.toString());
args.push_back(QDir::toNativeSeparators(filePath));
- p.start(compiler.absoluteFilePath(), std::move(args));
+ p.start(compiler.absoluteFilePath(), args);
p.waitForFinished(3000);
fakeIn.remove();
- const QStringList lines = QString::fromUtf8(p.readAllStandardOutput())
- .split(QRegularExpression(QLatin1String("\\r?\\n")));
+ QStringList lines = QString::fromUtf8(p.readAllStandardOutput())
+ .split(QRegularExpression(QLatin1String("\\r?\\n")));
return lines;
}
@@ -141,7 +141,7 @@ static bool supportsWatcomPlatform(const QFileInfo &compiler, const Platform &pl
static std::vector<Profile> createWatcomProfileHelper(const ToolchainInstallInfo &info,
Settings *settings,
- const QString &profileName = QString())
+ QStringView profileName = {})
{
const QFileInfo compiler = info.compilerPath;
std::vector<Profile> profiles;
@@ -231,10 +231,10 @@ bool isWatcomCompiler(const QString &compilerName)
});
}
-void createWatcomProfile(const QFileInfo &compiler, Settings *settings, QString profileName)
+void createWatcomProfile(const QFileInfo &compiler, Settings *settings, QStringView profileName)
{
const ToolchainInstallInfo info = {compiler, Version{}};
- createWatcomProfileHelper(info, settings, std::move(profileName));
+ createWatcomProfileHelper(info, settings, profileName);
}
void watcomProbe(Settings *settings, std::vector<Profile> &profiles)
diff --git a/src/app/qbs-setup-toolchains/watcomprobe.h b/src/app/qbs-setup-toolchains/watcomprobe.h
index 26e75bbc3..ea010461d 100644
--- a/src/app/qbs-setup-toolchains/watcomprobe.h
+++ b/src/app/qbs-setup-toolchains/watcomprobe.h
@@ -52,7 +52,8 @@ class Settings;
} // namespace qbs
bool isWatcomCompiler(const QString &compilerName);
-void createWatcomProfile(const QFileInfo &compiler, qbs::Settings *settings, QString profileName);
+void createWatcomProfile(
+ const QFileInfo &compiler, qbs::Settings *settings, QStringView profileName);
void watcomProbe(qbs::Settings *settings, std::vector<qbs::Profile> &profiles);
#endif // Header guard
diff --git a/src/app/qbs/commandlinefrontend.cpp b/src/app/qbs/commandlinefrontend.cpp
index 489be4ed5..c3269ebcf 100644
--- a/src/app/qbs/commandlinefrontend.cpp
+++ b/src/app/qbs/commandlinefrontend.cpp
@@ -157,6 +157,7 @@ void CommandLineFrontend::start()
params.setSettingsDirectory(m_settings->baseDirectory());
params.setOverrideBuildGraphData(m_parser.command() == ResolveCommandType);
params.setPropertyCheckingMode(ErrorHandlingMode::Strict);
+ params.setDeprecationWarningMode(m_parser.deprecationWarningMode());
if (!m_parser.buildBeforeInstalling() || !m_parser.commandCanResolve())
params.setRestoreBehavior(SetupProjectParameters::RestoreOnly);
const auto buildConfigs = m_parser.buildConfigurations();
diff --git a/src/app/qbs/parser/commandlineoption.cpp b/src/app/qbs/parser/commandlineoption.cpp
index a09f36c2c..ddbcd4da1 100644
--- a/src/app/qbs/parser/commandlineoption.cpp
+++ b/src/app/qbs/parser/commandlineoption.cpp
@@ -663,6 +663,41 @@ void CommandEchoModeOption::doParse(const QString &representation, QStringList &
m_echoMode = commandEchoModeFromName(mode);
}
+QString DeprecationWarningsOption::description(CommandType command) const
+{
+ Q_UNUSED(command);
+ return Tr::tr("%1 <mode>\n"
+ "\tWhat to do when encountering deprecated items or properties.\n"
+ "\tPossible values are '%2'.\n"
+ "\tThe default is '%3'.\n")
+ .arg(longRepresentation(),
+ allDeprecationWarningModeStrings().join(QLatin1String("', '")),
+ deprecationWarningModeName(defaultDeprecationWarningMode()));
+}
+
+QString DeprecationWarningsOption::longRepresentation() const
+{
+ return QStringLiteral("--deprecation-warnings");
+}
+
+void DeprecationWarningsOption::doParse(const QString &representation, QStringList &input)
+{
+ const QString mode = getArgument(representation, input);
+ if (mode.isEmpty()) {
+ throw ErrorInfo(Tr::tr("Invalid use of option '%1': No deprecation warning mode given.\n"
+ "Usage: %2")
+ .arg(representation, description(command())));
+ }
+
+ if (!allDeprecationWarningModeStrings().contains(mode)) {
+ throw ErrorInfo(Tr::tr("Invalid use of option '%1': "
+ "Invalid deprecation warning mode '%2' given.\nUsage: %3")
+ .arg(representation, mode, description(command())));
+ }
+
+ m_mode = deprecationWarningModeFromName(mode);
+}
+
QString WaitLockOption::description(CommandType command) const
{
Q_UNUSED(command);
diff --git a/src/app/qbs/parser/commandlineoption.h b/src/app/qbs/parser/commandlineoption.h
index f8ec1c735..d51d5f765 100644
--- a/src/app/qbs/parser/commandlineoption.h
+++ b/src/app/qbs/parser/commandlineoption.h
@@ -42,6 +42,7 @@
#include "commandtype.h"
#include <tools/commandechomode.h>
+#include <tools/deprecationwarningmode.h>
#include <tools/joblimits.h>
#include <QtCore/qstringlist.h>
@@ -76,6 +77,7 @@ public:
WaitLockOptionType,
RunEnvConfigOptionType,
DisableFallbackProviderType,
+ DeprecationWarningsOptionType,
};
virtual ~CommandLineOption();
@@ -367,6 +369,20 @@ private:
CommandEchoMode m_echoMode = CommandEchoModeInvalid;
};
+class DeprecationWarningsOption : public CommandLineOption
+{
+public:
+ QString description(CommandType command) const override;
+ QString shortRepresentation() const override { return {}; }
+ QString longRepresentation() const override;
+ DeprecationWarningMode mode() const { return m_mode; }
+
+private:
+ void doParse(const QString &representation, QStringList &input) override;
+
+ DeprecationWarningMode m_mode = defaultDeprecationWarningMode();
+};
+
class SettingsDirOption : public CommandLineOption
{
public:
diff --git a/src/app/qbs/parser/commandlineoptionpool.cpp b/src/app/qbs/parser/commandlineoptionpool.cpp
index 63711f623..3908f262c 100644
--- a/src/app/qbs/parser/commandlineoptionpool.cpp
+++ b/src/app/qbs/parser/commandlineoptionpool.cpp
@@ -134,6 +134,9 @@ CommandLineOption *CommandLineOptionPool::getOption(CommandLineOption::Type type
case CommandLineOption::RunEnvConfigOptionType:
option = new RunEnvConfigOption;
break;
+ case CommandLineOption::DeprecationWarningsOptionType:
+ option = new DeprecationWarningsOption;
+ break;
default:
qFatal("Unknown option type %d", type);
}
@@ -287,4 +290,10 @@ RunEnvConfigOption *CommandLineOptionPool::runEnvConfigOption() const
return static_cast<RunEnvConfigOption *>(getOption(CommandLineOption::RunEnvConfigOptionType));
}
+DeprecationWarningsOption *CommandLineOptionPool::deprecationWarningsOption() const
+{
+ return static_cast<DeprecationWarningsOption *>
+ (getOption(CommandLineOption::DeprecationWarningsOptionType));
+}
+
} // namespace qbs
diff --git a/src/app/qbs/parser/commandlineoptionpool.h b/src/app/qbs/parser/commandlineoptionpool.h
index c7ac263e1..5f3c1d87c 100644
--- a/src/app/qbs/parser/commandlineoptionpool.h
+++ b/src/app/qbs/parser/commandlineoptionpool.h
@@ -79,6 +79,7 @@ public:
WaitLockOption *waitLockOption() const;
DisableFallbackProviderOption *disableFallbackProviderOption() const;
RunEnvConfigOption *runEnvConfigOption() const;
+ DeprecationWarningsOption *deprecationWarningsOption() const;
private:
mutable QHash<CommandLineOption::Type, CommandLineOption *> m_options;
diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp
index 0f70b3fe9..c6134ec80 100644
--- a/src/app/qbs/parser/commandlineparser.cpp
+++ b/src/app/qbs/parser/commandlineparser.cpp
@@ -278,6 +278,11 @@ QString CommandLineParser::settingsDir() const
return d->settingsDir();
}
+DeprecationWarningMode CommandLineParser::deprecationWarningMode() const
+{
+ return d->optionPool.deprecationWarningsOption()->mode();
+}
+
QString CommandLineParser::commandName() const
{
return d->command->representation();
diff --git a/src/app/qbs/parser/commandlineparser.h b/src/app/qbs/parser/commandlineparser.h
index 70586b2d4..999027006 100644
--- a/src/app/qbs/parser/commandlineparser.h
+++ b/src/app/qbs/parser/commandlineparser.h
@@ -41,6 +41,8 @@
#include "commandtype.h"
+#include <tools/deprecationwarningmode.h>
+
#include <QtCore/qstringlist.h>
#include <QtCore/qvariant.h>
@@ -89,6 +91,7 @@ public:
bool showProgress() const;
bool showVersion() const;
QString settingsDir() const;
+ DeprecationWarningMode deprecationWarningMode() const;
private:
class CommandLineParserPrivate;
diff --git a/src/app/qbs/parser/parsercommand.cpp b/src/app/qbs/parser/parsercommand.cpp
index 799bf5dcf..8fa67e241 100644
--- a/src/app/qbs/parser/parsercommand.cpp
+++ b/src/app/qbs/parser/parsercommand.cpp
@@ -208,6 +208,7 @@ static QList<CommandLineOption::Type> resolveOptions()
CommandLineOption::DryRunOptionType,
CommandLineOption::ForceProbesOptionType,
CommandLineOption::LogTimeOptionType,
+ CommandLineOption::DeprecationWarningsOptionType,
CommandLineOption::DisableFallbackProviderType};
}
diff --git a/src/app/qbs/session.cpp b/src/app/qbs/session.cpp
index 5a1fe145d..c958c88b6 100644
--- a/src/app/qbs/session.cpp
+++ b/src/app/qbs/session.cpp
@@ -554,7 +554,7 @@ void Session::getGeneratedFilesForSources(const QJsonObject &request)
reply.insert(StringConstants::type(), QLatin1String(replyType));
const QJsonArray specs = request.value(StringConstants::productsKey()).toArray();
QJsonArray resultProducts;
- for (const QJsonValue &p : specs) {
+ for (const auto &p : specs) {
const QJsonObject productObject = p.toObject();
const ProductData product = getProductByName(
productObject.value(StringConstants::fullDisplayNameKey()).toString());
@@ -564,7 +564,7 @@ void Session::getGeneratedFilesForSources(const QJsonObject &request)
resultProduct.insert(StringConstants::fullDisplayNameKey(), product.fullDisplayName());
QJsonArray results;
const QJsonArray requests = productObject.value(QLatin1String("requests")).toArray();
- for (const QJsonValue &r : requests) {
+ for (const auto &r : requests) {
const QJsonObject request = r.toObject();
const QString filePath = request.value(QLatin1String("source-file")).toString();
const QStringList tags = fromJson<QStringList>(request.value(QLatin1String("tags")));
@@ -646,7 +646,7 @@ Session::FileUpdateData Session::prepareFileUpdate(const QJsonObject &request)
data.error = tr("Product '%1' not found in project.").arg(productName);
}
const QJsonArray filesArray = request.value(QLatin1String("files")).toArray();
- for (const QJsonValue &v : filesArray)
+ for (const auto &v : filesArray)
data.filePaths << v.toString();
if (m_currentJob)
data.error = tr("Cannot update the list of source files while a job is running.");
diff --git a/src/app/qbs/sessionpacket.cpp b/src/app/qbs/sessionpacket.cpp
index dd6d1726e..5af252179 100644
--- a/src/app/qbs/sessionpacket.cpp
+++ b/src/app/qbs/sessionpacket.cpp
@@ -82,7 +82,7 @@ SessionPacket::Status SessionPacket::parseInput(QByteArray &input)
QJsonObject SessionPacket::retrievePacket()
{
QBS_ASSERT(isComplete(), return QJsonObject());
- const auto packet = QJsonDocument::fromJson(QByteArray::fromBase64(m_payload)).object();
+ auto packet = QJsonDocument::fromJson(QByteArray::fromBase64(m_payload)).object();
m_payload.clear();
m_expectedPayloadLength = -1;
return packet;
diff --git a/src/lib/corelib/CMakeLists.txt b/src/lib/corelib/CMakeLists.txt
index a6efd0ff3..7c358722d 100644
--- a/src/lib/corelib/CMakeLists.txt
+++ b/src/lib/corelib/CMakeLists.txt
@@ -306,6 +306,7 @@ set(TOOLS_SOURCES
cleanoptions.cpp
codelocation.cpp
commandechomode.cpp
+ deprecationwarningmode.cpp
dynamictypecheck.h
error.cpp
executablefinder.cpp
@@ -389,6 +390,7 @@ set(TOOLS_HEADERS
cleanoptions.h
codelocation.h
commandechomode.h
+ deprecationwarningmode.h
error.h
generateoptions.h
installoptions.h
diff --git a/src/lib/corelib/api/internaljobs.cpp b/src/lib/corelib/api/internaljobs.cpp
index 0fabc6279..f3bb46d48 100644
--- a/src/lib/corelib/api/internaljobs.cpp
+++ b/src/lib/corelib/api/internaljobs.cpp
@@ -337,7 +337,7 @@ void InternalSetupProjectJob::resolveBuildDataFromScratch(const RulesEvaluationC
BuildGraphLoadResult InternalSetupProjectJob::restoreProject(const RulesEvaluationContextPtr &evalContext)
{
BuildGraphLoader bgLoader(logger());
- const BuildGraphLoadResult loadResult
+ BuildGraphLoadResult loadResult
= bgLoader.load(m_existingProject, m_parameters, evalContext);
return loadResult;
}
diff --git a/src/lib/corelib/api/qmljsrewriter.cpp b/src/lib/corelib/api/qmljsrewriter.cpp
index 46cd10b95..d98fe62e0 100644
--- a/src/lib/corelib/api/qmljsrewriter.cpp
+++ b/src/lib/corelib/api/qmljsrewriter.cpp
@@ -132,8 +132,7 @@ Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast,
break;
case ObjectBinding:
- newPropertyTemplate = QStringLiteral("%1: %2");
- break;
+ Q_FALLTHROUGH();
case ScriptBinding:
newPropertyTemplate = QStringLiteral("%1: %2");
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp
index f0fe7d726..06d49cb4d 100644
--- a/src/lib/corelib/buildgraph/executor.cpp
+++ b/src/lib/corelib/buildgraph/executor.cpp
@@ -135,11 +135,9 @@ void Executor::retrieveSourceFileTimestamp(Artifact *artifact) const
{
QBS_CHECK(artifact->artifactType == Artifact::SourceFile);
- if (m_buildOptions.changedFiles().empty())
- artifact->setTimestamp(recursiveFileTime(artifact->filePath()));
- else if (m_buildOptions.changedFiles().contains(artifact->filePath()))
+ if (m_buildOptions.changedFiles().contains(artifact->filePath()))
artifact->setTimestamp(FileTime::currentTime());
- else if (!artifact->timestamp().isValid())
+ else if (m_buildOptions.changedFiles().empty() || !artifact->timestamp().isValid())
artifact->setTimestamp(recursiveFileTime(artifact->filePath()));
artifact->timestampRetrieved = true;
diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.cpp b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
index 57d69ac0b..e687342e1 100644
--- a/src/lib/corelib/buildgraph/processcommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
@@ -211,7 +211,7 @@ void ProcessCommandExecutor::cancel(const qbs::ErrorInfo &reason)
QString ProcessCommandExecutor::filterProcessOutput(const QByteArray &_output,
const QString &filterFunctionSource)
{
- const QString output = QString::fromLocal8Bit(_output);
+ QString output = QString::fromLocal8Bit(_output);
if (filterFunctionSource.isEmpty())
return output;
diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs
index cf3c45cda..91532c14e 100644
--- a/src/lib/corelib/corelib.qbs
+++ b/src/lib/corelib/corelib.qbs
@@ -410,6 +410,7 @@ QbsLibrary {
"cleanoptions.cpp",
"codelocation.cpp",
"commandechomode.cpp",
+ "deprecationwarningmode.cpp",
"dynamictypecheck.h",
"error.cpp",
"executablefinder.cpp",
@@ -495,6 +496,7 @@ QbsLibrary {
"cleanoptions.h",
"codelocation.h",
"commandechomode.h",
+ "deprecationwarningmode.h",
"error.h",
"generateoptions.h",
"installoptions.h",
diff --git a/src/lib/corelib/jsextensions/fileinfoextension.cpp b/src/lib/corelib/jsextensions/fileinfoextension.cpp
index a69dbc621..a4986d12c 100644
--- a/src/lib/corelib/jsextensions/fileinfoextension.cpp
+++ b/src/lib/corelib/jsextensions/fileinfoextension.cpp
@@ -86,6 +86,7 @@ public:
static QScriptValue js_joinPaths(QScriptContext *context, QScriptEngine *engine);
static QScriptValue js_pathListSeparator(QScriptContext *context, QScriptEngine *engine);
static QScriptValue js_pathSeparator(QScriptContext *context, QScriptEngine *engine);
+ static QScriptValue js_executableSuffix(QScriptContext *context, QScriptEngine *engine);
};
QScriptValue FileInfoExtension::js_ctor(QScriptContext *context, QScriptEngine *engine)
@@ -297,6 +298,15 @@ QScriptValue FileInfoExtension::js_pathSeparator(QScriptContext *context, QScrip
return QString(HostOsInfo::pathSeparator());
}
+QScriptValue FileInfoExtension::js_executableSuffix(QScriptContext *context, QScriptEngine *engine)
+{
+ Q_UNUSED(context);
+ Q_UNUSED(engine);
+ static QString executableSuffix = HostOsInfo::isWindowsHost() ?
+ QLatin1String(QBS_HOST_EXE_SUFFIX) : QString();
+ return executableSuffix;
+}
+
} // namespace Internal
} // namespace qbs
@@ -342,6 +352,8 @@ void initializeJsExtensionFileInfo(QScriptValue extensionObject)
engine->newFunction(FileInfoExtension::js_pathListSeparator));
fileInfoObj.setProperty(QStringLiteral("pathSeparator"),
engine->newFunction(FileInfoExtension::js_pathSeparator));
+ fileInfoObj.setProperty(QStringLiteral("executableSuffix"),
+ engine->newFunction(FileInfoExtension::js_executableSuffix));
extensionObject.setProperty(QStringLiteral("FileInfo"), fileInfoObj);
}
diff --git a/src/lib/corelib/jsextensions/utilitiesextension.cpp b/src/lib/corelib/jsextensions/utilitiesextension.cpp
index 19afc6ca9..5426658a9 100644
--- a/src/lib/corelib/jsextensions/utilitiesextension.cpp
+++ b/src/lib/corelib/jsextensions/utilitiesextension.cpp
@@ -203,7 +203,7 @@ QScriptValue UtilitiesExtension::js_canonicalToolchain(QScriptContext *context,
}
// copied from src/corelib/tools/qtools_p.h
-Q_DECL_CONSTEXPR inline char toHexUpper(uint value) Q_DECL_NOTHROW
+Q_DECL_CONSTEXPR inline uchar toHexUpper(uint value) Q_DECL_NOTHROW
{
return "0123456789ABCDEF"[value & 0xF];
}
diff --git a/src/lib/corelib/language/deprecationinfo.h b/src/lib/corelib/language/deprecationinfo.h
index 89cd07f4a..2f9bfc103 100644
--- a/src/lib/corelib/language/deprecationinfo.h
+++ b/src/lib/corelib/language/deprecationinfo.h
@@ -39,6 +39,11 @@
#ifndef QBS_DEPRECATIONINFO_H
#define QBS_DEPRECATIONINFO_H
+#include <api/languageinfo.h>
+#include <logging/logger.h>
+#include <logging/translator.h>
+#include <tools/deprecationwarningmode.h>
+#include <tools/error.h>
#include <tools/version.h>
#include <QtCore/qstring.h>
@@ -58,7 +63,46 @@ public:
bool isValid() const { return m_removalVersion.isValid(); }
Version removalVersion() const { return m_removalVersion; }
- QString additionalUserInfo() const { return m_additionalUserInfo; }
+
+ ErrorInfo checkForDeprecation(DeprecationWarningMode mode, const QString &name,
+ const CodeLocation &loc, bool isItem, Logger &logger) const
+ {
+ if (!isValid())
+ return {};
+ const Version qbsVersion = LanguageInfo::qbsVersion();
+ if (removalVersion() <= qbsVersion) {
+ const QString msgTemplate = isItem
+ ? Tr::tr("The item '%1' can no longer be used. It was removed in Qbs %2.")
+ : Tr::tr("The property '%1' can no longer be used. It was removed in Qbs %2.");
+ ErrorInfo error(msgTemplate.arg(name, removalVersion().toString()), loc);
+ if (!m_additionalUserInfo.isEmpty())
+ error.append(m_additionalUserInfo);
+ return error;
+ }
+ const QString msgTemplate = isItem
+ ? Tr::tr("The item '%1' is deprecated and will be removed in Qbs %2.")
+ : Tr::tr("The property '%1' is deprecated and will be removed in Qbs %2.");
+ ErrorInfo error(msgTemplate.arg(name, removalVersion().toString()), loc);
+ if (!m_additionalUserInfo.isEmpty())
+ error.append(m_additionalUserInfo);
+ switch (mode) {
+ case DeprecationWarningMode::Error:
+ return error;
+ case DeprecationWarningMode::On:
+ logger.printWarning(error);
+ break;
+ case DeprecationWarningMode::BeforeRemoval: {
+ const Version next(qbsVersion.majorVersion(), qbsVersion.minorVersion() + 1);
+ if (removalVersion() == next || removalVersion().minorVersion() == 0)
+ logger.printWarning(error);
+ break;
+ }
+ case DeprecationWarningMode::Off:
+ break;
+ }
+
+ return {};
+ }
private:
Version m_removalVersion;
diff --git a/src/lib/corelib/language/item.cpp b/src/lib/corelib/language/item.cpp
index 2f23de210..c58d2058d 100644
--- a/src/lib/corelib/language/item.cpp
+++ b/src/lib/corelib/language/item.cpp
@@ -168,8 +168,8 @@ ItemValuePtr Item::itemProperty(const QString &name, const Item *itemTemplate,
if (!itemTemplate)
return ItemValuePtr();
const bool createdByPropertiesBlock = itemValue && itemValue->createdByPropertiesBlock();
- const ItemValuePtr result = ItemValue::create(Item::create(m_pool, itemTemplate->type()),
- createdByPropertiesBlock);
+ ItemValuePtr result = ItemValue::create(Item::create(m_pool, itemTemplate->type()),
+ createdByPropertiesBlock);
setProperty(name, result);
return result;
}
@@ -246,7 +246,7 @@ bool Item::isPresentModule() const
return v && v->type() == Value::JSSourceValueType;
}
-void Item::setupForBuiltinType(Logger &logger)
+void Item::setupForBuiltinType(DeprecationWarningMode deprecationMode, Logger &logger)
{
const BuiltinDeclarations &builtins = BuiltinDeclarations::instance();
const auto properties = builtins.declarationsForType(type()).properties();
@@ -263,23 +263,9 @@ void Item::setupForBuiltinType(Logger &logger)
? StringConstants::undefinedValue()
: pd.initialValueSource());
m_properties.insert(pd.name(), sourceValue);
- } else if (pd.isDeprecated()) {
- const DeprecationInfo &di = pd.deprecationInfo();
- if (di.removalVersion() <= LanguageInfo::qbsVersion()) {
- QString message = Tr::tr("The property '%1' is no longer valid for %2 items. "
- "It was removed in qbs %3.")
- .arg(pd.name(), typeName(), di.removalVersion().toString());
- ErrorInfo error(message, value->location());
- if (!di.additionalUserInfo().isEmpty())
- error.append(di.additionalUserInfo());
- throw error;
- }
- QString warning = Tr::tr("The property '%1' is deprecated and will be removed in "
- "qbs %2.").arg(pd.name(), di.removalVersion().toString());
- ErrorInfo error(warning, value->location());
- if (!di.additionalUserInfo().isEmpty())
- error.append(di.additionalUserInfo());
- logger.printWarning(error);
+ } else if (ErrorInfo error = pd.checkForDeprecation(deprecationMode, value->location(),
+ logger); error.hasError()) {
+ throw error;
}
}
}
diff --git a/src/lib/corelib/language/item.h b/src/lib/corelib/language/item.h
index 22cf6b810..60d74a3f4 100644
--- a/src/lib/corelib/language/item.h
+++ b/src/lib/corelib/language/item.h
@@ -46,6 +46,7 @@
#include "qualifiedid.h"
#include <parser/qmljsmemorypool_p.h>
#include <tools/codelocation.h>
+#include <tools/deprecationwarningmode.h>
#include <tools/error.h>
#include <tools/version.h>
@@ -144,7 +145,7 @@ public:
static void removeChild(Item *parent, Item *child);
void dump() const;
bool isPresentModule() const;
- void setupForBuiltinType(Logger &logger);
+ void setupForBuiltinType(DeprecationWarningMode deprecationMode, Logger &logger);
void copyProperty(const QString &propertyName, Item *target) const;
void overrideProperties(
const QVariantMap &config,
diff --git a/src/lib/corelib/language/itemdeclaration.cpp b/src/lib/corelib/language/itemdeclaration.cpp
index d7230e9d6..eb9fd84a6 100644
--- a/src/lib/corelib/language/itemdeclaration.cpp
+++ b/src/lib/corelib/language/itemdeclaration.cpp
@@ -60,5 +60,11 @@ bool ItemDeclaration::isChildTypeAllowed(ItemType type) const
return m_allowedChildTypes.contains(type);
}
+ErrorInfo ItemDeclaration::checkForDeprecation(DeprecationWarningMode mode, const QString &name,
+ const CodeLocation &loc, Logger &logger) const
+{
+ return deprecationInfo().checkForDeprecation(mode, name, loc, true, logger);
+}
+
} // namespace Internal
} // namespace qbs
diff --git a/src/lib/corelib/language/itemdeclaration.h b/src/lib/corelib/language/itemdeclaration.h
index 6da699d28..1fbd7e456 100644
--- a/src/lib/corelib/language/itemdeclaration.h
+++ b/src/lib/corelib/language/itemdeclaration.h
@@ -71,6 +71,9 @@ public:
const TypeNames &allowedChildTypes() const { return m_allowedChildTypes; }
bool isChildTypeAllowed(ItemType type) const;
+ ErrorInfo checkForDeprecation(DeprecationWarningMode mode, const QString &name,
+ const CodeLocation &loc, Logger &logger) const;
+
private:
ItemType m_type;
Properties m_properties;
diff --git a/src/lib/corelib/language/itemreader.cpp b/src/lib/corelib/language/itemreader.cpp
index 1abc5caf9..a29b36320 100644
--- a/src/lib/corelib/language/itemreader.cpp
+++ b/src/lib/corelib/language/itemreader.cpp
@@ -143,5 +143,10 @@ void ItemReader::setEnableTiming(bool on)
m_elapsedTime = on ? 0 : -1;
}
+void ItemReader::setDeprecationWarningMode(DeprecationWarningMode mode)
+{
+ m_visitorState->setDeprecationWarningMode(mode);
+}
+
} // namespace Internal
} // namespace qbs
diff --git a/src/lib/corelib/language/itemreader.h b/src/lib/corelib/language/itemreader.h
index 3dc5329d2..6b2531cf2 100644
--- a/src/lib/corelib/language/itemreader.h
+++ b/src/lib/corelib/language/itemreader.h
@@ -40,8 +40,8 @@
#ifndef QBS_ITEMREADER_H
#define QBS_ITEMREADER_H
-#include "forward_decls.h"
#include <logging/logger.h>
+#include <tools/deprecationwarningmode.h>
#include <tools/set.h>
#include <QtCore/qstringlist.h>
@@ -87,6 +87,8 @@ public:
void setEnableTiming(bool on);
qint64 elapsedTime() const { return m_elapsedTime; }
+ void setDeprecationWarningMode(DeprecationWarningMode mode);
+
private:
ItemPool *m_pool = nullptr;
QStringList m_searchPaths;
diff --git a/src/lib/corelib/language/itemreaderastvisitor.cpp b/src/lib/corelib/language/itemreaderastvisitor.cpp
index f22a1c4e8..721f24079 100644
--- a/src/lib/corelib/language/itemreaderastvisitor.cpp
+++ b/src/lib/corelib/language/itemreaderastvisitor.cpp
@@ -173,7 +173,7 @@ bool ItemReaderASTVisitor::visit(AST::UiObjectDefinition *ast)
// Only the item at the top of the inheritance chain is a built-in item.
// We cannot do this in "part 1", because then the visitor would complain about duplicate
// bindings.
- item->setupForBuiltinType(m_logger);
+ item->setupForBuiltinType(m_visitorState.deprecationWarningMode(), m_logger);
}
return false;
@@ -369,24 +369,10 @@ void ItemReaderASTVisitor::checkDeprecationStatus(ItemType itemType, const QStri
const CodeLocation &itemLocation)
{
const ItemDeclaration itemDecl = BuiltinDeclarations::instance().declarationsForType(itemType);
- const DeprecationInfo &di = itemDecl.deprecationInfo();
- if (!di.isValid())
- return;
- if (di.removalVersion() <= LanguageInfo::qbsVersion()) {
- QString message = Tr::tr("The item '%1' cannot be used anymore. "
- "It was removed in qbs %2.")
- .arg(itemName, di.removalVersion().toString());
- ErrorInfo error(message, itemLocation);
- if (!di.additionalUserInfo().isEmpty())
- error.append(di.additionalUserInfo());
+ const ErrorInfo error = itemDecl.checkForDeprecation(m_visitorState.deprecationWarningMode(),
+ itemName, itemLocation, m_logger);
+ if (error.hasError())
throw error;
- }
- QString warning = Tr::tr("The item '%1' is deprecated and will be removed in "
- "qbs %2.").arg(itemName, di.removalVersion().toString());
- ErrorInfo error(warning, itemLocation);
- if (!di.additionalUserInfo().isEmpty())
- error.append(di.additionalUserInfo());
- m_logger.printWarning(error);
}
void ItemReaderASTVisitor::doCheckItemTypes(const Item *item)
diff --git a/src/lib/corelib/language/itemreadervisitorstate.h b/src/lib/corelib/language/itemreadervisitorstate.h
index 3901be16e..90f88cd5e 100644
--- a/src/lib/corelib/language/itemreadervisitorstate.h
+++ b/src/lib/corelib/language/itemreadervisitorstate.h
@@ -40,6 +40,7 @@
#define QBS_ITEMREADERVISITORSTATE_H
#include <logging/logger.h>
+#include <tools/deprecationwarningmode.h>
#include <tools/set.h>
#include <QtCore/qstringlist.h>
@@ -67,7 +68,11 @@ public:
Item *mostDerivingItem() const;
void setMostDerivingItem(Item *item);
+ void setDeprecationWarningMode(DeprecationWarningMode mode) { m_deprecationWarningMode = mode; }
+ DeprecationWarningMode deprecationWarningMode() const { return m_deprecationWarningMode; }
+
private:
+ DeprecationWarningMode m_deprecationWarningMode = defaultDeprecationWarningMode();
Logger &m_logger;
Set<QString> m_filesRead;
QHash<QString, QStringList> m_directoryEntries;
diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp
index 3db41b8c8..bd134040d 100644
--- a/src/lib/corelib/language/language.cpp
+++ b/src/lib/corelib/language/language.cpp
@@ -592,7 +592,7 @@ TopLevelProject::~TopLevelProject()
QString TopLevelProject::deriveId(const QVariantMap &config)
{
const QVariantMap qbsProperties = config.value(StringConstants::qbsModule()).toMap();
- const QString configurationName = qbsProperties.value(
+ QString configurationName = qbsProperties.value(
StringConstants::configurationNameProperty()).toString();
return configurationName;
}
diff --git a/src/lib/corelib/language/loader.cpp b/src/lib/corelib/language/loader.cpp
index 1de84da63..3fff71c10 100644
--- a/src/lib/corelib/language/loader.cpp
+++ b/src/lib/corelib/language/loader.cpp
@@ -169,7 +169,7 @@ TopLevelProjectPtr Loader::loadProject(const SetupProjectParameters &_parameters
const ModuleLoaderResult loadResult = moduleLoader.load(parameters);
ProjectResolver resolver(&evaluator, loadResult, std::move(parameters), m_logger);
resolver.setProgressObserver(m_progressObserver);
- const TopLevelProjectPtr project = resolver.resolve();
+ TopLevelProjectPtr project = resolver.resolve();
project->lastStartResolveTime = resolveTime;
project->lastEndResolveTime = FileTime::currentTime();
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index 574c03bfb..86553916b 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -290,6 +290,7 @@ ModuleLoaderResult ModuleLoader::load(const SetupProjectParameters &parameters)
m_modulePrototypeEnabledInfo.clear();
m_parameterDeclarations.clear();
m_disabledItems.clear();
+ m_reader->setDeprecationWarningMode(parameters.deprecationWarningMode());
m_reader->clearExtraSearchPathsStack();
m_reader->setEnableTiming(parameters.logElapsedTime());
m_moduleProviderLoader->setProjectParameters(m_parameters);
@@ -500,28 +501,10 @@ private:
continue;
const PropertyDeclaration decl = item->propertyDeclaration(it.key());
if (decl.isValid()) {
- if (!decl.isDeprecated())
- continue;
- const DeprecationInfo &di = decl.deprecationInfo();
- QString message;
- bool warningOnly;
- if (decl.isExpired()) {
- message = Tr::tr("The property '%1' can no longer be used. "
- "It was removed in Qbs %2.")
- .arg(decl.name(), di.removalVersion().toString());
- warningOnly = false;
- } else {
- message = Tr::tr("The property '%1' is deprecated and will be removed "
- "in Qbs %2.").arg(decl.name(), di.removalVersion().toString());
- warningOnly = true;
- }
- ErrorInfo error(message, it.value()->location());
- if (!di.additionalUserInfo().isEmpty())
- error.append(di.additionalUserInfo());
- if (warningOnly)
- m_logger.printWarning(error);
- else
- handlePropertyError(error, m_params, m_logger);
+ const ErrorInfo deprecationError = decl.checkForDeprecation(
+ m_params.deprecationWarningMode(), it.value()->location(), m_logger);
+ if (deprecationError.hasError())
+ handlePropertyError(deprecationError, m_params, m_logger);
continue;
}
m_currentName = it.key();
@@ -979,7 +962,7 @@ QList<Item *> ModuleLoader::multiplexProductItem(ProductContext *dummyContext, I
dependsItem->setProperty(StringConstants::profilesProperty(),
VariantValue::create(QStringList()));
dependsItem->setFile(aggregator->file());
- dependsItem->setupForBuiltinType(m_logger);
+ dependsItem->setupForBuiltinType(m_parameters.deprecationWarningMode(), m_logger);
Item::addChild(aggregator, dependsItem);
}
}
@@ -1289,13 +1272,13 @@ void ModuleLoader::prepareProduct(ProjectContext *projectContext, Item *productI
importer->setFile(productItem->file());
importer->setLocation(productItem->location());
importer->setScope(projectContext->scope);
- importer->setupForBuiltinType(m_logger);
+ importer->setupForBuiltinType(m_parameters.deprecationWarningMode(), m_logger);
Item * const dependsItem = Item::create(productItem->pool(), ItemType::Depends);
dependsItem->setProperty(QStringLiteral("name"), VariantValue::create(productContext.name));
dependsItem->setProperty(QStringLiteral("required"), VariantValue::create(false));
dependsItem->setFile(importer->file());
dependsItem->setLocation(importer->location());
- dependsItem->setupForBuiltinType(m_logger);
+ dependsItem->setupForBuiltinType(m_parameters.deprecationWarningMode(), m_logger);
Item::addChild(importer, dependsItem);
Item::addChild(productItem, importer);
prepareProduct(projectContext, importer);
@@ -1973,7 +1956,7 @@ bool ModuleLoader::mergeExportItems(const ProductContext &productContext)
merged->setLocation(exportItems.empty()
? productContext.item->location() : exportItems.back()->location());
Item::addChild(productContext.item, merged);
- merged->setupForBuiltinType(m_logger);
+ merged->setupForBuiltinType(m_parameters.deprecationWarningMode(), m_logger);
pmi.exportItem = merged;
pmi.multiplexId = productContext.multiplexConfigurationId;
productContext.project->topLevelProject->productModules.insert(productContext.name, pmi);
@@ -3033,7 +3016,7 @@ Item *ModuleLoader::searchAndLoadModuleFile(ProductContext *productContext,
if (existingPaths.isEmpty()) { // no suitable names found, try to use providers
AccumulatingTimer providersTimer(
m_parameters.logElapsedTime() ? &m_elapsedTimeModuleProviders : nullptr);
- auto result = m_moduleProviderLoader->executeModuleProvider(
+ auto result = m_moduleProviderLoader->executeModuleProviders(
*productContext,
dependsItemLocation,
moduleName,
@@ -3501,7 +3484,7 @@ Item *ModuleLoader::wrapInProjectIfNecessary(Item *item)
Item::addChild(prj, item);
prj->setFile(item->file());
prj->setLocation(item->location());
- prj->setupForBuiltinType(m_logger);
+ prj->setupForBuiltinType(m_parameters.deprecationWarningMode(), m_logger);
return prj;
}
diff --git a/src/lib/corelib/language/moduleproviderinfo.h b/src/lib/corelib/language/moduleproviderinfo.h
index 8ed6f008d..d4c375f4a 100644
--- a/src/lib/corelib/language/moduleproviderinfo.h
+++ b/src/lib/corelib/language/moduleproviderinfo.h
@@ -92,7 +92,12 @@ using ModuleProviderInfoList = std::vector<ModuleProviderInfo>;
// Persistent info stored between sessions
struct StoredModuleProviderInfo
{
- using CacheKey = std::tuple<QString /*name*/, QVariantMap /*config*/, int /*lookup*/>;
+ using CacheKey = std::tuple<
+ QString /*name*/,
+ QVariantMap /*config*/,
+ QVariantMap /*qbsModule*/,
+ int /*lookup*/
+ >;
using ModuleProvidersCache = QHash<CacheKey, ModuleProviderInfo>;
ModuleProvidersCache providers;
diff --git a/src/lib/corelib/language/moduleproviderloader.cpp b/src/lib/corelib/language/moduleproviderloader.cpp
index 49c77b7fc..3e62d9ed9 100644
--- a/src/lib/corelib/language/moduleproviderloader.cpp
+++ b/src/lib/corelib/language/moduleproviderloader.cpp
@@ -71,7 +71,7 @@ ModuleProviderLoader::ModuleProviderLoader(ItemReader *reader, Evaluator *evalua
{
}
-ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModuleProvider(
+ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModuleProviders(
ProductContext &productContext,
const CodeLocation &dependsItemLocation,
const QualifiedId &moduleName,
@@ -91,35 +91,36 @@ ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModulePr
providersToRun.push_back({providerName, ModuleProviderLookup::Scoped});
}
}
- result = findModuleProvider(providersToRun, productContext, dependsItemLocation);
+ result = executeModuleProvidersHelper(productContext, dependsItemLocation, providersToRun);
if (fallbackMode == FallbackMode::Enabled
&& !result.providerFound
&& !providerNames) {
qCDebug(lcModuleLoader) << "Specific module provider not found for"
<< moduleName.toString() << ", setting up fallback.";
- result = findModuleProvider(
- {{moduleName, ModuleProviderLookup::Fallback}},
+ result = executeModuleProvidersHelper(
productContext,
- dependsItemLocation);
+ dependsItemLocation,
+ {{moduleName, ModuleProviderLookup::Fallback}});
}
return result;
}
-ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::findModuleProvider(
- const std::vector<Provider> &providers,
+ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModuleProvidersHelper(
ProductContext &product,
- const CodeLocation &dependsItemLocation)
+ const CodeLocation &dependsItemLocation,
+ const std::vector<Provider> &providers)
{
if (providers.empty())
return {};
QStringList allSearchPaths;
ModuleProviderResult result;
+ const auto qbsModule = evaluateQbsModule(product);
for (const auto &[name, lookupType] : providers) {
- const QVariantMap config = moduleProviderConfig(product).value(name.toString()).toMap();
- ModuleProviderInfo &info =
- m_storedModuleProviderInfo.providers[{name.toString(), config, int(lookupType)}];
+ const QVariantMap config = getModuleProviderConfig(product).value(name.toString()).toMap();
+ ModuleProviderInfo &info = m_storedModuleProviderInfo.providers[
+ {name.toString(), config, qbsModule, int(lookupType)}];
const bool fromCache = !info.name.isEmpty();
if (!fromCache) {
info.name = name;
@@ -127,8 +128,8 @@ ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::findModuleProvi
info.providerFile = findModuleProviderFile(name, lookupType);
if (!info.providerFile.isEmpty()) {
qCDebug(lcModuleLoader) << "Running provider" << name << "at" << info.providerFile;
- info.searchPaths = getProviderSearchPaths(
- name, info.providerFile, product, config, dependsItemLocation);
+ info.searchPaths = evaluateModuleProvider(
+ product, dependsItemLocation, name, info.providerFile, config, qbsModule);
info.transientOutput = m_parameters.dryRun();
}
}
@@ -160,7 +161,7 @@ ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::findModuleProvi
return result;
}
-QVariantMap ModuleProviderLoader::moduleProviderConfig(
+QVariantMap ModuleProviderLoader::getModuleProviderConfig(
ProductContext &product)
{
if (product.theModuleProviderConfig)
@@ -228,7 +229,7 @@ std::optional<std::vector<QualifiedId>> ModuleProviderLoader::getModuleProviders
}
QString ModuleProviderLoader::findModuleProviderFile(
- const QualifiedId &name, ModuleProviderLookup lookupType)
+ const QualifiedId &name, ModuleProviderLookup lookupType)
{
for (const QString &path : m_reader->allSearchPaths()) {
QString fullPath = FileInfo::resolvePath(path, QStringLiteral("module-providers"));
@@ -260,12 +261,47 @@ QString ModuleProviderLoader::findModuleProviderFile(
return {};
}
-QStringList ModuleProviderLoader::getProviderSearchPaths(
+QVariantMap ModuleProviderLoader::evaluateQbsModule(ProductContext &product) const
+{
+ const QString properties[] = {
+ QStringLiteral("sysroot"),
+ };
+ const auto qbsItemValue = std::static_pointer_cast<ItemValue>(
+ product.item->property(StringConstants::qbsModule()));
+ QVariantMap result;
+ for (const auto &property : properties) {
+ auto value = m_evaluator->value(qbsItemValue->item(), property).toVariant();
+ if (value.isValid())
+ result[property] = std::move(value);
+ }
+ return result;
+}
+
+Item *ModuleProviderLoader::createProviderScope(
+ ProductContext &product, const QVariantMap &qbsModule)
+{
+ const auto qbsItemValue = std::static_pointer_cast<ItemValue>(
+ product.item->property(StringConstants::qbsModule()));
+
+ Item *fakeQbsModule = Item::create(product.item->pool(), ItemType::Scope);
+
+ for (auto it = qbsModule.begin(), end = qbsModule.end(); it != end; ++it) {
+ fakeQbsModule->setProperty(it.key(), VariantValue::create(it.value()));
+ }
+
+ Item *scope = Item::create(product.item->pool(), ItemType::Scope);
+ scope->setFile(qbsItemValue->item()->file());
+ scope->setProperty(StringConstants::qbsModule(), ItemValue::create(fakeQbsModule));
+ return scope;
+}
+
+QStringList ModuleProviderLoader::evaluateModuleProvider(
+ ProductContext &product,
+ const CodeLocation &dependsItemLocation,
const QualifiedId &name,
const QString &providerFile,
- ProductContext &product,
const QVariantMap &moduleConfig,
- const CodeLocation &location)
+ const QVariantMap &qbsModule)
{
QTemporaryFile dummyItemFile;
if (!dummyItemFile.open()) {
@@ -278,6 +314,11 @@ QStringList ModuleProviderLoader::getProviderSearchPaths(
const QString projectBuildDir = product.project->item->variantProperty(
StringConstants::buildDirectoryProperty())->value().toString();
const QString searchPathBaseDir = ModuleProviderInfo::outputDirPath(projectBuildDir, name);
+
+ // include qbs module into hash
+ auto jsConfig = moduleConfig;
+ jsConfig[StringConstants::qbsModule()] = qbsModule;
+
QTextStream stream(&dummyItemFile);
using Qt::endl;
setupDefaultCodec(stream);
@@ -286,7 +327,7 @@ QStringList ModuleProviderLoader::getProviderSearchPaths(
stream << "import '" << providerFile << "' as Provider" << endl;
stream << "Provider {" << endl;
stream << " name: " << toJSLiteral(name.toString()) << endl;
- stream << " property var config: (" << toJSLiteral(moduleConfig) << ')' << endl;
+ stream << " property var config: (" << toJSLiteral(jsConfig) << ')' << endl;
stream << " outputBaseDir: FileInfo.joinPaths(baseDirPrefix, "
" Utilities.getHash(JSON.stringify(config)))" << endl;
stream << " property string baseDirPrefix: " << toJSLiteral(searchPathBaseDir) << endl;
@@ -296,14 +337,16 @@ QStringList ModuleProviderLoader::getProviderSearchPaths(
stream << "}" << endl;
stream.flush();
Item * const providerItem =
- m_reader->readFile(dummyItemFile.fileName(), location);
+ m_reader->readFile(dummyItemFile.fileName(), dependsItemLocation);
if (providerItem->type() != ItemType::ModuleProvider) {
throw ErrorInfo(Tr::tr("File '%1' declares an item of type '%2', "
"but '%3' was expected.")
.arg(providerFile, providerItem->typeName(),
BuiltinDeclarations::instance().nameForType(ItemType::ModuleProvider)));
}
- providerItem->setParent(product.item);
+
+ providerItem->setScope(createProviderScope(product, qbsModule));
+
providerItem->overrideProperties(moduleConfig, name.toString(), m_parameters, m_logger);
m_probesResolver->resolveProbes(&product, providerItem);
diff --git a/src/lib/corelib/language/moduleproviderloader.h b/src/lib/corelib/language/moduleproviderloader.h
index b0571a548..91a32ec80 100644
--- a/src/lib/corelib/language/moduleproviderloader.h
+++ b/src/lib/corelib/language/moduleproviderloader.h
@@ -93,29 +93,33 @@ public:
m_parameters = std::move(parameters);
}
- ModuleProviderResult executeModuleProvider(
+ const Set<QString> &tempQbsFiles() const { return m_tempQbsFiles; }
+
+ ModuleProviderResult executeModuleProviders(
ProductContext &productContext,
const CodeLocation &dependsItemLocation,
const QualifiedId &moduleName,
FallbackMode fallbackMode);
- ModuleProviderResult findModuleProvider(
- const std::vector<Provider> &providers,
- ProductContext &product,
- const CodeLocation &dependsItemLocation);
- QVariantMap moduleProviderConfig(ProductContext &product);
- const Set<QString> &tempQbsFiles() const { return m_tempQbsFiles; }
+private:
+ ModuleProviderResult executeModuleProvidersHelper(
+ ProductContext &product,
+ const CodeLocation &dependsItemLocation,
+ const std::vector<Provider> &providers);
+ QVariantMap getModuleProviderConfig(ProductContext &product);
std::optional<std::vector<QualifiedId>> getModuleProviders(Item *item);
-private:
QString findModuleProviderFile(const QualifiedId &name, ModuleProviderLookup lookupType);
- QStringList getProviderSearchPaths(
+ QVariantMap evaluateQbsModule(ProductContext &product) const;
+ Item *createProviderScope(ProductContext &product, const QVariantMap &qbsModule);
+ QStringList evaluateModuleProvider(
+ ProductContext &product,
+ const CodeLocation &location,
const QualifiedId &name,
const QString &providerFile,
- ProductContext &product,
const QVariantMap &moduleConfig,
- const CodeLocation &location);
+ const QVariantMap &qbsModule);
private:
ItemReader *const m_reader{nullptr};
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp
index d7ae11aaf..208f2c5a6 100644
--- a/src/lib/corelib/language/projectresolver.cpp
+++ b/src/lib/corelib/language/projectresolver.cpp
@@ -233,7 +233,7 @@ TopLevelProjectPtr ProjectResolver::resolveTopLevelProject()
{
if (m_progressObserver)
m_progressObserver->setMaximum(int(m_loadResult.productInfos.size()));
- const TopLevelProjectPtr project = TopLevelProject::create();
+ TopLevelProjectPtr project = TopLevelProject::create();
project->buildDirectory = TopLevelProject::deriveBuildDirectory(m_setupParams.buildRoot(),
TopLevelProject::deriveId(m_setupParams.finalBuildConfigurationTree()));
project->buildSystemFiles = m_loadResult.qbsFiles;
@@ -490,7 +490,7 @@ void ProjectResolver::resolveProductFully(Item *item, ProjectContext *projectCon
item->property(StringConstants::excludeFilesProperty()));
fakeGroup->setProperty(StringConstants::overrideTagsProperty(),
VariantValue::falseValue());
- fakeGroup->setupForBuiltinType(m_logger);
+ fakeGroup->setupForBuiltinType(m_setupParams.deprecationWarningMode(), m_logger);
subItems.prepend(fakeGroup);
}
diff --git a/src/lib/corelib/language/propertydeclaration.cpp b/src/lib/corelib/language/propertydeclaration.cpp
index 2dbe41afd..05b2a7f55 100644
--- a/src/lib/corelib/language/propertydeclaration.cpp
+++ b/src/lib/corelib/language/propertydeclaration.cpp
@@ -275,6 +275,12 @@ void PropertyDeclaration::setDeprecationInfo(const DeprecationInfo &deprecationI
d->deprecationInfo = deprecationInfo;
}
+ErrorInfo PropertyDeclaration::checkForDeprecation(DeprecationWarningMode mode,
+ const CodeLocation &loc, Logger &logger) const
+{
+ return deprecationInfo().checkForDeprecation(mode, name(), loc, false, logger);
+}
+
// see also: EvaluatorScriptClass::convertToPropertyType()
QVariant PropertyDeclaration::convertToPropertyType(const QVariant &v, Type t,
const QStringList &namePrefix, const QString &key)
diff --git a/src/lib/corelib/language/propertydeclaration.h b/src/lib/corelib/language/propertydeclaration.h
index 137315d14..d1e114296 100644
--- a/src/lib/corelib/language/propertydeclaration.h
+++ b/src/lib/corelib/language/propertydeclaration.h
@@ -40,6 +40,8 @@
#ifndef QBS_PROPERTYDECLARATION_H
#define QBS_PROPERTYDECLARATION_H
+#include <tools/deprecationwarningmode.h>
+
#include <QtCore/qshareddata.h>
#include <QtCore/qstring.h>
@@ -48,9 +50,12 @@ class QVariant;
QT_END_NAMESPACE
namespace qbs {
+class CodeLocation;
+class ErrorInfo;
namespace Internal {
class DeprecationInfo;
class PropertyDeclarationData;
+class Logger;
class PropertyDeclaration
{
@@ -116,6 +121,8 @@ public:
bool isExpired() const;
const DeprecationInfo &deprecationInfo() const;
void setDeprecationInfo(const DeprecationInfo &deprecationInfo);
+ ErrorInfo checkForDeprecation(DeprecationWarningMode mode, const CodeLocation &loc,
+ Logger &logger) const;
static QVariant convertToPropertyType(
const QVariant &v, Type t, const QStringList &namePrefix, const QString &key);
diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp
index 0614f31f5..adf1a61cc 100644
--- a/src/lib/corelib/language/scriptengine.cpp
+++ b/src/lib/corelib/language/scriptengine.cpp
@@ -129,7 +129,7 @@ std::unique_ptr<ScriptEngine> ScriptEngine::create(Logger &logger, EvalContext e
ScriptEngine::~ScriptEngine()
{
m_creationDestructionMutex.lock();
- connect(this, &QObject::destroyed, std::bind(&std::mutex::unlock, &m_creationDestructionMutex));
+ connect(this, &QObject::destroyed, []{ m_creationDestructionMutex.unlock(); });
releaseResourcesOfScriptObjects();
delete (m_scriptImporter);
@@ -394,7 +394,7 @@ void ScriptEngine::importFile(const QString &filePath, QScriptValue &targetObjec
static QString findExtensionDir(const QStringList &searchPaths, const QString &extensionPath)
{
for (const QString &searchPath : searchPaths) {
- const QString dirPath = searchPath + QStringLiteral("/imports/") + extensionPath;
+ QString dirPath = searchPath + QStringLiteral("/imports/") + extensionPath;
QFileInfo fi(dirPath);
if (fi.exists() && fi.isDir())
return dirPath;
diff --git a/src/lib/corelib/tools/architectures.cpp b/src/lib/corelib/tools/architectures.cpp
index cf9fec27b..f139509e4 100644
--- a/src/lib/corelib/tools/architectures.cpp
+++ b/src/lib/corelib/tools/architectures.cpp
@@ -55,7 +55,7 @@ QString canonicalTargetArchitecture(const QString &architecture,
const QString &system,
const QString &abi)
{
- const QString arch = canonicalArchitecture(architecture);
+ QString arch = canonicalArchitecture(architecture);
const bool isApple = (vendor == QStringLiteral("apple")
|| system == QStringLiteral("darwin")
|| system == QStringLiteral("macosx")
diff --git a/src/lib/corelib/tools/buildoptions.cpp b/src/lib/corelib/tools/buildoptions.cpp
index e4e9ba17f..cc3ef7557 100644
--- a/src/lib/corelib/tools/buildoptions.cpp
+++ b/src/lib/corelib/tools/buildoptions.cpp
@@ -413,8 +413,8 @@ template<> JobLimits fromJson(const QJsonValue &limitsData)
{
JobLimits limits;
const QJsonArray &limitsArray = limitsData.toArray();
- for (const QJsonValue &v : limitsArray) {
- const QJsonObject limitData = v.toObject();
+ for (const auto &value : limitsArray) {
+ const QJsonObject limitData = value.toObject();
QString pool;
int limit = 0;
setValueFromJson(pool, limitData, "pool");
diff --git a/src/lib/corelib/tools/clangclinfo.cpp b/src/lib/corelib/tools/clangclinfo.cpp
index a9a1cb449..68486b91f 100644
--- a/src/lib/corelib/tools/clangclinfo.cpp
+++ b/src/lib/corelib/tools/clangclinfo.cpp
@@ -61,7 +61,7 @@ static std::vector<MSVCInstallInfo> compatibleMsvcs(Logger &logger)
static QString findCompatibleVcsarsallBat(const std::vector<MSVCInstallInfo> &msvcs)
{
for (const auto &msvc: msvcs) {
- const auto vcvarsallPath = msvc.findVcvarsallBat();
+ auto vcvarsallPath = msvc.findVcvarsallBat();
if (!vcvarsallPath.isEmpty())
return vcvarsallPath;
}
diff --git a/src/lib/corelib/tools/deprecationwarningmode.cpp b/src/lib/corelib/tools/deprecationwarningmode.cpp
new file mode 100644
index 000000000..e140e3e49
--- /dev/null
+++ b/src/lib/corelib/tools/deprecationwarningmode.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qbs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** 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-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deprecationwarningmode.h"
+
+/*!
+ * \enum DeprecationWarningMode
+ * This enum type specifies how \QBS should behave on encountering deprecated items or properties.
+ * \value DeprecationWarningMode::Error Project resolving will stop with an error message.
+ * \value DeprecationWarningMode::On A warning will be printed.
+ * \value DeprecationWarningMode::BeforeRemoval A warning will be printed if and only if this is
+ * the last \QBS version before the removal version. This is the default behavior.
+ * \note If the removal version's minor version number is zero, the behavior is
+ * the same as for ErrorHandlingMode::On.
+ * \value DeprecationWarningMode::Off No warnings will be emitted for deprecated constructs.
+ */
+
+namespace qbs {
+
+DeprecationWarningMode defaultDeprecationWarningMode()
+{
+ return DeprecationWarningMode::BeforeRemoval;
+}
+
+QString deprecationWarningModeName(DeprecationWarningMode mode)
+{
+ switch (mode) {
+ case DeprecationWarningMode::Error:
+ return QStringLiteral("error");
+ case DeprecationWarningMode::On:
+ return QStringLiteral("on");
+ case DeprecationWarningMode::BeforeRemoval:
+ return QStringLiteral("before-removal");
+ case DeprecationWarningMode::Off:
+ return QStringLiteral("off");
+ default:
+ break;
+ }
+ return {};
+}
+
+DeprecationWarningMode deprecationWarningModeFromName(const QString &name)
+{
+ DeprecationWarningMode mode = defaultDeprecationWarningMode();
+ for (int i = 0; i <= int(DeprecationWarningMode::Sentinel); ++i) {
+ if (deprecationWarningModeName(static_cast<DeprecationWarningMode>(i)) == name) {
+ mode = static_cast<DeprecationWarningMode>(i);
+ break;
+ }
+ }
+ return mode;
+}
+
+QStringList allDeprecationWarningModeStrings()
+{
+ QStringList result;
+ for (int i = 0; i <= int(DeprecationWarningMode::Sentinel); ++i)
+ result << deprecationWarningModeName(static_cast<DeprecationWarningMode>(i));
+ return result;
+}
+
+} // namespace qbs
diff --git a/src/lib/corelib/tools/deprecationwarningmode.h b/src/lib/corelib/tools/deprecationwarningmode.h
new file mode 100644
index 000000000..bb2a14155
--- /dev/null
+++ b/src/lib/corelib/tools/deprecationwarningmode.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qbs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** 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-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBS_DEPRECATIONWARNINGMODE_H
+#define QBS_DEPRECATIONWARNINGMODE_H
+
+#include "qbs_export.h"
+
+#include <QtCore/qstringlist.h>
+
+namespace qbs {
+
+enum class DeprecationWarningMode { Error, On, BeforeRemoval, Off, Sentinel = Off };
+
+QBS_EXPORT DeprecationWarningMode defaultDeprecationWarningMode();
+QBS_EXPORT QString deprecationWarningModeName(DeprecationWarningMode mode);
+QBS_EXPORT DeprecationWarningMode deprecationWarningModeFromName(const QString &name);
+QBS_EXPORT QStringList allDeprecationWarningModeStrings();
+
+} // namespace qbs
+
+#endif // QBS_DEPRECATIONWARNINGMODE_H
+
diff --git a/src/lib/corelib/tools/installoptions.cpp b/src/lib/corelib/tools/installoptions.cpp
index 5e112e6de..563f04a7b 100644
--- a/src/lib/corelib/tools/installoptions.cpp
+++ b/src/lib/corelib/tools/installoptions.cpp
@@ -68,7 +68,7 @@ public:
QString effectiveInstallRoot(const InstallOptions &options, const TopLevelProject *project)
{
- const QString installRoot = options.installRoot();
+ QString installRoot = options.installRoot();
if (!installRoot.isEmpty())
return installRoot;
diff --git a/src/lib/corelib/tools/msvcinfo.cpp b/src/lib/corelib/tools/msvcinfo.cpp
index 418a76ba1..973284b2b 100644
--- a/src/lib/corelib/tools/msvcinfo.cpp
+++ b/src/lib/corelib/tools/msvcinfo.cpp
@@ -309,7 +309,7 @@ static QString vswhereFilePath()
static const std::vector<const char *> envVarCandidates{"ProgramFiles", "ProgramFiles(x86)"};
for (const char * const envVar : envVarCandidates) {
const QString value = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv(envVar)));
- const QString cmd = value
+ QString cmd = value
+ QStringLiteral("/Microsoft Visual Studio/Installer/vswhere.exe");
if (QFileInfo(cmd).exists())
return cmd;
@@ -356,8 +356,8 @@ static std::vector<MSVCInstallInfo> retrieveInstancesFromVSWhere(
return result;
}
const auto jsonArray = jsonOutput.array();
- for (const QJsonValue &v : jsonArray) {
- const QJsonObject o = v.toObject();
+ for (const auto &value : jsonArray) {
+ const QJsonObject o = value.toObject();
MSVCInstallInfo info;
info.version = o.value(QStringLiteral("installationVersion")).toString();
if (productType == ProductType::BuildTools) {
@@ -509,7 +509,7 @@ void MSVC::init()
QString MSVC::architectureFromClPath(const QString &clPath)
{
const auto parentDir = QFileInfo(clPath).absolutePath();
- const auto parentDirName = QFileInfo(parentDir).fileName().toLower();
+ auto parentDirName = QFileInfo(parentDir).fileName().toLower();
// can be the case when cl.exe is present within the Windows SDK installation... but can it?
if (parentDirName == QLatin1String("bin"))
return QStringLiteral("x86");
@@ -722,7 +722,7 @@ QString MSVCInstallInfo::findVcvarsallBat() const
std::vector<MSVCInstallInfo> MSVCInstallInfo::installedMSVCs(Logger &logger)
{
- const auto installInfos = installedMSVCsFromVsWhere(logger);
+ auto installInfos = installedMSVCsFromVsWhere(logger);
if (installInfos.empty())
return installedMSVCsFromRegistry();
return installInfos;
diff --git a/src/lib/corelib/tools/persistence.cpp b/src/lib/corelib/tools/persistence.cpp
index 95211e894..1940b19de 100644
--- a/src/lib/corelib/tools/persistence.cpp
+++ b/src/lib/corelib/tools/persistence.cpp
@@ -48,7 +48,7 @@
namespace qbs {
namespace Internal {
-static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-130";
+static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-131";
NoBuildGraphError::NoBuildGraphError(const QString &filePath)
: ErrorInfo(Tr::tr("Build graph not found for configuration '%1'. Expected location was '%2'.")
diff --git a/src/lib/corelib/tools/profile.cpp b/src/lib/corelib/tools/profile.cpp
index 2eac25091..0fe0ba19d 100644
--- a/src/lib/corelib/tools/profile.cpp
+++ b/src/lib/corelib/tools/profile.cpp
@@ -213,7 +213,7 @@ QVariant Profile::possiblyInheritedValue(const QString &key, const QVariant &def
QStringList profileChain) const
{
extendAndCheckProfileChain(profileChain);
- const QVariant v = localValue(key);
+ QVariant v = localValue(key);
if (v.isValid())
return v;
const QString baseProfileName = baseProfile();
diff --git a/src/lib/corelib/tools/qbsprocess.cpp b/src/lib/corelib/tools/qbsprocess.cpp
index de2590e8a..3fdc05afe 100644
--- a/src/lib/corelib/tools/qbsprocess.cpp
+++ b/src/lib/corelib/tools/qbsprocess.cpp
@@ -120,7 +120,7 @@ void QbsProcess::sendPacket(const LauncherPacket &packet)
QByteArray QbsProcess::readAndClear(QByteArray &data)
{
- const QByteArray tmp = data;
+ QByteArray tmp = data;
data.clear();
return tmp;
}
diff --git a/src/lib/corelib/tools/settingscreator.cpp b/src/lib/corelib/tools/settingscreator.cpp
index f94ae6f10..2cef0e5ce 100644
--- a/src/lib/corelib/tools/settingscreator.cpp
+++ b/src/lib/corelib/tools/settingscreator.cpp
@@ -53,14 +53,26 @@
namespace qbs {
namespace Internal {
+namespace {
+QString getBaseDir(QString baseDir) {
+ if (!baseDir.isEmpty())
+ return baseDir;
+
+ const char key[] = "QBS_SETTINGS_DIR";
+ if (qEnvironmentVariableIsSet(key))
+ return QLatin1String(qgetenv(key));
+
+ return {};
+}
+} // namespace
+
static QSettings::Format format()
{
return HostOsInfo::isWindowsHost() ? QSettings::IniFormat : QSettings::NativeFormat;
}
-
SettingsCreator::SettingsCreator(QString baseDir)
- : m_settingsBaseDir(std::move(baseDir))
+ : m_settingsBaseDir(getBaseDir(std::move(baseDir)))
, m_qbsVersion(Version::fromString(QLatin1String(QBS_VERSION)))
{
}
diff --git a/src/lib/corelib/tools/setupprojectparameters.cpp b/src/lib/corelib/tools/setupprojectparameters.cpp
index a06ffc4bd..564ebe873 100644
--- a/src/lib/corelib/tools/setupprojectparameters.cpp
+++ b/src/lib/corelib/tools/setupprojectparameters.cpp
@@ -98,6 +98,7 @@ public:
SetupProjectParameters::RestoreBehavior restoreBehavior;
ErrorHandlingMode propertyCheckingMode;
ErrorHandlingMode productErrorMode;
+ DeprecationWarningMode deprecationWarningMode = defaultDeprecationWarningMode();
QProcessEnvironment environment;
};
@@ -125,6 +126,11 @@ template<> ErrorHandlingMode fromJson(const QJsonValue &v)
return ErrorHandlingMode::Strict;
}
+template<> DeprecationWarningMode fromJson(const QJsonValue &v)
+{
+ return deprecationWarningModeFromName(v.toString());
+}
+
template<> SetupProjectParameters::RestoreBehavior fromJson(const QJsonValue &v)
{
const QString value = v.toString();
@@ -154,6 +160,7 @@ SetupProjectParameters SetupProjectParameters::fromJson(const QJsonObject &data)
setValueFromJson(params.d->environment, data, "environment");
setValueFromJson(params.d->restoreBehavior, data, "restore-behavior");
setValueFromJson(params.d->propertyCheckingMode, data, "error-handling-mode");
+ setValueFromJson(params.d->deprecationWarningMode, data, "deprecation-warning-mode");
params.d->productErrorMode = params.d->propertyCheckingMode;
return params;
}
@@ -688,4 +695,20 @@ void SetupProjectParameters::setProductErrorMode(ErrorHandlingMode mode)
d->productErrorMode = mode;
}
+/*!
+ * \brief Indicates how deprecated constructs are handled.
+ */
+DeprecationWarningMode SetupProjectParameters::deprecationWarningMode() const
+{
+ return d->deprecationWarningMode;
+}
+
+/*!
+ * \brief Specifies the behavior on encountering deprecated constructs.
+ */
+void SetupProjectParameters::setDeprecationWarningMode(DeprecationWarningMode mode)
+{
+ d->deprecationWarningMode = mode;
+}
+
} // namespace qbs
diff --git a/src/lib/corelib/tools/setupprojectparameters.h b/src/lib/corelib/tools/setupprojectparameters.h
index 2617a34cd..5c7bf3715 100644
--- a/src/lib/corelib/tools/setupprojectparameters.h
+++ b/src/lib/corelib/tools/setupprojectparameters.h
@@ -41,6 +41,7 @@
#include "qbs_export.h"
+#include <tools/deprecationwarningmode.h>
#include <tools/error.h>
#include <QtCore/qshareddata.h>
@@ -144,6 +145,9 @@ public:
ErrorHandlingMode productErrorMode() const;
void setProductErrorMode(ErrorHandlingMode mode);
+ DeprecationWarningMode deprecationWarningMode() const;
+ void setDeprecationWarningMode(DeprecationWarningMode mode);
+
private:
QSharedDataPointer<Internal::SetupProjectParametersPrivate> d;
};
diff --git a/src/lib/corelib/tools/tools.pri b/src/lib/corelib/tools/tools.pri
index 1fdacc016..835fbbfda 100644
--- a/src/lib/corelib/tools/tools.pri
+++ b/src/lib/corelib/tools/tools.pri
@@ -13,6 +13,7 @@ HEADERS += \
$$PWD/clangclinfo.h \
$$PWD/codelocation.h \
$$PWD/commandechomode.h \
+ $$PWD/deprecationwarningmode.h \
$$PWD/dynamictypecheck.h \
$$PWD/error.h \
$$PWD/executablefinder.h \
@@ -73,6 +74,7 @@ SOURCES += \
$$PWD/clangclinfo.cpp \
$$PWD/codelocation.cpp \
$$PWD/commandechomode.cpp \
+ $$PWD/deprecationwarningmode.cpp \
$$PWD/error.cpp \
$$PWD/executablefinder.cpp \
$$PWD/fileinfo.cpp \
@@ -127,6 +129,7 @@ osx {
$$PWD/cleanoptions.h \
$$PWD/codelocation.h \
$$PWD/commandechomode.h \
+ $$PWD/deprecationwarningmode.h \
$$PWD/error.h \
$$PWD/generateoptions.h \
$$PWD/installoptions.h \
diff --git a/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp b/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp
index 7a67ce22b..e1b83d801 100644
--- a/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp
+++ b/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp
@@ -52,7 +52,7 @@ VisualStudioSolutionFileProject::~VisualStudioSolutionFileProject() = default;
QString VisualStudioSolutionFileProject::name() const
{
- const auto projectName = IVisualStudioSolutionProject::name();
+ auto projectName = IVisualStudioSolutionProject::name();
if (projectName.isEmpty())
return QFileInfo(filePath()).baseName();
return projectName;
diff --git a/src/lib/pkgconfig/pcparser.cpp b/src/lib/pkgconfig/pcparser.cpp
index b314bc1bb..388363af6 100644
--- a/src/lib/pkgconfig/pcparser.cpp
+++ b/src/lib/pkgconfig/pcparser.cpp
@@ -64,6 +64,15 @@ namespace qbs {
namespace {
+// workaround for a missing ctor before c++20
+template<typename It>
+std::string_view makeStringView(It begin, It end)
+{
+ if (begin == end)
+ return {};
+ return std::string_view(&*begin, std::distance(begin, end));
+}
+
bool readOneLine(std::ifstream &file, std::string &line)
{
bool quoted = false;
@@ -133,7 +142,7 @@ std::string_view trimmed(std::string_view str)
const auto right = std::find_if_not(str.rbegin(), str.rend(), predicate).base();
if (right <= left)
return {};
- return std::string_view(&*left, std::distance(left, right));
+ return makeStringView(left, right);
}
// based on https://opensource.apple.com/source/distcc/distcc-31.0.81/popt/poptparse.c.auto.html
@@ -466,10 +475,10 @@ std::string PcParser::trimAndSubstitute(const PcPackage &pkg, std::string_view s
const auto varval = m_pkgConfig.packageGetVariable(pkg, varname);
- if (varval.empty())
+ if (!varval)
raizeUndefinedVariableException(pkg, varname);
- result += varval;
+ result += *varval;
} else {
result += str.front();
str.remove_prefix(1);
@@ -633,10 +642,10 @@ std::vector<PcPackage::RequiredVersion> PcParser::parseModuleList(PcPackage &pkg
auto start = p;
- while (*p && !std::isspace(*p))
+ while (p != end && !std::isspace(*p))
++p;
- const auto name = std::string_view(&*start, std::distance(start, p));
+ const auto name = makeStringView(start, p);
if (name.empty())
raizeEmptyPackageNameException(pkg);
@@ -651,7 +660,7 @@ std::vector<PcPackage::RequiredVersion> PcParser::parseModuleList(PcPackage &pkg
while (p != end && !std::isspace(*p))
++p;
- const auto comp = std::string_view(&*start, std::distance(start, p));
+ const auto comp = makeStringView(start, p);
ver.comparison = comparisonFromString(pkg, ver.name, comp);
while (p != end && std::isspace(*p))
@@ -662,7 +671,7 @@ std::vector<PcPackage::RequiredVersion> PcParser::parseModuleList(PcPackage &pkg
while (p != end && !std::isspace(*p))
++p;
- const auto version = std::string_view(&*start, std::distance(start, p));
+ const auto version = makeStringView(start, p);
while (p != end && std::isspace(*p))
++p;
diff --git a/src/lib/pkgconfig/pkgconfig.cpp b/src/lib/pkgconfig/pkgconfig.cpp
index 856c871bf..b2c3d4d71 100644
--- a/src/lib/pkgconfig/pkgconfig.cpp
+++ b/src/lib/pkgconfig/pkgconfig.cpp
@@ -217,16 +217,17 @@ const PcPackageVariant &PkgConfig::getPackage(std::string_view baseFileName) con
return *it;
}
-std::string_view PkgConfig::packageGetVariable(const PcPackage &pkg, std::string_view var) const
+std::optional<std::string_view> PkgConfig::packageGetVariable(
+ const PcPackage &pkg, std::string_view var) const
{
- std::string_view varval;
+ std::optional<std::string_view> result;
if (var.empty())
- return varval;
+ return result;
const auto &globals = m_options.globalVariables;
if (auto it = globals.find(var); it != globals.end())
- varval = it->second;
+ result = it->second;
// Allow overriding specific variables using an environment variable of the
// form PKG_CONFIG_$PACKAGENAME_$VARIABLE
@@ -234,15 +235,15 @@ std::string_view PkgConfig::packageGetVariable(const PcPackage &pkg, std::string
const std::string envVariable = varToEnvVar(pkg.baseFileName, var);
const auto it = m_options.systemVariables.find(envVariable);
if (it != m_options.systemVariables.end())
- return it->second;
+ result = it->second;
}
- if (varval.empty()) {
- const auto it = pkg.variables.find(var);
- varval = (it != pkg.variables.end()) ? it->second : std::string_view();
+ if (!result) {
+ if (const auto it = pkg.variables.find(var); it != pkg.variables.end())
+ result = it->second;
}
- return varval;
+ return result;
}
#if HAS_STD_FILESYSTEM
diff --git a/src/lib/pkgconfig/pkgconfig.h b/src/lib/pkgconfig/pkgconfig.h
index 6da1f053f..c1cc634e3 100644
--- a/src/lib/pkgconfig/pkgconfig.h
+++ b/src/lib/pkgconfig/pkgconfig.h
@@ -72,7 +72,8 @@ public:
const Packages &packages() const { return m_packages; }
const PcPackageVariant &getPackage(std::string_view baseFileName) const;
- std::string_view packageGetVariable(const PcPackage &pkg, std::string_view var) const;
+ std::optional<std::string_view> packageGetVariable(
+ const PcPackage &pkg, std::string_view var) const;
private:
Packages findPackages() const;
diff --git a/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp b/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp
index fc1a36c96..dc5450967 100644
--- a/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp
+++ b/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp
@@ -115,12 +115,11 @@ QJsonObject ClangCompilationDatabaseGenerator::createEntry(const QString &filePa
const QStringList arguments = QStringList() << ruleCommand.executable()
<< ruleCommand.arguments();
- const QJsonObject object = {
+ return QJsonObject{
{ QStringLiteral("directory"), QJsonValue(workDir) },
{ QStringLiteral("arguments"), QJsonArray::fromStringList(arguments) },
{ QStringLiteral("file"), QJsonValue(filePath) }
};
- return object;
}
void ClangCompilationDatabaseGenerator::writeProjectDatabase(const QString &filePath,
diff --git a/src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.cpp b/src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.cpp
index b0c4b9368..2fa3cfa6a 100644
--- a/src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.cpp
+++ b/src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.cpp
@@ -95,17 +95,15 @@ struct TargetPageOptions final
const QString core = IarewUtils::flagValue(
flags, QStringLiteral("--core"))
.toLower();
- if (core == QLatin1String("plain")) {
+ // If the core variant is not set, then choose the
+ // default value, CorePlain (see the compiler datasheet for
+ // '--core' option).
+ if (core == QLatin1String("plain") || core.isEmpty()) {
cpuCore = TargetPageOptions::CorePlain;
} else if (core == QLatin1String("extended1")) {
cpuCore = TargetPageOptions::CoreExtended1;
} else if (core == QLatin1String("extended2")) {
cpuCore = TargetPageOptions::CoreExtended2;
- } else {
- // If the core variant is not set, then choose the
- // default values (see the compiler datasheet for
- // '--core' option).
- cpuCore = TargetPageOptions::CorePlain;
}
const QString cm = IarewUtils::flagValue(
@@ -119,7 +117,7 @@ struct TargetPageOptions final
codeModel = TargetPageOptions::CodeModelFar;
} else if (cm == QLatin1String("banked_ext2")) {
codeModel = TargetPageOptions::CodeModelBankedExtended2;
- } else {
+ } else if (cm.isEmpty()) {
// If the code model is not set, then choose the
// default values (see the compiler datasheet for
// '--code_model' option).
@@ -145,7 +143,7 @@ struct TargetPageOptions final
dataModel = TargetPageOptions::DataModelFarGeneric;
} else if (dm == QLatin1String("far")) {
dataModel = TargetPageOptions::DataModelFar;
- } else {
+ } else if (dm.isEmpty()) {
// If the data model is not set, then choose the
// default values (see the compiler datasheet for
// '--data_model' option).
@@ -172,26 +170,26 @@ struct TargetPageOptions final
const QString constPlace = IarewUtils::flagValue(
flags, QStringLiteral("--place_constants"))
.toLower();
- if (constPlace == QLatin1String("data")) {
+ // If this option is not set, then choose the
+ // default value (see the compiler datasheet for
+ // '--place_constants' option).
+ if (constPlace == QLatin1String("data") || constPlace.isEmpty()) {
constPlacement = TargetPageOptions::RamMemoryPlace;
} else if (constPlace == QLatin1String("data_rom")) {
constPlacement = TargetPageOptions::RomMemoryPlace;
} else if (constPlace == QLatin1String("code")) {
constPlacement = TargetPageOptions::CodeMemoryPlace;
- } else {
- // If this option is not set, then choose the
- // default value (see the compiler datasheet for
- // '--place_constants' option).
- constPlacement = TargetPageOptions::RamMemoryPlace;
}
-
const QString cc = IarewUtils::flagValue(
flags, QStringLiteral("--calling_convention")).toLower();
if (cc == QLatin1String("data_overlay")) {
callingConvention = TargetPageOptions::DataOverlayConvention;
} else if (cc == QLatin1String("idata_overlay")) {
callingConvention = TargetPageOptions::IDataOverlayConvention;
- } else if (cc == QLatin1String("idata_reentrant")) {
+ } else if (cc == QLatin1String("idata_reentrant") || cc.isEmpty()) {
+ // If this option is not set, then choose the
+ // default value (see the compiler datasheet for
+ // '--calling_convention' option).
callingConvention = TargetPageOptions::IDataReentrantConvention;
} else if (cc == QLatin1String("pdata_reentrant")) {
callingConvention = TargetPageOptions::PDataReentrantConvention;
@@ -199,11 +197,6 @@ struct TargetPageOptions final
callingConvention = TargetPageOptions::XDataReentrantConvention;
} else if (cc == QLatin1String("ext_stack_reentrant")) {
callingConvention = TargetPageOptions::ExtendedStackReentrantConvention;
- } else {
- // If this option is not set, then choose the
- // default value (see the compiler datasheet for
- // '--calling_convention' option).
- callingConvention = TargetPageOptions::IDataReentrantConvention;
}
}
@@ -446,13 +439,12 @@ struct DptrPageOptions final
case VisibilityIndex:
if (part == QLatin1String("shadowed"))
dptrVisibility = DptrPageOptions::DptrShadowed;
- else if (part == QLatin1String("separate"))
- dptrVisibility = DptrPageOptions::DptrSeparate;
- else
- // If this option is not set, then choose the
+ else if (part == QLatin1String("separate") || part.isEmpty()) {
+ // If this option is not set or set to "separate", then choose the
// default value (see the compiler datasheet for
// '--dptr' option).
dptrVisibility = DptrPageOptions::DptrSeparate;
+ }
break;
case SwitchMethodIndex:
if (part == QLatin1String("inc")) {
@@ -647,30 +639,22 @@ struct LibraryOptionsPageOptions final
Qt::CaseInsensitive)) {
const QString prop = flag.split(
QLatin1Char('=')).at(0).toLower();
+ // see the compiler datasheet for the '_formatted_write' option.
if (prop == QLatin1String("-e_large_write"))
printfFormatter = LibraryOptionsPageOptions::PrintfLargeFormatter;
else if (prop == QLatin1String("-e_medium_write"))
printfFormatter = LibraryOptionsPageOptions::PrintfMediumFormatter;
else if (prop == QLatin1String("-e_small_write"))
printfFormatter = LibraryOptionsPageOptions::PrintfSmallFormatter;
- else
- // If this option is not set, then choose the
- // default value (see the compiler datasheet for
- // '_formatted_write' option).
- printfFormatter = LibraryOptionsPageOptions::PrintfMediumFormatter;
} else if (flag.endsWith(QLatin1String("_formatted_read"),
Qt::CaseInsensitive)) {
const QString prop = flag.split(QLatin1Char('='))
.at(0).toLower();
+ // see the compiler datasheet for the '_formatted_read' option.
if (prop == QLatin1String("-e_large_read"))
scanfFormatter = LibraryOptionsPageOptions::ScanfLargeFormatter;
else if (prop == QLatin1String("-e_medium_read"))
scanfFormatter = LibraryOptionsPageOptions::ScanfMediumFormatter;
- else
- // If this option is not set, then choose the
- // default value (see the compiler datasheet for
- // '_formatted_read' option).
- scanfFormatter = LibraryOptionsPageOptions::ScanfMediumFormatter;
}
}
}
diff --git a/src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.cpp b/src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.cpp
index d99e15bb2..7b330ca7f 100644
--- a/src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.cpp
+++ b/src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.cpp
@@ -281,7 +281,7 @@ struct LibraryOptionsPageOptions final
else if (prop == QLatin1String("_printflarge"))
printfFormatter = PrintfLargeFormatter;
else if (prop == QLatin1String("_printflargenomb"))
- printfFormatter = PrintfLargeFormatter;
+ printfFormatter = PrintfLargeNoMultibytesFormatter;
else if (prop == QLatin1String("_printfsmall"))
printfFormatter = PrintfSmallFormatter;
else if (prop == QLatin1String("_printfsmallnomb"))
@@ -299,7 +299,7 @@ struct LibraryOptionsPageOptions final
else if (prop == QLatin1String("_scanflarge"))
scanfFormatter = ScanfLargeFormatter;
else if (prop == QLatin1String("_scanflargenomb"))
- scanfFormatter = ScanfLargeFormatter;
+ scanfFormatter = ScanfLargeNoMultibytesFormatter;
else if (prop == QLatin1String("_scanfsmall"))
scanfFormatter = ScanfSmallFormatter;
else if (prop == QLatin1String("_scanfsmallnomb"))
diff --git a/src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.cpp b/src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.cpp
index 9477bc36e..83766442b 100644
--- a/src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.cpp
+++ b/src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.cpp
@@ -205,7 +205,7 @@ struct LibraryOptionsPageOptions final
else if (prop == QLatin1String("_printffullnomb"))
printfFormatter = PrintfFullNoMultibytesFormatter;
else if (prop == QLatin1String("_printflarge"))
- printfFormatter = PrintfLargeFormatter;
+ printfFormatter = PrintfLargeNoMultibytesFormatter;
else if (prop == QLatin1String("_printflargenomb"))
printfFormatter = PrintfLargeFormatter;
else if (prop == QLatin1String("_printfsmall"))
@@ -223,7 +223,7 @@ struct LibraryOptionsPageOptions final
else if (prop == QLatin1String("_scanffullnomb"))
scanfFormatter = ScanfFullNoMultibytesFormatter;
else if (prop == QLatin1String("_scanflarge"))
- scanfFormatter = ScanfLargeFormatter;
+ scanfFormatter = ScanfLargeNoMultibytesFormatter;
else if (prop == QLatin1String("_scanflargenomb"))
scanfFormatter = ScanfLargeFormatter;
else if (prop == QLatin1String("_scanfsmall"))
diff --git a/src/plugins/scanner/cpp/Lexer.cpp b/src/plugins/scanner/cpp/Lexer.cpp
index 6bad85c5c..ebf843aca 100644
--- a/src/plugins/scanner/cpp/Lexer.cpp
+++ b/src/plugins/scanner/cpp/Lexer.cpp
@@ -69,8 +69,6 @@ Lexer::Lexer(const char *firstChar, const char *lastChar)
setSource(firstChar, lastChar);
}
-Lexer::~Lexer() = default;
-
void Lexer::setSource(const char *firstChar, const char *lastChar)
{
_firstChar = firstChar;
diff --git a/src/plugins/scanner/cpp/Lexer.h b/src/plugins/scanner/cpp/Lexer.h
index 8f55f84e9..42f733dc5 100644
--- a/src/plugins/scanner/cpp/Lexer.h
+++ b/src/plugins/scanner/cpp/Lexer.h
@@ -79,7 +79,6 @@ public:
};
Lexer(const char *firstChar, const char *lastChar);
- ~Lexer();
bool qtMocRunEnabled() const;
void setQtMocRunEnabled(bool onoff);
diff --git a/src/shared/qtscript b/src/shared/qtscript
-Subproject e19477e1129a4c64e023006c59878637d594e99
+Subproject 2c1ffc66bf5d5db05018d7b06253b5ca51e557a
diff --git a/tests/auto/blackbox/CMakeLists.txt b/tests/auto/blackbox/CMakeLists.txt
index 0bf79a433..5b5376064 100644
--- a/tests/auto/blackbox/CMakeLists.txt
+++ b/tests/auto/blackbox/CMakeLists.txt
@@ -1,6 +1,7 @@
add_qbs_test(blackbox
DEFINES
${QBS_UNIT_TESTS_DEFINES}
+ "QBS_VERSION=\"${QBS_VERSION}\""
SOURCES
../shared.h
tst_blackboxbase.cpp
diff --git a/tests/auto/blackbox/blackbox.qbs b/tests/auto/blackbox/blackbox.qbs
index 3f0ff959a..ac6bf750e 100644
--- a/tests/auto/blackbox/blackbox.qbs
+++ b/tests/auto/blackbox/blackbox.qbs
@@ -25,4 +25,5 @@ QbsAutotest {
]
cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)])
.concat(qbsbuildconfig.enableUnitTests ? ["QBS_ENABLE_UNIT_TESTS"] : [])
+ .concat("QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version))
}
diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-application/main.c b/tests/auto/blackbox/testdata-baremetal/one-object-application/main.c
index d5ac449bf..58fe69254 100644
--- a/tests/auto/blackbox/testdata-baremetal/one-object-application/main.c
+++ b/tests/auto/blackbox/testdata-baremetal/one-object-application/main.c
@@ -1,6 +1,4 @@
-#include <stdio.h>
int main(void)
{
- printf("Hello from app\n");
return 0;
}
diff --git a/tests/auto/blackbox/testdata-baremetal/two-object-application/fun.c b/tests/auto/blackbox/testdata-baremetal/two-object-application/fun.c
index e5850346a..3b8c8f2f4 100644
--- a/tests/auto/blackbox/testdata-baremetal/two-object-application/fun.c
+++ b/tests/auto/blackbox/testdata-baremetal/two-object-application/fun.c
@@ -1,6 +1,4 @@
-#include <stdio.h>
int f(void)
{
- printf("Hello from app\n");
return 0;
}
diff --git a/tests/auto/blackbox/testdata/deprecated-property/deprecated-property.qbs b/tests/auto/blackbox/testdata/deprecated-property/deprecated-property.qbs
index e3dacffea..e699672a8 100644
--- a/tests/auto/blackbox/testdata/deprecated-property/deprecated-property.qbs
+++ b/tests/auto/blackbox/testdata/deprecated-property/deprecated-property.qbs
@@ -3,6 +3,6 @@ import qbs // FIXME: Don't remove this import because then the test fails!
Product {
Depends { name: "themodule" }
themodule.newProp: true
- themodule.oldProp: false
+ themodule.expiringProp: false
themodule.veryOldProp: false
}
diff --git a/tests/auto/blackbox/testdata/deprecated-property/modules/themodule/m.qbs b/tests/auto/blackbox/testdata/deprecated-property/modules/themodule/m.qbs
index cd6b0b70c..58164e918 100644
--- a/tests/auto/blackbox/testdata/deprecated-property/modules/themodule/m.qbs
+++ b/tests/auto/blackbox/testdata/deprecated-property/modules/themodule/m.qbs
@@ -1,8 +1,8 @@
-import qbs // FIXME: Don't remove this import because then the test fails!
+import qbs.Environment
Module {
property bool newProp
- property bool oldProp
+ property bool expiringProp
property bool forgottenProp
PropertyOptions {
@@ -10,9 +10,9 @@ Module {
description: "Use this, it's good!"
}
PropertyOptions {
- name: "oldProp"
+ name: "expiringProp"
description: "Use newProp instead."
- removalVersion: "99.9"
+ removalVersion: Environment.getEnv("REMOVAL_VERSION")
}
PropertyOptions {
name: "veryOldProp"
diff --git a/tests/auto/blackbox/testdata/maximum-c-language-version/maximum-c-language-version.qbs b/tests/auto/blackbox/testdata/maximum-c-language-version/maximum-c-language-version.qbs
index 320494d00..9f41570f8 100644
--- a/tests/auto/blackbox/testdata/maximum-c-language-version/maximum-c-language-version.qbs
+++ b/tests/auto/blackbox/testdata/maximum-c-language-version/maximum-c-language-version.qbs
@@ -4,10 +4,13 @@ CppApplication {
Probe {
id: osProbe
- property stringList toolchain: qbs.toolchain
+ property string toolchainType: qbs.toolchainType
+ property string compilerVersion: cpp.compilerVersion
configure: {
- if (toolchain.contains("msvc"))
- console.info("is msvc");
+ console.info("is msvc: " + (toolchainType === "msvc" || toolchainType === "clang-cl"));
+ var isOld = (toolchainType === "msvc" && compilerVersion < "19.29.30138")
+ || (toolchainType === "clang-cl" && compilerVersion < "13");
+ console.info("is old msvc: " + isOld);
found = true;
}
}
diff --git a/tests/auto/blackbox/testdata/qbs-module-properties-in-providers/module-providers/provider_a.qbs b/tests/auto/blackbox/testdata/qbs-module-properties-in-providers/module-providers/provider_a.qbs
new file mode 100644
index 000000000..95c89cd1c
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qbs-module-properties-in-providers/module-providers/provider_a.qbs
@@ -0,0 +1,9 @@
+import "../../qbs-module-providers-helpers.js" as Helpers
+
+ModuleProvider {
+ property string sysroot: qbs.sysroot
+ relativeSearchPaths: {
+ Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", sysroot);
+ return "";
+ }
+}
diff --git a/tests/auto/blackbox/testdata/qbs-module-properties-in-providers/qbs-module-properties-in-providers.qbs b/tests/auto/blackbox/testdata/qbs-module-properties-in-providers/qbs-module-properties-in-providers.qbs
new file mode 100644
index 000000000..a338a220d
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qbs-module-properties-in-providers/qbs-module-properties-in-providers.qbs
@@ -0,0 +1,34 @@
+Project {
+ qbsModuleProviders: "provider_a"
+ name: "project"
+
+ Profile {
+ name: "profile1"
+ qbs.sysroot: "sysroot1"
+ }
+
+ Profile {
+ name: "profile2"
+ qbs.sysroot: "sysroot2"
+ }
+
+ Product {
+ name: "product1"
+ Depends { name: "qbsmetatestmodule" }
+ property bool dummy: {
+ console.info("product1.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop);
+ }
+ // multiplex over profiles, sysroot should not be cached
+ qbs.profiles: ["profile1", "profile2"]
+ }
+
+ Product {
+ name: "product2"
+ Depends { name: "qbsmetatestmodule" }
+ property bool dummy: {
+ console.info("product2.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop);
+ }
+ // multiplex over profiles, sysroot should not be cached
+ qbs.profiles: ["profile1", "profile2"]
+ }
+}
diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc
deleted file mode 100644
index 077a05893..000000000
--- a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc
+++ /dev/null
@@ -1,6 +0,0 @@
-Name: libA
-Description: just a test
-Version: 0.0.1
-
-Cflags: -DTHE_MAGIC_DEFINE -I/usr/local/include
-Libs: -L/usr/local/lib -llibA
diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs
index 9d482415b..b473083c6 100644
--- a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs
+++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs
@@ -6,6 +6,8 @@ Project {
DynamicLibrary {
Depends { name: "cpp" }
Depends { name: "bundle" }
+ Depends { name: "Exporter.pkgconfig" }
+ Exporter.pkgconfig.versionEntry: "1.0"
name: "libA"
bundle.isBundle: project.isBundle
bundle.publicHeaders: ["libA.h"]
@@ -16,7 +18,7 @@ Project {
result.push("MYLIB_FRAMEWORK");
return result;
}
- qbs.installPrefix: ""
+ qbs.installPrefix: "/usr"
install: true
installImportLib: true
installDir: "lib"
@@ -25,5 +27,16 @@ Project {
qbs.install: !project.isBundle
qbs.installDir: FileInfo.joinPaths("include", product.name)
}
+ Group {
+ fileTagsFilter: ["Exporter.pkgconfig.pc"]
+ qbs.install: !project.isBundle
+ qbs.installDir: FileInfo.joinPaths("share", "pkgconfig")
+ }
+ Export {
+ Depends { name: "cpp" }
+ cpp.defines: ["THE_MAGIC_DEFINE"]
+ cpp.includePaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "include")]
+ cpp.libraryPaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "lib")]
+ }
}
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index bfec09344..8bc905929 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -53,6 +53,7 @@
#include <QtCore/qsettings.h>
#include <QtCore/qtemporarydir.h>
#include <QtCore/qtemporaryfile.h>
+#include <QtCore/qversionnumber.h>
#include <algorithm>
#include <functional>
@@ -1055,22 +1056,68 @@ void TestBlackbox::dependencyScanningLoop()
void TestBlackbox::deprecatedProperty()
{
+ QFETCH(QString, version);
+ QFETCH(QString, mode);
+ QFETCH(bool, expiringWarning);
+ QFETCH(bool, expiringError);
+
QDir::setCurrent(testDataDir + "/deprecated-property");
QbsRunParameters params(QStringList("-q"));
params.expectFailure = true;
+ params.environment.insert("REMOVAL_VERSION", version);
+ if (!mode.isEmpty())
+ params.arguments << "--deprecation-warnings" << mode;
QVERIFY(runQbs(params) != 0);
m_qbsStderr = QDir::fromNativeSeparators(QString::fromLocal8Bit(m_qbsStderr)).toLocal8Bit();
- QVERIFY2(m_qbsStderr.contains("deprecated-property.qbs:6:24 The property 'oldProp' is "
- "deprecated and will be removed in Qbs 99.9.0."), m_qbsStderr.constData());
- QVERIFY2(m_qbsStderr.contains("deprecated-property.qbs:7:28 The property 'veryOldProp' can no "
- "longer be used. It was removed in Qbs 1.3.0."), m_qbsStderr.constData());
+ const bool hasExpiringWarning = m_qbsStderr.contains(QByteArray(
+ "deprecated-property.qbs:6:29 The property 'expiringProp' is "
+ "deprecated and will be removed in Qbs ") + version.toLocal8Bit());
+ QVERIFY2(expiringWarning == hasExpiringWarning, m_qbsStderr.constData());
+ const bool hasRemovedOutput = m_qbsStderr.contains(
+ "deprecated-property.qbs:7:28 The property 'veryOldProp' can no "
+ "longer be used. It was removed in Qbs 1.3.0.");
+ QVERIFY2(hasRemovedOutput == !expiringError, m_qbsStderr.constData());
QVERIFY2(m_qbsStderr.contains("Property 'forgottenProp' was scheduled for removal in version "
"1.8.0, but is still present."), m_qbsStderr.constData());
QVERIFY2(m_qbsStderr.contains("themodule/m.qbs:22:5 Removal version for 'forgottenProp' "
"specified here."), m_qbsStderr.constData());
- QVERIFY2(m_qbsStderr.count("Use newProp instead.") == 2, m_qbsStderr.constData());
- QVERIFY2(m_qbsStderr.count("is deprecated") == 1, m_qbsStderr.constData());
- QVERIFY2(m_qbsStderr.count("was removed") == 1, m_qbsStderr.constData());
+ QVERIFY2(m_qbsStderr.count("Use newProp instead.") == 1
+ + int(expiringWarning && !expiringError), m_qbsStderr.constData());
+ QVERIFY2(m_qbsStderr.count("is deprecated") == int(expiringWarning), m_qbsStderr.constData());
+ QVERIFY2(m_qbsStderr.count("was removed") == int(!expiringError), m_qbsStderr.constData());
+}
+
+void TestBlackbox::deprecatedProperty_data()
+{
+ QTest::addColumn<QString>("version");
+ QTest::addColumn<QString>("mode");
+ QTest::addColumn<bool>("expiringWarning");
+ QTest::addColumn<bool>("expiringError");
+
+ const auto current = QVersionNumber::fromString(QBS_VERSION);
+ const QString next = QVersionNumber(current.majorVersion(), current.minorVersion() + 1)
+ .toString();
+ const QString nextNext = QVersionNumber(current.majorVersion(), current.minorVersion() + 2)
+ .toString();
+ const QString nextMajor = QVersionNumber(current.majorVersion() + 1).toString();
+
+ QTest::newRow("default/next") << next << QString() << true << false;
+ QTest::newRow("default/nextnext") << nextNext << QString() << false << false;
+ QTest::newRow("default/nextmajor") << nextMajor << QString() << true << false;
+ QTest::newRow("error/next") << next << QString("error") << true << true;
+ QTest::newRow("error/nextnext") << nextNext << QString("error") << true << true;
+ QTest::newRow("error/nextmajor") << nextMajor << QString("error") << true << true;
+ QTest::newRow("on/next") << next << QString("on") << true << false;
+ QTest::newRow("on/nextnext") << nextNext << QString("on") << true << false;
+ QTest::newRow("on/nextmajor") << nextMajor << QString("on") << true << false;
+ QTest::newRow("before-removal/next") << next << QString("before-removal") << true << false;
+ QTest::newRow("before-removal/nextnext") << nextNext << QString("before-removal")
+ << false << false;
+ QTest::newRow("before-removal/nextmajor") << nextMajor << QString("before-removal")
+ << true << false;
+ QTest::newRow("off/next") << next << QString("off") << false << false;
+ QTest::newRow("off/nextnext") << nextNext << QString("off") << false << false;
+ QTest::newRow("off/nextmajor") << nextMajor << QString("off") << false << false;
}
void TestBlackbox::disappearedProfile()
@@ -6111,6 +6158,27 @@ void TestBlackbox::qbsConfigAddProfile_data()
<< QString("Profile properties must be key/value pairs");
}
+// checks that we can set qbs module properties in providers and provider cache works corectly
+void TestBlackbox::qbsModulePropertiesInProviders()
+{
+ QDir::setCurrent(testDataDir + "/qbs-module-properties-in-providers");
+
+ QbsRunParameters params("resolve");
+
+ QCOMPARE(runQbs(params), 0);
+
+ // We have 2 products in 2 configurations, but second product should use the cached value
+ // so we should have only 2 copies of the module, not 4.
+ QCOMPARE(m_qbsStdout.count("Running setup script for qbsmetatestmodule"), 2);
+
+ // Check that products get correct values from modules
+ QVERIFY2(m_qbsStdout.contains(("product1.qbsmetatestmodule.prop: sysroot1")), m_qbsStdout);
+ QVERIFY2(m_qbsStdout.contains(("product1.qbsmetatestmodule.prop: sysroot2")), m_qbsStdout);
+
+ QVERIFY2(m_qbsStdout.contains(("product2.qbsmetatestmodule.prop: sysroot1")), m_qbsStdout);
+ QVERIFY2(m_qbsStdout.contains(("product2.qbsmetatestmodule.prop: sysroot2")), m_qbsStdout);
+}
+
// Tests whether it is possible to set qbsModuleProviders in Product and Project items
// and that the order of providers results in correct priority
void TestBlackbox::qbsModuleProviders()
@@ -6226,9 +6294,9 @@ void TestBlackbox::qbsModuleProvidersCompatibility_data()
void TestBlackbox::qbspkgconfigModuleProvider()
{
QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider/libs");
+ rmDirR(relativeBuildDir());
const auto commonParams = QbsRunParameters(QStringLiteral("install"), {
- QStringLiteral("qbs.installPrefix:/usr/local"),
QStringLiteral("--install-root"),
QStringLiteral("install-root")
});
@@ -6237,11 +6305,12 @@ void TestBlackbox::qbspkgconfigModuleProvider()
QCOMPARE(runQbs(dynamicParams), 0);
QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider");
+ rmDirR(relativeBuildDir());
+
+ const auto sysroot = testDataDir + "/qbspkgconfig-module-provider/libs/install-root";
QbsRunParameters params;
- params.arguments
- << "moduleProviders.qbspkgconfig.libDirs:libdir"
- << "moduleProviders.qbspkgconfig.sysroot:" + QDir::currentPath() + "/libs/install-root";
+ params.arguments << "moduleProviders.qbspkgconfig.sysroot:" + sysroot;
QCOMPARE(runQbs(params), 0);
}
@@ -7916,14 +7985,18 @@ void TestBlackbox::maximumCLanguageVersion()
QDir::setCurrent(testDataDir + "/maximum-c-language-version");
QCOMPARE(runQbs(QbsRunParameters("resolve",
QStringList("products.app.enableNewestModule:true"))), 0);
- if (m_qbsStdout.contains("is msvc"))
- QSKIP("MSVC has no support for setting the C language version.");
+ const bool isMsvc = m_qbsStdout.contains("is msvc: true");
+ if (isMsvc && m_qbsStdout.contains("is old msvc: true"))
+ QSKIP("MSVC supports setting the C language version only from version 16.8, and Clang from version 13.");
QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line", "-n"})), 0);
QVERIFY2(m_qbsStdout.contains("c11") || m_qbsStdout.contains("c1x"), m_qbsStdout.constData());
QCOMPARE(runQbs(QbsRunParameters("resolve",
QStringList("products.app.enableNewestModule:false"))), 0);
QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line", "-n"})), 0);
- QVERIFY2(m_qbsStdout.contains("c99"), m_qbsStdout.constData());
+ if (isMsvc)
+ QVERIFY2(!m_qbsStdout.contains("c11"), m_qbsStdout.constData());
+ else
+ QVERIFY2(m_qbsStdout.contains("c99"), m_qbsStdout.constData());
}
void TestBlackbox::maximumCxxLanguageVersion()
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index ea3a8597d..285d465fd 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -95,6 +95,7 @@ private slots:
void dependenciesProperty();
void dependencyScanningLoop();
void deprecatedProperty();
+ void deprecatedProperty_data();
void disappearedProfile();
void discardUnusedData();
void discardUnusedData_data();
@@ -262,6 +263,7 @@ private slots:
void qbsConfig();
void qbsConfigAddProfile();
void qbsConfigAddProfile_data();
+ void qbsModulePropertiesInProviders();
void qbsModuleProviders();
void qbsModuleProviders_data();
void qbsModuleProvidersCliOverride();
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index 2744f907e..0a6a763ee 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -1023,6 +1023,7 @@ void TestBlackboxApple::infoPlist()
if (!content.contains(QStringLiteral("SDKROOT"))) { // macOS-specific values
QCOMPARE(content.value("LSMinimumSystemVersion"), QStringLiteral("10.7"));
QCOMPARE(content.value("NSPrincipalClass"), QStringLiteral("NSApplication"));
+ QCOMPARE(content.value(QStringLiteral("NSSupportsAutomaticGraphicsSwitching")), true);
} else {
// QBS-1447: UIDeviceFamily was set to a string instead of an array
const auto family = content.value(QStringLiteral("UIDeviceFamily"));
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
index 5de30b4e1..ec6ffcdc6 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
@@ -123,7 +123,6 @@ void TestBlackboxBareMetal::application()
if (m_qbsStdout.contains("targetPlatform differs from hostPlatform"))
QSKIP("Cannot run binaries in cross-compiled build");
QCOMPARE(runQbs(QbsRunParameters("run")), 0);
- QVERIFY2(m_qbsStdout.contains("Hello from app"), m_qbsStdout.constData());
}
void TestBlackboxBareMetal::staticLibraryDependencies()
diff --git a/tests/auto/pkgconfig/testdata/empty-variable.json b/tests/auto/pkgconfig/testdata/empty-variable.json
new file mode 100644
index 000000000..b96689979
--- /dev/null
+++ b/tests/auto/pkgconfig/testdata/empty-variable.json
@@ -0,0 +1,21 @@
+{
+ "Name": "Empty Variable test",
+ "Description": "Checks that empty variables are handled correcty",
+ "Version": "1.0.0",
+ "Vars": {
+ "rootprefix": "",
+ "prefix": "/usr",
+ "exec_prefix": "//usr",
+ "libdir": "//usr/lib",
+ "includedir": "//usr/include"
+ },
+ "Libs": [
+ {"Type": "LibraryName", "Value": "simple"}
+ ],
+ "LibsPrivate": [
+ {"Type": "LibraryName", "Value": "m"}
+ ],
+ "Cflags": [
+ {"Type": "IncludePath", "Value": "//usr/include"}
+ ]
+}
diff --git a/tests/auto/pkgconfig/testdata/empty-variable.pc b/tests/auto/pkgconfig/testdata/empty-variable.pc
new file mode 100644
index 000000000..581382b7e
--- /dev/null
+++ b/tests/auto/pkgconfig/testdata/empty-variable.pc
@@ -0,0 +1,13 @@
+rootprefix=
+prefix=/usr
+exec_prefix=${rootprefix}/${prefix}
+libdir=${exec_prefix}/lib
+includedir=${rootprefix}/${prefix}/include
+
+Name: Empty Variable test
+Description: Checks that empty variables are handled correcty
+Version: 1.0.0
+Requires:
+Libs: -lsimple
+Libs.private: -lm
+Cflags: -I${includedir}
diff --git a/tests/auto/pkgconfig/tst_pkgconfig.cpp b/tests/auto/pkgconfig/tst_pkgconfig.cpp
index ec62e1a7f..220e54e7a 100644
--- a/tests/auto/pkgconfig/tst_pkgconfig.cpp
+++ b/tests/auto/pkgconfig/tst_pkgconfig.cpp
@@ -168,6 +168,8 @@ void TestPkgConfig::pkgConfig_data()
QTest::addColumn<QString>("jsonFileName");
QTest::addColumn<QVariantMap>("optionsMap");
+ QTest::newRow("empty-variable")
+ << QStringLiteral("empty-variable") << QString() << QVariantMap();
QTest::newRow("non-l-required")
<< QStringLiteral("non-l-required") << QString() << QVariantMap();
QTest::newRow("simple")