|
1 | 1 |
|
| 2 | +SPRING_BOOT_MAJOR_2_VERSION_NAME = '2' |
2 | 3 | SPRING_BOOT_MAJOR_2_VERSION_TAG_PREFIX = '' |
| 4 | +SPRING_BOOT_MAJOR_3_VERSION_NAME = '3' |
3 | 5 | SPRING_BOOT_MAJOR_3_VERSION_TAG_PREFIX = 'springboot3_' |
4 | | -SPRING_BOOT_MAJOR_2_VERSION_NAME = 'v2' |
5 | | -SPRING_BOOT_MAJOR_3_VERSION_NAME = 'v3' |
6 | | -SPRING_BOOT_MAJOR_VERSION_PREFIX_MAP = { |
7 | | - 'v2': SPRING_BOOT_MAJOR_2_VERSION_TAG_PREFIX, |
8 | | - 'v3': SPRING_BOOT_MAJOR_3_VERSION_TAG_PREFIX |
| 6 | +SPRING_BOOT_MAJOR_VERSION_PREFIX_DICT = { |
| 7 | + SPRING_BOOT_MAJOR_2_VERSION_NAME: SPRING_BOOT_MAJOR_2_VERSION_TAG_PREFIX, |
| 8 | + SPRING_BOOT_MAJOR_3_VERSION_NAME: SPRING_BOOT_MAJOR_3_VERSION_TAG_PREFIX |
9 | 9 | } |
10 | 10 |
|
11 | 11 |
|
12 | | -def get_spring_boot_major_version_tag_prefix(spring_boot_version): |
13 | | - if spring_boot_version.startswith('3.'): |
14 | | - return SPRING_BOOT_MAJOR_VERSION_PREFIX_MAP['v3'] |
15 | | - elif spring_boot_version.startswith('2.'): |
16 | | - return SPRING_BOOT_MAJOR_VERSION_PREFIX_MAP['v2'] |
| 12 | +def get_spring_boot_version_tag_prefix(spring_boot_version): |
| 13 | + if spring_boot_version.startswith('3.') or spring_boot_version == SPRING_BOOT_MAJOR_3_VERSION_NAME: |
| 14 | + return SPRING_BOOT_MAJOR_VERSION_PREFIX_DICT[SPRING_BOOT_MAJOR_3_VERSION_NAME] |
| 15 | + elif spring_boot_version.startswith('2.') or spring_boot_version == SPRING_BOOT_MAJOR_2_VERSION_NAME: |
| 16 | + return SPRING_BOOT_MAJOR_VERSION_PREFIX_DICT[SPRING_BOOT_MAJOR_2_VERSION_NAME] |
17 | 17 | else: |
18 | 18 | return '' |
| 19 | + |
| 20 | + |
| 21 | +# Since Spring Cloud Azure uses multiple versions of external dependencies managed by Spring Boot, |
| 22 | +# the modules that still use Spring Boot 2 to manage dependencies will be skipped. |
| 23 | +SKIP_ADDING_DEPENDENCY_MANAGEMENT_ARTIFACTS = [ |
| 24 | + 'spring-cloud-azure-starter-monitor-test', |
| 25 | + 'spring-cloud-azure-starter-monitor' |
| 26 | +] |
| 27 | +# Since some features are based on a higher Spring Boot version, it is sufficient to let the modules |
| 28 | +# corresponding to these special Spring Boot versions use the latest Spring Boot version. |
| 29 | +SKIP_ADDING_DEPENDENCY_MANAGEMENT_ARTIFACTS_WITH_SPRING_BOOT_VERSION = { |
| 30 | + '3.0': [ |
| 31 | + # skip for test containers |
| 32 | + 'spring-cloud-azure-autoconfigure', |
| 33 | + 'spring-cloud-azure-testcontainers' |
| 34 | + ] |
| 35 | +} |
| 36 | +# The artifact will be updated with different Spring versions of external dependencies to run the tests. |
| 37 | +INTEGRATION_TESTS_ARTIFACTS = [ |
| 38 | + 'spring-cloud-azure-integration-tests', |
| 39 | + 'spring-cloud-azure-integration-test-appconfiguration-config' |
| 40 | +] |
| 41 | +COMPATIBILITY_USAGE_TYPE = 'compatibility' |
| 42 | +INTEGRATION_USAGE_TYPE = 'integration' |
| 43 | + |
| 44 | +def should_skip_artifacts_when_adding_dependency_management(file_path): |
| 45 | + for artifact in SKIP_ADDING_DEPENDENCY_MANAGEMENT_ARTIFACTS: |
| 46 | + if artifact in file_path: |
| 47 | + return True |
| 48 | + else: |
| 49 | + return False |
| 50 | + |
| 51 | + |
| 52 | +def should_skip_artifacts_when_adding_dependency_management_with_spring_version(spring_boot_version, file_path): |
| 53 | + version_prefix = spring_boot_version[0:spring_boot_version.rindex('.')] |
| 54 | + if version_prefix in list(SKIP_ADDING_DEPENDENCY_MANAGEMENT_ARTIFACTS_WITH_SPRING_BOOT_VERSION.keys()): |
| 55 | + for artifact in SKIP_ADDING_DEPENDENCY_MANAGEMENT_ARTIFACTS_WITH_SPRING_BOOT_VERSION[version_prefix]: |
| 56 | + if artifact in file_path: |
| 57 | + return True |
| 58 | + return False |
| 59 | + |
| 60 | + |
| 61 | +def is_integration_tests_artifact(file_path): |
| 62 | + for artifact in INTEGRATION_TESTS_ARTIFACTS: |
| 63 | + if artifact in file_path: |
| 64 | + return True |
| 65 | + else: |
| 66 | + return False |
0 commit comments