Sever dependency from :desktop => :grpc

The :grpc module will soon be renamed to :daemon. These two modules
represent two separate and equal modes of running bisq, either as a
desktop GUI or as a daemon. They are both applications, and one should
not depend on the other as it would be illogical and confusing to model
things that way. The reason for the current dependency from :desktop to
:grpc is because :grpc is the home of BisqGrpcServer. This change moves
this class up to :core, in a new bisq.core.grpc package, such that both
the :desktop and :daemon applications can pull it in cleanly.

The CoreApi 'facade' that BisqGrpcServer uses to abstract away bisq
internals has been moved from bisq.core to bisq.core.grpc as well and
for the same reasons detailed in 8b30c22d6.

This change also renames the Java package for generated grpc types from
bisq.grpc.protobuf to bisq.core.grpc (the same new package that
BisqGrpcServer and CoreApi now live in). Again, this is for reasons of
cohesion: BisqGrpcServer is the only user of these grpc-generated types,
and they should logically live in the same package (even if they
physically live in separate source dirs at the build level).
This commit is contained in:
Chris Beams 2019-11-21 22:54:23 +01:00
parent eaad2e0a4c
commit aff760514b
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
6 changed files with 21 additions and 42 deletions

View File

@ -336,7 +336,6 @@ configure(project(':desktop')) {
dependencies {
compile project(':core')
compile project(':grpc')
compile "net.glxn:qrgen:$qrgenVersion"
compile "de.jensd:fontawesomefx:$fontawesomefxVersion"
compile "de.jensd:fontawesomefx-commons:$fontawesomefxCommonsVersion"

View File

@ -17,6 +17,20 @@
package bisq.cli.app;
import bisq.core.grpc.GetBalanceGrpc;
import bisq.core.grpc.GetBalanceRequest;
import bisq.core.grpc.GetOffersGrpc;
import bisq.core.grpc.GetOffersRequest;
import bisq.core.grpc.GetPaymentAccountsGrpc;
import bisq.core.grpc.GetPaymentAccountsRequest;
import bisq.core.grpc.GetTradeStatisticsGrpc;
import bisq.core.grpc.GetTradeStatisticsRequest;
import bisq.core.grpc.GetVersionGrpc;
import bisq.core.grpc.GetVersionRequest;
import bisq.core.grpc.PlaceOfferGrpc;
import bisq.core.grpc.PlaceOfferRequest;
import bisq.core.grpc.StopServerGrpc;
import bisq.core.grpc.StopServerRequest;
import bisq.core.payment.PaymentAccount;
import bisq.core.proto.network.CoreNetworkProtoResolver;
import bisq.core.proto.persistable.CorePersistenceProtoResolver;
@ -39,20 +53,6 @@ import static java.lang.String.format;
import bisq.grpc.protobuf.GetBalanceGrpc;
import bisq.grpc.protobuf.GetBalanceRequest;
import bisq.grpc.protobuf.GetOffersGrpc;
import bisq.grpc.protobuf.GetOffersRequest;
import bisq.grpc.protobuf.GetPaymentAccountsGrpc;
import bisq.grpc.protobuf.GetPaymentAccountsRequest;
import bisq.grpc.protobuf.GetTradeStatisticsGrpc;
import bisq.grpc.protobuf.GetTradeStatisticsRequest;
import bisq.grpc.protobuf.GetVersionGrpc;
import bisq.grpc.protobuf.GetVersionRequest;
import bisq.grpc.protobuf.PlaceOfferGrpc;
import bisq.grpc.protobuf.PlaceOfferRequest;
import bisq.grpc.protobuf.StopServerGrpc;
import bisq.grpc.protobuf.StopServerRequest;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.StatusRuntimeException;

View File

@ -15,9 +15,8 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.grpc;
package bisq.core.grpc;
import bisq.core.CoreApi;
import bisq.core.offer.Offer;
import bisq.core.payment.PaymentAccount;
import bisq.core.trade.handlers.TransactionResultHandler;
@ -32,31 +31,11 @@ import lombok.extern.slf4j.Slf4j;
import bisq.grpc.protobuf.GetBalanceGrpc;
import bisq.grpc.protobuf.GetBalanceReply;
import bisq.grpc.protobuf.GetBalanceRequest;
import bisq.grpc.protobuf.GetOffersGrpc;
import bisq.grpc.protobuf.GetOffersReply;
import bisq.grpc.protobuf.GetOffersRequest;
import bisq.grpc.protobuf.GetPaymentAccountsGrpc;
import bisq.grpc.protobuf.GetPaymentAccountsReply;
import bisq.grpc.protobuf.GetPaymentAccountsRequest;
import bisq.grpc.protobuf.GetTradeStatisticsGrpc;
import bisq.grpc.protobuf.GetTradeStatisticsReply;
import bisq.grpc.protobuf.GetTradeStatisticsRequest;
import bisq.grpc.protobuf.GetVersionGrpc;
import bisq.grpc.protobuf.GetVersionReply;
import bisq.grpc.protobuf.GetVersionRequest;
import bisq.grpc.protobuf.PlaceOfferGrpc;
import bisq.grpc.protobuf.PlaceOfferReply;
import bisq.grpc.protobuf.PlaceOfferRequest;
import bisq.grpc.protobuf.StopServerGrpc;
import bisq.grpc.protobuf.StopServerReply;
import bisq.grpc.protobuf.StopServerRequest;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.stub.StreamObserver;
/**
* gRPC server. Gets a instance of BisqFacade passed to access data from the running Bisq instance.
*/
@ -199,7 +178,7 @@ public class BisqGrpcServer {
* Await termination on the main thread since the grpc library uses daemon threads.
* Only used for headless version
*/
void blockUntilShutdown() throws InterruptedException {
public void blockUntilShutdown() throws InterruptedException {
if (server != null) {
server.awaitTermination();
}

View File

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core;
package bisq.core.grpc;
import bisq.core.btc.Balances;
import bisq.core.monetary.Price;

View File

@ -21,7 +21,7 @@ package io.bisq.protobuffer;
// FIXME: IntelliJ does not recognize the import but the compiler does
import "pb.proto";
option java_package = "bisq.grpc.protobuf";
option java_package = "bisq.core.grpc";
option java_multiple_files = true;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -17,11 +17,12 @@
package bisq.grpc;
import bisq.core.CoreApi;
import bisq.core.app.BisqExecutable;
import bisq.core.app.BisqHeadlessAppMain;
import bisq.core.app.BisqSetup;
import bisq.core.app.CoreModule;
import bisq.core.grpc.BisqGrpcServer;
import bisq.core.grpc.CoreApi;
import bisq.common.UserThread;
import bisq.common.app.AppModule;