From b1a5509927fe74d095add35ae014a713a169c49e Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 23 Sep 2019 15:02:49 +0200 Subject: [PATCH] smack-tcp: Split dot to png into two makefile steps Since using a pipe, as we did previously would not error the target if the first command in the pipe fails. It is still far from ideal, since the dot file is also generated if the gradle command fails. At some point, this should probably become part of gradle build step instead of shelling out to a Makefile. --- smack-tcp/Makefile | 19 ++++++++++++++----- .../smack/tcp/doc-files/.gitignore | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/smack-tcp/Makefile b/smack-tcp/Makefile index 00e349208..8decb8444 100644 --- a/smack-tcp/Makefile +++ b/smack-tcp/Makefile @@ -1,12 +1,21 @@ -.PHONY := clean generate +.PHONY := all clean GRADLE_QUITE_ARGS := --quiet --console plain -GENERATED_FILES := src/javadoc/org/jivesoftware/smack/tcp/doc-files/XmppNioTcpConnectionStateGraph.png -generate: $(GENERATED_FILES) +XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_PNG := src/javadoc/org/jivesoftware/smack/tcp/doc-files/XmppNioTcpConnectionStateGraph.png +XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_DOT := $(XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_PNG:.png=.dot) + +GENERATED_FILES := $(XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_PNG) $(XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_DOT) + +all: $(XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_PNG) clean: rm -f $(GENERATED_FILES) -src/javadoc/org/jivesoftware/smack/tcp/doc-files/XmppNioTcpConnectionStateGraph.png: src/main/java/org/jivesoftware/smack/tcp/XmppNioTcpConnection.java ../smack-core/src/main/java/org/jivesoftware/smack/fsm/AbstractXmppStateMachineConnection.java - gradle $(GRADLE_QUITE_ARGS) :smack-repl:printXmppNioTcpConnectionStateGraph | dot -Tpng -o $@ +%.png: %.dot + dot -Tpng -o $@ $^ + +$(XMPP_NIO_TCP_CONNECTION_STATE_GRAPH_DOT): src/main/java/org/jivesoftware/smack/tcp/XmppNioTcpConnection.java ../smack-core/src/main/java/org/jivesoftware/smack/fsm/AbstractXmppStateMachineConnection.java + # TODO: This also creates the dot file even if the command + # fails. It would be better if this was not the case. + gradle $(GRADLE_QUITE_ARGS) :smack-repl:printXmppNioTcpConnectionStateGraph > $@ diff --git a/smack-tcp/src/javadoc/org/jivesoftware/smack/tcp/doc-files/.gitignore b/smack-tcp/src/javadoc/org/jivesoftware/smack/tcp/doc-files/.gitignore index e68066393..35616fd31 100644 --- a/smack-tcp/src/javadoc/org/jivesoftware/smack/tcp/doc-files/.gitignore +++ b/smack-tcp/src/javadoc/org/jivesoftware/smack/tcp/doc-files/.gitignore @@ -1 +1,2 @@ /XmppNioTcpConnectionStateGraph.png +/XmppNioTcpConnectionStateGraph.dot