Skip to content

Commit 13aa6b1

Browse files
chalinwardbell
authored andcommitted
chore(travis): include dart doc generation
closes angular#1910 - Installs Dart SDK - Installs ng2/dart sources from the pub package site. - Re-enables doc build on Travis - install Dartium browser for eventual testing. - allow TMP and PKG to be set by developer before calling, e.g., install-dart-sdk.sh. - removes `npm install -g gulp --no-optional` has been removed since it does not appear to be needed. - Implements most of angular#1907.
1 parent f00b96f commit 13aa6b1

10 files changed

+253
-14
lines changed

.travis.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,26 @@ env:
1111
- DISPLAY=:99.0
1212
- CHROME_BIN=chromium-browser
1313
- LATEST_RELEASE=2.0.0-rc.4
14+
- TASK_FLAGS="--dgeni-log=warn"
15+
# - TASK_FLAGS=""
1416
matrix:
1517
- TASK=lint
1618
- TASK="run-e2e-tests --fast" SCRIPT=examples-install.sh
1719
- TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
18-
- TASK=build-compile SCRIPT=deploy-install.sh
19-
- TASK=build-compile SCRIPT=deploy-install-preview.sh
20+
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50"
21+
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
2022
matrix:
2123
fast_finish: true
2224
allow_failures:
23-
- env: "TASK=\"run-e2e-tests --fast\" SCRIPT=examples-install-preview.sh"
24-
- env: "TASK=build-compile SCRIPT=deploy-install-preview.sh"
25+
- env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
26+
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
2527
before_install:
26-
- npm install -g gulp --no-optional
28+
- source ./scripts/env-set.sh
29+
- ./scripts/before-install.sh
2730
install:
2831
- npm install --no-optional
29-
- if [[ $SCRIPT ]]; then ./scripts/$SCRIPT; fi
32+
- if [[ -n "$SCRIPT" ]]; then echo "EXTRA INSTALL $SCRIPT"; ./scripts/$SCRIPT; fi
3033
before_script:
3134
- sh -e /etc/init.d/xvfb start
3235
script:
33-
- gulp $TASK
36+
- $WAIT gulp $TASK $TASK_FLAGS

gulpfile.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ var _exampleConfigFilename = 'example-config.json';
116116
//
117117
var lang, langs, buildDartApiDocs = false;
118118
function configLangs(langOption) {
119-
// TODO(chalin): temporary dependence on process.env.TRAVIS until #1910 lands.
120-
const buildAllDocs = argv['_'] && argv['_'].indexOf('check-deploy' ) >= 0;
121-
const langDefault = (!buildAllDocs || process.env.TRAVIS) ? '(ts|js)' : 'all';
119+
const fullSiteBuildTasks = ['build-compile', 'check-serve', 'check-deploy'];
120+
const buildAllDocs = argv['_'] &&
121+
fullSiteBuildTasks.some((task) => argv['_'].indexOf(task) >= 0);
122+
const langDefault = buildAllDocs ? 'all' : '(ts|js)';
122123
lang = (langOption || langDefault).toLowerCase();
123124
if (lang === 'all') lang = '(ts|js|dart)';
124125
langs = lang.match(/\w+/g); // the languages in `lang` as an array
125-
gutil.log('Build docs for: ' + lang);
126+
gutil.log('Building docs for: ' + lang);
126127
if (langs.indexOf('dart') >= 0) {
127128
buildDartApiDocs = true;
128129
// For Dart, be proactive about checking for the repo

pubspec.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: angular2_io
2+
description: Angular 2 for Dart Website
3+
version: 0.0.1
4+
environment:
5+
sdk: '>=1.13.0 <2.0.0'
6+
dependencies:
7+
angular2: 2.0.0-beta.17
8+
browser: ^0.10.0
9+
dart_to_js_script_rewriter: ^1.0.1
10+
transformers:
11+
- angular2:
12+
platform_directives:
13+
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
14+
platform_pipes:
15+
- 'package:angular2/common.dart#COMMON_PIPES'
16+
entry_points: web/main.dart
17+
- dart_to_js_script_rewriter

scripts/before-install.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
./scripts/env-info-and-check.sh
6+
7+
if [[ 0 ]]; then
8+
# Doesn't seem to be necessary. Disabling.
9+
travis_fold start install.globals
10+
set -x
11+
npm install -g gulp --no-optional
12+
set +x
13+
travis_fold end install.globals
14+
fi

scripts/deploy-install.sh

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
#!/usr/bin/env bash
22

3-
set -ex -o pipefail
3+
set -e -o pipefail
44

5-
(cd ../ && git clone https://github.com/angular/angular.git --branch $LATEST_RELEASE)
5+
[[ -z "$NGIO_ENV_DEFS" ]] && . ./scripts/env-set.sh
6+
7+
if [[ -e "$NG2_REPO" ]]; then
8+
echo Angular2 repo is already present at: $NG2_REPO
9+
else
10+
travis_fold start install.ng2
11+
echo GETTING Angular2 from GitHub ...
12+
set -x
13+
git clone https://github.com/angular/angular.git --branch $LATEST_RELEASE $NG2_REPO
14+
set +x
15+
travis_fold end install.ng2
16+
fi
17+
18+
if [[ -e "$NG2DART_REPO" ]]; then
19+
echo Angular2 Dart repo is already present at: $NG2DART_REPO
20+
elif [[ -n "$TRAVIS" ]]; then
21+
./scripts/install-ng2dart.sh
22+
# else
23+
# echo WARNING: no Angular2 Dart repo found at: $NG2DART_REPO
24+
fi
25+
26+
echo INSTALLED repos:
27+
ls -ld ../a*

scripts/env-info-and-check.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
travis_fold start env_info
6+
echo ENVIRONMENT INFO
7+
travis_fold start env_info.path
8+
echo Path:
9+
echo $PATH | tr : '\n'
10+
echo
11+
travis_fold end env_info.path
12+
travis_fold start env_info.home
13+
echo Home: $HOME
14+
ls ~ -la
15+
echo
16+
travis_fold end env_info.home
17+
travis_fold start env_info.pwd
18+
echo Pwd: `pwd`
19+
ls -la
20+
echo
21+
travis_fold end env_info.pwd
22+
if [[ 0 ]]; then
23+
# Not needed anymore, but keeping it at least for the first commit for archival purposes.
24+
travis_fold start env_info.bash_profile
25+
echo Bash profile ------------------------------------------------------------
26+
cat ~/.bash_profile
27+
travis_fold end env_info.bash_profile
28+
travis_fold start env_info.bashrc
29+
echo Bashrc ------------------------------------------------------------------
30+
cat ~/.bashrc
31+
echo -------------------------------------------------------------------------
32+
travis_fold end env_info.bashrc
33+
travis_fold start env_info.build
34+
echo build.sh ----------------------------------------------------------------
35+
cat ~/build.sh
36+
echo -------------------------------------------------------------------------
37+
travis_fold end env_info.build
38+
fi
39+
travis_fold end env_info
40+
41+
echo ENVIRONMENT CONFIG CHECK:
42+
if [[ -z "$NGIO_ENV_DEFS" ]]; then
43+
echo Environment variables are not being set. Aborting.
44+
exit 1;
45+
else
46+
echo Environment variables successfully set.
47+
fi

scripts/env-set.sh

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -z "$NGIO_ENV_DEFS" ]]; then
4+
export ANSI_YELLOW="\033[33;1m"
5+
export ANSI_RESET="\033[0m"
6+
echo -e "${ANSI_YELLOW}Setting environment variables from scripts/env.sh${ANSI_RESET}"
7+
8+
export NGIO_ENV_DEFS=1
9+
10+
export NG2_REPO=../angular
11+
export NG2DART_REPO=$NG2_REPO-dart
12+
13+
if [ ! $(type -t travis_fold) ]; then
14+
# In case this is being run locally. Turn travis_fold into a noop.
15+
travis_fold () { return; }
16+
# Alternative definition:
17+
# travis_fold () { echo -en "travis_fold:${1}:${2}"; }
18+
fi
19+
export -f travis_fold
20+
21+
case "$(uname -a)" in
22+
Darwin\ *) _OS_NAME=macos ;;
23+
Linux\ *) _OS_NAME=linux ;;
24+
*) _OS_NAME=linux ;;
25+
esac
26+
export _OS_NAME
27+
28+
: ${TMP:=$HOME/tmp}
29+
: ${PKG:=$TMP/pkg}
30+
export TMP
31+
export PKG
32+
33+
if [[ -z "$(type -t dart)" && ! $PATH =~ */dart-sdk/* ]]; then
34+
export DART_SDK="$PKG/dart-sdk"
35+
# echo Updating PATH to include access to Dart bin.
36+
export PATH="$DART_SDK/bin:$PATH"
37+
export PATH="$HOME/.pub-cache/bin:$PATH"
38+
fi
39+
fi

scripts/install-dart-sdk.sh

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
[[ -z "$NGIO_ENV_DEFS" ]] && . ./scripts/env-set.sh
6+
7+
if [[ -z "$(type -t dart)" ]]; then
8+
travis_fold start install.dart
9+
echo INSTALLING Dart SDK and Dartium ...
10+
11+
# URLs for sdk and dartium:
12+
# https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-linux-x64-release.zip
13+
# https://storage.googleapis.com/dart-archive/channels/stable/release/latest/dartium/dartium-macos-x64-release.zip
14+
15+
DART_ARCHIVE=https://storage.googleapis.com/dart-archive/channels
16+
VERS=stable/release/latest
17+
18+
mkUrl() {
19+
local dir=$1
20+
local pkg=$2
21+
local arch=$3
22+
local zip=$pkg-$_OS_NAME-$arch-release.zip
23+
echo "$DART_ARCHIVE/$VERS/$dir/$zip";
24+
}
25+
26+
getAndInstall() {
27+
local dir=$1
28+
local pkg=${2:-$dir};
29+
local arch=${3:-x64}
30+
local URL=$(mkUrl $dir $pkg $arch)
31+
local exitStatus=0;
32+
local zip=$(basename $URL)
33+
34+
echo "Getting $pkg from:"
35+
echo " $URL"
36+
37+
[[ ! -d "$TMP" ]] && mkdir "$TMP"
38+
[[ ! -d "$PKG" ]] && mkdir "$PKG"
39+
40+
curl $URL > "$TMP/$zip" # 2> /dev/null
41+
42+
if [[ "1000" -lt "$(wc -c $TMP/$zip | awk '{print $1}')" ]]; then
43+
unzip "$TMP/$zip" -d "$PKG" > /dev/null
44+
rm -f "$TMP/$zip"
45+
# PATH is set in ./scripts/env-set.sh
46+
else
47+
echo FAILED to download Dart $pkg. Check URL.
48+
exitStatus=1;
49+
fi
50+
}
51+
52+
if getAndInstall sdk dartsdk; then
53+
# Install Dartium
54+
if [[ "$_OS_NAME" == "macos" ]]; then
55+
getAndInstall dartium dartium ia32
56+
else
57+
getAndInstall dartium
58+
fi
59+
echo
60+
dart --version
61+
fi
62+
travis_fold end install.dart
63+
else
64+
echo Dart SDK appears to be installed: `type dart`
65+
# PATH is set in ./scripts/env-set.sh
66+
dart --version
67+
fi

scripts/install-ng2dart.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
[[ -z "$NGIO_ENV_DEFS" ]] && . ./scripts/env-set.sh
6+
7+
./scripts/install-dart-sdk.sh
8+
9+
travis_fold start install.ng2dart
10+
if [[ -z "$(type -t dart)" ]]; then
11+
echo "No Dart SDK: aborting install of Angular2/Dart"
12+
exit 1;
13+
elif [[ -e "$NG2DART_REPO" ]]; then
14+
echo Angular2/Dart found at: $NG2DART_REPO
15+
else
16+
echo GETTING Angular2/Dart from pub package ...
17+
set -x
18+
# Get ng2dart via pub on ng.io pubspec.yaml
19+
pub upgrade > /dev/null
20+
21+
NG2DART_PUB=`find ~/.pub-cache/ -type d -name "angular2*" | xargs ls -dtr | tail -1`
22+
23+
cp -r $NG2DART_PUB $NG2DART_REPO
24+
fi
25+
26+
# Run pub on ng2dart
27+
(cd $NG2DART_REPO && pub get)
28+
set +x
29+
travis_fold end install.ng2dart

scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ npm install --no-optional
1919
echo "Patching ..."
2020
source ./scripts/patch.sh
2121

22-
if [ "$TRAVIS" != "true" ]; then
22+
if [ -z "$TRAVIS" ]; then
2323
echo "Rebuilding node-sass, just in case ..."
2424
npm rebuild node-sass;
2525
fi

0 commit comments

Comments
 (0)