Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# How to contribute to Arcs

Thank you for taking the time to contribute to the Arcs project.
Thank you for taking the time to contribute to the Arcs project.
This guide outlines how to become an Arcs developer.

**Table of Contents**
Expand Down Expand Up @@ -33,12 +33,12 @@ This guide outlines how to become an Arcs developer.

**If you notice a security issue, please file a bug.**

* Before filing an [issue](https://github.com/PolymerLabs/arcs/issues), please check if one already exists.
* Before filing an [issue](https://github.com/PolymerLabs/arcs/issues), please check if one already exists.

* After filing an issue, please attach an appropriate [label](https://github.com/PolymerLabs/arcs/labels).

* Questions are welcome! If you do ask a question that doesn't have an answer, please add the
[question](https://github.com/PolymerLabs/arcs/labels/question) or
* Questions are welcome! If you do ask a question that doesn't have an answer, please add the
[question](https://github.com/PolymerLabs/arcs/labels/question) or
[design question](https://github.com/PolymerLabs/arcs/labels/design%20question) label to your issue.

* All `TODO`s in the project need to be tracked with a buginizer bug or an issue (e.g. `TODO(#3838)`).
Expand All @@ -49,18 +49,18 @@ This guide outlines how to become an Arcs developer.

1) Create a PR and go through reviews.

If you are an external contributor, you will have to agree to the
If you are an external contributor, you will have to agree to the
[Contributor License Agreement](https://opensource.google/docs/cla/).

1) When you are ready to merge, add the "ready to pull" label to your PR.

This will trigger an internal review process for the change. If you are an
This will trigger an internal review process for the change. If you are an
internal contributor, please click `+2` to the Safe Review. Otherwise, please
reach out to an [approved committer](AUTHORS.md) to help you land the change.
1) [Copybara](https://github.com/google/copybara) will create another import CL.

1) [Copybara](https://github.com/google/copybara) will create another import CL.
Get _another [approved committer](AUTHORS.md)_ to approve the CL.

1) When GCB and our internal integration tests are green, the import CL will be
automatically submitted and the corresponding PR will be merged on GitHub.

Expand Down Expand Up @@ -90,7 +90,7 @@ This guide outlines how to become an Arcs developer.
```shell script
$ npm install -g npm # can use [email protected] to install a specific version
```

1) Setup subprojects & invoke `sigh`.

```shell script
Expand All @@ -101,7 +101,7 @@ This guide outlines how to become an Arcs developer.
`tools/npm-install-all` is required on a fresh checkout. After that it only
needs to be re-run infrequently as new dependencies are included, and usually a
build failure will be the signal for that.

`tools/sigh` is the web-runtime's main build tool. Please run `tools/sigh --help`
to see all available commands.

Expand All @@ -111,36 +111,36 @@ If you only want to develop using JavaScript, the following instructions are opt
These are required for building / running WebAssembly particles, or working with Android.

1) Install Bazel.
Please follow the [official docs](https://docs.bazel.build/versions/master/install.html) to
learn how to install Bazel on your machine.

Please follow the [official docs](https://docs.bazel.build/versions/master/install.html) to
learn how to install Bazel on your machine.

1) Install the Android SDK.

Follow steps 1-3 of [this section of the IDE Setup doc](docs/IDE-Setup.md#add-android-support) to install the
Android SDK.
Follow steps 1-3 of [this section of the IDE Setup doc](docs/IDE-Setup.md#add-android-support) to install the
Android SDK.

1) Install [ktlint](https://ktlint.github.io/).

```shell script
$ mkdir -p $HOME/bin && cd $HOME/bin && curl -L -s -O https://github.com/pinterest/ktlint/releases/download/0.35.0/ktlint && cd -
$ mkdir -p $HOME/bin && cd $HOME/bin && curl -L -s -O https://github.com/pinterest/ktlint/releases/download/0.39.0/ktlint && cd -
$ chmod a+x $HOME/bin/ktlint
$ echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.bashrc
```

Thereafter, lint checks can be done with `tools/sigh lint` or `tools/sigh ktlint`.

1) Build & run targets with Bazelisk
Our project manages Bazel versions with Bazelisk. To run a test or build a target, please

Our project manages Bazel versions with Bazelisk. To run a test or build a target, please
use the wrapper in `tools/`. For example:

```shell script
$ tools/bazelisk sync
$ tools/bazelisk build //java/...
$ tools/bazelisk test //javatests/...
```

1) For more information about Wasm, see the [C++ wasm instructions](src/wasm/cpp/README.md).


Expand All @@ -167,9 +167,9 @@ These are required for building / running WebAssembly particles, or working with

### Mac Installation Notes

- Instructions above assume that Command Line Tools are installed. To check or install these, run the
- Instructions above assume that Command Line Tools are installed. To check or install these, run the
following command:

`xcode-select --version || xcode-select --install`
- When installing, if you run into SSL Cert verification errors, consider certifying Python 3.6 on Mac:
`/Applications/Python\ 3.6/Install\ Certificates.command` ([source](https://stackoverflow.com/a/42334357))
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ WORKDIR $WORKSPACE

# Install ktlint
RUN (cd /usr/bin/ && \
curl -L -s -O https://github.com/pinterest/ktlint/releases/download/0.35.0/ktlint && \
curl -L -s -O https://github.com/pinterest/ktlint/releases/download/0.39.0/ktlint && \
cd - && \
chmod +x /usr/bin/ktlint)

Expand Down
10 changes: 5 additions & 5 deletions java/arcs/android/common/resurrection/DbHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class DbHelper(
SELECT
component_package, component_class, notification_key, target_id
FROM requested_notifiers
""".trimIndent(),
""".trimIndent(),
null
).forEach {
val componentName = ComponentName(it.getString(0), it.getString(1))
Expand All @@ -171,7 +171,7 @@ class DbHelper(
intent_extras,
target_id
FROM resurrection_requests
""".trimIndent(),
""".trimIndent(),
null
).map {
val componentName = ComponentName(it.getString(0), it.getString(1))
Expand Down Expand Up @@ -223,23 +223,23 @@ class DbHelper(
intent_extras BLOB,
PRIMARY KEY (component_package, component_class, target_id)
)
""".trimIndent(),
""".trimIndent(),
"""
CREATE TABLE requested_notifiers (
component_package TEXT NOT NULL,
component_class TEXT NOT NULL,
target_id TEXT NOT NULL,
notification_key TEXT NOT NULL
)
""".trimIndent(),
""".trimIndent(),
"""
CREATE INDEX notifiers_by_component_and_id
ON requested_notifiers (
component_package,
component_class,
target_id
)
""".trimIndent()
""".trimIndent()
)

private val VERSION_2_MIGRATION = arrayOf(
Expand Down
8 changes: 4 additions & 4 deletions java/arcs/android/common/resurrection/ResurrectorService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import androidx.annotation.VisibleForTesting
import arcs.android.common.resurrection.ResurrectionRequest.UnregisterRequest
import arcs.core.storage.StorageKey
import arcs.core.util.guardedBy
import java.io.PrintWriter
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -29,6 +28,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import java.io.PrintWriter

/**
* Extension point for [Service]s which wish to be capable of resurrecting their clients.
Expand All @@ -46,9 +46,9 @@ abstract class ResurrectorService : Service() {

private val mutex = Mutex()
private var registeredRequests: Set<ResurrectionRequest>
by guardedBy(mutex, setOf())
by guardedBy(mutex, setOf())
private var registeredRequestsByNotifiers: Map<StorageKey?, Set<ResurrectionRequest>>
by guardedBy(mutex, mapOf())
by guardedBy(mutex, mapOf())

@VisibleForTesting
var loadJob: Job? = null
Expand Down Expand Up @@ -118,7 +118,7 @@ abstract class ResurrectorService : Service() {
"""
Resurrection Requests
---------------------
""".trimIndent()
""".trimIndent()
)

val requests = StringBuilder().apply {
Expand Down
12 changes: 7 additions & 5 deletions java/arcs/android/crdt/ReferencableInlineEntityListProto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ fun ReferencableList<*>.toInlineEntityListProto(): ReferencableInlineEntityListP
ReferencableInlineEntityListProto
.newBuilder()
.setType(type.schemaHash)
.addAllValue(value.map {
require(it is RawEntity) {
"Non-entity found in entity list"
.addAllValue(
value.map {
require(it is RawEntity) {
"Non-entity found in entity list"
}
it.toProto()
}
it.toProto()
})
)
.build()
}
else -> throw IllegalStateException(
Expand Down
23 changes: 13 additions & 10 deletions java/arcs/android/crdt/ReferencablePrimitiveListProto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ fun ReferencablePrimitiveListProto.toReferencableList(): ReferencableList<Refere
fun ReferencableList<*>.toPrimitiveListProto(): ReferencablePrimitiveListProto {
val type = (itemType as FieldType.ListOf).primitiveType
return when (type) {
is FieldType.Primitive -> ReferencablePrimitiveListProto
.newBuilder()
.setType(type.primitiveType.ordinal)
.addAllValue(value.map {
require(it is ReferencablePrimitive<*>) {
"Non-primitive found in primitive list"
}
it.toProto()
})
.build()
is FieldType.Primitive ->
ReferencablePrimitiveListProto
.newBuilder()
.setType(type.primitiveType.ordinal)
.addAllValue(
value.map {
require(it is ReferencablePrimitive<*>) {
"Non-primitive found in primitive list"
}
it.toProto()
}
)
.build()
else -> throw IllegalStateException("Invalid FieldType for primitive ReferencableList")
}
}
Expand Down
12 changes: 7 additions & 5 deletions java/arcs/android/crdt/ReferencableReferenceListProto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ fun ReferencableList<*>.toReferenceListProto(): ReferencableReferenceListProto {
ReferencableReferenceListProto
.newBuilder()
.setType(type.schemaHash)
.addAllValue(value.map {
require(it is Reference) {
"Non-reference found in reference list"
.addAllValue(
value.map {
require(it is Reference) {
"Non-reference found in reference list"
}
it.toProto()
}
it.toProto()
})
)
.build()
}
else -> throw IllegalStateException("Invalid FieldType for ReferencableList of references")
Expand Down
6 changes: 4 additions & 2 deletions java/arcs/android/devtools/ModelUpdateMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class ModelUpdateMessage(
collections: Map<FieldName, CrdtSet<CrdtEntity.Reference>>
) = JsonValue.JsonObject(
collections.map {
(name, collection) -> name to JsonValue.JsonObject(
(name, collection) ->
name to JsonValue.JsonObject(
VERSION_MAP to collection.data.versionMap.toJson(),
"values" to getValues(collection.data.values)
)
Expand All @@ -76,7 +77,8 @@ class ModelUpdateMessage(
singletons: Map<FieldName, CrdtSingleton<CrdtEntity.Reference>>
) = JsonValue.JsonObject(
singletons.map {
(name, singleton) -> name to JsonValue.JsonObject(
(name, singleton) ->
name to JsonValue.JsonObject(
VERSION_MAP to singleton.data.versionMap.toJson(),
"values" to getValues(singleton.data.values)
)
Expand Down
14 changes: 8 additions & 6 deletions java/arcs/android/labs/host/AndroidManifestHostRegistry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ class AndroidManifestHostRegistry private constructor(

override suspend fun availableArcHosts(): List<ArcHost> {
if (arcHosts.isEmpty()) {
arcHosts.addAll(serviceHosts.flatMap { registryHost ->
try {
registryHost.registeredHosts()
} catch (e: TimeoutCancellationException) {
emptyList<ArcHost>()
arcHosts.addAll(
serviceHosts.flatMap { registryHost ->
try {
registryHost.registeredHosts()
} catch (e: TimeoutCancellationException) {
emptyList<ArcHost>()
}
}
})
)
}
return arcHosts
}
Expand Down
2 changes: 1 addition & 1 deletion java/arcs/android/labs/host/prod/ProdArcHostService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import arcs.core.storage.StorageEndpointManager
import arcs.jvm.host.scanForParticles
import arcs.sdk.android.labs.host.AndroidHost
import arcs.sdk.android.labs.host.ArcHostService
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlin.coroutines.CoroutineContext

/**
* An isolatable (can run in another process) [Service] that has a [ProdHost] inside. [Particle]
Expand Down
8 changes: 4 additions & 4 deletions java/arcs/android/storage/database/DatabaseImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ import arcs.core.util.performance.PerformanceStatistics
import arcs.core.util.performance.Timer
import arcs.jvm.util.JvmTime
import com.google.protobuf.InvalidProtocolBufferException
import kotlin.coroutines.coroutineContext
import kotlin.math.roundToLong
import kotlin.reflect.KClass
import kotlinx.atomicfu.atomic
import kotlinx.atomicfu.updateAndGet
import kotlinx.coroutines.CoroutineScope
Expand All @@ -83,6 +80,9 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlin.coroutines.coroutineContext
import kotlin.math.roundToLong
import kotlin.reflect.KClass

/** The Type ID that gets stored in the database. */
typealias TypeId = Long
Expand Down Expand Up @@ -944,7 +944,7 @@ class DatabaseImpl(
if (storageKey is InlineStorageKey) {
throw UnsupportedOperationException(
"Invalid attempt to delete inline storage key $storageKey." +
" Inline entities should not be removed using delete()."
" Inline entities should not be removed using delete()."
)
}
counters.increment(DatabaseCounters.GET_STORAGE_KEY_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
package arcs.android.storage.service

import arcs.core.storage.StorageKey
import java.util.concurrent.ConcurrentHashMap
import kotlinx.coroutines.ExperimentalCoroutinesApi
import java.util.concurrent.ConcurrentHashMap

/**
* A [DevToolsStorageManager] is used by a client of the [StorageService] to manage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import arcs.core.storage.UntypedDirectStoreMuxer
import arcs.core.storage.WriteBackProvider
import arcs.flags.BuildFlagDisabledError
import arcs.flags.BuildFlags
import java.util.concurrent.ConcurrentHashMap
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import java.util.concurrent.ConcurrentHashMap

/**
* Implementation of the [IMuxedStorageService] AIDL interface. Responsible for forwarding messages
Expand Down
Loading