22set -e -o pipefail
33
44if [ -z " $DX_API_TOKEN " ]; then
5- echo " ERROR: DX_API_TOKEN is not set, this is needed to build dxWDL workflows."
5+ echo " ERROR: DX_API_TOKEN is not set, this is needed to build DNAnexus workflows."
66 exit 1
77fi
88
@@ -14,8 +14,8 @@ source dx-toolkit/environment
1414dx login --token " $DX_API_TOKEN " --noprojects
1515dx select $DX_PROJECT
1616
17- # compile with dxWDL
18- COMPILE_SUCCESS=" dxWDL -compile_all-success.txt"
17+ # compile with dxCompiler
18+ COMPILE_SUCCESS=" dxCompiler -compile_all-success.txt"
1919touch $COMPILE_SUCCESS
2020for workflow in pipes/WDL/workflows/* .wdl; do
2121 if [ -n " $( grep DX_SKIP_WORKFLOW $workflow ) " ]; then
@@ -34,7 +34,7 @@ for workflow in pipes/WDL/workflows/*.wdl; do
3434 extras_json=" pipes/dnax/dx-extras.json"
3535 CMD_DEFAULTS+=" -extras $extras_json "
3636
37- dx_id=$( java -jar dxWDL .jar compile \
37+ dx_id=$( java -jar dxCompiler .jar compile \
3838 $workflow $CMD_DEFAULTS -f -verbose \
3939 -leaveWorkflowsOpen \
4040 -imports pipes/WDL/tasks/ \
@@ -50,27 +50,42 @@ for workflow in pipes/WDL/workflows/*.wdl; do
5050 fi
5151done
5252
53- # build consolidate_run_tarballs (native DNAnexus applet) applet
54- pushd pipes/dnax/dx-launcher
55- cp consolidate_run_tarballs.yml consolidate_run_tarballs_dxapp.yml
56- consolidate_tarballs_dx_id=$( ./dx-yml-build consolidate_run_tarballs_dxapp.yml -a --destination /build/$VERSION / | jq -r " .id" )
57- popd
58- echo -e " consolidate_run_tarballs\t$dx_id " >> $COMPILE_SUCCESS
59-
6053# Special case: build demux launchers (native DNAnexus applets), embedding the
61- # demux workflow ID as a default input
54+ # demux workflow ID as a default input. Skip if no demux workflows were compiled.
6255demux_workflows_to_build=" demux_plus demux_only"
56+ any_demux_compiled=false
6357for wf_name in $( echo " ${demux_workflows_to_build} " ) ; do
64- echo " Building applet ${wf_name} ..."
65- demux_workflow_id=$( grep " ^${wf_name} \s" $COMPILE_SUCCESS | cut -f 2)
58+ if grep -q " ^${wf_name} \s" $COMPILE_SUCCESS ; then
59+ any_demux_compiled=true
60+ fi
61+ done
62+
63+ if [ " $any_demux_compiled " = true ]; then
64+ # build consolidate_run_tarballs (native DNAnexus applet) applet
6665 pushd pipes/dnax/dx-launcher
67- sed " s/DEFAULT_DEMUX_WORKFLOW_ID/$demux_workflow_id /" demux_launcher.yml \
68- | sed " s/DEFAULT_DEMUX_WORKFLOW_NAME/${wf_name} _launcher/" \
69- | sed " s/DEFAULT_CONSOLIDATE_RUN_TARBALLS_APPLET_ID/$consolidate_tarballs_dx_id /" > " ${wf_name} _dxapp.yml"
70- dx_id=$( ./dx-yml-build ${wf_name} _dxapp.yml -a --destination /build/$VERSION / | jq -r " .id" )
66+ cp consolidate_run_tarballs.yml consolidate_run_tarballs_dxapp.yml
67+ consolidate_tarballs_dx_id=$( ./dx-yml-build consolidate_run_tarballs_dxapp.yml -a --destination /build/$VERSION / | jq -r " .id" )
7168 popd
72- echo -e " ${wf_name} _launcher\t$dx_id " >> $COMPILE_SUCCESS
73- done
69+ echo -e " consolidate_run_tarballs\t$consolidate_tarballs_dx_id " >> $COMPILE_SUCCESS
70+
71+ for wf_name in $( echo " ${demux_workflows_to_build} " ) ; do
72+ demux_workflow_id=$( grep " ^${wf_name} \s" $COMPILE_SUCCESS | cut -f 2)
73+ if [ -z " $demux_workflow_id " ]; then
74+ echo " Skipping applet ${wf_name} _launcher (${wf_name} was not compiled)"
75+ continue
76+ fi
77+ echo " Building applet ${wf_name} ..."
78+ pushd pipes/dnax/dx-launcher
79+ sed " s/DEFAULT_DEMUX_WORKFLOW_ID/$demux_workflow_id /" demux_launcher.yml \
80+ | sed " s/DEFAULT_DEMUX_WORKFLOW_NAME/${wf_name} _launcher/" \
81+ | sed " s/DEFAULT_CONSOLIDATE_RUN_TARBALLS_APPLET_ID/$consolidate_tarballs_dx_id /" > " ${wf_name} _dxapp.yml"
82+ dx_id=$( ./dx-yml-build ${wf_name} _dxapp.yml -a --destination /build/$VERSION / | jq -r " .id" )
83+ popd
84+ echo -e " ${wf_name} _launcher\t$dx_id " >> $COMPILE_SUCCESS
85+ done
86+ else
87+ echo " Skipping consolidate_run_tarballs and demux launchers (no demux workflows were compiled)"
88+ fi
7489
7590# the presence of this file in the project denotes successful build
7691dx upload --brief --no-progress --destination /build/$VERSION / $COMPILE_SUCCESS
0 commit comments