Skip to content

Commit

Permalink
Undo executors, Kotlin upgrade, and dynamic xform.
Browse files Browse the repository at this point in the history
This undoes the work of PRs #4484 and others not yet created in order to
isolate the expanded translations support directly off of the develop
branch to expedite getting it finished for the upcoming beta release.
  • Loading branch information
BenHenning committed Sep 5, 2022
1 parent 6727b25 commit bbc6b16
Show file tree
Hide file tree
Showing 288 changed files with 9,572 additions and 10,835 deletions.
89 changes: 18 additions & 71 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file lists and imports all external dependencies needed to build Oppia Andr

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_jar")
load("//third_party:versions.bzl", "HTTP_DEPENDENCY_VERSIONS", "MAVEN_REPOSITORIES", "get_maven_dependencies")
load("//third_party:versions.bzl", "HTTP_DEPENDENCY_VERSIONS", "get_maven_dependencies")

# Android SDK configuration. For more details, see:
# https://docs.bazel.build/versions/master/be/android.html#android_sdk_repository
Expand All @@ -30,11 +30,16 @@ http_archive(
urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/%s/rules_kotlin_release.tgz" % HTTP_DEPENDENCY_VERSIONS["rules_kotlin"]["version"]],
)

load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
# TODO(#1535): Remove once rules_kotlin is released because these lines become unnecessary
load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies")

kt_download_local_dev_dependencies()

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

kotlin_repositories()

register_toolchains("//tools/kotlin:kotlin_16_toolchain")
kt_register_toolchains()

# The proto_compiler and proto_java_toolchain bindings load the protos rules needed for the model
# module while helping us avoid the unnecessary compilation of protoc. Referecences:
Expand Down Expand Up @@ -91,7 +96,6 @@ load("@dagger//:workspace_defs.bzl", "DAGGER_ARTIFACTS", "DAGGER_REPOSITORIES")
# Add support for Robolectric: https://github.com/robolectric/robolectric-bazel
http_archive(
name = "robolectric",
sha256 = "af0177d32ecd2cd68ee6e9f5d38288e1c4de0dd2a756bb7133c243f2d5fe06f7",
strip_prefix = "robolectric-bazel-4.5",
urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.5.tar.gz"],
)
Expand All @@ -105,7 +109,6 @@ git_repository(
name = "tools_android",
commit = "00e6f4b7bdd75911e33c618a9bc57bab7a6e8930",
remote = "https://github.com/bazelbuild/tools_android",
shallow_since = "1594238320 -0400",
)

load("@tools_android//tools/googleservices:defs.bzl", "google_services_workspace_dependencies")
Expand All @@ -116,7 +119,6 @@ git_repository(
name = "circularimageview",
commit = "35d08ba88a4a22e6e9ac96bdc5a68be27b55d09f",
remote = "https://github.com/oppia/CircularImageview",
shallow_since = "1622148929 -0700",
)

# A custom version of Android SVG is needed since custom changes needed to be added to the library
Expand All @@ -130,16 +132,11 @@ git_repository(

# A custom fork of KotliTeX that removes resources artifacts that break the build, and updates the
# min target SDK version to be compatible with Oppia.
#git_repository(
# name = "kotlitex",
# commit = "0091f4979b81a860d68021e7f3653a8896fe6b3e",
# remote = "https://github.com/oppia/kotlitex",
# shallow_since = "1658115608 -0700",
#)
# TODO: Revert.
local_repository(
git_repository(
name = "kotlitex",
path = "/home/ben/opensource/kotlitex",
commit = "6b7db8ff9e0f4a70bdaa25f482143e038fd0c301",
remote = "https://github.com/oppia/kotlitex",
shallow_since = "1647554845 -0700",
)

bind(
Expand All @@ -149,13 +146,11 @@ bind(

http_archive(
name = "protobuf_tools",
sha256 = "efcb0b9004200fce79de23be796072a055105273905a5a441dbb5a979d724d20",
strip_prefix = "protobuf-%s" % HTTP_DEPENDENCY_VERSIONS["protobuf_tools"]["version"],
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-all-{0}.zip".format(HTTP_DEPENDENCY_VERSIONS["protobuf_tools"]["version"])],
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@rules_jvm_external//:specs.bzl", "maven")

ATS_TAG = "1edfdab3134a7f01b37afabd3eebfd2c5bb05151"

Expand All @@ -181,65 +176,17 @@ http_jar(

# Note to developers: new dependencies should be added to //third_party:versions.bzl, not here.
maven_install(
name = "maven",
artifacts = DAGGER_ARTIFACTS + get_maven_dependencies(maven),
artifacts = DAGGER_ARTIFACTS + get_maven_dependencies(),
fail_if_repin_required = True,
fetch_sources = True,
maven_install_json = "//third_party:maven_install.json",
override_targets = {
"com.google.guava:guava": "@//third_party:guava_android",
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm": "@//third_party:kotlinx-coroutines-core-jvm",
},
repositories = DAGGER_REPOSITORIES + MAVEN_REPOSITORIES,
repositories = DAGGER_REPOSITORIES + [
"https://maven.fabric.io/public",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)

load("@maven//:defs.bzl", "pinned_maven_install")

pinned_maven_install()

[
http_jar(
name = "guava_%s" % guava_type,
sha256 = HTTP_DEPENDENCY_VERSIONS["guava_%s" % guava_type]["sha"],
urls = [
"{0}/com/google/guava/guava/{1}-{2}/guava-{1}-{2}.jar".format(
url_base,
HTTP_DEPENDENCY_VERSIONS["guava_%s" % guava_type]["version"],
guava_type,
)
for url_base in DAGGER_REPOSITORIES + MAVEN_REPOSITORIES
],
)
for guava_type in [
# TODO(#1719): Add support for Guava JRE once it's needed in scripts.
"android",
]
]

http_jar(
name = "kotlinx-coroutines-core-jvm",
sha256 = HTTP_DEPENDENCY_VERSIONS["kotlinx-coroutines-core-jvm"]["sha"],
urls = [
"{0}/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/{1}/kotlinx-coroutines-core-jvm-{1}.jar".format(
url_base,
HTTP_DEPENDENCY_VERSIONS["kotlinx-coroutines-core-jvm"]["version"],
)
for url_base in DAGGER_REPOSITORIES + MAVEN_REPOSITORIES
],
)

http_jar(
name = "kotlinx-coroutines-core-jvm-sources",
sha256 = HTTP_DEPENDENCY_VERSIONS["kotlinx-coroutines-core-jvm"]["src-sha"],
urls = [
"{0}/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/{1}/kotlinx-coroutines-core-jvm-{1}-sources.jar".format(
url_base,
HTTP_DEPENDENCY_VERSIONS["kotlinx-coroutines-core-jvm"]["version"],
)
for url_base in DAGGER_REPOSITORIES + MAVEN_REPOSITORIES
],
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()
4 changes: 2 additions & 2 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ order to build with Bazel.
"""

load("@dagger//:workspace_defs.bzl", "dagger_rules")
load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")
load("@tools_android//tools/crashlytics:defs.bzl", "crashlytics_android_library")
load("@tools_android//tools/googleservices:defs.bzl", "google_services_xml")
load("//app:app_test.bzl", "app_test")
Expand Down Expand Up @@ -860,7 +860,7 @@ TEST_DEPS = [
"//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module",
"//testing/src/main/java/org/oppia/android/testing/robolectric:is_on_robolectric",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/threading:glide_test_executor",
"//testing/src/main/java/org/oppia/android/testing/threading:coroutine_executor_service",
"//testing/src/main/java/org/oppia/android/testing/threading:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
"//third_party:androidx_annotation_annotation",
Expand Down
26 changes: 13 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ dependencies {
implementation(
'android.arch.lifecycle:extensions:1.1.1',
'androidx.appcompat:appcompat:1.0.2',
'androidx.constraintlayout:constraintlayout:2.0.1',
'androidx.core:core-ktx:1.3.1',
'androidx.constraintlayout:constraintlayout:1.1.3',
'androidx.core:core-ktx:1.0.2',
'androidx.legacy:legacy-support-v4:1.0.0',
'androidx.lifecycle:lifecycle-extensions:2.0.0',
'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-alpha03',
Expand All @@ -159,7 +159,7 @@ dependencies {
"androidx.fragment:fragment:$fragment_version",
'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-alpha03',
'androidx.multidex:multidex:2.0.1',
'androidx.recyclerview:recyclerview:1.1.0',
'androidx.recyclerview:recyclerview:1.0.0',
'androidx.work:work-runtime-ktx:2.4.0',
'com.github.bumptech.glide:glide:4.11.0',
'com.google.android.flexbox:flexbox:3.0.0',
Expand All @@ -169,23 +169,23 @@ dependencies {
'com.google.firebase:firebase-analytics-ktx:17.5.0',
'com.google.firebase:firebase-core:17.5.0',
'com.google.firebase:firebase-crashlytics:17.0.0',
'com.google.guava:guava:31.0.1-android',
'com.google.guava:guava:28.1-android',
'com.google.protobuf:protobuf-javalite:3.17.3',
'com.github.oppia:CircularImageview:35d08ba88a',
'de.hdodenhof:circleimageview:3.0.1',
'nl.dionsegijn:konfetti:1.2.5',
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version",
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1',
'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0',
'org.mockito:mockito-core:3.9.0',
'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1',
'org.mockito:mockito-core:2.7.22',
)
compileOnly(
'jakarta.xml.bind:jakarta.xml.bind-api:2.3.2',
'javax.annotation:javax.annotation-api:1.3.2',
'org.glassfish.jaxb:jaxb-runtime:2.3.2',
)
testImplementation(
'androidx.test:core:1.4.0',
'androidx.test:core:1.2.0',
'androidx.test.espresso:espresso-contrib:3.1.0',
'androidx.test.espresso:espresso-core:3.2.0',
'androidx.test.espresso:espresso-intents:3.1.0',
Expand All @@ -197,13 +197,13 @@ dependencies {
'com.google.truth.extensions:truth-liteproto-extension:1.1.3',
'org.robolectric:annotations:4.5',
'org.robolectric:robolectric:4.5',
'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4',
'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.2.2',
"org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version",
'org.mockito:mockito-core:3.9.0',
'org.mockito:mockito-core:2.7.22',
project(":testing"),
)
androidTestImplementation(
'androidx.test:core:1.4.0',
'androidx.test:core:1.2.0',
'androidx.test.espresso:espresso-contrib:3.1.0',
'androidx.test.espresso:espresso-core:3.2.0',
'androidx.test.espresso:espresso-intents:3.1.0',
Expand All @@ -212,7 +212,7 @@ dependencies {
'com.google.truth:truth:1.1.3',
'androidx.work:work-testing:2.4.0',
'com.google.truth.extensions:truth-liteproto-extension:1.1.3',
'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4',
'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.2.2',
'org.mockito:mockito-android:2.7.22',
'org.robolectric:annotations:4.5',
)
Expand All @@ -233,7 +233,7 @@ dependencies {
exclude group: "org.robolectric"
}
androidTestUtil(
'androidx.test:orchestrator:1.4.1',
'androidx.test:orchestrator:1.2.0',
)
kapt(
'com.google.dagger:dagger-compiler:2.24'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Constructs for setting up activities for injection in the Dagger graph.
"""

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

# TODO(#59): Define these exported files as separate libraries from top-level targets.
exports_files([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class AdministratorControlsActivityPresenter @Inject constructor(
if (isMultipane) {
val adminControlsActivity = activity as AdministratorControlsActivity
when (lastLoadedFragment) {
PROFILE_LIST_FRAGMENT -> activity.loadProfileList()
APP_VERSION_FRAGMENT -> activity.loadAppVersion()
PROFILE_LIST_FRAGMENT -> (activity as AdministratorControlsActivity).loadProfileList()
APP_VERSION_FRAGMENT -> (activity as AdministratorControlsActivity).loadAppVersion()
PROFILE_EDIT_FRAGMENT -> selectedProfileId.let { profileId ->
if (extraControlsTitle != null) {
activity.loadProfileEdit(
(activity as AdministratorControlsActivity).loadProfileEdit(
profileId = profileId,
profileName = extraControlsTitle
)
Expand Down Expand Up @@ -206,7 +206,9 @@ class AdministratorControlsActivityPresenter @Inject constructor(
outState.putString(SELECTED_CONTROLS_TITLE_SAVED_KEY, titleTextView.text.toString())
}
outState.putString(LAST_LOADED_FRAGMENT_EXTRA_KEY, lastLoadedFragment)
outState.putBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY, isProfileDeletionDialogVisible)
outState.putInt(SELECTED_PROFILE_ID_SAVED_KEY, selectedProfileId)
isProfileDeletionDialogVisible?.let {
outState.putBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY, it)
}
selectedProfileId?.let { outState.putInt(SELECTED_PROFILE_ID_SAVED_KEY, it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class NavigationDrawerFragmentPresenter @Inject constructor(
)
}
}
drawerLayout.addDrawerListener(drawerToggle)
drawerLayout.setDrawerListener(drawerToggle)
/* Synchronize the state of the drawer indicator/affordance with the linked [drawerLayout]. */
drawerLayout.post { drawerToggle.syncState() }
} else {
Expand Down Expand Up @@ -472,7 +472,7 @@ class NavigationDrawerFragmentPresenter @Inject constructor(
)
}
}
drawerLayout.addDrawerListener(drawerToggle)
drawerLayout.setDrawerListener(drawerToggle)
/* Synchronize the state of the drawer indicator/affordance with the linked [drawerLayout]. */
drawerLayout.post { drawerToggle.syncState() }
if (previousMenuItemId != NavigationDrawerItem.HOME.ordinal && previousMenuItemId != -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum class NavigationDrawerItem(val value: Int) {
for (item: NavigationDrawerItem in values()) {
if (item.value == id) return item
}
throw IllegalArgumentException("NavigationDrawerItem not found by $id")
return throw IllegalArgumentException("NavigationDrawerItem not found by $id")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Constructs for setting up fragments for injection in the Dagger graph.
"""

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

# TODO(#59): Define these exported files as separate libraries from top-level targets.
exports_files([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,48 @@ import javax.inject.Inject
class AppLanguageActivity : InjectableAppCompatActivity() {
@Inject
lateinit var appLanguageActivityPresenter: AppLanguageActivityPresenter
private lateinit var prefKey: String
private lateinit var prefSummaryValue: String

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
prefKey = checkNotNull(intent.getStringExtra(APP_LANGUAGE_PREFERENCE_TITLE_EXTRA_KEY)) {
"Expected $APP_LANGUAGE_PREFERENCE_TITLE_EXTRA_KEY to be in intent extras."
}
prefSummaryValue = if (savedInstanceState == null) {
checkNotNull(intent.getStringExtra(APP_LANGUAGE_PREFERENCE_SUMMARY_VALUE_EXTRA_KEY)) {
"Expected $APP_LANGUAGE_PREFERENCE_SUMMARY_VALUE_EXTRA_KEY to be in intent extras."
}
} else {
savedInstanceState.get(SELECTED_LANGUAGE_EXTRA_KEY) as String
}
appLanguageActivityPresenter.handleOnCreate(prefSummaryValue)
appLanguageActivityPresenter.handleOnCreate(prefKey, prefSummaryValue)
}

companion object {
internal const val APP_LANGUAGE_PREFERENCE_TITLE_EXTRA_KEY =
"AppLanguageActivity.app_language_preference_title"
const val APP_LANGUAGE_PREFERENCE_SUMMARY_VALUE_EXTRA_KEY =
"AppLanguageActivity.app_language_preference_summary_value"
internal const val SELECTED_LANGUAGE_EXTRA_KEY = "AppLanguageActivity.selected_language"

/** Returns a new [Intent] to route to [AppLanguageActivity]. */
fun createAppLanguageActivityIntent(
context: Context,
prefKey: String,
summaryValue: String?
): Intent {
val intent = Intent(context, AppLanguageActivity::class.java)
intent.putExtra(APP_LANGUAGE_PREFERENCE_TITLE_EXTRA_KEY, prefKey)
intent.putExtra(APP_LANGUAGE_PREFERENCE_SUMMARY_VALUE_EXTRA_KEY, summaryValue)
return intent
}

fun getAppLanguagePreferenceTitleExtraKey(): String {
return APP_LANGUAGE_PREFERENCE_TITLE_EXTRA_KEY
}

fun getAppLanguagePreferenceSummaryValueExtraKey(): String {
return APP_LANGUAGE_PREFERENCE_SUMMARY_VALUE_EXTRA_KEY
}
Expand Down
Loading

0 comments on commit bbc6b16

Please sign in to comment.