mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-03 14:10:29 +03:00
scanner: fix catalog match
This commit is contained in:
parent
9b8a334dcf
commit
5f6e59c76d
6 changed files with 58 additions and 16 deletions
|
|
@ -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.jameshnsears.quoteunquote/build.gradle
|
||||||
include tests/source-files/com.github.shadowsocks/core/build.gradle.kts
|
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.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/build.gradle
|
||||||
include tests/source-files/com.integreight.onesheeld/gradle/wrapper/gradle-wrapper.properties
|
include tests/source-files/com.integreight.onesheeld/gradle/wrapper/gradle-wrapper.properties
|
||||||
include tests/source-files/com.integreight.onesheeld/localeapi/build.gradle
|
include tests/source-files/com.integreight.onesheeld/localeapi/build.gradle
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,8 @@ SCANNER_CACHE_VERSION = 1
|
||||||
DEFAULT_CATALOG_PREFIX_REGEX = re.compile(
|
DEFAULT_CATALOG_PREFIX_REGEX = re.compile(
|
||||||
r'''defaultLibrariesExtensionName\s*=\s*['"](\w+)['"]'''
|
r'''defaultLibrariesExtensionName\s*=\s*['"](\w+)['"]'''
|
||||||
)
|
)
|
||||||
GRADLE_KTS_CATALOG_FILE_REGEX = re.compile(
|
|
||||||
r'''create\("(\w+)"\)\s*\{[^}]*from\(files\(['"]([^"]+)['"]\)\)'''
|
|
||||||
)
|
|
||||||
GRADLE_CATALOG_FILE_REGEX = re.compile(
|
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*\{')
|
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"
|
groovy_file = root / "settings.gradle"
|
||||||
kotlin_file = root / "settings.gradle.kts"
|
kotlin_file = root / "settings.gradle.kts"
|
||||||
if groovy_file.is_file():
|
if groovy_file.is_file():
|
||||||
s = groovy_file.read_text(encoding="utf-8")
|
gradle_file = groovy_file
|
||||||
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)
|
|
||||||
elif kotlin_file.is_file():
|
elif kotlin_file.is_file():
|
||||||
s = kotlin_file.read_text(encoding="utf-8")
|
gradle_file = kotlin_file
|
||||||
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)
|
|
||||||
else:
|
else:
|
||||||
return {}
|
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)
|
m_default = DEFAULT_CATALOG_PREFIX_REGEX.search(s)
|
||||||
if m_default:
|
if m_default:
|
||||||
default_prefix = m_default.group(1)
|
default_prefix = m_default.group(1)
|
||||||
|
|
|
||||||
44
tests/source-files/com.infomaniak.mail/settings.gradle
Normal file
44
tests/source-files/com.infomaniak.mail/settings.gradle
Normal file
|
|
@ -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'
|
||||||
|
|
@ -176,6 +176,7 @@ class ScannerTest(unittest.TestCase):
|
||||||
('source-files/com.lolo.io.onelist/', 1),
|
('source-files/com.lolo.io.onelist/', 1),
|
||||||
('source-files/catalog.test/', 3),
|
('source-files/catalog.test/', 3),
|
||||||
('source-files/org.piepmeyer.gauguin/', 1),
|
('source-files/org.piepmeyer.gauguin/', 1),
|
||||||
|
('source-files/com.infomaniak.mail/', 2),
|
||||||
]
|
]
|
||||||
|
|
||||||
for root, count in test_files:
|
for root, count in test_files:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue