Skip to content

Instantly share code, notes, and snippets.

@bangpound
Created June 11, 2017 00:54
Show Gist options
  • Select an option

  • Save bangpound/50f16b0ce51a175ea5ac9a165c012cfd to your computer and use it in GitHub Desktop.

Select an option

Save bangpound/50f16b0ce51a175ea5ac9a165c012cfd to your computer and use it in GitHub Desktop.

Revisions

  1. bangpound created this gist Jun 11, 2017.
    34 changes: 34 additions & 0 deletions compile.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    #!/bin/bash

    [ -d ac_global/jsc ] || mkdir ac_global/jsc
    [ -d admin/jsc ] || mkdir admin/jsc

    closure_compile() {
    temp="${1%\'}"
    temp="${temp#\'}"
    list=()
    js=$(jq --raw-output '.["'"$temp"'"] | @sh' < tools/compilejs.json)
    for f in $js
    do
    list+=("--js=$f ")
    done
    echo ${list[@]}
    java -jar ~/closure-compiler/closure-compiler-v20170521.jar ${list[@]} --js_output_file "${temp}"
    }

    closure_compiler_check() {
    list=()
    for f in ${1}
    do
    list+=("--js=$f ")
    done
    java -jar ~/closure-compiler/closure-compiler-v20170521.jar ${list[@]} --checks-only -W DEFAULT
    }

    #files=$(jq --raw-output '. | flatten | unique | @sh' < tools/compilejs.json)
    #closure_compiler_check "${files}"

    for i in $(jq --raw-output 'keys | @sh' < tools/compilejs.json);
    do
    closure_compile "${i}"
    done