Merge pull request #3945 from vector-im/dbkr/fetch_deps_script

Script to fetch corresponding branches of dependent projects
This commit is contained in:
David Baker 2017-05-19 13:14:07 +01:00 committed by GitHub
commit 50b46af943
5 changed files with 101 additions and 19 deletions

61
scripts/fetch-develop.deps.sh Executable file
View file

@ -0,0 +1,61 @@
#!/bin/bash
# Fetches the js-sdk and matrix-react-sdk dependencies for development
# or testing purposes
# If there exists a branch of that dependency with the same name as
# the branch the current checkout is on, use that branch. Otherwise,
# use develop.
# Look in the many different CI env vars for which branch we're
# building
if [[ "$TRAVIS" == true ]]; then
curbranch="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
else
# ghprbSourceBranch for jenkins github pull request builder
# GIT_BRANCH for other jenkins builds
curbranch="${ghprbSourceBranch:-$GIT_BRANCH}"
# Otherwise look at the actual branch we're on
if [ -z "$curbranch" ]
then
curbranch=`git rev-parse --abbrev-ref HEAD`
fi
fi
echo "Determined branch to be $curbranch"
function dodep() {
org=$1
repo=$2
rm -rf $repo || true
git clone https://github.com/$org/$repo.git $repo
pushd $repo
git checkout $curbranch || git checkout develop
echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD`
popd
}
dodep matrix-org matrix-js-sdk
dodep matrix-org matrix-react-sdk
mkdir -p node_modules
cd node_modules
ln -s ../matrix-js-sdk ./
pushd matrix-js-sdk
npm install
popd
ln -s ../matrix-react-sdk ./
pushd matrix-react-sdk
mkdir -p node_modules
cd node_modules
ln -s ../../matrix-js-sdk matrix-js-sdk
cd ..
npm install
popd
# Link the reskindex binary in place: if we used npm link,
# npm would do this for us, but we don't because we'd have
# to define the npm prefix somewhere so it could put the
# intermediate symlinks there. Instead, we do it ourselves.
mkdir -p .bin
ln -s ../matrix-react-sdk/scripts/reskindex.js .bin/reskindex

View file

@ -8,10 +8,13 @@ nvm use 6
set -x
# check out corresponding branches of dependencies
`dirname $0`/fetch-develop.deps.sh
npm install
# apparently npm 3.10.3 on node 6.4.0 doesn't upgrade #develop target with npm install unless explicitly asked.
npm install matrix-react-sdk matrix-js-sdk olm
npm install olm
# install olm. A naive 'npm i ./olm/olm-*.tgz' fails because it uses the url
# from our package.json (or even matrix-js-sdk's) in preference.
@ -23,11 +26,6 @@ npm install matrix-react-sdk matrix-js-sdk olm
#rm -r node_modules/olm
#cp -r olm/package node_modules/olm
# we may be using dev branches of js-sdk and react-sdk, in which case we need to build them
(cd node_modules/matrix-js-sdk && npm install)
(cd node_modules/matrix-react-sdk && npm install)
# run the mocha tests
npm run test