diff --git a/.cirrus.yml b/.cirrus.yml index c233d5be1ca48..be073d9907906 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -27,26 +27,37 @@ base_template: &BASE_TEMPLATE - git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts # Also, the merge commit is used to lint COMMIT_RANGE="HEAD~..HEAD" +main_template: &MAIN_TEMPLATE + timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out + ccache_cache: + folder: "/tmp/ccache_dir" + ci_script: + - ./ci/test_run_all.sh + global_task_template: &GLOBAL_TASK_TEMPLATE << : *BASE_TEMPLATE - timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out container: # https://cirrus-ci.org/faq/#are-there-any-limits # Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel cpu: 2 greedy: true memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers - ccache_cache: - folder: "/tmp/ccache_dir" depends_built_cache: - folder: "/tmp/cirrus-ci-build/depends/built" + folder: "depends/built" + fingerprint_script: echo $CIRRUS_TASK_NAME $(git rev-list -1 HEAD ./depends) depends_sdk_cache: folder: "/tmp/cirrus-ci-build/depends/sdk-sources" depends_releases_cache: folder: "/tmp/cirrus-ci-build/releases" - ci_script: - - ./ci/test_run_all.sh + << : *MAIN_TEMPLATE +macos_native_task_template: &MACOS_NATIVE_TASK_TEMPLATE + << : *BASE_TEMPLATE + check_clang_script: + - clang --version + brew_install_script: + - brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt + << : *MAIN_TEMPLATE compute_credits_template: &CREDITS_TEMPLATE # https://cirrus-ci.org/pricing/#compute-credits # Only use credits for pull requests to the main repo @@ -169,15 +180,29 @@ task: FILE_ENV: "./ci/test/00_setup_env_mac.sh" task: - name: 'macOS 12 native [gui, system sqlite only] [no depends]' - brew_install_script: - - brew install boost libevent qt@5 miniupnpc ccache zeromq qrencode libtool automake gnu-getopt - << : *GLOBAL_TASK_TEMPLATE + name: 'macOS 12 native x86_64 [gui, system sqlite] [no depends]' macos_instance: # Use latest image, but hardcode version to avoid silent upgrades (and breaks) image: monterey-xcode-13.3 # https://cirrus-ci.org/guide/macOS + << : *MACOS_NATIVE_TASK_TEMPLATE env: DANGER_RUN_CI_ON_HOST: "true" CI_USE_APT_INSTALL: "no" PACKAGE_MANAGER_INSTALL: "echo" # Nothing to do - FILE_ENV: "./ci/test/00_setup_env_mac_host.sh" + FILE_ENV: "./ci/test/00_setup_env_mac_native_x86_64.sh" + +task: + name: 'ARM64 Android APK [focal]' + << : *BASE_TEMPLATE + android_sdk_cache: + folder: "depends/SDKs/android" + fingerprint_key: "ANDROID_API_LEVEL=28 ANDROID_BUILD_TOOLS_VERSION=28.0.3 ANDROID_NDK_VERSION=23.2.8568313" + depends_sources_cache: + folder: "depends/sources" + fingerprint_script: git rev-list -1 HEAD ./depends + << : *MAIN_TEMPLATE + container: + image: ubuntu:focal + env: + << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV + FILE_ENV: "./ci/test/00_setup_env_android.sh" diff --git a/ci/dash/lint-tidy.sh b/ci/dash/lint-tidy.sh index 50b7cc11464f0..7786a58f7ef91 100755 --- a/ci/dash/lint-tidy.sh +++ b/ci/dash/lint-tidy.sh @@ -20,6 +20,18 @@ iwyu_tool.py \ "src/init" \ "src/rpc/fees.cpp" \ "src/rpc/signmessage.cpp" \ + "src/util/bip32.cpp" \ + "src/util/bytevectorhash.cpp" \ + "src/util/error.cpp" \ + "src/util/getuniquepath.cpp" \ + "src/util/hasher.cpp" \ + "src/util/message.cpp" \ + "src/util/moneystr.cpp" \ + "src/util/serfloat.cpp" \ + "src/util/spanparsing.cpp" \ + "src/util/strencodings.cpp" \ + "src/util/syserror.cpp" \ + "src/util/url.cpp" \ -p . "${MAKEJOBS}" \ -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \ 2>&1 | tee "/tmp/iwyu_ci.out" diff --git a/ci/test/00_setup_env_mac_host.sh b/ci/test/00_setup_env_mac_native_x86_64.sh similarity index 100% rename from ci/test/00_setup_env_mac_host.sh rename to ci/test/00_setup_env_mac_native_x86_64.sh diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 0ece5876c83ec..8c1ca8c2e3797 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -98,7 +98,11 @@ static void RegisterMetaTypes() qRegisterMetaType("QMessageBox::Icon"); qRegisterMetaType("interfaces::BlockAndHeaderTipInfo"); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qRegisterMetaTypeStreamOperators("BitcoinUnit"); +#else + qRegisterMetaType("BitcoinUnit"); +#endif } static QString GetLangTerritory() @@ -137,21 +141,30 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans // - First load the translator for the base language, without territory // - Then load the more specific locale translator +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) + const QString translation_path{QLibraryInfo::location(QLibraryInfo::TranslationsPath)}; +#else + const QString translation_path{QLibraryInfo::path(QLibraryInfo::TranslationsPath)}; +#endif // Load e.g. qt_de.qm - if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + if (qtTranslatorBase.load("qt_" + lang, translation_path)) { QApplication::installTranslator(&qtTranslatorBase); + } // Load e.g. qt_de_DE.qm - if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + if (qtTranslator.load("qt_" + lang_territory, translation_path)) { QApplication::installTranslator(&qtTranslator); + } // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in dash.qrc) - if (translatorBase.load(lang, ":/translations/")) + if (translatorBase.load(lang, ":/translations/")) { QApplication::installTranslator(&translatorBase); + } // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in dash.qrc) - if (translator.load(lang_territory, ":/translations/")) + if (translator.load(lang_territory, ":/translations/")) { QApplication::installTranslator(&translator); + } } static bool InitSettings() @@ -513,9 +526,11 @@ int GuiMain(int argc, char* argv[]) Q_INIT_RESOURCE(dash); Q_INIT_RESOURCE(dash_locale); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) // Generate high-dpi pixmaps QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif BitcoinApplication app; GUIUtil::LoadFont(QStringLiteral(":/fonts/monospace")); diff --git a/src/univalue/include/univalue.h b/src/univalue/include/univalue.h index fc5cf402be3ce..0742f9fcb1575 100644 --- a/src/univalue/include/univalue.h +++ b/src/univalue/include/univalue.h @@ -111,6 +111,8 @@ class UniValue { return push_back(tmpVal); } bool push_backV(const std::vector& vec); + template + bool push_backV(It first, It last); void __pushKV(const std::string& key, const UniValue& val); bool pushKV(const std::string& key, const UniValue& val); @@ -180,6 +182,14 @@ class UniValue { friend const UniValue& find_value( const UniValue& obj, const std::string& name); }; +template +bool UniValue::push_backV(It first, It last) +{ + if (typ != VARR) return false; + values.insert(values.end(), first, last); + return true; +} + enum jtokentype { JTOK_ERR = -1, JTOK_NONE = 0, // eof diff --git a/src/util/asmap.cpp b/src/util/asmap.cpp index a881a7f3a4f23..8a4f5c4d7bbdc 100644 --- a/src/util/asmap.cpp +++ b/src/util/asmap.cpp @@ -7,11 +7,14 @@ #include #include #include +#include #include +#include #include #include -#include +#include +#include #include namespace { diff --git a/src/util/bip32.cpp b/src/util/bip32.cpp index d2b9aaef1d3ce..c8864d9bedd7a 100644 --- a/src/util/bip32.cpp +++ b/src/util/bip32.cpp @@ -2,12 +2,14 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include #include #include #include +#include +#include #include +#include bool ParseHDKeypath(const std::string& keypath_str, std::vector& keypath) { diff --git a/src/util/bip32.h b/src/util/bip32.h index b1d53616a4f24..0872bc88de6f8 100644 --- a/src/util/bip32.h +++ b/src/util/bip32.h @@ -5,7 +5,6 @@ #ifndef BITCOIN_UTIL_BIP32_H #define BITCOIN_UTIL_BIP32_H -#include #include #include #include diff --git a/src/util/bytevectorhash.cpp b/src/util/bytevectorhash.cpp index bc060a44c95fe..5c2458a162140 100644 --- a/src/util/bytevectorhash.cpp +++ b/src/util/bytevectorhash.cpp @@ -6,6 +6,8 @@ #include #include +#include + ByteVectorHash::ByteVectorHash() { GetRandBytes({reinterpret_cast(&m_k0), sizeof(m_k0)}); diff --git a/src/util/bytevectorhash.h b/src/util/bytevectorhash.h index b88c17460b494..c2322b8daff5b 100644 --- a/src/util/bytevectorhash.h +++ b/src/util/bytevectorhash.h @@ -5,7 +5,8 @@ #ifndef BITCOIN_UTIL_BYTEVECTORHASH_H #define BITCOIN_UTIL_BYTEVECTORHASH_H -#include +#include +#include #include /** diff --git a/src/util/error.cpp b/src/util/error.cpp index c571e19bfefd9..5dc2a89b30d18 100644 --- a/src/util/error.cpp +++ b/src/util/error.cpp @@ -5,9 +5,11 @@ #include #include -#include #include +#include +#include + bilingual_str TransactionErrorString(const TransactionError err) { switch (err) { diff --git a/src/util/hasher.cpp b/src/util/hasher.cpp index 8e833214a9a1c..585f9a7f6efba 100644 --- a/src/util/hasher.cpp +++ b/src/util/hasher.cpp @@ -2,7 +2,9 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include #include +#include #include #include diff --git a/src/util/hasher.h b/src/util/hasher.h index 533316b9cf1db..182a0365926d1 100644 --- a/src/util/hasher.h +++ b/src/util/hasher.h @@ -5,10 +5,16 @@ #ifndef BITCOIN_UTIL_HASHER_H #define BITCOIN_UTIL_HASHER_H +#include #include #include #include +#include +#include + +template class Span; + class SaltedTxidHasher { private: diff --git a/src/util/message.cpp b/src/util/message.cpp index 7b1388b88ccfa..81510735ed468 100644 --- a/src/util/message.cpp +++ b/src/util/message.cpp @@ -3,16 +3,20 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include // For CHashWriter -#include // For CKey -#include // For DecodeDestination() -#include // For CPubKey -#include