mojo/v23proxy: Update Dart to work with Dart Mojom Types
If we generate Dart Mojom types with the Mojo CL here,
https://codereview.chromium.org/1539673003/
then the Dart echo and fortune examples will work again with this change.
Note: We also now must specify --generate-type-info manually when
invoking the mojom compiler. So this is MultiPart with the shared repo.
MultiPart: 1/2
Change-Id: I71084b20900ec3234c1ced6d67a88ea6fc1afc3c
diff --git a/Makefile b/Makefile
index de457ad..aba2a03 100644
--- a/Makefile
+++ b/Makefile
@@ -113,6 +113,7 @@
gofmt -w $@
gen/echo.mojom.dart: mojom/mojom/examples/echo.mojom | mojo-env-check
+ cd dart-examples/echo && pub get
$(call MOJOM_GEN,$<,mojom,dart-examples/echo/lib/gen,dart,--generate-type-info)
$(BUILD_DIR)/fortune_client.mojo: gen/go/src/mojom/examples/fortune/fortune.mojom.go
@@ -126,9 +127,10 @@
gofmt -w $@
gen/fortune.mojom.dart: mojom/mojom/examples/fortune.mojom | mojo-env-check
+ cd dart-examples/fortune && pub get
$(call MOJOM_GEN,$<,mojom,dart-examples/fortune/lib/gen,dart,--generate-type-info)
-$(BUILD_DIR)/v23clientproxy.mojo: $(shell find $(PWD)/go/src/v.io/x/mojo/proxy/clientproxy -name *.go) | mojo-env-check
+$(BUILD_DIR)/v23clientproxy.mojo: $(shell find $(PWD)/go/src/v.io/x/mojo/proxy/clientproxy -name *.go) gen/go/src/mojom/v23clientproxy/v23clientproxy.mojom.go gen/go/src/mojo/public/interfaces/bindings/mojom_types/mojom_types.mojom.go | mojo-env-check
$(call MOGO_BUILD,v.io/x/mojo/proxy/clientproxy,$@)
$(BUILD_DIR)/v23serverproxy.mojo: $(shell find $(PWD)/go/src/v.io/x/mojo/proxy/serverproxy -name *.go) gen/go/src/mojom/v23serverproxy/v23serverproxy.mojom.go | mojo-env-check
@@ -186,13 +188,12 @@
--config-file $(PWD)/mojoconfig \
--shell-path $(MOJO_SHELL) \
$(ANDROID_FLAG) \
- --enable-multiprocess \
- --config-alias V23PROXY_DIR=$(PWD) \
- --config-alias V23PROXY_BUILD_DIR=$(BUILD_DIR) \
- "--args-for=https://mojo.v.io/$1 $(ARGS) $(V23_MOJO_FLAGS)" \
- "--args-for=mojo:dart_content_handler --enable-strict-mode" \
- $(ORIGIN_FLAG)
- $(MOJO_SHELL_FLAGS)
+ $(MOJO_SHELL_FLAGS) \
+ --config-alias V23PROXY_DIR=$(PWD) \
+ --config-alias V23PROXY_BUILD_DIR=$(BUILD_DIR) \
+ --args-for="https://mojo.v.io/$1 $(ARGS) $(V23_MOJO_FLAGS)" \
+ --args-for="mojo:dart_content_handler --enable-strict-mode" \
+ $(ORIGIN_FLAG)
endef
# Start the v23proxy (server-side). This runs the v23proxy in its own shell and
diff --git a/README.md b/README.md
index 49ee923..7a91283 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,16 @@
[here](https://docs.google.com/a/google.com/document/d/17cMUkwolbQphimAYdyVNBCzA_f-HZy3YcxEpKOAmw48/edit?usp=sharing)
that enables communication between Mojo applications on different devices.
+## Prerequisites
+
+You must have the `jiri` tool installed with the `base` and `mojo` v23-profiles.
+
+To update v23proxy to the latest version of mojo, you will need to also have
+the `mojo-dev` profile.
+
## Quick start
+You must always `make build` first. (The Makefile is not very good currently.)
- For desktop: `make build`
- For android: `ANDROID=1 make build`
@@ -17,4 +25,9 @@
You can also run these with Android devices. Use an `ANDROID={N}` prefix to run on
the `Nth` Android device connected to your machine. `N` must be a positive integer.
-Note: To run these examples, the devices used must run mojo_shell on the same local network.
\ No newline at end of file
+Note: To run these examples, the devices used must run mojo_shell on the same local network.
+
+## Updating v23proxy to the latest version of mojo
+
+Prefix all commands with `USE_MOJO_DEV_PROFILE=1` in order to run with the
+`mojo-dev` profile instead of `mojo`.
\ No newline at end of file
diff --git a/dart-examples/echo/lib/main.dart b/dart-examples/echo/lib/main.dart
index 1670564..c572b3e 100644
--- a/dart-examples/echo/lib/main.dart
+++ b/dart-examples/echo/lib/main.dart
@@ -8,7 +8,6 @@
import 'gen/dart-gen/mojom/lib/mojo/examples/echo.mojom.dart';
import 'package:v23proxy/client.dart' as v23proxy;
import 'package:mojo/application.dart';
-import 'package:mojo/bindings.dart';
import 'package:mojo/core.dart';
class Echo extends Application {
diff --git a/dart-examples/fortune/lib/main.dart b/dart-examples/fortune/lib/main.dart
index 227e6d8..2191686 100644
--- a/dart-examples/fortune/lib/main.dart
+++ b/dart-examples/fortune/lib/main.dart
@@ -8,7 +8,6 @@
import 'gen/dart-gen/mojom/lib/mojo/examples/fortune.mojom.dart';
import 'package:v23proxy/client.dart' as v23proxy;
import 'package:mojo/application.dart';
-import 'package:mojo/bindings.dart';
import 'package:mojo/core.dart';
class Fortune extends Application {
diff --git a/lib/client.dart b/lib/client.dart
index dd4cd0c..7ebb87c 100644
--- a/lib/client.dart
+++ b/lib/client.dart
@@ -4,7 +4,7 @@
library v23proxy;
-import 'gen/dart-gen/mojom/lib/mojo/bindings/types/v23proxy.mojom.dart';
+import 'gen/dart-gen/mojom/lib/mojo/bindings/types/v23clientproxy.mojom.dart';
import 'package:mojo/application.dart' as application;
import 'package:mojo/bindings.dart' as bindings;
@@ -17,8 +17,8 @@
core.MojoMessagePipe pipe = new core.MojoMessagePipe();
proxy.impl.bind(pipe.endpoints[0]);
- V23Proxy v23proxy = new V23Proxy.unbound();
- app.connectToService("https://mojo.v.io/v23proxy.mojo", v23proxy);
+ V23ClientProxyProxy v23proxy = new V23ClientProxyProxy.unbound();
+ app.connectToService("https://mojo.v.io/v23clientproxy.mojo", v23proxy);
// Due to mojom type generation limitations, the proxy may not always have
// a service description. To avoid issues with dartanalyzer, we use 'dynamic'.
@@ -28,7 +28,10 @@
// This is a service_describer.ServiceDescription.
var serviceDescription = dynproxyimpl.serviceDescription;
- v23proxy.ptr.setupProxy(v23Name, serviceDescription.getTopLevelInterface(),
- serviceDescription.getAllTypeDefinitions(), proxy.name,
+ v23proxy.ptr.setupClientProxy(
+ v23Name,
+ serviceDescription.getTopLevelInterface(),
+ serviceDescription.getAllTypeDefinitions(),
+ proxy.serviceName,
pipe.endpoints[1]);
}
diff --git a/mojoconfig b/mojoconfig
index c20d5fc..0a0e9d9 100644
--- a/mojoconfig
+++ b/mojoconfig
@@ -9,8 +9,8 @@
('', [
# For v23proxy.mojo.
'@{V23PROXY_BUILD_DIR}',
- # For examples.
- '@{V23PROXY_DIR}/example'
+ # For dart examples.
+ '@{V23PROXY_DIR}'
]),
],
},
diff --git a/mojom/mojom/v23serverproxy.mojom b/mojom/mojom/v23serverproxy.mojom
index a26855d..9d1b16c 100644
--- a/mojom/mojom/v23serverproxy.mojom
+++ b/mojom/mojom/v23serverproxy.mojom
@@ -5,8 +5,6 @@
module mojo.bindings.types;
//module v23proxy; // TODO(bprosnitz) Ideally, this would be in v23proxy. This is in mojo.bindings.types because importing across modules is broken in mojo.
-import "mojo/public/interfaces/bindings/mojom_types.mojom";
-
[ServiceName="v23::v23proxy::V23ServerProxy"]
interface V23ServerProxy {
// Endpoints gets the endpoints that the v23proxy serves at.