mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 14:30:30 +03:00 
			
		
		
		
	Don't allow '_' in first place of version code
Fixes a regression of2cb0ff45. Example: versionCode project.versionCode_plus931b0a3087/app/build.gradle (L38)
This commit is contained in:
		
							parent
							
								
									a946ae2b44
								
							
						
					
					
						commit
						a9a336a12b
					
				
					 3 changed files with 23 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1579,7 +1579,7 @@ def remove_debuggable_flags(root_dir):
 | 
			
		|||
                        os.path.join(root, 'AndroidManifest.xml'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
vcsearch_g = re.compile(r'''\b[Vv]ersionCode\s*=?\s*["'(]*([0-9_]+)["')]*''').search
 | 
			
		||||
vcsearch_g = re.compile(r'''\b[Vv]ersionCode\s*=?\s*["'(]*([0-9][0-9_]*)["')]*''').search
 | 
			
		||||
vnsearch_g = re.compile(r'''\b[Vv]ersionName\s*=?\s*\(?(["'])((?:(?=(\\?))\3.)*?)\1''').search
 | 
			
		||||
vnssearch_g = re.compile(r'''\b[Vv]ersionNameSuffix\s*=?\s*(["'])((?:(?=(\\?))\3.)*?)\1''').search
 | 
			
		||||
psearch_g = re.compile(r'''\b(packageName|applicationId)\s*=*\s*["']([^"']+)["']''').search
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1222,6 +1222,19 @@ class CommonTest(unittest.TestCase):
 | 
			
		|||
        self.assertEqual(('20180430-underscore', '2018_04_30', 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore'),
 | 
			
		||||
                         fdroidserver.common.parse_androidmanifests(paths, app))
 | 
			
		||||
 | 
			
		||||
        app = fdroidserver.metadata.App()
 | 
			
		||||
        build = fdroidserver.metadata.Build()
 | 
			
		||||
        build.gradle = ['underscore_first']
 | 
			
		||||
        app['Builds'] = [build]
 | 
			
		||||
        app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first'
 | 
			
		||||
        paths = [
 | 
			
		||||
            os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'),
 | 
			
		||||
        ]
 | 
			
		||||
        for path in paths:
 | 
			
		||||
            self.assertTrue(os.path.isfile(path))
 | 
			
		||||
        self.assertEqual(('1.0', '1', 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first'),
 | 
			
		||||
                         fdroidserver.common.parse_androidmanifests(paths, app))
 | 
			
		||||
 | 
			
		||||
    def test_get_all_gradle_and_manifests(self):
 | 
			
		||||
        """Test whether the function works with relative and absolute paths"""
 | 
			
		||||
        a = fdroidserver.common.get_all_gradle_and_manifests(Path('source-files/cn.wildfirechat.chat'))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,15 @@ android {
 | 
			
		|||
            // Version code : 2018_04_30
 | 
			
		||||
            // Version name : 20180430-underscore
 | 
			
		||||
        }
 | 
			
		||||
        underscore_first {
 | 
			
		||||
            applicationIdSuffix = ".underscore_first"
 | 
			
		||||
            versionCode _04_30
 | 
			
		||||
            buildConfigField "boolean", "FULL_VERSION", "true"
 | 
			
		||||
            buildConfigField "boolean", "CLOSED_STORE", "true"
 | 
			
		||||
            // ApplicationId : com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first
 | 
			
		||||
            // Version code : 1
 | 
			
		||||
            // Version name : 1.0
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue