Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add branch info into release builds #4141

Open
avently opened this issue Aug 16, 2020 · 5 comments
Open

Add branch info into release builds #4141

avently opened this issue Aug 16, 2020 · 5 comments
Labels
feature request Issue is related to a feature in the app meta Related to the project but not strictly to code

Comments

@avently
Copy link
Contributor

avently commented Aug 16, 2020

Describe the feature you want

I want to see support of custom branches (i.e. branches for PR makers) inside release part of build.gradle file. For now there is only such support for debug build type but not for release.

Is your feature request related to a problem? Please describe it

Right now when I make some code changes for PR I have to specify

resValue "string", "app_name", "NewPipe Feature name"
applicationIdSuffix ".mysuffix"

here: https://github.com/TeamNewPipe/NewPipe/blob/dev/app/build.gradle#L55

Because users asks me about release build instead of debug build. Debug build is terribly slow because of enabled debugging (this is expected behaviour for all apps).

Additional context

Just make the same thing from debug build with release build (set resValue and applicationIdSuffix if workingBranch != "master" && workingBranch != "dev")

How will you/everyone benefit from this feature?

Developers will not need to write this info for every PR they do after you make proposed change.

@avently avently added the feature request Issue is related to a feature in the app label Aug 16, 2020
@wb9688
Copy link
Contributor

wb9688 commented Aug 16, 2020

Note how it'll also still need to work for F-Droid, which will check out a certain tag, which might not be the latest commit on master.

@opusforlife2
Copy link
Collaborator

Developers will not need to write this info for every PR they do after you make proposed change.

At the very least, in case this change risks disrupting anything, as a last resort the build.gradle could have this code in comments

/*
applicationIdSuffix ".debug." + normalizedWorkingBranch
resValue "string", "app_name", "NewPipe " + workingBranch
archivesBaseName = 'NewPipe_' + normalizedWorkingBranch
*/

so that it takes marginally less work than before.

@avently
Copy link
Contributor Author

avently commented Aug 17, 2020

@wb9688 then there is another way: just to add a new build configuration which can be used by devs. It should be inherited from "release". Something like "releaseLocally".

@opusforlife2
Copy link
Collaborator

@TobiGr Ja?

@Stypox Stypox added the meta Related to the project but not strictly to code label Sep 3, 2020
@TobiGr
Copy link
Member

TobiGr commented Sep 27, 2020

    pr {
           multiDexEnabled true

           // suffix the app id and the app name with git branch name
           def workingBranch = getGitWorkingBranch()
           def normalizedWorkingBranch = workingBranch.replaceFirst("^[^A-Za-z]+", "").replaceAll("[^0-9A-Za-z]+", "")
           if (normalizedWorkingBranch.isEmpty() || workingBranch == "master" || workingBranch == "dev") {
               // default values when branch name could not be determined or is master or dev
               applicationIdSuffix ".releaseTest"
               resValue "string", "app_name", "NewPipe Test"
           } else {
               applicationIdSuffix "." + normalizedWorkingBranch
               resValue "string", "app_name", "NewPipe " + workingBranch
               archivesBaseName = 'NewPipe_' + normalizedWorkingBranch
           }
       }

Apart from that, we also need to change

public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");

not sure, what else needs to be changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app meta Related to the project but not strictly to code
Projects
None yet
Development

No branches or pull requests

5 participants