Skip to content

Commit

Permalink
Fix oppia#2585: Adding BUILD.bazel in //app/viewmodel/ (oppia#2648)
Browse files Browse the repository at this point in the history
* Adding BUILD.bazel in app//viewmodel

* Reformatted to alphabetical order

* Adding target deps

* Resolving Requested changes

* lexicographic ordering in deps

* Resolving requested changes

* replacing with third party wrapper

* Added Doc for viewmodel/BUILD.bazel

* Excluding from the glob

* Update app/BUILD.bazel

Co-authored-by: Ben Henning <henning.benmax@gmail.com>

Co-authored-by: Ben Henning <henning.benmax@gmail.com>
  • Loading branch information
FareesHussain and BenHenning authored Feb 23, 2021
1 parent 6107ecd commit a70d9b0
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ package(default_visibility = ["//utility:__subpackages__"])

exports_files(["src/main/AndroidManifest.xml"])

# Source files for the migrated source files library. The files inside the migrated source files
# library are dependencies in app module that have their own libraries.
# Place your files here if:
# - A file of any type has their own BAZEL library
# NOTE: if the file is added here make sure to remove this from the other sub lists
# of EXCLUDED_APP_LIB_FILES.

# keep sorted
MIGRATED_SOURCE_FILES = [
"src/main/java/org/oppia/android/app/viewmodel/ObservableArrayList.kt",
"src/main/java/org/oppia/android/app/viewmodel/ObservableViewModel.kt",
]

# Source files for the annotations library. The files inside the annotations library are dependencies
# for all other libraries in app module, except the listeners library.
# Place your file here if:
Expand Down Expand Up @@ -246,8 +259,6 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/topic/revision/TopicRevisionViewModel.kt",
"src/main/java/org/oppia/android/app/topic/revisioncard/RevisionCardViewModel.kt",
"src/main/java/org/oppia/android/app/topic/TopicViewModel.kt",
"src/main/java/org/oppia/android/app/viewmodel/ObservableArrayList.kt",
"src/main/java/org/oppia/android/app/viewmodel/ObservableViewModel.kt",
"src/main/java/org/oppia/android/app/walkthrough/end/WalkthroughFinalViewModel.kt",
"src/main/java/org/oppia/android/app/walkthrough/topiclist/topiclistviewmodel/WalkthroughTopicHeaderViewModel.kt",
"src/main/java/org/oppia/android/app/walkthrough/topiclist/topiclistviewmodel/WalkthroughTopicSummaryViewModel.kt",
Expand Down Expand Up @@ -406,7 +417,7 @@ SNAP_HELPER = ["src/main/java/org/oppia/android/app/recyclerview/StartSnapHelper
# - annotations
# - binding_adapters

EXCLUDED_APP_LIB_FILES = VIEW_MODELS + VIEW_MODELS_WITH_RESOURCE_IMPORTS + VIEWS + VIEWS_WITH_RESOURCE_IMPORTS + BINDING_ADAPTERS + BINDING_ADAPTERS_WITH_RESOURCE_IMPORTS + LISTENERS + ANNOTATIONS + SNAP_HELPER
EXCLUDED_APP_LIB_FILES = VIEW_MODELS + VIEW_MODELS_WITH_RESOURCE_IMPORTS + VIEWS + VIEWS_WITH_RESOURCE_IMPORTS + BINDING_ADAPTERS + BINDING_ADAPTERS_WITH_RESOURCE_IMPORTS + LISTENERS + ANNOTATIONS + SNAP_HELPER + MIGRATED_SOURCE_FILES

# Files to be built by the app library. All of these files are assumed to have resource imports and
# will be processed by the app library genrule regardless in order to avoid any import issues.
Expand Down Expand Up @@ -548,6 +559,9 @@ kt_android_library(
":dagger",
":listeners",
":resources",
"//app/src/main/java/org/oppia/android/app/viewmodel:observable_array_list",
"//app/src/main/java/org/oppia/android/app/viewmodel:observable_view_model",
"//app/src/main/java/org/oppia/android/app/viewmodel:view_model_provider",
"//domain",
"//model",
"//third_party:androidx_databinding_databinding-common",
Expand Down
42 changes: 42 additions & 0 deletions app/src/main/java/org/oppia/android/app/viewmodel/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Utilities corresponding to simplify using Jetpack's view model functionality.
"""

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")

kt_android_library(
name = "observable_array_list",
srcs = [
"ObservableArrayList.kt",
],
visibility = ["//visibility:public"],
deps = [
"//third_party:androidx_databinding_databinding-adapters",
],
)

kt_android_library(
name = "observable_view_model",
srcs = [
"ObservableViewModel.kt",
],
visibility = ["//visibility:public"],
deps = [
"//third_party:androidx_databinding_databinding-adapters",
"//third_party:androidx_lifecycle_lifecycle-extensions",
],
)

kt_android_library(
name = "view_model_provider",
srcs = [
"ViewModelBridgeFactory.kt",
"ViewModelProvider.kt",
],
visibility = ["//visibility:public"],
deps = [
"//third_party:androidx_appcompat_appcompat",
"//third_party:androidx_lifecycle_lifecycle-extensions",
"//third_party:javax_inject_javax_inject",
],
)
1 change: 1 addition & 0 deletions third_party/versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ MAVEN_PRODUCTION_DEPENDENCY_VERSIONS = {
"de.hdodenhof:circleimageview": "3.0.1",
"io.fabric.sdk.android:fabric": "1.4.7",
"javax.annotation:javax.annotation-api:jar": "1.3.2",
"javax.inject:javax.inject": "1",
"nl.dionsegijn:konfetti": "1.2.5",
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar": "1.3.72",
"org.jetbrains.kotlinx:kotlinx-coroutines-android": "1.3.2",
Expand Down

0 comments on commit a70d9b0

Please sign in to comment.