Skip to content

Commit 912e06f

Browse files
author
markheger
authored
Merge pull request #45 from markheger/samples
update samples, makefiles added, add appconfig param
2 parents e25f8e6 + eb4d1fa commit 912e06f

File tree

5 files changed

+119
-2
lines changed
  • samples
    • com.ibm.streamsx.slack.sample.CustomIconEmoji
    • com.ibm.streamsx.slack.sample.HelloWorld

5 files changed

+119
-2
lines changed

samples/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Licensed Materials - Property of IBM
2+
# ObjectStorage Toolkit for IBM Streams
3+
# (c) Copyright IBM Corp. 2019
4+
# All rights reserved.
5+
.PHONY: all clean
6+
7+
all:
8+
for dir in $(shell ls -d -1 */); do\
9+
make -C $$dir || exit 1; \
10+
done
11+
12+
clean:
13+
for dir in $(shell ls -d -1 */); do\
14+
make -C $$dir clean || exit 1; \
15+
done
16+
17+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (C)2019, International Business Machines Corporation and
2+
# others. All Rights Reserved.
3+
4+
.PHONY: all clean
5+
6+
# determine pathes
7+
ifeq ($(STREAMS_STUDIO_BUILDING), 1)
8+
# Building from Streams Studio, use env vars set by studio
9+
SPLC = $(STREAMS_STUDIO_SC_PATH)
10+
SPL_PATH = $(STREAMS_STUDIO_SPL_PATH)
11+
OUTPUT_DIR = $(STREAMS_STUDIO_OUTPUT_DIRECTORY)
12+
else
13+
# Building outside of Streams Studio...
14+
ifeq ($(STREAMS_INSTALL),)
15+
$(error error: environment variable STREAMS_INSTALL has to be set)
16+
endif
17+
# Set the SLACK_TOOLKIT_HOME variable if the toolkit or sample location changed
18+
ifeq ($(SLACK_TOOLKIT_HOME),)
19+
ifneq ($(realpath ../../com.ibm.streamsx.slack),)
20+
SLACK_TOOLKIT_HOME = ../../com.ibm.streamsx.slack
21+
endif
22+
ifneq ($(realpath $(STREAMS_INSTALL)/toolkits/com.ibm.streamsx.slack),)
23+
SLACK_TOOLKIT_HOME = $(STREAMS_INSTALL)/toolkits/com.ibm.streamsx.slack
24+
endif
25+
endif
26+
SPLC = $(STREAMS_INSTALL)/bin/sc
27+
SPL_PATH = $(STREAMS_INSTALL)/toolkits/com.ibm.streamsx.json:$(SLACK_TOOLKIT_HOME)
28+
endif
29+
30+
SPL_NAMESPACE = com.ibm.streamsx.slack.sample.CustomIconEmoji
31+
SPL_MAIN_COMPOSITE = $(SPL_NAMESPACE)::Main
32+
SPLC_FLAGS = -a -t $(SPL_PATH)
33+
SPL_CMD_ARGS ?=
34+
OUTPUT_DIR = output
35+
36+
all:
37+
$(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) --output-directory $(OUTPUT_DIR) $(SPL_CMD_ARGS)
38+
39+
clean:
40+
$(SPLC) $(SPLC_FLAGS) -C -M $(SPL_MAIN_COMPOSITE) --output-directory $(OUTPUT_DIR)
41+
-rm -rf $(OUTPUT_DIR)
42+
-rm -rf toolkit.xml
43+
-rm -rf .toolkitList
44+
45+
configure:
46+
-streamtool rmappconfig --noprompt slack
47+
streamtool mkappconfig --property slackUrl=$(SLACK_URL) slack
48+
49+

samples/com.ibm.streamsx.slack.sample.CustomIconEmoji/com.ibm.streamsx.slack.sample.CustomIconEmoji/Main.spl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public composite Main
6464
() as SendMessage = SendSlackMessage(JSONMessage)
6565
{
6666
param
67-
slackUrl : getSubmissionTimeValue("slackUrl") ;
67+
slackUrl : getSubmissionTimeValue("slackUrl", "");
68+
slackConfiguration : getSubmissionTimeValue("slackConfiguration", "slack");
6869
}
6970

7071
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (C)2019, International Business Machines Corporation and
2+
# others. All Rights Reserved.
3+
4+
.PHONY: all clean
5+
6+
# determine pathes
7+
ifeq ($(STREAMS_STUDIO_BUILDING), 1)
8+
# Building from Streams Studio, use env vars set by studio
9+
SPLC = $(STREAMS_STUDIO_SC_PATH)
10+
SPL_PATH = $(STREAMS_STUDIO_SPL_PATH)
11+
OUTPUT_DIR = $(STREAMS_STUDIO_OUTPUT_DIRECTORY)
12+
else
13+
# Building outside of Streams Studio...
14+
ifeq ($(STREAMS_INSTALL),)
15+
$(error error: environment variable STREAMS_INSTALL has to be set)
16+
endif
17+
# Set the SLACK_TOOLKIT_HOME variable if the toolkit or sample location changed
18+
ifeq ($(SLACK_TOOLKIT_HOME),)
19+
ifneq ($(realpath ../../com.ibm.streamsx.slack),)
20+
SLACK_TOOLKIT_HOME = ../../com.ibm.streamsx.slack
21+
endif
22+
ifneq ($(realpath $(STREAMS_INSTALL)/toolkits/com.ibm.streamsx.slack),)
23+
SLACK_TOOLKIT_HOME = $(STREAMS_INSTALL)/toolkits/com.ibm.streamsx.slack
24+
endif
25+
endif
26+
SPLC = $(STREAMS_INSTALL)/bin/sc
27+
SPL_PATH = $(SLACK_TOOLKIT_HOME)
28+
endif
29+
30+
SPL_NAMESPACE = com.ibm.streamsx.slack.sample.HelloWorld
31+
SPL_MAIN_COMPOSITE = $(SPL_NAMESPACE)::Main
32+
SPLC_FLAGS = -a -t $(SPL_PATH)
33+
SPL_CMD_ARGS ?=
34+
OUTPUT_DIR = output
35+
36+
all:
37+
$(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) --output-directory $(OUTPUT_DIR) $(SPL_CMD_ARGS)
38+
39+
clean:
40+
$(SPLC) $(SPLC_FLAGS) -C -M $(SPL_MAIN_COMPOSITE) --output-directory $(OUTPUT_DIR)
41+
-rm -rf $(OUTPUT_DIR)
42+
-rm -rf toolkit.xml
43+
-rm -rf .toolkitList
44+
45+
configure:
46+
-streamtool rmappconfig --noprompt slack
47+
streamtool mkappconfig --property slackUrl=$(SLACK_URL) slack
48+
49+

samples/com.ibm.streamsx.slack.sample.HelloWorld/com.ibm.streamsx.slack.sample.HelloWorld/Main.spl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public composite Main
3434
() as SendMessage = SendSlackMessage(GenerateMessage)
3535
{
3636
param
37-
slackUrl : getSubmissionTimeValue("slackUrl") ;
37+
slackUrl : getSubmissionTimeValue("slackUrl", "");
38+
slackConfiguration : getSubmissionTimeValue("slackConfiguration", "slack");
3839
}
3940

4041
}

0 commit comments

Comments
 (0)