mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +03:00 
			
		
		
		
	calculate all combinations of gradle flavors
This commit is contained in:
		
							parent
							
								
									e957583337
								
							
						
					
					
						commit
						a5d966bf0f
					
				
					 5 changed files with 29 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -803,6 +803,7 @@ include tests/source-files/firebase-allowlisted/app/build.gradle
 | 
			
		|||
include tests/source-files/firebase-allowlisted/build.gradle
 | 
			
		||||
include tests/source-files/firebase-suspect/app/build.gradle
 | 
			
		||||
include tests/source-files/firebase-suspect/build.gradle
 | 
			
		||||
include tests/source-files/flavor.test/build.gradle
 | 
			
		||||
include tests/source-files/info.guardianproject.ripple/build.gradle
 | 
			
		||||
include tests/source-files/lockfile.test/flutter/.dart_tool/flutter_gen/pubspec.yaml
 | 
			
		||||
include tests/source-files/lockfile.test/flutter/pubspec.lock
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -270,9 +270,10 @@ def get_gradle_compile_commands(build):
 | 
			
		|||
        'runtimeOnly',
 | 
			
		||||
    ]
 | 
			
		||||
    buildTypes = ['', 'release']
 | 
			
		||||
    flavors = ['']
 | 
			
		||||
    if build.gradle and build.gradle != ['yes']:
 | 
			
		||||
        flavors += build.gradle
 | 
			
		||||
        flavors = common.calculate_gradle_flavor_combination(build.gradle)
 | 
			
		||||
    else:
 | 
			
		||||
        flavors = ['']
 | 
			
		||||
 | 
			
		||||
    return [''.join(c) for c in itertools.product(flavors, buildTypes, compileCommands)]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1180,13 +1180,16 @@ def insert_localized_app_metadata(apps):
 | 
			
		|||
            destdir = os.path.join('repo', packageName, locale)
 | 
			
		||||
 | 
			
		||||
            # flavors specified in build receipt
 | 
			
		||||
            build_flavors = ""
 | 
			
		||||
            build_flavors = []
 | 
			
		||||
            if (
 | 
			
		||||
                apps[packageName]
 | 
			
		||||
                and len(apps[packageName].get('Builds', [])) > 0
 | 
			
		||||
                and 'gradle' in apps[packageName]['Builds'][-1]
 | 
			
		||||
                and apps[packageName]['Builds'][-1]['gradle'] != ['yes']
 | 
			
		||||
            ):
 | 
			
		||||
                build_flavors = apps[packageName]['Builds'][-1]['gradle']
 | 
			
		||||
                build_flavors = common.calculate_gradle_flavor_combination(
 | 
			
		||||
                    apps[packageName]['Builds'][-1]['gradle']
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
            if len(segments) >= 5 and segments[4] == "fastlane" and segments[3] not in build_flavors:
 | 
			
		||||
                logging.debug("ignoring due to wrong flavor")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								tests/source-files/flavor.test/build.gradle
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/source-files/flavor.test/build.gradle
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
dependenies {
 | 
			
		||||
    /// dependencies for app building
 | 
			
		||||
    fossImplementation 'com.android.support:multidex:1.0.2'
 | 
			
		||||
    implementation 'com.github.nextcloud:android-library:1.0.33'
 | 
			
		||||
    devImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' // use always latest master
 | 
			
		||||
    implementation "com.android.support:support-v4:${supportLibraryVersion}"
 | 
			
		||||
    prodImplementation "com.android.support:design:${supportLibraryVersion}"
 | 
			
		||||
    gplayImplementation 'com.jakewharton:disklrucache:2.0.2'
 | 
			
		||||
    implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
 | 
			
		||||
    gplayProdImplementation "com.android.support:cardview-v7:${supportLibraryVersion}"
 | 
			
		||||
    implementation "com.android.support:exifinterface:${supportLibraryVersion}"
 | 
			
		||||
    fossDevImplementation 'com.github.tobiasKaminsky:android-floating-action-button:1.10.2'
 | 
			
		||||
    gplayDevImplementation 'com.github.albfernandez:juniversalchardet:v2.0.0'
 | 
			
		||||
    fossProdImplementation 'com.google.code.findbugs:annotations:2.0.1'
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -107,11 +107,15 @@ class ScannerTest(unittest.TestCase):
 | 
			
		|||
            ('source-files/eu.siacs.conversations/build.gradle', 'free', 21),
 | 
			
		||||
            ('source-files/org.mozilla.rocket/app/build.gradle', 'focus', 40),
 | 
			
		||||
            ('source-files/com.jens.automation2/app/build.gradle', 'fdroidFlavor', 5),
 | 
			
		||||
            ('source-files/flavor.test/build.gradle', ['foss', 'prod'], 7),
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
        for f, flavor, count in test_files:
 | 
			
		||||
            i = 0
 | 
			
		||||
            build = fdroidserver.metadata.Build()
 | 
			
		||||
            if isinstance(flavor, list):
 | 
			
		||||
                build.gradle = flavor
 | 
			
		||||
            else:
 | 
			
		||||
                build.gradle = [flavor]
 | 
			
		||||
            regexs = fdroidserver.scanner.get_gradle_compile_commands_without_catalog(
 | 
			
		||||
                build
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue