Skip to content

Commit

Permalink
Merge pull request #37 from tai271828/mr-devenv-launch
Browse files Browse the repository at this point in the history
feat(launch): init support of launching applications
  • Loading branch information
yungyuc authored Jun 6, 2021
2 parents 5b4563d + 6e92061 commit c144dd0
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 6 deletions.
17 changes: 16 additions & 1 deletion applications/solvcon/prepare-solvcon-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
# source <this script> <your-project-folder>
#
set -x
SOLVCON_PROJECT=${1:-${HOME}/solvcon}

if [ -z "${DEVENVFLAVOR}" ]
then
SOLVCON_PROJECT=${1:-${HOME}/solvcon}
else
SOLVCON_PROJECT=${1:-${DEVENVAPP}}
fi

SCSRC="${SOLVCON_PROJECT}/solvcon"
SCSRC_WORKING="${SOLVCON_PROJECT}/solvcon-working"
SCDE_SRC=${SCDE_SRC:-${SOLVCON_PROJECT}/devenv}
Expand Down Expand Up @@ -78,3 +85,11 @@ pushd ${SCSRC}/sandbox/gas/tube
./go run
popd


# A workaround to use packages built or managed by conda. We could abandon
# this workaround when devenv is fully integrated and used for SOLVCON
echo "Re-launch SOLVCON by the following commands:"
echo ""
echo "export PATH="${SCSRC}:${MINICONDA_DIR}/bin:${PATH}""
echo ""

11 changes: 6 additions & 5 deletions bin/devenv
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ Description:
devenv management tool
Commands:
add - create a new devenv environment
use - select an environment to use
del - delete an environment directory
off - deactivate environment
build - build applications"
add - create a new devenv environment
use - select an environment to use
del - delete an environment directory
off - deactivate environment
build - build package
launch - launch application"
else
display -e "Unrecognized command line argument: '${cmd}'"
fi
Expand Down
21 changes: 21 additions & 0 deletions scripts/application.d/solvcon
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e

application_name=solvcon
application_branch=${VERSION:-master}
application_full=$application_name-$application_branch
application_src=${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${application_full}

syncgit https://github.com/solvcon ${application_name} ${application_branch}

export DEVENVAPP=${DEVENVROOT}/flavors/${DEVENVFLAVOR}/application-${application_name}
mkdir -p ${DEVENVAPP}

ln -s ${application_src} ${DEVENVAPP}/${application_name}


echo "launching solvcon..."
${DEVENVROOT}/bin/build-application-solvcon-devenv.sh

# vim: set et nobomb ft=bash ff=unix fenc=utf8:
17 changes: 17 additions & 0 deletions scripts/cmd.d/launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
. ${DEVENVROOT}/scripts/func.d/bash_utils

script="${DEVENVROOT}/scripts/application.d/$1"
if [ ! -f "${script}" ]; then
display -e "'$1' not defined"
fi

if [ -z "${DEVENVFLAVOR}" ] ; then
display -e "\$DEVENVFLAVOR not defined"
fi

. ${DEVENVROOT}/scripts/func.d/build_utils
display "Execute building script \"${script}\" ${@:$(($#+1))} ..."
. ${script}
display "Finished building script \"${script}\"."

# vim: set et nu nobomb fenc=utf8 ft=sh ff=unix sw=2 ts=2:
3 changes: 3 additions & 0 deletions scripts/func.d/bash_utils
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ get_list() {
build)
dir="${DEVENVROOT}/scripts/build.d"
;;
application)
dir="${DEVENVROOT}/scripts/application.d"
;;
cmd)
dir="${DEVENVROOT}/scripts/cmd.d"
;;
Expand Down
5 changes: 5 additions & 0 deletions scripts/init
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ _devenv() {
COMPREPLY=( $(compgen -W "$(get_list build)" -- ${cur}) )
return 0
;;
launch)
[[ $COMP_CWORD > 2 ]] && return 1
COMPREPLY=( $(compgen -W "$(get_list application)" -- ${cur}) )
return 0
;;
*)
[[ $COMP_CWORD > 1 ]] && return 1
cmds=$(get_list cmd)
Expand Down

0 comments on commit c144dd0

Please sign in to comment.