|
8 | 8 |
|
9 | 9 | set -e |
10 | 10 |
|
| 11 | +GIT_CLONE_ARGS=("$@") |
| 12 | + |
11 | 13 | # Look in the many different CI env vars for which branch we're |
12 | 14 | # building |
13 | 15 | if [[ "$TRAVIS" == true ]]; then |
|
25 | 27 |
|
26 | 28 | echo "Determined branch to be $curbranch" |
27 | 29 |
|
| 30 | +# clone a specific branch of a github repo |
| 31 | +function clone() { |
| 32 | + org=$1 |
| 33 | + repo=$2 |
| 34 | + branch=$3 |
| 35 | + git clone https://github.com/$org/$repo.git $repo --branch $branch \ |
| 36 | + "${GIT_CLONE_ARGS[@]}" |
| 37 | +} |
| 38 | + |
28 | 39 | function dodep() { |
29 | 40 | org=$1 |
30 | 41 | repo=$2 |
31 | | - rm -rf $repo || true |
32 | | - git clone https://github.com/$org/$repo.git $repo |
33 | | - pushd $repo |
34 | | - git checkout $curbranch || git checkout develop |
35 | | - echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD` |
36 | | - popd |
| 42 | + rm -rf $repo |
| 43 | + clone $org $repo $curbranch || { |
| 44 | + [ "$curbranch" != 'develop' ] && clone $org $repo develop |
| 45 | + } || return $? |
| 46 | + |
| 47 | + ( |
| 48 | + cd $repo |
| 49 | + echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD` |
| 50 | + ) |
| 51 | + |
| 52 | + mkdir -p node_modules |
| 53 | + rm -r "node_modules/$repo" 2>/dev/null || true |
| 54 | + ln -sv "../$repo" node_modules/ |
37 | 55 | } |
38 | 56 |
|
| 57 | +echo -en 'travis_fold:start:matrix-js-sdk\r' |
| 58 | +echo 'Setting up matrix-js-sdk' |
| 59 | + |
39 | 60 | dodep matrix-org matrix-js-sdk |
| 61 | +( |
| 62 | + cd node_modules/matrix-js-sdk |
| 63 | + npm install |
| 64 | +) |
| 65 | + |
| 66 | +echo -en 'travis_fold:end:matrix-js-sdk\r' |
| 67 | + |
| 68 | +echo -en 'travis_fold:start:matrix-react-sdk\r' |
| 69 | +echo 'Setting up matrix-react-sdk' |
| 70 | + |
40 | 71 | dodep matrix-org matrix-react-sdk |
41 | 72 |
|
42 | | -mkdir -p node_modules |
43 | | -cd node_modules |
44 | | - |
45 | | -rm -r matrix-js-sdk 2> /dev/null || true |
46 | | -ln -s ../matrix-js-sdk ./ |
47 | | -pushd matrix-js-sdk |
48 | | -npm install |
49 | | -popd |
50 | | - |
51 | | -rm -r matrix-react-sdk 2> /dev/null || true |
52 | | -ln -s ../matrix-react-sdk ./ |
53 | | -pushd matrix-react-sdk |
54 | | -mkdir -p node_modules |
55 | | -cd node_modules |
56 | | -ln -s ../../matrix-js-sdk matrix-js-sdk |
57 | | -cd .. |
58 | | -npm install |
59 | | -popd |
| 73 | +mkdir -p node_modules/matrix-react-sdk/node_modules |
| 74 | +ln -s ../../matrix-js-sdk node_modules/matrix-react-sdk/node_modules/ |
| 75 | + |
| 76 | +( |
| 77 | + cd node_modules/matrix-react-sdk |
| 78 | + npm install |
| 79 | +) |
| 80 | + |
| 81 | +echo -en 'travis_fold:end:matrix-react-sdk\r' |
| 82 | + |
60 | 83 | # Link the reskindex binary in place: if we used npm link, |
61 | 84 | # npm would do this for us, but we don't because we'd have |
62 | 85 | # to define the npm prefix somewhere so it could put the |
63 | 86 | # intermediate symlinks there. Instead, we do it ourselves. |
64 | | -mkdir -p .bin |
65 | | -ln -sf ../matrix-react-sdk/scripts/reskindex.js .bin/reskindex |
| 87 | +mkdir -p node_modules/.bin |
| 88 | +ln -sfv ../matrix-react-sdk/scripts/reskindex.js node_modules/.bin/reskindex |
0 commit comments