From 87e4fad96cb38ff04a3bf5198684e99aa5454e84 Mon Sep 17 00:00:00 2001 From: Turky Mohammed <45469625+DelinWorks@users.noreply.github.com> Date: Sun, 12 Jun 2022 17:26:54 +0300 Subject: [PATCH] Merge: a2bea19e1e 3ac444efa6 Merge branch 'adxeproject:dev' into partical-system-animation --- .github/workflows/genbindings-ci.yml | 5 +- README.md | 4 +- README_CN.md | 4 +- cmake/Modules/CocosConfigDepend.cmake | 8 +- core/2d/CCFontAtlas.cpp | 117 +--------- core/2d/CCFontAtlas.h | 8 +- core/2d/CCFontAtlasCache.cpp | 9 +- core/2d/CCFontFreeType.cpp | 116 ++++----- core/2d/CCFontFreeType.h | 11 +- core/base/CCConsole.cpp | 2 +- core/base/CCValue.cpp | 2 +- core/base/ccUtils.cpp | 2 +- core/network/CCDownloader-curl.cpp | 5 +- core/platform/CCFileUtils.cpp | 221 +++--------------- core/platform/CCFileUtils.h | 61 ----- core/platform/android/CCFileUtils-android.cpp | 53 ----- core/platform/android/CCFileUtils-android.h | 2 - .../org/cocos2dx/lib/Cocos2dxActivity.java | 19 +- .../android/libcocos2dx/adxetools.gradle | 4 +- core/ui/UITextFieldEx.cpp | 5 +- .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 153 ------------ .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 3 - .../proj.android/app/build.gradle | 2 +- .../proj.android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../runtime-src/proj.android/app/build.gradle | 2 +- .../runtime-src/proj.android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 49 ---- .../Classes/FileUtilsTest/FileUtilsTest.h | 10 - tests/cpp-tests/Classes/FontTest/FontTest.cpp | 40 ---- tests/cpp-tests/Classes/FontTest/FontTest.h | 12 - tests/cpp-tests/proj.android/app/build.gradle | 2 +- tests/cpp-tests/proj.android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../proj.android/app/build.gradle | 2 +- .../fairygui-tests/proj.android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../project/proj.android/app/build.gradle | 2 +- .../project/proj.android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- tools/unix-ci/setup_android.py | 6 +- 42 files changed, 155 insertions(+), 806 deletions(-) diff --git a/.github/workflows/genbindings-ci.yml b/.github/workflows/genbindings-ci.yml index 1d15539a33..8880d84a47 100644 --- a/.github/workflows/genbindings-ci.yml +++ b/.github/workflows/genbindings-ci.yml @@ -4,7 +4,6 @@ on: push: branches: - dev - - main paths: - core/**/* - extensions/**/* @@ -31,10 +30,10 @@ jobs: run: tools\win-ci\genbindings.ps1 - name: Commit genbindings changes - uses: EndBug/add-and-commit@v7.5.0 + uses: EndBug/add-and-commit@v9.0.0 with: committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com - message: 'Committing genbindings changes [skip ci]' + message: 'Committing genbindings changes' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index c4577449e4..beec48417b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # adxe -[![dev](https://img.shields.io/badge/v1.0.0-beta6-yellow.svg)](https://github.com/adxeproject/adxe/releases) +[![dev](https://img.shields.io/github/v/release/adxeproject/adxe?include_prereleases&label=release)](https://github.com/adxeproject/adxe/releases) [![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/adxeproject/adxe/blob/master/LICENSE) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1c5628dea478449ea0c6e1b0e30c3be9)](https://app.codacy.com/gh/adxeproject/adxe?utm_source=github.com&utm_medium=referral&utm_content=adxeproject/adxe&utm_campaign=Badge_Grade_Settings) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/adxeproject/adxe/pulls) @@ -99,7 +99,7 @@ Open [APPENDIX.md](APPENDIX.md) for additional information and see [Milestones]( 4. Start Android Studio and Open [Tools][SDKManager], then switch to ```SDK Tools```, check the ```Show Package Details```, choose the following tools and click the button ```Apply``` to install them: * Android SDK Platform 29 r5 * Android SDK Build-Tools 29.0.2 - * NDK r19c+ + * NDK r23c+ * CMake 3.10+ 5. Wait for ```Gradle sync``` finish. 6. Note: If you use non-sdk provided CMake edition, you will need to download ```ninja``` from https://github.com/ninja-build/ninja/releases, and copy ```ninja.exe``` to cmake's bin directory diff --git a/README_CN.md b/README_CN.md index 5dda931525..99027375ec 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,6 +1,6 @@ # adxe -[![dev](https://img.shields.io/badge/v1.0.0-beta6-yellow.svg)](https://github.com/adxeproject/adxe/releases) +[![dev](https://img.shields.io/github/v/release/adxeproject/adxe?include_prereleases&label=release)](https://github.com/adxeproject/adxe/releases) [![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/adxeproject/adxe/blob/master/LICENSE) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1c5628dea478449ea0c6e1b0e30c3be9)](https://app.codacy.com/gh/adxeproject/adxe?utm_source=github.com&utm_medium=referral&utm_content=adxeproject/adxe&utm_campaign=Badge_Grade_Settings) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/adxeproject/adxe/pulls) @@ -73,7 +73,7 @@ 3. 通过 [Tools][SdkManagers] 打开sdk管理工具,选择如下SDK Platforms和SDK Tools后, 点击按钮 ```Apply``` 一路跟着引导安装即可: * Android SDK Platform 29 r5 (在SDK Platforms页签) * Android SDK Build-Tools 29.0.2 - * NDK r19c+ + * NDK r23c+ * CMake 3.10+ 5. 等待Gradle sync完成后,Build APKs,安装运行 diff --git a/cmake/Modules/CocosConfigDepend.cmake b/cmake/Modules/CocosConfigDepend.cmake index ed5a528c01..118097e198 100644 --- a/cmake/Modules/CocosConfigDepend.cmake +++ b/cmake/Modules/CocosConfigDepend.cmake @@ -55,7 +55,7 @@ macro(cocos2dx_depend) find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices) find_library(IOKIT_LIBRARY IOKit) find_library(APPKIT_LIBRARY AppKit) - find_library(ICONV_LIBRARY iconv) + #find_library(ICONV_LIBRARY iconv) find_library(AUDIOUNIT_LIBRARY AudioUnit) find_library(COREAUDIO_LIBRARY CoreAudio) find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration) @@ -66,7 +66,7 @@ macro(cocos2dx_depend) ${IOKIT_LIBRARY} ${COCOS_APPLE_LIBS} ${APPKIT_LIBRARY} - ${ICONV_LIBRARY} + #${ICONV_LIBRARY} ${AUDIOUNIT_LIBRARY} ${COREAUDIO_LIBRARY} ${SYSTEMCONFIGURATION_LIBRARY} @@ -84,7 +84,7 @@ macro(cocos2dx_depend) find_library(AV_FOUNDATION_LIBRARY AVFoundation) find_library(WEBKIT_LIBRARY WebKit) find_library(ZLIB z) - find_library(ICONVLIB iconv) + #find_library(ICONVLIB iconv) list(APPEND PLATFORM_SPECIFIC_LIBS ${UIKIT_LIBRARY} ${OPENGLES_LIBRARY} @@ -98,7 +98,7 @@ macro(cocos2dx_depend) ${WEBKIT_LIBRARY} ${COCOS_APPLE_LIBS} ${ZLIB} - ${ICONVLIB} + #${ICONVLIB} ) endif() endif() diff --git a/core/2d/CCFontAtlas.cpp b/core/2d/CCFontAtlas.cpp index 5bf375f501..f3e38c2d19 100644 --- a/core/2d/CCFontAtlas.cpp +++ b/core/2d/CCFontAtlas.cpp @@ -2,7 +2,7 @@ Copyright (c) 2013 Zynga Inc. Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - Copyright (c) 2021 Bytedance Inc. + Copyright (c) 2021-2022 Bytedance Inc. https://adxeproject.github.io/ @@ -27,7 +27,6 @@ #include "2d/CCFontAtlas.h" #if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID -# include #elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID # include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h" #endif @@ -125,14 +124,6 @@ FontAtlas::~FontAtlas() releaseTextures(); delete[] _currentPageData; - -#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID - if (_iconv) - { - iconv_close(_iconv); - _iconv = nullptr; - } -#endif } void FontAtlas::initTextureWithZeros(Texture2D* texture) @@ -229,80 +220,9 @@ bool FontAtlas::getLetterDefinitionForChar(char32_t utf32Char, FontLetterDefinit } } -void FontAtlas::conversionU32TOGB2312(const std::u32string& u32Text, - std::unordered_map& charCodeMap) -{ - size_t strLen = u32Text.length(); - auto gb2312StrSize = strLen * 2; - auto gb2312Text = new char[gb2312StrSize]; - memset(gb2312Text, 0, gb2312StrSize); - - switch (_fontFreeType->getEncoding()) - { - case FT_ENCODING_GB2312: - { -#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 - std::u16string u16Text; - cocos2d::StringUtils::UTF32ToUTF16(u32Text, u16Text); - WideCharToMultiByte(936, NULL, (LPCWCH)u16Text.c_str(), strLen, (LPSTR)gb2312Text, gb2312StrSize, NULL, NULL); -#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID - conversionEncodingJNI((char*)u32Text.c_str(), gb2312StrSize, "UTF-32LE", gb2312Text, "GB2312"); -#else - if (_iconv == nullptr) - { - _iconv = iconv_open("GBK//TRANSLIT", "UTF-32LE"); - } - - if (_iconv == (iconv_t)-1) - { - CCLOG("conversion from utf32 to gb2312 not available"); - } - else - { - char* pin = (char*)u32Text.c_str(); - char* pout = gb2312Text; - size_t inLen = strLen * 2; - size_t outLen = gb2312StrSize; - - iconv(_iconv, (char**)&pin, &inLen, &pout, &outLen); - } -#endif - } - break; - default: - CCLOG("Unsupported encoding:%d", _fontFreeType->getEncoding()); - break; - } - - unsigned short gb2312Code = 0; - unsigned char* dst = (unsigned char*)&gb2312Code; - char32_t u32Code; - for (size_t index = 0, gbIndex = 0; index < strLen; ++index) - { - u32Code = u32Text[index]; - if (u32Code < 256) - { - charCodeMap[u32Code] = u32Code; - gbIndex += 1; - } - else - { - dst[0] = gb2312Text[gbIndex + 1]; - dst[1] = gb2312Text[gbIndex]; - charCodeMap[u32Code] = gb2312Code; - - gbIndex += 2; - } - } - - delete[] gb2312Text; -} - -void FontAtlas::findNewCharacters(const std::u32string& u32Text, - std::unordered_map& charCodeMap) +void FontAtlas::findNewCharacters(const std::u32string& u32Text, std::unordered_set& charset) { std::u32string newChars; - FT_Encoding charEncoding = _fontFreeType->getEncoding(); // find new characters if (_letterDefinitions.empty()) @@ -338,25 +258,8 @@ void FontAtlas::findNewCharacters(const std::u32string& u32Text, if (!newChars.empty()) { - switch (charEncoding) - { - case FT_ENCODING_UNICODE: - { - for (auto u32Code : newChars) - { - charCodeMap[u32Code] = u32Code; - } - break; - } - case FT_ENCODING_GB2312: - { - conversionU32TOGB2312(newChars, charCodeMap); - break; - } - default: - CCLOG("FontAtlas::findNewCharacters: Unsupported encoding:%d", charEncoding); - break; - } + for (auto u32Code : newChars) + charset.insert(u32Code); } } @@ -370,9 +273,9 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) if (!_currentPageData) reinit(); - std::unordered_map codeMapOfNewChar; - findNewCharacters(utf32Text, codeMapOfNewChar); - if (codeMapOfNewChar.empty()) + std::unordered_set charCodeSet; + findNewCharacters(utf32Text, charCodeSet); + if (charCodeSet.empty()) { return false; } @@ -390,9 +293,9 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) int startY = (int)_currentPageOrigY; - for (auto&& it : codeMapOfNewChar) + for (auto charCode : charCodeSet) { - auto bitmap = _fontFreeType->getGlyphBitmap(it.second, bitmapWidth, bitmapHeight, tempRect, tempDef.xAdvance); + auto bitmap = _fontFreeType->getGlyphBitmap(charCode, bitmapWidth, bitmapHeight, tempRect, tempDef.xAdvance); if (bitmap && bitmapWidth > 0 && bitmapHeight > 0) { tempDef.validDefinition = true; @@ -471,7 +374,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) _currentPageOrigX += 1; } - _letterDefinitions[it.first] = tempDef; + _letterDefinitions[charCode] = tempDef; } updateTextureContent(pixelFormat, startY); diff --git a/core/2d/CCFontAtlas.h b/core/2d/CCFontAtlas.h index 946466601b..e96ce3be36 100644 --- a/core/2d/CCFontAtlas.h +++ b/core/2d/CCFontAtlas.h @@ -2,7 +2,7 @@ Copyright (c) 2013 Zynga Inc. Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - Copyright (c) 2021 Bytedance Inc. + Copyright (c) 2021-2022 Bytedance Inc. https://adxeproject.github.io/ @@ -120,10 +120,7 @@ protected: void releaseTextures(); - void findNewCharacters(const std::u32string& u32Text, std::unordered_map& charCodeMap); - - void conversionU32TOGB2312(const std::u32string& u32Text, - std::unordered_map& charCodeMap); + void findNewCharacters(const std::u32string& u32Text, std::unordered_set& charCodeSet); void initTextureWithZeros(Texture2D* texture); @@ -141,7 +138,6 @@ protected: float _lineHeight = 0.f; Font* _font = nullptr; FontFreeType* _fontFreeType = nullptr; - void* _iconv = nullptr; // Dynamic GlyphCollection related stuff int _currentPage = 0; diff --git a/core/2d/CCFontAtlasCache.cpp b/core/2d/CCFontAtlasCache.cpp index 0570b563b2..afc7bf56d5 100644 --- a/core/2d/CCFontAtlasCache.cpp +++ b/core/2d/CCFontAtlasCache.cpp @@ -54,8 +54,7 @@ void FontAtlasCache::purgeCachedData() FontAtlas* FontAtlasCache::getFontAtlasTTF(const _ttfConfig* config) { - auto realFontFilename = FileUtils::getInstance()->getNewFilename( - config->fontFilePath); // resolves real file path, to prevent storing multiple atlases for the same file. + auto realFontFilename = config->fontFilePath; // resolves real file path, to prevent storing multiple atlases for the same file. bool useDistanceField = config->distanceFieldEnabled; if (config->outlineSize > 0) { @@ -97,8 +96,7 @@ FontAtlas* FontAtlasCache::getFontAtlasFNT(std::string_view fontFileName) FontAtlas* FontAtlasCache::getFontAtlasFNT(std::string_view fontFileName, std::string_view subTextureKey) { - const auto realFontFilename = FileUtils::getInstance()->getNewFilename( - fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. + const auto realFontFilename = fontFileName; // resolves real file path, to prevent storing multiple atlases for the same file. std::string atlasName{subTextureKey}; atlasName.append(" ", 1).append(realFontFilename); @@ -125,8 +123,7 @@ FontAtlas* FontAtlasCache::getFontAtlasFNT(std::string_view fontFileName, std::s FontAtlas* FontAtlasCache::getFontAtlasFNT(std::string_view fontFileName, const Rect& imageRect, bool imageRotated) { - const auto realFontFilename = FileUtils::getInstance()->getNewFilename( - fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. + const auto realFontFilename = fontFileName; // resolves real file path, to prevent storing multiple atlases for the same file. char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageRect.origin.x, imageRect.origin.y); std::string atlasName(keyPrefix); diff --git a/core/2d/CCFontFreeType.cpp b/core/2d/CCFontFreeType.cpp index aaf3e085ac..6a2713ee58 100644 --- a/core/2d/CCFontFreeType.cpp +++ b/core/2d/CCFontFreeType.cpp @@ -2,7 +2,7 @@ Copyright (c) 2013 Zynga Inc. Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -Copyright (c) 2021 Bytedance Inc. +Copyright (c) 2021-2022 Bytedance Inc. https://adxeproject.github.io/ @@ -59,7 +59,7 @@ typedef struct _DataRef unsigned int referenceCount = 0; } DataRef; -static std::unordered_map s_cacheFontData; +static hlookup::string_map s_cacheFontData; // ------ freetype2 stream parsing support --- static unsigned long ft_stream_read_callback(FT_Stream stream, @@ -149,7 +149,6 @@ FT_Library FontFreeType::getFTLibrary() FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */, float outline /* = 0 */) : _fontFace(nullptr) , _stroker(nullptr) -, _encoding(FT_ENCODING_UNICODE) , _distanceFieldEnabled(distanceFieldEnabled) , _outlineSize(0.0f) , _ascender(0) @@ -170,16 +169,12 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */, float outlin } // clang-format on -bool FontFreeType::loadFontFace(std::string_view fontName, float fontSize) +bool FontFreeType::loadFontFace(std::string_view fontPath, float fontSize) { FT_Face face; - // save font name locally - _fontName = fontName; - _fontSize = fontSize; - if (_streamParsingEnabled) { - auto fullPath = FileUtils::getInstance()->fullPathForFilename(_fontName); + auto fullPath = FileUtils::getInstance()->fullPathForFilename(fontPath); if (fullPath.empty()) return false; @@ -207,15 +202,15 @@ bool FontFreeType::loadFontFace(std::string_view fontName, float fontSize) else { DataRef* sharableData; - auto it = s_cacheFontData.find(_fontName); + auto it = s_cacheFontData.find(fontPath); if (it != s_cacheFontData.end()) { sharableData = &it->second; } else { - sharableData = &s_cacheFontData[_fontName]; - sharableData->data = FileUtils::getInstance()->getDataFromFile(_fontName); + sharableData = &s_cacheFontData[fontPath]; + sharableData->data = FileUtils::getInstance()->getDataFromFile(fontPath); } ++sharableData->referenceCount; @@ -225,66 +220,55 @@ bool FontFreeType::loadFontFace(std::string_view fontName, float fontSize) return false; } - if (FT_Select_Charmap(face, FT_ENCODING_UNICODE)) + do { - int foundIndex = -1; - for (int charmapIndex = 0; charmapIndex < face->num_charmaps; charmapIndex++) + if (!face->charmap || face->charmap->encoding != FT_ENCODING_UNICODE) + break; + + // set the requested font size + int dpi = 72; + int fontSizePoints = (int)(64.f * fontSize * CC_CONTENT_SCALE_FACTOR()); + if (FT_Set_Char_Size(face, fontSizePoints, fontSizePoints, dpi, dpi)) + break; + + // store the face globally + _fontFace = face; + _fontSize = fontSize; + _fontName = fontPath; + + // Notes: + // a. Since freetype 2.8.1 the TT matrics isn't sync to size_matrics, see the function 'tt_size_request' in + // truetype/ttdriver.c b. The TT spec always asks for ROUND, not FLOOR or CEIL, see also the function + // 'tt_size_reset' in truetype/ttobjs.c + // ** Please see description of FT_Size_Metrics_ in freetype.h about this solution + // FT_PIX_ROUND is copy from freetype/internal/ftobjs.h + auto& size_metrics = _fontFace->size->metrics; + if (_doNativeBytecodeHinting && !strcmp(FT_Get_Font_Format(face), "TrueType")) { - if (face->charmaps[charmapIndex]->encoding != FT_ENCODING_NONE) - { - foundIndex = charmapIndex; - break; - } - } - - if (foundIndex == -1) - { - return false; - } - - _encoding = face->charmaps[foundIndex]->encoding; - if (FT_Select_Charmap(face, _encoding)) - { - return false; - } - } - - // set the requested font size - int dpi = 72; - int fontSizePoints = (int)(64.f * fontSize * CC_CONTENT_SCALE_FACTOR()); - if (FT_Set_Char_Size(face, fontSizePoints, fontSizePoints, dpi, dpi)) - return false; - - // store the face globally - _fontFace = face; - - // Notes: - // a. Since freetype 2.8.1 the TT matrics isn't sync to size_matrics, see the function 'tt_size_request' in - // truetype/ttdriver.c b. The TT spec always asks for ROUND, not FLOOR or CEIL, see also the function - // 'tt_size_reset' in truetype/ttobjs.c - // ** Please see description of FT_Size_Metrics_ in freetype.h about this solution - // FT_PIX_ROUND is copy from freetype/internal/ftobjs.h - auto& size_metrics = _fontFace->size->metrics; - if (_doNativeBytecodeHinting && !strcmp(FT_Get_Font_Format(face), "TrueType")) - { #if !defined(FT_PIX_ROUND) # define FT_TYPEOF(type) # define FT_PIX_FLOOR(x) ((x) & ~FT_TYPEOF(x) 63) # define FT_PIX_ROUND(x) FT_PIX_FLOOR((x) + 32) #endif - _ascender = FT_PIX_ROUND(FT_MulFix(face->ascender, size_metrics.y_scale)); - _descender = FT_PIX_ROUND(FT_MulFix(face->descender, size_metrics.y_scale)); - } - else - { - _ascender = size_metrics.ascender; - _descender = size_metrics.descender; - } + _ascender = FT_PIX_ROUND(FT_MulFix(face->ascender, size_metrics.y_scale)); + _descender = FT_PIX_ROUND(FT_MulFix(face->descender, size_metrics.y_scale)); + } + else + { + _ascender = size_metrics.ascender; + _descender = size_metrics.descender; + } - _lineHeight = (_ascender - _descender) >> 6; + _lineHeight = (_ascender - _descender) >> 6; - // done and good - return true; + // done and good + return true; + } while (false); + + FT_Done_Face(face); + + cocos2d::log("Init font '%s' failed, only unicode ttf/ttc was supported.", fontPath.data()); + return false; } FontFreeType::~FontFreeType() @@ -386,7 +370,7 @@ const char* FontFreeType::getFontFamily() const return _fontFace->family_name; } -unsigned char* FontFreeType::getGlyphBitmap(uint32_t theChar, +unsigned char* FontFreeType::getGlyphBitmap(char32_t charCode, int32_t& outWidth, int32_t& outHeight, Rect& outRect, @@ -400,11 +384,11 @@ unsigned char* FontFreeType::getGlyphBitmap(uint32_t theChar, break; // @remark: glyphIndex=0 means charactor is mssing on current font face - auto glyphIndex = FT_Get_Char_Index(_fontFace, static_cast(theChar)); + auto glyphIndex = FT_Get_Char_Index(_fontFace, static_cast(charCode)); #if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0 if (glyphIndex == 0) { - char32_t ntcs[2] = {theChar, (char32_t)0}; + char32_t ntcs[2] = {charCode, (char32_t)0}; std::u32string_view charUTF32(ntcs, 1); std::string charUTF8; cocos2d::StringUtils::UTF32ToUTF8(charUTF32, charUTF8); diff --git a/core/2d/CCFontFreeType.h b/core/2d/CCFontFreeType.h index 97a06a226f..ca7165cfef 100644 --- a/core/2d/CCFontFreeType.h +++ b/core/2d/CCFontFreeType.h @@ -2,7 +2,7 @@ Copyright (c) 2013 Zynga Inc. Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - Copyright (c) 2021 Bytedance Inc. + Copyright (c) 2021-2022 Bytedance Inc. https://adxeproject.github.io/ @@ -45,7 +45,7 @@ class CC_DLL FontFreeType : public Font public: static const int DistanceMapSpread; - static FontFreeType* create(std::string_view fontName, + static FontFreeType* create(std::string_view fontPath, float fontSize, GlyphCollection glyphs, std::string_view customGlyphs, @@ -89,11 +89,9 @@ public: int32_t bitmapWidth, int32_t bitmapHeight); - FT_Encoding getEncoding() const { return _encoding; } - int* getHorizontalKerningForTextUTF32(const std::u32string& text, int& outNumLetters) const override; - unsigned char* getGlyphBitmap(uint32_t theChar, + unsigned char* getGlyphBitmap(char32_t charCode, int32_t& outWidth, int32_t& outHeight, Rect& outRect, @@ -119,7 +117,7 @@ private: FontFreeType(bool distanceFieldEnabled = false, float outline = 0); virtual ~FontFreeType(); - bool loadFontFace(std::string_view fontName, float fontSize); + bool loadFontFace(std::string_view fontPath, float fontSize); static bool initFreeType(); @@ -132,7 +130,6 @@ private: FT_Face _fontFace; std::unique_ptr _fontStream; FT_Stroker _stroker; - FT_Encoding _encoding; std::string _fontName; float _fontSize; diff --git a/core/base/CCConsole.cpp b/core/base/CCConsole.cpp index b1d37376f1..59cc44ebb6 100644 --- a/core/base/CCConsole.cpp +++ b/core/base/CCConsole.cpp @@ -131,7 +131,7 @@ void log(const char* format, ...) va_end(args); #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf.c_str()); + __android_log_print(ANDROID_LOG_DEBUG, "adxe debug info", "%s", buf.c_str()); #elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 buf.push_back('\n'); diff --git a/core/base/CCValue.cpp b/core/base/CCValue.cpp index f0085ef1f5..60bb783dfe 100644 --- a/core/base/CCValue.cpp +++ b/core/base/CCValue.cpp @@ -210,7 +210,7 @@ Value& Value::operator=(Value&& other) switch (other.getTypeFamily()) { case Type::INTEGER: - _field.uintVal = other._field.uintVal; + _field.uint64Val = other._field.uint64Val; break; case Type::FLOAT: _field.floatVal = other._field.floatVal; diff --git a/core/base/ccUtils.cpp b/core/base/ccUtils.cpp index 13775e198d..9d43f9ee6b 100644 --- a/core/base/ccUtils.cpp +++ b/core/base/ccUtils.cpp @@ -405,7 +405,7 @@ std::string getDataMD5Hash(const Data& data) return computeDigest(std::string_view{(const char*)data.getBytes(), (size_t)data.getSize()}, "md5"sv); } -CC_DLL std::string computeDigest(std::string_view data, std::string_view algorithm) +std::string computeDigest(std::string_view data, std::string_view algorithm) { const EVP_MD* md = nullptr; unsigned char mdValue[EVP_MAX_MD_SIZE] = {0}; diff --git a/core/network/CCDownloader-curl.cpp b/core/network/CCDownloader-curl.cpp index 01f3070606..46f699ef9c 100644 --- a/core/network/CCDownloader-curl.cpp +++ b/core/network/CCDownloader-curl.cpp @@ -1,7 +1,7 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - Copyright (c) 2021 Bytedance Inc. + Copyright (c) 2021-2022 Bytedance Inc. https://adxeproject.github.io/ @@ -206,7 +206,8 @@ public: _cancelled = true; if (this->_sockfd != -1) { - ::shutdown(this->_sockfd, SD_BOTH); // may cause curl CURLE_SEND_ERROR(55) or CURLE_RECV_ERROR(56) + if(::shutdown(this->_sockfd, SD_BOTH) == -1) // may cause curl CURLE_SEND_ERROR(55) or CURLE_RECV_ERROR(56) + ::closesocket(this->_sockfd); this->_sockfd = -1; } } diff --git a/core/platform/CCFileUtils.cpp b/core/platform/CCFileUtils.cpp index 1bc2f5ff96..9b0c3a0aad 100644 --- a/core/platform/CCFileUtils.cpp +++ b/core/platform/CCFileUtils.cpp @@ -35,7 +35,6 @@ THE SOFTWARE. #include "base/ccMacros.h" #include "base/CCDirector.h" #include "platform/CCSAXParser.h" -//#include "base/ccUtils.h" #include "platform/CCPosixFileStream.h" #ifdef MINIZIP_FROM_SYSTEM @@ -50,19 +49,19 @@ THE SOFTWARE. # include "yasio/cxx17/string_view.hpp" #endif -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS -# include "tinydir/tinydir.h" -#endif - #include "pugixml/pugixml.hpp" #define DECLARE_GUARD (void)0 #if CC_TARGET_PLATFORM != CC_PLATFORM_IOS && \ (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID || (defined(__NDK_MAJOR__) && __NDK_MAJOR__ >= 22)) -# define ADXE_HAVE_STDFS 1 # include namespace stdfs = std::filesystem; +#else +#include "ghc/filesystem.hpp" +namespace stdfs = ghc::filesystem; +#endif + # if defined(_WIN32) inline stdfs::path toFspath(const std::string_view& pathSV) { @@ -74,10 +73,6 @@ inline stdfs::path toFspath(const std::string_view& pathSV) return stdfs::path{pathSV}; } # endif -#else -# include "tinydir/tinydir.h" -# define ADXE_HAVE_STDFS 0 -#endif NS_CC_BEGIN @@ -163,7 +158,7 @@ public: void startElement(void* ctx, const char* name, const char** atts) override { const std::string sName(name); - if (sName == "dict") + if (sName == "dict"sv) { if (_resultType == SAX_RESULT_DICT && _rootDict.empty()) { @@ -197,23 +192,23 @@ public: _stateStack.push(_state); _dictStack.push(_curDict); } - else if (sName == "key") + else if (sName == "key"sv) { _state = SAX_KEY; } - else if (sName == "integer") + else if (sName == "integer"sv) { _state = SAX_INT; } - else if (sName == "real") + else if (sName == "real"sv) { _state = SAX_REAL; } - else if (sName == "string") + else if (sName == "string"sv) { _state = SAX_STRING; } - else if (sName == "array") + else if (sName == "array"sv) { _state = SAX_ARRAY; @@ -253,7 +248,7 @@ public: { SAXState curState = _stateStack.empty() ? SAX_DICT : _stateStack.top(); const std::string sName((char*)name); - if (sName == "dict") + if (sName == "dict"sv) { _stateStack.pop(); _dictStack.pop(); @@ -262,7 +257,7 @@ public: _curDict = _dictStack.top(); } } - else if (sName == "array") + else if (sName == "array"sv) { _stateStack.pop(); _arrayStack.pop(); @@ -271,7 +266,7 @@ public: _curArray = _arrayStack.top(); } } - else if (sName == "true") + else if (sName == "true"sv) { if (SAX_ARRAY == curState) { @@ -282,7 +277,7 @@ public: (*_curDict)[_curKey] = Value(true); } } - else if (sName == "false") + else if (sName == "false"sv) { if (SAX_ARRAY == curState) { @@ -293,22 +288,22 @@ public: (*_curDict)[_curKey] = Value(false); } } - else if (sName == "string" || sName == "integer" || sName == "real") + else if (sName == "string"sv || sName == "integer"sv || sName == "real"sv) { if (SAX_ARRAY == curState) { - if (sName == "string") + if (sName == "string"sv) _curArray->push_back(Value(_curValue)); - else if (sName == "integer") + else if (sName == "integer"sv) _curArray->push_back(Value(atoi(_curValue.c_str()))); else _curArray->push_back(Value(std::atof(_curValue.c_str()))); } else if (SAX_DICT == curState) { - if (sName == "string") + if (sName == "string"sv) (*_curDict)[_curKey] = Value(_curValue); - else if (sName == "integer") + else if (sName == "integer"sv) (*_curDict)[_curKey] = Value(atoi(_curValue.c_str())); else (*_curDict)[_curKey] = Value(std::atof(_curValue.c_str())); @@ -423,25 +418,25 @@ static void generateElementForObject(const Value& value, pugi::xml_node& parent) // object is String if (value.getType() == Value::Type::STRING) { - auto node = parent.append_child("string"); - node.append_child(pugi::xml_node_type::node_pcdata).set_value(value.asString().c_str()); + auto node = parent.append_child("string"sv); + node.append_child(pugi::xml_node_type::node_pcdata).set_value(value.asString()); } // object is integer else if (value.getType() == Value::Type::INTEGER) { - auto node = parent.append_child("integer"); - node.append_child(pugi::xml_node_type::node_pcdata).set_value(value.asString().c_str()); + auto node = parent.append_child("integer"sv); + node.append_child(pugi::xml_node_type::node_pcdata).set_value(value.asString()); } // object is real else if (value.getType() == Value::Type::FLOAT || value.getType() == Value::Type::DOUBLE) { - auto node = parent.append_child("real"); - node.append_child(pugi::xml_node_type::node_pcdata).set_value(value.asString().c_str()); + auto node = parent.append_child("real"sv); + node.append_child(pugi::xml_node_type::node_pcdata).set_value(value.asString()); } // object is bool else if (value.getType() == Value::Type::BOOLEAN) { - parent.append_child(value.asString().c_str()); + parent.append_child(value.asString()); } // object is Array else if (value.getType() == Value::Type::VECTOR) @@ -453,11 +448,11 @@ static void generateElementForObject(const Value& value, pugi::xml_node& parent) static void generateElementForDict(const ValueMap& dict, pugi::xml_node& parent) { - auto dictDS = parent.append_child("dict"); + auto dictDS = parent.append_child("dict"sv); for (const auto& iter : dict) { - auto key = dictDS.append_child("key"); - key.append_child(pugi::xml_node_type::node_pcdata).set_value(iter.first.c_str()); + auto key = dictDS.append_child("key"sv); + key.append_child(pugi::xml_node_type::node_pcdata).set_value(iter.first); generateElementForObject(iter.second, dictDS); } @@ -465,7 +460,7 @@ static void generateElementForDict(const ValueMap& dict, pugi::xml_node& parent) static void generateElementForArray(const ValueVector& array, pugi::xml_node& parent) { - auto arrayDS = parent.append_child("array"); + auto arrayDS = parent.append_child("array"sv); for (const auto& value : array) { generateElementForObject(value, arrayDS); @@ -646,26 +641,6 @@ void FileUtils::writeValueVectorToFile(ValueVector vecData, std::move(callback), std::move(vecData)); } -std::string FileUtils::getNewFilename(std::string_view filename) const -{ - std::string newFileName; - - DECLARE_GUARD; - - // in Lookup Filename dictionary ? - auto iter = _filenameLookupDict.find(filename); - - if (iter == _filenameLookupDict.end()) - { - newFileName = filename; - } - else - { - newFileName = iter->second.asString(); - } - return newFileName; -} - std::string FileUtils::getPathForFilename(std::string_view filename, std::string_view resolutionDirectory, std::string_view searchPath) const @@ -724,16 +699,13 @@ std::string FileUtils::fullPathForFilename(std::string_view filename) const return cacheIter->second; } - // Get the new file name. - const std::string newFilename(getNewFilename(filename)); - std::string fullpath; for (const auto& searchIt : _searchPathArray) { for (const auto& resolutionIt : _searchResolutionsOrderArray) { - fullpath = this->getPathForFilename(newFilename, resolutionIt, searchIt); + fullpath = this->getPathForFilename(filename, resolutionIt, searchIt); if (!fullpath.empty()) { @@ -781,13 +753,11 @@ std::string FileUtils::fullPathForDirectory(std::string_view dir) const longdir += "/"; } - const std::string newdirname(getNewFilename(longdir)); - for (const auto& searchIt : _searchPathArray) { for (const auto& resolutionIt : _searchResolutionsOrderArray) { - fullpath = this->getPathForDirectory(newdirname, resolutionIt, searchIt); + fullpath = this->getPathForDirectory(longdir, resolutionIt, searchIt); if (!fullpath.empty() && isDirectoryExistInternal(fullpath)) { // Using the filename passed in as key. @@ -808,7 +778,7 @@ std::string FileUtils::fullPathForDirectory(std::string_view dir) const std::string FileUtils::fullPathFromRelativeFile(std::string_view filename, std::string_view relativeFile) const { - return std::string{relativeFile.substr(0, relativeFile.rfind('/') + 1)}.append(getNewFilename(filename)); + return std::string{relativeFile.substr(0, relativeFile.rfind('/') + 1)}.append(filename); } void FileUtils::setSearchResolutionsOrder(const std::vector& searchResolutionsOrder) @@ -977,35 +947,6 @@ void FileUtils::addSearchPath(std::string_view searchpath, const bool front) } } -void FileUtils::setFilenameLookupDictionary(const ValueMap& filenameLookupDict) -{ - DECLARE_GUARD; - _fullPathCache.clear(); - _fullPathCacheDir.clear(); - _filenameLookupDict = filenameLookupDict; -} - -void FileUtils::loadFilenameLookupDictionaryFromFile(std::string_view filename) -{ - const std::string fullPath = fullPathForFilename(filename); - if (!fullPath.empty()) - { - ValueMap dict = getValueMapFromFile(fullPath); - if (!dict.empty()) - { - ValueMap& metadata = dict["metadata"].asValueMap(); - int version = metadata["version"].asInt(); - if (version != 1) - { - CCLOG("cocos2d: ERROR: Invalid filenameLookup dictionary version: %d. Filename: %s", version, - filename.data()); - return; - } - setFilenameLookupDictionary(dict["filenames"].asValueMap()); - } - } -} - std::string FileUtils::getFullPathForFilenameWithinDirectory(std::string_view directory, std::string_view filename) const { @@ -1176,10 +1117,9 @@ std::unique_ptr FileUtils::openFileStream(std::string_view filePath, } /* !!!Notes for c++fs - a. ios: require ios 13.0+ + a. ios: require ios 13.0+, currently use ghc as workaround in lower ios 13.0- devices b. android: require ndk-r22+ */ -#if ADXE_HAVE_STDFS std::vector FileUtils::listFiles(std::string_view dirPath) const { const auto fullPath = fullPathForDirectory(dirPath); @@ -1206,9 +1146,7 @@ std::vector FileUtils::listFiles(std::string_view dirPath) const std::string pathStr = entry.path().string(); # endif if (isDir) - { pathStr += '/'; - } files.emplace_back(std::move(pathStr)); } } @@ -1240,100 +1178,11 @@ void FileUtils::listFilesRecursively(std::string_view dirPath, std::vectoremplace_back(std::move(pathStr)); } } } -#else -std::vector FileUtils::listFiles(std::string_view dirPath) const -{ - std::vector files; - std::string fullpath = fullPathForDirectory(dirPath); - if (!fullpath.empty() && isDirectoryExist(fullpath)) - { - tinydir_dir dir; - std::string fullpathstr = fullpath; - - if (tinydir_open(&dir, &fullpathstr[0]) != -1) - { - while (dir.has_next) - { - tinydir_file file; - if (tinydir_readfile(&dir, &file) == -1) - { - // Error getting file - break; - } - std::string filepath = file.path; - - if (strcmp(file.name, ".") != 0 && strcmp(file.name, "..") != 0) - { - if (file.is_dir) - filepath.push_back('/'); - - files.push_back(std::move(filepath)); - } - - if (tinydir_next(&dir) == -1) - { - // Error getting next file - break; - } - } - } - tinydir_close(&dir); - } - return files; -} - -void FileUtils::listFilesRecursively(std::string_view dirPath, std::vector* files) const -{ - std::string fullpath = fullPathForDirectory(dirPath); - if (isDirectoryExist(fullpath)) - { - tinydir_dir dir; - std::string fullpathstr = fullpath; - - if (tinydir_open(&dir, &fullpathstr[0]) != -1) - { - while (dir.has_next) - { - tinydir_file file; - if (tinydir_readfile(&dir, &file) == -1) - { - // Error getting file - break; - } - - if (strcmp(file.name, ".") != 0 && strcmp(file.name, "..") != 0) - { - std::string filepath = file.path; - if (file.is_dir) - { - filepath.push_back('/'); - files->push_back(filepath); - listFilesRecursively(filepath, files); - } - else - { - files->push_back(std::move(filepath)); - } - } - - if (tinydir_next(&dir) == -1) - { - // Error getting next file - break; - } - } - } - tinydir_close(&dir); - } -} -#endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) // windows os implement should override in platform specific FileUtiles class diff --git a/core/platform/CCFileUtils.h b/core/platform/CCFileUtils.h index 60f78431d2..5f29278bb1 100644 --- a/core/platform/CCFileUtils.h +++ b/core/platform/CCFileUtils.h @@ -293,49 +293,6 @@ public: */ virtual std::string fullPathForFilename(std::string_view filename) const; - /** - * Loads the filenameLookup dictionary from the contents of a filename. - * - * @note The plist file name should follow the format below: - * - * @code - * - * - * - * - * filenames - * - * sounds/click.wav - * sounds/click.caf - * sounds/endgame.wav - * sounds/endgame.caf - * sounds/gem-0.wav - * sounds/gem-0.caf - * - * metadata - * - * version - * 1 - * - * - * - * @endcode - * @param filename The plist file name. - * - @since v2.1 - * @js loadFilenameLookup - * @lua loadFilenameLookup - */ - virtual void loadFilenameLookupDictionaryFromFile(std::string_view filename); - - /** - * Sets the filenameLookup dictionary. - * - * @param filenameLookupDict The dictionary for replacing filename. - * @since v2.1 - */ - virtual void setFilenameLookupDictionary(const ValueMap& filenameLookupDict); - /** * Gets full path from a file name and the path of the relative file. * @param filename The file name. @@ -820,15 +777,6 @@ public: /** Returns the full path cache. */ const hlookup::string_map getFullPathCache() const { return _fullPathCache; } - /** - * Gets the new filename from the filename lookup dictionary. - * It is possible to have a override names. - * @param filename The original filename. - * @return The new filename after searching in the filename lookup dictionary. - * If the original filename wasn't in the dictionary, it will return the original filename. - */ - virtual std::string getNewFilename(std::string_view filename) const; - /** * Checks whether a file exists without considering search paths and resolution orders. * @param filename The file (with absolute path) to look up for @@ -909,15 +857,6 @@ protected: */ mutable std::recursive_mutex _mutex; - /** Dictionary used to lookup filenames based on a key. - * It is used internally by the following methods: - * - * std::string fullPathForFilename(const char*); - * - * @since v2.1 - */ - ValueMap _filenameLookupDict; - /** * The vector contains resolution folders. * The lower index of the element in this vector, the higher priority for this resolution directory. diff --git a/core/platform/android/CCFileUtils-android.cpp b/core/platform/android/CCFileUtils-android.cpp index 929b495761..50f1636d73 100644 --- a/core/platform/android/CCFileUtils-android.cpp +++ b/core/platform/android/CCFileUtils-android.cpp @@ -105,59 +105,6 @@ bool FileUtilsAndroid::init() return FileUtils::init(); } -std::string FileUtilsAndroid::getNewFilename(std::string_view filename) const -{ - std::string newFileName = FileUtils::getNewFilename(filename); - // ../xxx do not fix this path - auto pos = newFileName.find("../"); - if (pos == std::string::npos || pos == 0) - { - return newFileName; - } - - std::vector v(3); - v.resize(0); - auto change = false; - size_t size = newFileName.size(); - size_t idx = 0; - bool noexit = true; - while (noexit) - { - pos = newFileName.find('/', idx); - std::string tmp; - if (pos == std::string::npos) - { - tmp = newFileName.substr(idx, size - idx); - noexit = false; - } - else - { - tmp = newFileName.substr(idx, pos - idx + 1); - } - auto t = v.size(); - if (t > 0 && v[t - 1].compare("../") != 0 && (tmp.compare("../") == 0 || tmp.compare("..") == 0)) - { - v.pop_back(); - change = true; - } - else - { - v.push_back(tmp); - } - idx = pos + 1; - } - - if (change) - { - newFileName.clear(); - for (auto& s : v) - { - newFileName.append(s); - } - } - return newFileName; -} - bool FileUtilsAndroid::isFileExistInternal(std::string_view strFilePath) const { diff --git a/core/platform/android/CCFileUtils-android.h b/core/platform/android/CCFileUtils-android.h index baacb19a1d..9a24a19cde 100644 --- a/core/platform/android/CCFileUtils-android.h +++ b/core/platform/android/CCFileUtils-android.h @@ -64,8 +64,6 @@ public: /* override functions */ bool init() override; - virtual std::string getNewFilename(std::string_view filename) const override; - virtual FileUtils::Status getContents(std::string_view filename, ResizableBuffer* buffer) const override; virtual std::string getWritablePath() const override; diff --git a/core/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/core/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index c51134378b..8b230be3bc 100644 --- a/core/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/core/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -171,8 +171,9 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe Log.d(TAG, "onResume()"); paused = false; super.onResume(); - this.hideVirtualButton(); - resumeIfHasFocus(); + if (this.hasFocus) { + resume(); + } } @Override @@ -181,7 +182,15 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe super.onWindowFocusChanged(hasFocus); this.hasFocus = hasFocus; - resumeIfHasFocus(); + if (this.hasFocus && !paused) { + resume(); + } + } + + private void resume() { + this.hideVirtualButton(); + Cocos2dxHelper.onResume(); + mGLSurfaceView.onResume(); } private void resumeIfHasFocus() { @@ -190,9 +199,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe boolean readyToPlay = !isDeviceLocked() && !isDeviceAsleep(); if(hasFocus && readyToPlay) { - this.hideVirtualButton(); - Cocos2dxHelper.onResume(); - mGLSurfaceView.onResume(); + resume(); } } diff --git a/core/platform/android/libcocos2dx/adxetools.gradle b/core/platform/android/libcocos2dx/adxetools.gradle index 73b378cd97..1173e9bd1e 100644 --- a/core/platform/android/libcocos2dx/adxetools.gradle +++ b/core/platform/android/libcocos2dx/adxetools.gradle @@ -96,7 +96,9 @@ class adxetools { return new VersionComparator().compare(ver1, ver2); } - static String[] findNDK(String ndkVer){ + static String[] findNDK(){ + def ndkVer = "23.2.8568313" // ndk-r23c + def allowNewerNdk = false if(ndkVer.endsWith('+')) { allowNewerNdk = true diff --git a/core/ui/UITextFieldEx.cpp b/core/ui/UITextFieldEx.cpp index 8e9e6b0e31..6e62e1d34f 100644 --- a/core/ui/UITextFieldEx.cpp +++ b/core/ui/UITextFieldEx.cpp @@ -1,14 +1,11 @@ // -// Copyright (c) 2014-2020 @HALX99 - All Rights Reserved +// Copyright (c) 2014-2022 @HALX99 - All Rights Reserved // #ifndef _UITEXTFIELD_CPP_H_ #define _UITEXTFIELD_CPP_H_ #include "UITextFieldEx.h" #include "base/CCDirector.h" -// #include "CCGLView.h" -//#include "NXMacroDefs.h" -//#include "purelib/utils/iconvw.h" /// cocos2d singleton objects #define CCDIRECTOR cocos2d::Director::getInstance() diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 685ecfb439..37b9871732 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -32132,56 +32132,6 @@ int lua_cocos2dx_FileUtils_getStringFromFile(lua_State* tolua_S) return 0; } -int lua_cocos2dx_FileUtils_setFilenameLookupDictionary(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::FileUtils* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_setFilenameLookupDictionary'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::ValueMap arg0; - - ok &= luaval_to_ccvaluemap(tolua_S, 2, &arg0, "cc.FileUtils:setFilenameLookupDictionary"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_setFilenameLookupDictionary'", nullptr); - return 0; - } - cobj->setFilenameLookupDictionary(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:setFilenameLookupDictionary",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_setFilenameLookupDictionary'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_FileUtils_getNativeWritableAbsolutePath(lua_State* tolua_S) { int argc = 0; @@ -32565,56 +32515,6 @@ int lua_cocos2dx_FileUtils_getDefaultResourceRootPath(lua_State* tolua_S) return 0; } -int lua_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::FileUtils* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string_view arg0; - - ok &= luaval_to_std_string_view(tolua_S, 2,&arg0, "cc.FileUtils:loadFilenameLookupDictionaryFromFile"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile'", nullptr); - return 0; - } - cobj->loadFilenameLookupDictionaryFromFile(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:loadFilenameLookupDictionaryFromFile",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_FileUtils_isPopupNotify(lua_State* tolua_S) { int argc = 0; @@ -32859,56 +32759,6 @@ int lua_cocos2dx_FileUtils_getOriginalSearchPaths(lua_State* tolua_S) return 0; } -int lua_cocos2dx_FileUtils_getNewFilename(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::FileUtils* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_getNewFilename'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string_view arg0; - - ok &= luaval_to_std_string_view(tolua_S, 2,&arg0, "cc.FileUtils:getNewFilename"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_FileUtils_getNewFilename'", nullptr); - return 0; - } - std::string ret = cobj->getNewFilename(arg0); - lua_pushlstring(tolua_S,ret.c_str(),ret.length()); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.FileUtils:getNewFilename",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_getNewFilename'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_FileUtils_listFiles(lua_State* tolua_S) { int argc = 0; @@ -34623,20 +34473,17 @@ int lua_register_cocos2dx_FileUtils(lua_State* tolua_S) tolua_beginmodule(tolua_S,"FileUtils"); tolua_function(tolua_S,"fullPathForFilename",lua_cocos2dx_FileUtils_fullPathForFilename); tolua_function(tolua_S,"getStringFromFile",lua_cocos2dx_FileUtils_getStringFromFile); - tolua_function(tolua_S,"setFilenameLookupDictionary",lua_cocos2dx_FileUtils_setFilenameLookupDictionary); tolua_function(tolua_S,"getNativeWritableAbsolutePath",lua_cocos2dx_FileUtils_getNativeWritableAbsolutePath); tolua_function(tolua_S,"removeFile",lua_cocos2dx_FileUtils_removeFile); tolua_function(tolua_S,"listFilesRecursivelyAsync",lua_cocos2dx_FileUtils_listFilesRecursivelyAsync); tolua_function(tolua_S,"isAbsolutePath",lua_cocos2dx_FileUtils_isAbsolutePath); tolua_function(tolua_S,"renameFile",lua_cocos2dx_FileUtils_renameFile); tolua_function(tolua_S,"getDefaultResourceRootPath",lua_cocos2dx_FileUtils_getDefaultResourceRootPath); - tolua_function(tolua_S,"loadFilenameLookup",lua_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile); tolua_function(tolua_S,"isPopupNotify",lua_cocos2dx_FileUtils_isPopupNotify); tolua_function(tolua_S,"getValueVectorFromFile",lua_cocos2dx_FileUtils_getValueVectorFromFile); tolua_function(tolua_S,"getSearchPaths",lua_cocos2dx_FileUtils_getSearchPaths); tolua_function(tolua_S,"writeToFile",lua_cocos2dx_FileUtils_writeToFile); tolua_function(tolua_S,"getOriginalSearchPaths",lua_cocos2dx_FileUtils_getOriginalSearchPaths); - tolua_function(tolua_S,"getNewFilename",lua_cocos2dx_FileUtils_getNewFilename); tolua_function(tolua_S,"listFiles",lua_cocos2dx_FileUtils_listFiles); tolua_function(tolua_S,"getValueMapFromFile",lua_cocos2dx_FileUtils_getValueMapFromFile); tolua_function(tolua_S,"getFileSize",lua_cocos2dx_FileUtils_getFileSize); diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index c037c4159a..bdd1fc1213 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2325,9 +2325,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - - - diff --git a/templates/cpp-template-default/proj.android/app/build.gradle b/templates/cpp-template-default/proj.android/app/build.gradle index 1bcedf7c13..bf5d0e66cf 100644 --- a/templates/cpp-template-default/proj.android/app/build.gradle +++ b/templates/cpp-template-default/proj.android/app/build.gradle @@ -9,7 +9,7 @@ android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() // setup ndk - def ndkInfo = adxetools.findNDK("19.2.5345600+") + def ndkInfo = adxetools.findNDK() ndkVersion = ndkInfo[0] if(ndkInfo[1]) { ndkPath = ndkInfo[1] diff --git a/templates/cpp-template-default/proj.android/build.gradle b/templates/cpp-template-default/proj.android/build.gradle index 7d7d19eb73..5a44a79f98 100644 --- a/templates/cpp-template-default/proj.android/build.gradle +++ b/templates/cpp-template-default/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath 'com.android.tools.build:gradle:7.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties b/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties index a449ebe63c..c6d2e0473d 100644 --- a/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle index ed2b0c4c82..5202f2aeaa 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle @@ -9,7 +9,7 @@ android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() // setup ndk - def ndkInfo = adxetools.findNDK("19.2.5345600+") + def ndkInfo = adxetools.findNDK() ndkVersion = ndkInfo[0] if(ndkInfo[1]) { ndkPath = ndkInfo[1] diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle b/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle index 7d7d19eb73..5a44a79f98 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath 'com.android.tools.build:gradle:7.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties b/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties index a449ebe63c..c6d2e0473d 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index c45f18d50d..4411634dc4 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -30,7 +30,6 @@ FileUtilsTests::FileUtilsTests() { ADD_TEST_CASE(TestResolutionDirectories); ADD_TEST_CASE(TestSearchPath); - ADD_TEST_CASE(TestFilenameLookup); ADD_TEST_CASE(TestIsFileExist); ADD_TEST_CASE(TestIsDirectoryExist); ADD_TEST_CASE(TestFileFuncs); @@ -208,44 +207,6 @@ std::string TestSearchPath::subtitle() const return "See the console, can see a orange box and a 'about' picture, except Android"; } -// TestFilenameLookup - -void TestFilenameLookup::onEnter() -{ - FileUtilsDemo::onEnter(); - - auto sharedFileUtils = FileUtils::getInstance(); - - ValueMap dict; - dict["grossini.bmp"] = Value("Images/grossini.png"); - dict["grossini.xcf"] = Value("Images/grossini.png"); - - sharedFileUtils->setFilenameLookupDictionary(dict); - - // Instead of loading carlitos.xcf, it will load grossini.png - auto sprite = Sprite::create("grossini.xcf"); - this->addChild(sprite); - - auto s = Director::getInstance()->getWinSize(); - sprite->setPosition(s.width / 2, s.height / 2); -} - -void TestFilenameLookup::onExit() -{ - - FileUtils* sharedFileUtils = FileUtils::getInstance(); - - // reset filename lookup - sharedFileUtils->setFilenameLookupDictionary(ValueMap()); - - FileUtilsDemo::onExit(); -} - -std::string TestFilenameLookup::title() const -{ - return "FileUtils: filename lookup"; -} - // TestIsFileExist void TestIsFileExist::onEnter() @@ -276,9 +237,6 @@ void TestIsFileExist::onExit() FileUtils* sharedFileUtils = FileUtils::getInstance(); - // reset filename lookup - sharedFileUtils->setFilenameLookupDictionary(ValueMap()); - FileUtilsDemo::onExit(); } @@ -997,7 +955,6 @@ void TestUnicodePath::onExit() FileUtils* sharedFileUtils = FileUtils::getInstance(); sharedFileUtils->purgeCachedEntries(); - sharedFileUtils->setFilenameLookupDictionary(ValueMap()); FileUtilsDemo::onExit(); } @@ -1037,12 +994,6 @@ void TestIsFileExistAsync::onEnter() void TestIsFileExistAsync::onExit() { - - FileUtils* sharedFileUtils = FileUtils::getInstance(); - - // reset filename lookup - sharedFileUtils->setFilenameLookupDictionary(ValueMap()); - FileUtilsDemo::onExit(); } diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h index 1d40951028..60eefc6d03 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h @@ -64,16 +64,6 @@ private: std::vector _defaultResolutionsOrderArray; }; -class TestFilenameLookup : public FileUtilsDemo -{ -public: - CREATE_FUNC(TestFilenameLookup); - - virtual void onEnter() override; - virtual void onExit() override; - virtual std::string title() const override; -}; - class TestIsFileExist : public FileUtilsDemo { public: diff --git a/tests/cpp-tests/Classes/FontTest/FontTest.cpp b/tests/cpp-tests/Classes/FontTest/FontTest.cpp index 115aba2a41..6aaaaf33ce 100644 --- a/tests/cpp-tests/Classes/FontTest/FontTest.cpp +++ b/tests/cpp-tests/Classes/FontTest/FontTest.cpp @@ -80,7 +80,6 @@ FontTests::FontTests() }); } ADD_TEST_CASE(FontNoReplacementTest); - ADD_TEST_CASE(FontReplacementTest); } void FontTest::showFont(std::string_view fontFile) @@ -162,7 +161,6 @@ FontNoReplacementTest* FontNoReplacementTest::create() FontNoReplacementTest::FontNoReplacementTest() { - _replace = false; } FontNoReplacementTest::~FontNoReplacementTest() @@ -176,7 +174,6 @@ FontNoReplacementTest::~FontNoReplacementTest() FontFreeType::releaseFont("fonts/Abduction.ttf"); FontAtlasCache::unloadFontAtlasTTF("fonts/Schwarzwald.ttf"); FontFreeType::releaseFont("fonts/Schwarzwald.ttf"); - FileUtils::getInstance()->setFilenameLookupDictionary(ValueMap()); } void FontNoReplacementTest::onEnter() @@ -184,17 +181,6 @@ void FontNoReplacementTest::onEnter() TestCase::onEnter(); std::string suffix; - if (_replace) - { - ValueMap dict{{"fonts/A Damn Mess.ttf", Value("fonts/arial.ttf")}, - {"fonts/Abberancy.ttf", Value("fonts/arial.ttf")}, - {"fonts/Abduction.ttf", Value("fonts/arial.ttf")}, - {"fonts/Schwarzwald.ttf", Value("fonts/arial.ttf")}}; - - FileUtils::getInstance()->setFilenameLookupDictionary(dict); - suffix = " replaced by arial.ttf"; - } - auto s = Director::getInstance()->getWinSize(); auto blockSize = Size(s.width / 3, 200); @@ -253,29 +239,3 @@ std::string FontNoReplacementTest::title() const { return "Font no replacement test"; } - -FontReplacementTest* FontReplacementTest::create() -{ - auto ret = new FontReplacementTest; - if (ret->init()) - { - ret->autorelease(); - } - else - { - delete ret; - ret = nullptr; - } - - return ret; -} - -FontReplacementTest::FontReplacementTest() -{ - _replace = true; -} - -std::string FontReplacementTest::title() const -{ - return "Font replacement test"; -} diff --git a/tests/cpp-tests/Classes/FontTest/FontTest.h b/tests/cpp-tests/Classes/FontTest/FontTest.h index 959f8f7c8d..df130b0e14 100644 --- a/tests/cpp-tests/Classes/FontTest/FontTest.h +++ b/tests/cpp-tests/Classes/FontTest/FontTest.h @@ -65,18 +65,6 @@ public: protected: FontNoReplacementTest(); - - bool _replace; -}; - -class FontReplacementTest : public FontNoReplacementTest -{ -public: - static FontReplacementTest* create(); - virtual std::string title() const override; - -protected: - FontReplacementTest(); }; #endif // _FONT_TEST_H_ diff --git a/tests/cpp-tests/proj.android/app/build.gradle b/tests/cpp-tests/proj.android/app/build.gradle index e8e4e4a822..b3a53dae33 100644 --- a/tests/cpp-tests/proj.android/app/build.gradle +++ b/tests/cpp-tests/proj.android/app/build.gradle @@ -9,7 +9,7 @@ android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() // setup ndk - def ndkInfo = adxetools.findNDK("19.2.5345600+") + def ndkInfo = adxetools.findNDK() ndkVersion = ndkInfo[0] if(ndkInfo[1]) { ndkPath = ndkInfo[1] diff --git a/tests/cpp-tests/proj.android/build.gradle b/tests/cpp-tests/proj.android/build.gradle index 7d7d19eb73..5a44a79f98 100644 --- a/tests/cpp-tests/proj.android/build.gradle +++ b/tests/cpp-tests/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath 'com.android.tools.build:gradle:7.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties index 3271841d36..066932a368 100644 --- a/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip diff --git a/tests/fairygui-tests/proj.android/app/build.gradle b/tests/fairygui-tests/proj.android/app/build.gradle index e7c41aeee5..3e5fbc7fb0 100644 --- a/tests/fairygui-tests/proj.android/app/build.gradle +++ b/tests/fairygui-tests/proj.android/app/build.gradle @@ -9,7 +9,7 @@ android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() // setup ndk - def ndkInfo = adxetools.findNDK("19.2.5345600+") + def ndkInfo = adxetools.findNDK() ndkVersion = ndkInfo[0] if(ndkInfo[1]) { ndkPath = ndkInfo[1] diff --git a/tests/fairygui-tests/proj.android/build.gradle b/tests/fairygui-tests/proj.android/build.gradle index 7d7d19eb73..5a44a79f98 100644 --- a/tests/fairygui-tests/proj.android/build.gradle +++ b/tests/fairygui-tests/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath 'com.android.tools.build:gradle:7.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/fairygui-tests/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/fairygui-tests/proj.android/gradle/wrapper/gradle-wrapper.properties index e66c903d52..b679d9630b 100644 --- a/tests/fairygui-tests/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/fairygui-tests/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip \ No newline at end of file diff --git a/tests/lua-tests/project/proj.android/app/build.gradle b/tests/lua-tests/project/proj.android/app/build.gradle index a91a5455ee..2b78b3848a 100644 --- a/tests/lua-tests/project/proj.android/app/build.gradle +++ b/tests/lua-tests/project/proj.android/app/build.gradle @@ -9,7 +9,7 @@ android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() // setup ndk - def ndkInfo = adxetools.findNDK("19.2.5345600+") + def ndkInfo = adxetools.findNDK() ndkVersion = ndkInfo[0] if(ndkInfo[1]) { ndkPath = ndkInfo[1] diff --git a/tests/lua-tests/project/proj.android/build.gradle b/tests/lua-tests/project/proj.android/build.gradle index 7d7d19eb73..5a44a79f98 100644 --- a/tests/lua-tests/project/proj.android/build.gradle +++ b/tests/lua-tests/project/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath 'com.android.tools.build:gradle:7.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties index b159c65463..a14cdb1aa5 100644 --- a/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip diff --git a/tools/unix-ci/setup_android.py b/tools/unix-ci/setup_android.py index d95f5b718f..8527d48a4e 100644 --- a/tools/unix-ci/setup_android.py +++ b/tools/unix-ci/setup_android.py @@ -28,9 +28,9 @@ COCOS2D_X = os.path.abspath(os.path.join(DIR_PATH, "../..")) ROOT_DIR = os.path.abspath(os.path.join(COCOS2D_X, "..")) # cmdlinetools download page: https://developer.android.com/studio#command-tools -# commandlinetools-linux-8092744_latest.zip -CMDLINETOOLS_REV = "8092744" -NDK_VER = "19.2.5345600" # "r19c" +# commandlinetools-win-8512546_latest.zip +CMDLINETOOLS_REV = "8512546" +NDK_VER = "23.2.8568313" # "r23c LTS" # ANDROID_NDK = os.path.join(ROOT_DIR, "android-ndk-" + NDK_VER) ANDROID_SDK = os.path.join(ROOT_DIR, "android-sdk")