diff options
author | Mark Allen <[email protected]> | 2016-04-06 14:27:04 -0500 |
---|---|---|
committer | Mark Allen <[email protected]> | 2016-04-06 14:27:04 -0500 |
commit | edced9e11a682a9484e7ad7eab2cc248d7cf8279 (patch) | |
tree | 5d3d0cdc3e3600595ce9cf10619787230ac40d89 /kerl | |
parent | 3067a7d6e78c7fa773d9348ab7e3be925f813f15 (diff) | |
parent | d1044e8748532643506525b337e969df3c27afd4 (diff) | |
download | kerl-edced9e11a682a9484e7ad7eab2cc248d7cf8279.tar.gz kerl-edced9e11a682a9484e7ad7eab2cc248d7cf8279.tar.bz2 kerl-edced9e11a682a9484e7ad7eab2cc248d7cf8279.zip |
Merge pull request #101 from erszcz/build-plt0.9
Build a Dialyzer PLT when installing a build
Diffstat (limited to 'kerl')
-rwxr-xr-x | kerl | 101 |
1 files changed, 81 insertions, 20 deletions
@@ -52,11 +52,15 @@ fi if [ -n "$KERL_INSTALL_MANPAGES" ]; then _KIM="$KERL_INSTALL_MANPAGES" fi +if [ -n "$KERL_BUILD_PLT" ]; then + _KBPLT="$KERL_BUILD_PLT" +fi KERL_CONFIGURE_OPTIONS= KERL_CONFIGURE_APPLICATIONS= KERL_CONFIGURE_DISABLE_APPLICATIONS= KERL_SASL_STARTUP= KERL_INSTALL_MANPAGES= +KERL_BUILD_PLT= # ensure the base dir exsists mkdir -p "$KERL_BASE_DIR" || exit 1 @@ -85,6 +89,9 @@ fi if [ -n "$_KIM" ]; then KERL_INSTALL_MANPAGES="$_KIM" fi +if [ -n "$_KBPLT" ]; then + KERL_BUILD_PLT="$_KBPLT" +fi if [ -z "$KERL_SASL_STARTUP" ]; then INSTALL_OPT=-minimal @@ -119,6 +126,7 @@ usage() echo " list List releases, builds and installations" echo " delete Delete builds and installations" echo " active Print the path of the active installation" + echo " plt Print Dialyzer PLT path for the active installation" echo " status Print available builds and installations" echo " prompt Print a string suitable for insertion in prompt" echo " cleanup Remove compilation artifacts (use after installation)" @@ -500,19 +508,12 @@ ACTIVATE if [ "$rel" != "git" ]; then if [ -n "$KERL_INSTALL_MANPAGES" ]; then echo "Fetching and installing manpages..." - FILENAME=otp_doc_man_$rel.tar.gz - download "$FILENAME" - echo "Extracting manpages" - cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" + do_install_manpages "$rel" fi if [ -n "$KERL_INSTALL_HTMLDOCS" ]; then echo "Fetching and installing HTML docs..." - FILENAME="otp_doc_html_$rel.tar.gz" - download "$FILENAME" - echo "Extracting HTML docs" - (cd "$absdir" && mkdir -p html && \ - tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") + do_install_htmldocs "$rel" fi else rel=$(get_newest_valid_release) @@ -523,28 +524,81 @@ ACTIVATE if [ -n "$KERL_INSTALL_MANPAGES" ]; then echo "CAUTION: Fetching and installing newest ($rel) manpages..." - FILENAME=otp_doc_man_$rel.tar.gz - download "$FILENAME" - echo "Extracting manpages" - cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" + do_install_manpages "$rel" fi if [ -n "$KERL_INSTALL_HTMLDOCS" ]; then - echo "CATION: Fetching and installing newest ($rel) HTML docs..." - FILENAME="otp_doc_html_$rel.tar.gz" - download "$FILENAME" - echo "Extracting HTML docs" - (cd "$absdir" && mkdir -p html && \ - tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") + echo "CAUTION: Fetching and installing newest ($rel) HTML docs..." + do_install_htmldocs "$rel" fi fi + if [ -n "$KERL_BUILD_PLT" ]; then + echo "Building Dialyzer PLT..." + build_plt "$absdir" + fi + echo "You can activate this installation running the following command:" echo ". $absdir/activate" echo "Later on, you can leave the installation typing:" echo "kerl_deactivate" } +do_install_manpages() +{ + FILENAME=otp_doc_man_$1.tar.gz + download "$FILENAME" + echo "Extracting manpages" + cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" +} + +do_install_htmldocs() +{ + FILENAME="otp_doc_html_$1.tar.gz" + download "$FILENAME" + echo "Extracting HTML docs" + (cd "$absdir" && mkdir -p html && \ + tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") +} + +build_plt() +{ + dialyzerd=$1/dialyzer + mkdir -p $dialyzerd + plt=$dialyzerd/plt + build_log=$dialyzerd/build.log + dialyzer=$1/bin/dialyzer + apps=`ls -1 $1/lib | cut -d- -f1 | grep -Ev 'erl_interface|jinterface' | xargs echo` + $dialyzer --output_plt $plt --build_plt --apps $apps > $build_log 2>&1 + status=$? + if [ $status -eq 0 -o $status -eq 2 ]; then + echo "Done building $plt" + return 0 + else + echo "Error building PLT, see $build_log for details" + return 1 + fi +} + +do_plt() +{ + ACTIVE_PATH=`get_active_path` + if [ -n "$ACTIVE_PATH" ]; then + plt=$ACTIVE_PATH/dialyzer/plt + if [ -f "$plt" ]; then + echo "Dialyzer PLT for the active installation is:" + echo $plt + return 0 + else + echo "There's no Dialyzer PLT for the active installation" + return 1 + fi + else + echo "No Erlang/OTP kerl installation is currently active" + return 2 + fi +} + do_deploy() { if [ -z "$1" ]; then @@ -842,6 +896,11 @@ case "$1" in exit 1; fi ;; + plt) + if ! do_plt; then + exit 1; + fi + ;; status) echo "Available builds:" list_print builds @@ -849,7 +908,9 @@ case "$1" in echo "Available installations:" list_print installations echo "----------" - do_active + if do_active; then + do_plt + fi exit 0 ;; prompt) |