diff --git a/MANIFEST.in b/MANIFEST.in index 77c176d4..93307ace 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -757,6 +757,9 @@ include tests/source-files/com.anpmech.launcher/settings.gradle include tests/source-files/com.github.jameshnsears.quoteunquote/build.gradle include tests/source-files/com.github.shadowsocks/core/build.gradle.kts include tests/source-files/com.github.shadowsocks/mobile/build.gradle.kts +include tests/source-files/com.infomaniak.mail/Core/gradle/core.versions.toml +include tests/source-files/com.infomaniak.mail/gradle/libs.versions.toml +include tests/source-files/com.infomaniak.mail/settings.gradle include tests/source-files/com.integreight.onesheeld/build.gradle include tests/source-files/com.integreight.onesheeld/gradle/wrapper/gradle-wrapper.properties include tests/source-files/com.integreight.onesheeld/localeapi/build.gradle diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 30b5b2c7..29c2ee18 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -71,11 +71,8 @@ SCANNER_CACHE_VERSION = 1 DEFAULT_CATALOG_PREFIX_REGEX = re.compile( r'''defaultLibrariesExtensionName\s*=\s*['"](\w+)['"]''' ) -GRADLE_KTS_CATALOG_FILE_REGEX = re.compile( - r'''create\("(\w+)"\)\s*\{[^}]*from\(files\(['"]([^"]+)['"]\)\)''' -) GRADLE_CATALOG_FILE_REGEX = re.compile( - r'''(\w+)\s*\{[^}]*from\(files\(['"]([^"]+)['"]\)\)''' + r'''(?:create\()?['"]?(\w+)['"]?\)?\s*\{[^}]*from\(files\(['"]([^"]+)['"]\)\)''' ) VERSION_CATALOG_REGEX = re.compile(r'versionCatalogs\s*\{') @@ -225,22 +222,19 @@ def get_catalogs(root: str) -> dict[str, GradleVersionCatalog]: groovy_file = root / "settings.gradle" kotlin_file = root / "settings.gradle.kts" if groovy_file.is_file(): - s = groovy_file.read_text(encoding="utf-8") - version_catalogs_m = VERSION_CATALOG_REGEX.search(s) - if version_catalogs_m: - start = version_catalogs_m.end() - end = find_block_end(s, start) - catalog_files_m = GRADLE_CATALOG_FILE_REGEX.finditer(s, start, end) + gradle_file = groovy_file elif kotlin_file.is_file(): - s = kotlin_file.read_text(encoding="utf-8") - version_catalogs_m = VERSION_CATALOG_REGEX.search(s) - if version_catalogs_m: - start = version_catalogs_m.end() - end = find_block_end(s, start) - catalog_files_m = GRADLE_KTS_CATALOG_FILE_REGEX.finditer(s, start, end) + gradle_file = kotlin_file else: return {} + s = gradle_file.read_text(encoding="utf-8") + version_catalogs_m = VERSION_CATALOG_REGEX.search(s) + if version_catalogs_m: + start = version_catalogs_m.end() + end = find_block_end(s, start) + catalog_files_m = GRADLE_CATALOG_FILE_REGEX.finditer(s, start, end) + m_default = DEFAULT_CATALOG_PREFIX_REGEX.search(s) if m_default: default_prefix = m_default.group(1) diff --git a/tests/source-files/com.infomaniak.mail/Core/gradle/core.versions.toml b/tests/source-files/com.infomaniak.mail/Core/gradle/core.versions.toml new file mode 100644 index 00000000..e69de29b diff --git a/tests/source-files/com.infomaniak.mail/gradle/libs.versions.toml b/tests/source-files/com.infomaniak.mail/gradle/libs.versions.toml new file mode 100644 index 00000000..e69de29b diff --git a/tests/source-files/com.infomaniak.mail/settings.gradle b/tests/source-files/com.infomaniak.mail/settings.gradle new file mode 100644 index 00000000..bb9b1161 --- /dev/null +++ b/tests/source-files/com.infomaniak.mail/settings.gradle @@ -0,0 +1,44 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } + versionCatalogs { + create("core") { from(files("Core/gradle/core.versions.toml")) } + } +} + +rootProject.name = 'Infomaniak Mail' +include ':app', + ':Core:AppIntegrity', + ':Core:Auth', + ':Core:Avatar', + ':Core:Coil', + ':Core:Compose:Basics', + ':Core:Compose:Margin', + ':Core:Compose:MaterialThemeFromXml', + ':Core:CrossAppLogin', + ':Core:CrossAppLoginUI', + ':Core:FragmentNavigation', + ':Core:Legacy', + ':Core:Legacy:AppLock', + ':Core:Legacy:BugTracker', + ':Core:Legacy:Confetti', + ':Core:Legacy:Stores', + ':Core:Matomo', + ':Core:MyKSuite', + ':Core:Network', + ':Core:Network:Models', + ':Core:Sentry', + ':EmojiComponents', + ':HtmlCleaner' diff --git a/tests/test_scanner.py b/tests/test_scanner.py index 849476e6..7d0f5b8e 100755 --- a/tests/test_scanner.py +++ b/tests/test_scanner.py @@ -176,6 +176,7 @@ class ScannerTest(unittest.TestCase): ('source-files/com.lolo.io.onelist/', 1), ('source-files/catalog.test/', 3), ('source-files/org.piepmeyer.gauguin/', 1), + ('source-files/com.infomaniak.mail/', 2), ] for root, count in test_files: