Skip to content

Commit

Permalink
Fix demo and e2e app so they build in g3
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 337344591
  • Loading branch information
jblebrun authored and arcs-c3po committed Oct 15, 2020
1 parent 9bff625 commit 936238c
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 42 deletions.
1 change: 1 addition & 0 deletions java/arcs/android/demo/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<activity
android:name=".DemoActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
12 changes: 3 additions & 9 deletions java/arcs/android/demo/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ arcs_kt_android_library(
"//java/arcs/android/util",
"//java/arcs/core/allocator",
"//java/arcs/core/common",
"//java/arcs/core/data",
"//java/arcs/core/data/util:data-util",
"//java/arcs/core/entity",
"//java/arcs/core/host",
"//java/arcs/core/storage",
"//java/arcs/core/storage/api",
"//java/arcs/core/storage/database",
"//java/arcs/core/storage/driver",
"//java/arcs/core/storage/keys",
"//java/arcs/core/storage/referencemode",
"//java/arcs/core/type",
"//java/arcs/core/storage/driver:ramdisk",
"//java/arcs/core/util",
"//java/arcs/jvm/util",
"//java/arcs/sdk/android/storage",
Expand All @@ -45,14 +39,14 @@ arcs_kt_android_library(
"//third_party/java/androidx/appcompat",
"//third_party/java/androidx/work",
"//third_party/kotlin/kotlinx_coroutines",
"//third_party/kotlin/kotlinx_coroutines:kotlinx_coroutines_android",
],
)

# Use this cmd to install:
# bazel mobile-install java/arcs/android/demo
android_binary(
name = "demo",
testonly = True,
dexopts = ["--force-jumbo"],
incremental_dexing = 0,
manifest = ":AndroidManifest.xml",
Expand Down
2 changes: 2 additions & 0 deletions java/arcs/android/demo/DemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

package arcs.android.demo

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
Expand Down
4 changes: 3 additions & 1 deletion java/arcs/android/demo/DemoService.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package arcs.android.demo

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import androidx.lifecycle.Lifecycle
import android.content.Context
import arcs.android.sdk.host.AndroidHost
import arcs.android.sdk.host.ArcHostService
import arcs.core.host.ArcHost
Expand Down
2 changes: 1 addition & 1 deletion java/arcs/android/demo/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
-->

<resources>
<string name="app_name">Arcs Android Demo</string>
<string name="app_name" translatable="false">Arcs Android Demo</string>
<string name="person_test_btn" translatable="false">PersonTest</string>
</resources>
12 changes: 8 additions & 4 deletions javatests/arcs/android/e2e/ArcsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@

package arcs.android.e2e

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import android.app.Activity
import android.app.Instrumentation
import android.content.Context
import android.content.Intent
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.google.common.truth.Truth.assertWithMessage
import org.junit.After
import org.junit.Before
Expand Down Expand Up @@ -238,7 +240,8 @@ class ArcsTest {
By.text(
sequencedText1
)
), UI_TIMEOUT_MS
),
UI_TIMEOUT_MS
)
assertWithMessage("View with exactly \"$sequencedText1\" should appear")
.that(text1Appeared).isTrue()
Expand All @@ -247,7 +250,8 @@ class ArcsTest {
By.text(
sequencedText2
)
), UI_TIMEOUT_MS
),
UI_TIMEOUT_MS
)
assertWithMessage("View with exactly \"$sequencedText2\" should appear")
.that(text2Appeared).isTrue()
Expand Down
4 changes: 3 additions & 1 deletion javatests/arcs/android/e2e/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ package(default_visibility = ["//java/arcs:allowed-packages"])

arcs_kt_android_library(
name = "arcs_e2e_test_lib",
testonly = 1,
testonly = True,
srcs = glob(["*.kt"]),
deps = [
"//third_party/android/androidx_test/ext/junit",
"//third_party/android/androidx_test/runner",
"//third_party/android/androidx_test/runner/monitor",
"//third_party/android/androidx_test/uiautomator",
"//third_party/java/junit:junit-android",
"//third_party/java/truth:truth-android",
Expand All @@ -23,6 +24,7 @@ arcs_kt_android_library(

android_binary(
name = "e2e",
testonly = True,
dexopts = [
"--min-sdk-version=29",
"--force-jumbo",
Expand Down
1 change: 1 addition & 0 deletions javatests/arcs/android/e2e/testapp/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<activity
android:name=".TestActivity"
android:launchMode="singleTask"
android:exported="true"
android:theme="@style/Theme.AppCompat.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
17 changes: 9 additions & 8 deletions javatests/arcs/android/e2e/testapp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,46 @@ arcs_kt_gen(

arcs_kt_android_library(
name = "test_app_lib",
testonly = 1,
testonly = True,
srcs = glob(["*.kt"]),
manifest = ":AndroidManifest.xml",
resource_files = glob(["res/**/*"]),
deps = [
":animal_arcs",
":person_arcs",
"//java/arcs/android/devtools",
"//java/arcs/android/devtools:aidl",
"//java/arcs/android/host",
"//java/arcs/android/sdk/host",
"//java/arcs/android/storage/database",
"//java/arcs/android/util",
"//java/arcs/core/allocator",
"//java/arcs/core/common",
"//java/arcs/core/data",
"//java/arcs/core/data/util:data-util",
"//java/arcs/core/data:data-kt",
"//java/arcs/core/data:rawentity",
"//java/arcs/core/data:schema_fields",
"//java/arcs/core/entity",
"//java/arcs/core/host",
"//java/arcs/core/storage",
"//java/arcs/core/storage/api",
"//java/arcs/core/storage/database",
"//java/arcs/core/storage/driver",
"//java/arcs/core/storage/driver:ramdisk",
"//java/arcs/core/storage/keys",
"//java/arcs/core/storage/referencemode",
"//java/arcs/core/type",
"//java/arcs/core/util",
"//java/arcs/jvm/util",
"//java/arcs/sdk:sdk-kt",
"//java/arcs/sdk/android/storage",
"//java/arcs/sdk/android/storage/service",
"//java/arcs/sdk/storage",
"//third_party/java/androidx/appcompat",
"//third_party/java/androidx/work",
"//third_party/kotlin/kotlinx_coroutines",
"//third_party/kotlin/kotlinx_coroutines:kotlinx_coroutines_android",
"//third_party/kotlin/kotlinx_coroutines:kotlinx_coroutines_android", # buildcleaner: keep
],
)

android_binary(
name = "testapp",
testonly = True,
dexopts = ["--force-jumbo"],
incremental_dexing = 0,
manifest = ":AndroidManifest.xml",
Expand Down
4 changes: 3 additions & 1 deletion javatests/arcs/android/e2e/testapp/PersonHostService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

package arcs.android.e2e.testapp

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import androidx.lifecycle.Lifecycle
import android.content.Context
import android.content.Intent
import androidx.lifecycle.Lifecycle
import arcs.android.sdk.host.AndroidHost
import arcs.android.sdk.host.ArcHostService
import arcs.core.data.Plan
Expand Down
4 changes: 3 additions & 1 deletion javatests/arcs/android/e2e/testapp/ReadAnimalHostService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

package arcs.android.e2e.testapp

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import androidx.lifecycle.Lifecycle
import android.content.Context
import android.content.Intent
import androidx.lifecycle.Lifecycle
import arcs.android.sdk.host.AndroidHost
import arcs.android.sdk.host.ArcHostService
import arcs.core.host.ArcHost
Expand Down
8 changes: 4 additions & 4 deletions javatests/arcs/android/e2e/testapp/StorageAccessService.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package arcs.android.e2e.testapp

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import android.app.Service
import android.content.Intent
import androidx.lifecycle.LifecycleService
import android.content.Intent
import arcs.core.data.EntityType
import arcs.core.data.HandleMode
import arcs.core.data.SingletonType
import arcs.core.entity.ForeignReferenceCheckerImpl
import arcs.core.entity.HandleSpec
import arcs.core.host.EntityHandleManager
import arcs.core.util.Scheduler
Expand Down Expand Up @@ -43,8 +44,7 @@ class StorageAccessService : LifecycleService() {
val handleManager = EntityHandleManager(
time = JvmTime,
scheduler = Scheduler(coroutineContext),
storageEndpointManager = storageEndpointManager,
foreignReferenceChecker = ForeignReferenceCheckerImpl(emptyMap())
storageEndpointManager = storageEndpointManager
)

@Suppress("UNCHECKED_CAST")
Expand Down
17 changes: 7 additions & 10 deletions javatests/arcs/android/e2e/testapp/TestActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

package arcs.android.e2e.testapp

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.Button
import android.widget.RadioButton
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import arcs.android.devtools.DevToolsService
import arcs.android.host.AndroidManifestHostRegistry
import arcs.core.allocator.Allocator
Expand All @@ -26,7 +28,6 @@ import arcs.core.data.CollectionType
import arcs.core.data.EntityType
import arcs.core.data.HandleMode
import arcs.core.data.SingletonType
import arcs.core.entity.ForeignReferenceCheckerImpl
import arcs.core.entity.HandleSpec
import arcs.core.entity.awaitReady
import arcs.core.host.EntityHandleManager
Expand Down Expand Up @@ -158,8 +159,7 @@ class TestActivity : AppCompatActivity() {
EntityHandleManager(
time = JvmTime,
scheduler = schedulerProvider("readWriteArc"),
storageEndpointManager = storageEndpointManager,
foreignReferenceChecker = ForeignReferenceCheckerImpl(emptyMap())
storageEndpointManager = storageEndpointManager
)
)
allocator?.startArcForPlan(PersonRecipePlan)
Expand All @@ -173,8 +173,7 @@ class TestActivity : AppCompatActivity() {
EntityHandleManager(
time = JvmTime,
scheduler = schedulerProvider("resurrectionArc"),
storageEndpointManager = storageEndpointManager,
foreignReferenceChecker = ForeignReferenceCheckerImpl(emptyMap())
storageEndpointManager = storageEndpointManager
)
)
resurrectionArcId = allocator?.startArcForPlan(AnimalRecipePlan)?.id
Expand Down Expand Up @@ -208,8 +207,7 @@ class TestActivity : AppCompatActivity() {
EntityHandleManager(
time = JvmTime,
scheduler = schedulerProvider("allocator"),
storageEndpointManager = storageEndpointManager,
foreignReferenceChecker = ForeignReferenceCheckerImpl(emptyMap())
storageEndpointManager = storageEndpointManager
)
)
val arcId = allocator.startArcForPlan(PersonRecipePlan).id
Expand Down Expand Up @@ -242,8 +240,7 @@ class TestActivity : AppCompatActivity() {
val handleManager = EntityHandleManager(
time = JvmTime,
scheduler = schedulerProvider("handle"),
storageEndpointManager = storageEndpointManager,
foreignReferenceChecker = ForeignReferenceCheckerImpl(emptyMap())
storageEndpointManager = storageEndpointManager
)
if (isCollection) {
@Suppress("UNCHECKED_CAST")
Expand Down
4 changes: 3 additions & 1 deletion javatests/arcs/android/e2e/testapp/WriteAnimalHostService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

package arcs.android.e2e.testapp

// TODO(b/170962663) Disabled due to different ordering after copybara transformations.
/* ktlint-disable import-ordering */
import androidx.lifecycle.Lifecycle
import android.content.Context
import android.content.Intent
import androidx.lifecycle.Lifecycle
import arcs.android.sdk.host.AndroidHost
import arcs.android.sdk.host.ArcHostService
import arcs.core.host.ParticleRegistration
Expand Down
2 changes: 1 addition & 1 deletion javatests/arcs/android/e2e/testapp/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-->

<resources>
<string name="app_name">Arcs Test</string>
<string name="app_name" translatable="false">Arcs Test</string>
<string name="result_prompt" translatable="false">Result will be shown here.</string>
<string name="waiting_for_result" translatable="false">Waiting for result.</string>
<string name="start_resurrection_arc_btn" translatable="false">StartResurrectionArc</string>
Expand Down

0 comments on commit 936238c

Please sign in to comment.