diff --git a/app/BUILD.bazel b/app/BUILD.bazel index 02534a05c75..0589cd75b45 100644 --- a/app/BUILD.bazel +++ b/app/BUILD.bazel @@ -671,6 +671,9 @@ kt_android_library( ":views", "//data/src/main/java/org/oppia/android/data/backends/gae:network_config_prod_module", "//data/src/main/java/org/oppia/android/data/backends/gae:prod_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:logger_module", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_module", "//model:arguments_java_proto_lite", "//third_party:androidx_databinding_databinding-adapters", "//third_party:androidx_databinding_databinding-common", diff --git a/domain/BUILD.bazel b/domain/BUILD.bazel index 034a1425570..b291178ff02 100755 --- a/domain/BUILD.bazel +++ b/domain/BUILD.bazel @@ -14,6 +14,7 @@ load("//domain:domain_test.bzl", "domain_test") # top-level module library. MIGRATED_PROD_FILES = glob([ "src/main/java/org/oppia/android/domain/feedbackreporting/*.kt", + "src/main/java/org/oppia/android/domain/oppialogger/**/*.kt", "src/main/java/org/oppia/android/domain/util/*.kt", ]) @@ -82,6 +83,10 @@ kt_android_library( ":dagger", "//data/src/main/java/org/oppia/android/data/backends/gae/api", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_factory", "//domain/src/main/java/org/oppia/android/domain/util:asset", "//domain/src/main/java/org/oppia/android/domain/util:extensions", "//domain/src/main/java/org/oppia/android/domain/util:retriever", @@ -134,6 +139,9 @@ TEST_DEPS = [ "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/feedbackreporting:prod_module", "//domain/src/main/java/org/oppia/android/domain/feedbackreporting:report_schema_version", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_factory", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader:worker_module", "//testing", "//testing/src/main/java/org/oppia/android/testing/network:network", "//testing/src/main/java/org/oppia/android/testing/network:test_module", diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel new file mode 100644 index 00000000000..2da3221e0f0 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/BUILD.bazel @@ -0,0 +1,40 @@ +""" +Package for providing logging support. +""" + +load("@dagger//:workspace_defs.bzl", "dagger_rules") +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "oppia_logger", + srcs = [ + "OppiaLogger.kt", + ], + visibility = ["//domain:__pkg__"], + deps = [ + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:controller", + "//model:event_logger_java_proto_lite", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + ], +) + +kt_android_library( + name = "startup_listener", + srcs = [ + "ApplicationStartupListener.kt", + ], + visibility = ["//:oppia_api_visibility"], +) + +kt_android_library( + name = "storage_module", + srcs = [ + "LogStorageModule.kt", + ], + visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], + deps = [ + ":dagger", + ], +) + +dagger_rules() diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel new file mode 100644 index 00000000000..b50d6a3f0b9 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel @@ -0,0 +1,23 @@ +""" +Package for providing logging support for analytics events. +""" + +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "controller", + srcs = [ + "AnalyticsController.kt", + ], + visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], + deps = [ + "//data/src/main/java/org/oppia/android/data/persistence:cache_store", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:storage_module", + "//model:event_logger_java_proto_lite", + "//utility/src/main/java/org/oppia/android/util/data:data_provider", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/logging:event_logger", + "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", + "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", + ], +) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/BUILD.bazel new file mode 100644 index 00000000000..773f17174de --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/BUILD.bazel @@ -0,0 +1,52 @@ +""" +Package for providing logging support for exceptions. +""" + +load("@dagger//:workspace_defs.bzl", "dagger_rules") +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "controller", + srcs = [ + "ExceptionsController.kt", + ], + visibility = ["//domain:__subpackages__"], + deps = [ + "//data/src/main/java/org/oppia/android/data/persistence:cache_store", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:storage_module", + "//model:event_logger_java_proto_lite", + "//utility/src/main/java/org/oppia/android/util/data:data_provider", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", + "//utility/src/main/java/org/oppia/android/util/networking:network_connection_util", + "//utility/src/main/java/org/oppia/android/util/system:oppia_clock", + ], +) + +kt_android_library( + name = "logger_module", + srcs = [ + "UncaughtExceptionLoggerModule.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + ":dagger", + ":startup_listener", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + ], +) + +kt_android_library( + name = "startup_listener", + srcs = [ + "UncaughtExceptionLoggerStartupListener.kt", + ], + visibility = ["//:oppia_testing_visibility"], + deps = [ + ":controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + ], +) + +dagger_rules() diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel new file mode 100644 index 00000000000..fe704893955 --- /dev/null +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/BUILD.bazel @@ -0,0 +1,62 @@ +""" +Package for providing log uploading functionality. +""" + +load("@dagger//:workspace_defs.bzl", "dagger_rules") +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") + +kt_android_library( + name = "initializer", + srcs = [ + "LogUploadWorkManagerInitializer.kt", + ], + deps = [ + ":worker", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + "//third_party:androidx_work_work-runtime-ktx", + "//utility/src/main/java/org/oppia/android/util/logging:log_uploader", + ], +) + +kt_android_library( + name = "worker", + srcs = [ + "LogUploadWorker.kt", + ], + deps = [ + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:controller", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions:controller", + "//third_party:androidx_work_work-runtime-ktx", + "//utility/src/main/java/org/oppia/android/util/logging:console_logger", + "//utility/src/main/java/org/oppia/android/util/logging:event_logger", + "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", + "//utility/src/main/java/org/oppia/android/util/threading:annotations", + ], +) + +kt_android_library( + name = "worker_factory", + srcs = [ + "LogUploadWorkerFactory.kt", + ], + visibility = ["//domain:__pkg__"], + deps = [ + ":worker", + "//third_party:androidx_work_work-runtime-ktx", + ], +) + +kt_android_library( + name = "worker_module", + srcs = [ + "LogUploadWorkerModule.kt", + ], + visibility = ["//:oppia_api_visibility"], + deps = [ + ":dagger", + ":initializer", + "//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener", + ], +) + +dagger_rules()