Skip to content

Commit

Permalink
fix npm pkg install
Browse files Browse the repository at this point in the history
  • Loading branch information
freemountain authored and freemountain committed Feb 3, 2017
1 parent eee4860 commit bd2efd7
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 9 deletions.
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ language: generic
os:
- osx
- linux
script:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install qt5 p7zip; fi
before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install qt5 p7zip qbs; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew link --force qt5; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:beineri/opt-qt57-trusty; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi

- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get -y install qt57declarative qt57quickcontrols qt57quickcontrols2 qt57graphicaleffects qt57tools qt57svg mesa-common-dev libglu1-mesa-dev; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get -y install qt57declarative qt57quickcontrols qt57quickcontrols2 qt57graphicaleffects qt57tools qt57svg mesa-common-dev libglu1-mesa-dev qt57qbs gcc-5 g++-5; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=/opt/qt57/bin:$PATH; fi

- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./qbs_wrapper setup-toolchains /usr/bin/clang clang; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./qbs_wrapper setup-qt /usr/local/opt/qt5/bin/qmake qt5; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./qbs_wrapper config profiles.qt5.baseProfile clang; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./qbs_wrapper config defaultProfile qt5; fi

script:
- make bootstrap
- make test
- mkdir build && cd build && qmake .. && make && make clean
Expand Down
28 changes: 23 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@ set -e
set -o xtrace

PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
OS="linux"

pushd . > /dev/null

cd "$PROJECT_PATH"
git submodule update --init --recursive

mkdir -p "$PROJECT_PATH/build/tools/qbs"
cd "$PROJECT_PATH/build/tools/qbs"
qmake -r "$PROJECT_PATH/tools/qbs/qbs.pro"
make


build_qbs=true
if qbs_loc="$(type -p "qbs")" || [ -z "$qbs_loc" ]; then
version="$(qbs --version)"
echo "found qbs version: $version"
a=( ${version//./ } )
major=${a[0]}
minor=${a[1]}
echo "qbs major: $major and minor: $minor"
if [ "$major" -ge "1" ] && [ "$minor" -ge "6" ]; then
build_qbs=false
fi
fi

if $build_qbs; then
echo "build qbs..."
mkdir -p "$PROJECT_PATH/build/tools/qbs"
cd "$PROJECT_PATH/build/tools/qbs"
qmake -r "$PROJECT_PATH/tools/qbs/qbs.pro"
make
fi

if [[ "$OSTYPE" == "linux-gnu" ]]; then
BIN_PATH="$PROJECT_PATH/build/tools/"
Expand Down
3 changes: 2 additions & 1 deletion qbs/imports/QNodeNpmPkg.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ Rule {
};

var commands = [cmd];
if(input.fileName === "package.json") commands.push(npmInstall)
var basePath = FileInfo.path(input.filePath);
if(input.fileName === "package.json" && basePath === product.sourceDirectory) commands.push(npmInstall)

return commands;
}
Expand Down
21 changes: 21 additions & 0 deletions qbs_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

use_system_qbs=false
if qbs_loc="$(type -p "qbs")" || [ -z "$qbs_loc" ]; then
version="$(qbs --version)"
a=( ${version//./ } )
major=${a[0]}
minor=${a[1]}
if [ "$major" -ge "1" ] && [ "$minor" -ge "6" ]; then
use_system_qbs=true
fi
fi

if $use_system_qbs; then
qbs "$@"
else
"$PROJECT_PATH/build/tools/qbs/bin/qbs" "$@"
fi
17 changes: 17 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e
set -o xtrace

build_qbs=true
if qbs_loc="$(type -p "qbs")" || [ -z "$qbs_loc" ]; then
version="$(qbs --version)"
echo "found qbs version: $version"
a=( ${version//./ } )
major=${a[0]}
minor=${a[1]}
echo "qbs major: $major and minor: $minor"
if [ "$major" -ge "1" ] && [ "$minor" -ge "6" ]; then
build_qbs=false
fi
fi
echo "build qbs: $build_qbs"

0 comments on commit bd2efd7

Please sign in to comment.