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

Fixes #2881: Creating BUILD.bazel for statusbar utility #2959

Merged
merged 10 commits into from
Apr 29, 2021

Conversation

Arjupta
Copy link
Contributor

@Arjupta Arjupta commented Mar 21, 2021

Explanation

Fixes #2881 by creating a BUILD.bazel file

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

@Arjupta Arjupta requested a review from rt4914 as a code owner March 21, 2021 20:57
@anandwana001
Copy link
Contributor

@Arjupta Please complete all the installation steps - https://github.com/oppia/oppia-android/wiki#installation

@Arjupta
Copy link
Contributor Author

Arjupta commented Mar 22, 2021

@Arjupta Please complete all the installation steps - https://github.com/oppia/oppia-android/wiki#installation

I have completed the setup again, but it isn't formatting the Bazel files as needed. Any hints ?

visibility = ["//:oppia_api_visibility"],
deps = [
"//third_party:androidx_appcompat_appcompat",
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
]
],

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for now, this will fix it. I will create a bazel lint guide in our wiki this week.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, by the time you can setup this, if you are not on windows - https://formulae.brew.sh/formula-linux/buildifier

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also used buildifier earlier, but it was just mentioning that there is a some lint failure in both the BUILD.bazel files I have changed. It was not actually pointing out the cause of failure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildifier has a different type of output while sending error, like #reformat. Will try to cover all possible cases in wiki page.
by the time, if you want to check what command we run in checks, you can look at this script - https://github.com/oppia/oppia-android/blob/develop/scripts/buildifier_lint_check.sh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Arjupta you can run buildifier on the file itself to let buildifier format the file.

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bazel lint successfully pass

@@ -51,6 +52,7 @@ kt_android_library(
"//third_party:com_google_guava_guava",
"//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-core",
"//utility/src/main/java/org/oppia/android/util/datetime:date_time_util",
"//utility/src/main/java/org/oppia/android/util/statusbar:status_bar_color",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try moving this dependency directly to the app module? I don't see any intradependency on this library in the utility module.

@fsharpasharp
Copy link
Contributor

Hi @Arjupta, are you still working on this? Let me know if you need any clarification on my part.

@Arjupta
Copy link
Contributor Author

Arjupta commented Apr 7, 2021

Hi @Arjupta, are you still working on this? Let me know if you need any clarification on my part.

Yes, please explain a bit, why a dependency from utility module must be taken up to the app module.

@fsharpasharp
Copy link
Contributor

Ultimately, we will be removing the utility library. So whichever package needs the statusbar utility will directly add that to its list of dependencies. Eventually we will also be modularizing the app module, but by adding this dependency to the app library, we remove one layer of indirection.

Right now it looks like this

statusbar <- utility <- app

we can remove one layer and let app depend on statusbar

statusbar <- app

@Arjupta
Copy link
Contributor Author

Arjupta commented Apr 16, 2021

Ultimately, we will be removing the utility library. So whichever package needs the statusbar utility will directly add that to its list of dependencies. Eventually we will also be modularizing the app module, but by adding this dependency to the app library, we remove one layer of indirection.

Right now it looks like this

statusbar <- utility <- app

we can remove one layer and let app depend on statusbar

statusbar <- app

Pardon for the delay, @fsharpasharp I have been busy with GSOC proposal all this time.

I understand what you are trying to do finally. But where do we include statusBarUtility in the app module. It is used by several activities like onboarding, profile, walkthrough. Also in this branch all these files don't have their own BUILD.bazel . What do you suggest to do?

@Arjupta Arjupta removed their assignment Apr 16, 2021
@fsharpasharp
Copy link
Contributor

Ultimately, we will be removing the utility library. So whichever package needs the statusbar utility will directly add that to its list of dependencies. Eventually we will also be modularizing the app module, but by adding this dependency to the app library, we remove one layer of indirection.
Right now it looks like this
statusbar <- utility <- app
we can remove one layer and let app depend on statusbar
statusbar <- app

Pardon for the delay, @fsharpasharp I have been busy with GSOC proposal all this time.

I understand what you are trying to do finally. But where do we include statusBarUtility in the app module. It is used by several activities like onboarding, profile, walkthrough. Also in this branch all these files don't have their own BUILD.bazel . What do you suggest to do?

Yes, for now we'll just add the dependency to the app library of app/BUILD.bazel, but eventually we will also create BUILD.bazel files for each package.

@Arjupta
Copy link
Contributor Author

Arjupta commented Apr 16, 2021

Ultimately, we will be removing the utility library. So whichever package needs the statusbar utility will directly add that to its list of dependencies. Eventually we will also be modularizing the app module, but by adding this dependency to the app library, we remove one layer of indirection.
Right now it looks like this
statusbar <- utility <- app
we can remove one layer and let app depend on statusbar
statusbar <- app

Pardon for the delay, @fsharpasharp I have been busy with GSOC proposal all this time.
I understand what you are trying to do finally. But where do we include statusBarUtility in the app module. It is used by several activities like onboarding, profile, walkthrough. Also in this branch all these files don't have their own BUILD.bazel . What do you suggest to do?

Yes, for now we'll just add the dependency to the app library of app/BUILD.bazel, but eventually we will also create BUILD.bazel files for each package.

Will we need to make a new library for this? I wasn't able to find a place where this status bar utility can be added as a dependecy. This is because status bar utility is only used by Presenters in our codebase and we don't have any separate library for presenters i guess.

@fsharpasharp
Copy link
Contributor

Ultimately, we will be removing the utility library. So whichever package needs the statusbar utility will directly add that to its list of dependencies. Eventually we will also be modularizing the app module, but by adding this dependency to the app library, we remove one layer of indirection.
Right now it looks like this
statusbar <- utility <- app
we can remove one layer and let app depend on statusbar
statusbar <- app

Pardon for the delay, @fsharpasharp I have been busy with GSOC proposal all this time.
I understand what you are trying to do finally. But where do we include statusBarUtility in the app module. It is used by several activities like onboarding, profile, walkthrough. Also in this branch all these files don't have their own BUILD.bazel . What do you suggest to do?

Yes, for now we'll just add the dependency to the app library of app/BUILD.bazel, but eventually we will also create BUILD.bazel files for each package.

Will we need to make a new library for this? I wasn't able to find a place where this status bar utility can be added as a dependecy. This is because status bar utility is only used by Presenters in our codebase and we don't have any separate library for presenters i guess.

Does it work when you add the dependency to this library?

kt_android_library(
    name = "app",
    srcs = APP_FILES,
    custom_package = "org.oppia.android.app.ui",
    enable_data_binding = 1,
    manifest = "src/main/AppAndroidManifest.xml",
    visibility = ["//visibility:public"],
    deps = [
        ":binding_adapters",
        ":dagger",
        ":databinding_resources",
        ":resources",
        ":view_models",
        ":views",
        "//data/src/main/java/org/oppia/android/data/backends/gae:prod_module",
        "//model",
        "//third_party:androidx_databinding_databinding-adapters",
        "//third_party:androidx_databinding_databinding-common",
        "//third_party:androidx_databinding_databinding-runtime",
        "//third_party:androidx_lifecycle_lifecycle-extensions",
        "//third_party:androidx_lifecycle_lifecycle-livedata-core",
        "//third_party:androidx_lifecycle_lifecycle-livedata-ktx",
        "//third_party:androidx_multidex_multidex",
        "//third_party:androidx_viewpager2_viewpager2",
        "//third_party:androidx_viewpager_viewpager",
        "//third_party:androidx_work_work-runtime-ktx",
        "//third_party:com_caverock_androidsvg-aar",
        "//third_party:com_google_android_flexbox",
        "//third_party:javax_annotation_javax_annotation-api_jar",
        "//utility",
        "//utility/src/main/java/org/oppia/android/util/accessibility:prod_module",
        "//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions",
    ],
)

@Arjupta
Copy link
Contributor Author

Arjupta commented Apr 20, 2021

Commited this change. @fsharpasharp PTAL

@Arjupta Arjupta requested review from fsharpasharp and removed request for fsharpasharp April 21, 2021 12:45
@@ -16,7 +16,6 @@ MIGRATED_PROD_FILES = glob([
"src/main/java/org/oppia/android/util/profile/*.kt",
"src/main/java/org/oppia/android/util/datetime/*.kt",
"src/main/java/org/oppia/android/util/system/*.kt",
"src/main/java/org/oppia/android/util/statusbar/*.kt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Arjupta
Copy link
Contributor Author

Arjupta commented Apr 24, 2021

@fsharpasharp PTAL

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this I will have to differ to @fsharpasharp and @BenHenning

@rt4914 rt4914 removed their assignment Apr 26, 2021
Copy link
Sponsor Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Arjupta! Just had one comment.

Also, @rt4914 codeowners is interesting here. I think I need to move the Bazel file ownership to be at the end of the codeowners file so that local directory ownership is overwritten (at least until the team's comfort with Bazel is increased).

@Arjupta Arjupta assigned BenHenning and unassigned Arjupta Apr 28, 2021
@Arjupta
Copy link
Contributor Author

Arjupta commented Apr 28, 2021

@BenHenning PTAL. Also the check which failed right now was not failing in the previous commit, the only change that was done in the latest commit was to change the desctiption of BUILD.bazel.

Copy link
Sponsor Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Arjupta. I agree that the failure is unrelated, though it's surprising. This is the first time I've noticed a flake in ExplorationActivityTest. We'll need to keep an eye out for this.

@BenHenning BenHenning merged commit aac8348 into oppia:develop Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a BUILD.bazel file for the statusbar package in the utility module
5 participants