about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/dart/build-dart-application/hooks/dart-install-hook.sh
blob: 888e12a07d83e616df091134fef56d88e1ffcdce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# shellcheck shell=bash

dartInstallHook() {
    echo "Executing dartInstallHook"

    runHook preInstall

    # Install snapshots and executables.
    mkdir -p "$out"
    while IFS=$'\t' read -ra target; do
        dest="${target[0]}"
        # Wrap with runtime command, if it's defined
        if [ -n "$dartRuntimeCommand" ]; then
            install -D "$dest" "$out/share/$dest"
            makeWrapper "$dartRuntimeCommand" "$out/$dest" \
                --add-flags "$out/share/$dest"
        else
            install -Dm755 "$dest" "$out/$dest"
        fi
    done < <(_getDartEntryPoints)

    # Install the package_config.json file.
    mkdir -p "$pubcache"
    cp .dart_tool/package_config.json "$pubcache/package_config.json"

    runHook postInstall

    echo "Finished dartInstallHook"
}

if [ -z "${dontDartInstall-}" ] && [ -z "${installPhase-}" ]; then
    installPhase=dartInstallHook
fi