-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes part of #59: Utility module source files build with both Bazel …
…+ Gradle [BLOCKED: #1481] (#1482) * Working on having one module build with bazel * Created initial app-level WORKSPACE file * Added proto_library rule to build model app module * Added newline at end of WORKSPACE file * Created macro to process proto files * Both Bazel and Gradle now build /model successfully * Fixed typo in BUILD * Added missing end of file empty lines * Added Robolectric dependencies and general build rule * Source files building in both systems - added a TODO for test files * Turned two kt_android_library rules into one * Added dependencies for test files * Added a test manifest for android_local_test() * Added Firebase dependencies and git_repository for tools_android * Refactored google-services.json, imported new dependencies * Fixed Bens nits * Fixed space in WORKSPACE comment * Got a demo test working in both Java and Kotlin * Added rules_java dependencies for protocol buffers * Added java_proto_library rules, each proto file now has its own rule * Remove unnecessary srcs attribute for android_library * Rename bzl file macro * Changed to java_lite * Each library now has its own build rule * Utility is now one rule * Changed visibility for utility_lib * Added duplicate google-services.json file to please Gradle * Changed event_logger.proto to oppia_logger.proto * Added missing EOF newlines * Fixed bug in import statements for exploration.proto, topic.proto, and question.proto * Deleted DemoJava * CHanged rules_kotlin version * Added Firebase dependencies * Removed AsyncResultTest example * Removed unnecessary comments in WORKSPACE and moved rules_kotlin * Added re-naming TODOs * Renamed java_proto rules java_proto_lite * Added doc comments to model/BUILD.bazel and format_import_proto_library * Added comments to WORKSPACE file * Fixed nits * Added comment to kt_android_library() rule * Fixed more nits * Added Firebase comment * Changed library name to model * Formatted WORKSPACE comment * Formatted TODO statement * Changed format_import_proto_library comment * Added EOF newline * Created Issue and linked TODO in WORKSPACE * Edited model BUILD file top comment * Addressed nits * Fixed nits and added comments * Fixing nits * Deleted unnecessary dependencies and testing example file * Fixed manifest issues * Move google json file * Restore app version of json * Edit TODO * Deleted TODO * Changed Firebase comment * Added targetSDK to manifests * Changed crashlytics_lib to crashlytics * Fixed nits and added TODOs * Changed targetSDK to 29 * Formatted TODO * Moved google-services.json * Added gogle-services.json back to app * Formatted dependencies and removed unused dependency * Updated dependency list * Fixed the duplicate google-services.json issue * Created Issue and added TODO * Changed targetSdk to 28
- Loading branch information
Showing
5 changed files
with
152 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# TODO(#1532): Rename file to 'BUILD' post-Gradle. | ||
''' | ||
Package for all Firebase dependencies. | ||
To reference these dependencies, add '//app:crashlytics' and '//app:crashlytics_deps' | ||
to your build rule's dependency list. | ||
''' | ||
load("@rules_jvm_external//:defs.bzl", "artifact") | ||
load("@dagger//:workspace_defs.bzl", "dagger_rules") | ||
load("@tools_android//tools/crashlytics:defs.bzl", "crashlytics_android_library") | ||
load("@tools_android//tools/googleservices:defs.bzl", "google_services_xml") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
# TODO(#1566): Move Firebase rules to their own package | ||
GOOGLE_SERVICES_RESOURCES = google_services_xml( | ||
package_name = "org.oppia.app", | ||
google_services_json = "google-services.json", | ||
) | ||
|
||
crashlytics_android_library( | ||
name = "crashlytics", | ||
package_name = "org.oppia.app", | ||
build_id = "48fc9d17-e102-444c-8e0d-638d75ec0942", | ||
resource_files = GOOGLE_SERVICES_RESOURCES, | ||
) | ||
|
||
android_library( | ||
name = "crashlytics_deps", | ||
exports = [ | ||
artifact("com.crashlytics.sdk.android:crashlytics"), | ||
artifact("io.fabric.sdk.android:fabric"), | ||
artifact("com.google.firebase:firebase-analytics"), | ||
artifact("com.google.firebase:firebase-crashlytics"), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# TODO(#1532): Rename file to 'BUILD' post-Gradle. | ||
''' | ||
This library contains utilities that all other modules, minus model, depend on. | ||
It also contains Robolectric and JUnit tests for it's utilities. | ||
In Bazel, Kotlin source files are built into a library using the kt_android_library() rule. | ||
Kotlin test files must be built in their own kt_android_library() rule and added as a dependency to | ||
an android_local_test() rule which configures instrumentation tests in Bazel. | ||
''' | ||
|
||
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library") | ||
load("@rules_jvm_external//:defs.bzl", "artifact") | ||
load("@dagger//:workspace_defs.bzl", "dagger_rules") | ||
|
||
# Library for general-purpose utilities. | ||
kt_android_library( | ||
name = "utility", | ||
custom_package = "org.oppia.util", | ||
srcs = glob(["src/main/java/org/oppia/util/**/*.kt"]), | ||
resource_files = glob(["src/main/res/**/*.xml"]), | ||
manifest = "src/main/AndroidManifest.xml", | ||
deps = [ | ||
":dagger", | ||
"//model", | ||
"//app:crashlytics", | ||
"//app:crashlytics_deps", | ||
artifact("org.jetbrains.kotlinx:kotlinx-coroutines-core"), | ||
artifact("androidx.appcompat:appcompat"), | ||
artifact("com.github.bumptech.glide:glide"), | ||
artifact("com.caverock:androidsvg-aar"), | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
# TODO(#59): Write a kt_android_library() rule to build test files and an android_local_test() rule. | ||
''' | ||
Because test files depend on the testing module source files being built, these rules have been left | ||
for a later PR. | ||
''' | ||
|
||
dagger_rules() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
<manifest package="org.oppia.util"/> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.oppia.util"> | ||
<uses-sdk android:minSdkVersion="19" | ||
android:targetSdkVersion="28" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.oppia.util"> | ||
<uses-sdk android:minSdkVersion="19" | ||
android:targetSdkVersion="28" /> | ||
</manifest> |