mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 23:03:00 +00:00 
			
		
		
		
	Merge pull request #3133 from Stypox/gradle-app-id-suffix
Change app id based on current git branch
This commit is contained in:
		| @@ -3,12 +3,31 @@ apply plugin: 'kotlin-android' | |||||||
| apply plugin: 'kotlin-android-extensions' | apply plugin: 'kotlin-android-extensions' | ||||||
| apply plugin: 'kotlin-kapt' | apply plugin: 'kotlin-kapt' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static String getGitWorkingBranch() { | ||||||
|  |     try { | ||||||
|  |         def gitProcess = "git rev-parse --abbrev-ref HEAD".execute() | ||||||
|  |         gitProcess.waitFor() | ||||||
|  |         if (gitProcess.exitValue() == 0) { | ||||||
|  |             return gitProcess.text.trim() | ||||||
|  |         } else { | ||||||
|  |             // not a git repository | ||||||
|  |             return "" | ||||||
|  |         } | ||||||
|  |     } catch (IOException ignored) { | ||||||
|  |         // git was not found | ||||||
|  |         return "" | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| android { | android { | ||||||
|     compileSdkVersion 28 |     compileSdkVersion 28 | ||||||
|     buildToolsVersion '28.0.3' |     buildToolsVersion '28.0.3' | ||||||
|  |  | ||||||
|     defaultConfig { |     defaultConfig { | ||||||
|         applicationId "org.schabi.newpipe" |         applicationId "org.schabi.newpipe" | ||||||
|  |         resValue "string", "app_name", "NewPipe" | ||||||
|         minSdkVersion 19 |         minSdkVersion 19 | ||||||
|         targetSdkVersion 28 |         targetSdkVersion 28 | ||||||
|         versionCode 860 |         versionCode 860 | ||||||
| @@ -28,7 +47,18 @@ android { | |||||||
|         debug { |         debug { | ||||||
|             multiDexEnabled true |             multiDexEnabled true | ||||||
|             debuggable true |             debuggable true | ||||||
|  |  | ||||||
|  |             // suffix the app id and the app name with git branch name | ||||||
|  |             def workingBranch = getGitWorkingBranch() | ||||||
|  |             def normalizedWorkingBranch = workingBranch.replaceAll("[^A-Za-z]+", "").toLowerCase() | ||||||
|  |             if (normalizedWorkingBranch.isEmpty() || workingBranch == "master" || workingBranch == "dev") { | ||||||
|  |                 // default values when branch name could not be determined or is master or dev | ||||||
|                 applicationIdSuffix ".debug" |                 applicationIdSuffix ".debug" | ||||||
|  |                 resValue "string", "app_name", "NewPipe Debug" | ||||||
|  |             } else { | ||||||
|  |                 applicationIdSuffix ".debug." + normalizedWorkingBranch | ||||||
|  |                 resValue "string", "app_name", "NewPipe " + workingBranch | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,17 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <manifest |  | ||||||
|     xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     xmlns:tools="http://schemas.android.com/tools" |  | ||||||
|     package="org.schabi.newpipe"> |  | ||||||
|  |  | ||||||
|     <application |  | ||||||
|         android:name=".DebugApp" |  | ||||||
|         android:label="NewPipe Debug" |  | ||||||
|         tools:replace="android:name, android:label"> |  | ||||||
|         <activity |  | ||||||
|             android:name=".MainActivity" |  | ||||||
|             android:label="NewPipe Debug" |  | ||||||
|             tools:replace="android:label"/> |  | ||||||
|     </application> |  | ||||||
|  |  | ||||||
| </manifest> |  | ||||||
| @@ -1,6 +1,5 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <resources> | <resources> | ||||||
|     <string name="app_name" translatable="false">NewPipe</string> |  | ||||||
|     <string name="main_bg_subtitle">Tap \"Search\" to get started</string> |     <string name="main_bg_subtitle">Tap \"Search\" to get started</string> | ||||||
|     <string name="view_count_text">%1$s views</string> |     <string name="view_count_text">%1$s views</string> | ||||||
|     <string name="upload_date_text">Published on %1$s</string> |     <string name="upload_date_text">Published on %1$s</string> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tobias Groza
					Tobias Groza