Skip to content

Commit 19f9900

Browse files
authored
Merge pull request element-hq#4147 from vector-im/rav/fetch_deps_tweaks
Various tweaks to fetch-develop-deps
2 parents 9e46d17 + 81c0c7b commit 19f9900

2 files changed

Lines changed: 52 additions & 28 deletions

File tree

‎.travis.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ node_js:
1717
- 6
1818
- 7
1919
install:
20-
- scripts/fetch-develop.deps.sh
21-
- npm install
20+
# clone the deps with depth 1: we know we will only ever need that one
21+
# commit.
22+
- scripts/fetch-develop.deps.sh --depth 1 && npm install

‎scripts/fetch-develop.deps.sh‎

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
set -e
1010

11+
GIT_CLONE_ARGS=("$@")
12+
1113
# Look in the many different CI env vars for which branch we're
1214
# building
1315
if [[ "$TRAVIS" == true ]]; then
@@ -25,41 +27,62 @@ fi
2527

2628
echo "Determined branch to be $curbranch"
2729

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+
2839
function dodep() {
2940
org=$1
3041
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/
3755
}
3856

57+
echo -en 'travis_fold:start:matrix-js-sdk\r'
58+
echo 'Setting up matrix-js-sdk'
59+
3960
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+
4071
dodep matrix-org matrix-react-sdk
4172

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+
6083
# Link the reskindex binary in place: if we used npm link,
6184
# npm would do this for us, but we don't because we'd have
6285
# to define the npm prefix somewhere so it could put the
6386
# 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

Comments
 (0)