github.com/jdhenke/godel@v0.0.0-20161213181855-abeb3861bf0d/godel/config/dist.yml (about)

     1  products:
     2    distgo:
     3      build:
     4        output-dir: ./apps/distgo/build
     5        main-pkg: ./apps/distgo/main/distgo
     6        environment:
     7          CGO_ENABLED: "0"
     8        version-var: github.com/palantir/godel/cmd/godel.Version
     9      dist:
    10        output-dir: ./apps/distgo/dist
    11        dist-type:
    12          type: bin
    13          info:
    14            omit-init-sh: true
    15    gonform:
    16      build:
    17        output-dir: ./apps/gonform/build
    18        main-pkg: ./apps/gonform/main/gonform
    19        environment:
    20          CGO_ENABLED: "0"
    21        version-var: github.com/palantir/godel/cmd/godel.Version
    22      dist:
    23        output-dir: ./apps/gonform/dist
    24        dist-type:
    25          type: bin
    26          info:
    27            omit-init-sh: true
    28    gunit:
    29      build:
    30        output-dir: ./apps/gunit/build
    31        main-pkg: ./apps/gunit/main/gunit
    32        environment:
    33          CGO_ENABLED: "0"
    34        version-var: github.com/palantir/godel/cmd/godel.Version
    35      dist:
    36        output-dir: ./apps/gunit/dist
    37        dist-type:
    38          type: bin
    39          info:
    40            omit-init-sh: true
    41    okgo:
    42      build:
    43        output-dir: ./apps/okgo/build
    44        main-pkg: ./apps/okgo/main/okgo
    45        environment:
    46          CGO_ENABLED: "0"
    47        version-var: github.com/palantir/godel/cmd/godel.Version
    48      dist:
    49        output-dir: ./apps/okgo/dist
    50        dist-type:
    51          type: bin
    52          info:
    53            omit-init-sh: true
    54    godel:
    55      build:
    56        main-pkg: ./main/godel
    57        environment:
    58          CGO_ENABLED: "0"
    59        os-archs:
    60          - os: darwin
    61            arch: amd64
    62          - os: linux
    63            arch: amd64
    64        version-var: github.com/palantir/godel/cmd/godel.Version
    65      dist:
    66        dist-type:
    67          type: bin
    68          info:
    69            omit-init-sh: true
    70        script: |
    71                set -euo pipefail
    72  
    73                # computes the SHA-256 hash of the provided file. Uses openssl, shasum or sha1sum program.
    74                function compute_sha256 {
    75                    local file=$1
    76                    if command -v openssl >/dev/null 2>&1; then
    77                        # print SHA-256 hash using openssl
    78                        openssl dgst -sha256 "$file" | sed -E 's/SHA256\(.*\)= //'
    79                    elif command -v shasum >/dev/null 2>&1; then
    80                        # Darwin systems ship with "shasum" utility
    81                        shasum -a 256 "$file" | sed -E 's/[[:space:]]+.+//'
    82                    elif command -v sha256sum >/dev/null 2>&1; then
    83                        # Most Linux systems ship with sha256sum utility
    84                        sha256sum "$file" | sed -E 's/[[:space:]]+.+//'
    85                    else
    86                        echo "Could not find program to calculate SHA-256 checksum for file"
    87                        exit 1
    88                    fi
    89                }
    90  
    91                # replaces all occurrences of the string "{{VERSION}}" in the provided file with the value of $VERSION
    92                function substitute_version {
    93                    local file=$1
    94                    substitute_variable "{{VERSION}}" "$VERSION" "$file"
    95                }
    96  
    97                # replaces all occurrences of the string "{{CHECKSUM_$1}}" in the provided file with the value computed
    98                # for the checksum of the binary for the OS/Arch combination specified by $1.
    99                function substitute_checksum {
   100                    local os_arch=$1
   101                    local file=$2
   102                    local checksum=$(compute_sha256 "$DIST_DIR/bin/$os_arch/godel")
   103                    substitute_variable "{{CHECKSUM_$os_arch}}" "$checksum" "$file"
   104                }
   105  
   106                # replaces all occurrences of the first argument with the value of the second argument in the file
   107                # provided as the third argument.
   108                function substitute_variable {
   109                    local variable=$1
   110                    local value=$2
   111                    local file=$3
   112  
   113                    local tmpFile=$file-$RANDOM.tmp
   114                    cp -p $file $tmpFile
   115                    sed 's|'"$variable"'|'"$value"'|' "$file" > "$tmpFile"
   116                    mv "$tmpFile" "$file"
   117                }
   118  
   119                function setup_wrapper {
   120                    local wrapper_dir=$1
   121  
   122                    # copy contents of resources directory
   123                    mkdir -p "$wrapper_dir"
   124                    cp -r "$PROJECT_DIR/resources/wrapper"/* "$wrapper_dir"
   125  
   126                    # substitute version for godelw
   127                    substitute_version "$wrapper_dir/godelw"
   128  
   129                    # substitute checksums for godelw
   130                    substitute_checksum darwin-amd64 "$wrapper_dir/godelw"
   131                    substitute_checksum linux-amd64 "$wrapper_dir/godelw"
   132  
   133                    # substitute the URL in the properties file
   134                    REPO=""
   135                    if [ "$IS_SNAPSHOT" == "1" ]; then
   136                        REPO="releases-internal"
   137                    else
   138                        REPO="releases"
   139                    fi
   140                    PROPERTIES_FILE="$wrapper_dir/godel/config/godel.properties"
   141                    URL="https://palantir.bintray.com/${REPO}/com/palantir/godel/godel/${VERSION}/godel-${VERSION}.tgz"
   142                    substitute_variable "{{URL}}" "$URL" "$PROPERTIES_FILE"
   143                }
   144  
   145                # copy contents of resources directory
   146                mkdir -p "$DIST_DIR/wrapper"
   147                setup_wrapper "$DIST_DIR/wrapper"
   148  group-id: com.palantir.godel