mojo/discovery: Depending on mojo_sdk instead of mojo,
fixing a null pointer bug and publishing a new version.
Also adding local-publish for testing purposes.
MultiPart: 2/2
Change-Id: I2f67470ec055fe21ff22825a9381eb33fc68cba8
diff --git a/.gitignore b/.gitignore
index 0530729..ec6cb21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,7 @@
/.packages
/.pub
/pubspec.lock
+/build
+/java/.gradle
+/java/build/
+/java/local.properties
diff --git a/Makefile b/Makefile
index 5a256ea..a3240c5 100644
--- a/Makefile
+++ b/Makefile
@@ -112,6 +112,12 @@
-pub publish $(PUBLISH_FLAGS)
rm -rf $(PACKAGE_MOJO_BIN_DIR)
+local-publish: clean packages
+ $(MAKE) build # Build for Linux.
+ ANDROID=1 $(MAKE) build # Cross-compile for Android.
+ mkdir -p $(PACKAGE_MOJO_BIN_DIR)
+ cp -r gen/mojo/* $(PACKAGE_MOJO_BIN_DIR)
+
# Examples.
run-advertiser: $(DISCOVERY_BUILD_DIR)/advertiser.mojo $(DISCOVERY_BUILD_DIR)/discovery.mojo
$(MOJO_DEVTOOLS)/mojo_run --config-file $(CURDIR)/mojoconfig $(MOJO_SHELL_FLAGS) $(MOJO_ANDROID_FLAGS) https://mojo.v.io/advertiser.mojo \
diff --git a/go/src/mojom/vanadium/discovery/discovery.mojom.go b/go/src/mojom/vanadium/discovery/discovery.mojom.go
index 197bfbb..bf1b8dd 100644
--- a/go/src/mojom/vanadium/discovery/discovery.mojom.go
+++ b/go/src/mojom/vanadium/discovery/discovery.mojom.go
@@ -34,11 +34,9 @@
discoveryDesc__["discovery_Service__"] = &mojom_types.UserDefinedTypeStructType{
Value: discovery_Service__(),
}
-
discoveryDesc__["discovery_Error__"] = &mojom_types.UserDefinedTypeStructType{
Value: discovery_Error__(),
}
-
discoveryDesc__["discovery_Advertiser__"] = &mojom_types.UserDefinedTypeInterfaceType{
Value: discovery_Advertiser__(),
}
@@ -49,7 +47,6 @@
discoveryDesc__["discovery_Advertiser_Advertise_ResponseParams__"] = &mojom_types.UserDefinedTypeStructType{
Value: discovery_Advertiser_Advertise_ResponseParams__(),
}
-
discoveryDesc__["discovery_Advertiser_Stop_Params__"] = &mojom_types.UserDefinedTypeStructType{
Value: discovery_Advertiser_Stop_Params__(),
}
@@ -57,7 +54,6 @@
discoveryDesc__["discovery_Advertiser_Stop_ResponseParams__"] = &mojom_types.UserDefinedTypeStructType{
Value: discovery_Advertiser_Stop_ResponseParams__(),
}
-
discoveryDesc__["discovery_Scanner__"] = &mojom_types.UserDefinedTypeInterfaceType{
Value: discovery_Scanner__(),
}
@@ -65,6 +61,16 @@
Value: discovery_Scanner_Scan_Params__(),
}
+ discoveryDesc__["discovery_Scanner_Scan_ResponseParams__"] = &mojom_types.UserDefinedTypeStructType{
+ Value: discovery_Scanner_Scan_ResponseParams__(),
+ }
+ discoveryDesc__["discovery_Scanner_Stop_Params__"] = &mojom_types.UserDefinedTypeStructType{
+ Value: discovery_Scanner_Stop_Params__(),
+ }
+
+ discoveryDesc__["discovery_Scanner_Stop_ResponseParams__"] = &mojom_types.UserDefinedTypeStructType{
+ Value: discovery_Scanner_Stop_ResponseParams__(),
+ }
discoveryDesc__["discovery_ScanHandler__"] = &mojom_types.UserDefinedTypeInterfaceType{
Value: discovery_ScanHandler__(),
}
@@ -76,18 +82,6 @@
Value: discovery_ScanHandler_Lost_Params__(),
}
- discoveryDesc__["discovery_Scanner_Scan_ResponseParams__"] = &mojom_types.UserDefinedTypeStructType{
- Value: discovery_Scanner_Scan_ResponseParams__(),
- }
-
- discoveryDesc__["discovery_Scanner_Stop_Params__"] = &mojom_types.UserDefinedTypeStructType{
- Value: discovery_Scanner_Stop_Params__(),
- }
-
- discoveryDesc__["discovery_Scanner_Stop_ResponseParams__"] = &mojom_types.UserDefinedTypeStructType{
- Value: discovery_Scanner_Stop_ResponseParams__(),
- }
-
}
func GetAllMojomTypeDefinitions() map[string]mojom_types.UserDefinedType {
return discoveryDesc__
diff --git a/java/generated-src/mojom/vanadium/discovery.mojom.srcjar b/java/generated-src/mojom/vanadium/discovery.mojom.srcjar
index 1f2979a..e2f880f 100644
--- a/java/generated-src/mojom/vanadium/discovery.mojom.srcjar
+++ b/java/generated-src/mojom/vanadium/discovery.mojom.srcjar
Binary files differ
diff --git a/java/src/main/java/io/v/mojo/discovery/AdvertiserImpl.java b/java/src/main/java/io/v/mojo/discovery/AdvertiserImpl.java
index f2e8b1d..00f327a 100644
--- a/java/src/main/java/io/v/mojo/discovery/AdvertiserImpl.java
+++ b/java/src/main/java/io/v/mojo/discovery/AdvertiserImpl.java
@@ -54,12 +54,15 @@
if (service.attrs == null) {
vService.setAttrs(new Attributes(new HashMap<String, String>()));
}
- List<BlessingPattern> patterns = new ArrayList<>(visibility.length);
- if (visibility != null) {
- for (String pattern : visibility) {
- patterns.add(new BlessingPattern(pattern));
- }
- }
+ List<BlessingPattern> patterns;
+ if (visibility != null) {
+ patterns = new ArrayList<>(visibility.length);
+ for (String pattern : visibility) {
+ patterns.add(new BlessingPattern(pattern));
+ }
+ } else {
+ patterns = new ArrayList<>(0);
+ }
ListenableFuture<ListenableFuture<Void>> done = discovery.advertise(ctx, vService, patterns);
Futures.addCallback(done, new FutureCallback<ListenableFuture<Void>>() {
@Override
diff --git a/pubspec.yaml b/pubspec.yaml
index ed6d142..57ef8a1 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -2,9 +2,9 @@
description: Discovery is a discovery system for developers that makes it easy to advertise apps and scan for them. It works over MDNS and BLE.
homepage: https://github.com/vanadium/mojo.discovery
name: v23discovery
-version: 0.0.7
+version: 0.0.8
dependencies:
- mojo: '>=0.3.0 <0.5.0'
+ mojo_sdk: 0.2.7
dev_dependencies:
dart_style: any
test: any