build: fix some issues on Windows platforms

Closes #9450
This commit is contained in:
Marc Laval 2016-06-21 00:25:55 +02:00
parent a5f2e205ef
commit 9decc3d823
8 changed files with 44 additions and 8 deletions

3
.gitattributes vendored
View File

@ -3,3 +3,6 @@
# JS files must always use LF for tools to work
*.js eol=lf
# Must keep Windows line ending to be parsed correctly
scripts/windows/packages.txt eol=crlf

View File

@ -73,12 +73,12 @@ do
echo "====== TSC 1.8 d.ts compat for ${DESTDIR} ====="
# safely strips 'readonly' specifier from d.ts files to make them compatible with tsc 1.8
if [[ ${TRAVIS} ]]; then
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -e 's/\(^ *(static |private )*\)*readonly */\1/g'
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
if [ "$(uname)" == "Darwin" ]; then
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\(^ *(static |private )*\)*readonly */\1/g'
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
else
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\(^ *(static |private )*\)*readonly */\1/g'
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -e 's/\(^ *(static |private )*\)*readonly */\1/g'
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
fi
if [[ ${PACKAGE} != compiler-cli ]]; then

View File

@ -8,6 +8,7 @@ require('./tools/check-environment')(
const gulp = require('gulp');
const path = require('path');
const os = require('os');
const srcsToFmt = ['tools/**/*.ts', 'modules/@angular/**/*.ts'];
@ -61,7 +62,8 @@ function tsc(projectPath, done) {
child_process
.spawn(
`${__dirname}/node_modules/.bin/tsc`, ['-p', path.join(__dirname, projectPath)],
path.normalize(`${__dirname}/node_modules/.bin/tsc`) + (/^win/.test(os.platform()) ? '.cmd' : ''),
['-p', path.join(__dirname, projectPath)],
{stdio: 'inherit'})
.on('close', (errorCode) => done(errorCode));
}

View File

@ -15,7 +15,7 @@
"url": "https://github.com/angular/angular.git"
},
"scripts": {
"postinstall": "node tools/npm/copy-npm-shrinkwrap; webdriver-manager update"
"postinstall": "node tools/npm/copy-npm-shrinkwrap && webdriver-manager update"
},
"dependencies": {
"es6-shim": "^0.35.0",

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
cd `dirname $0`
while read PACKAGE
do
DESTDIR=./../../modules/\@angular/${PACKAGE}/src
mv ${DESTDIR}/facade ${DESTDIR}/facade.old
cmd <<< "mklink \"..\\..\\modules\\\@angular\\"${PACKAGE}"\\src\\facade\" \"..\\..\\facade\\src\\\""
done < packages.txt

View File

@ -0,0 +1,9 @@
common
compiler
core
forms
http
platform-browser
platform-browser-dynamic
platform-server
router-deprecated

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
cd `dirname $0`
while read PACKAGE
do
DESTDIR=./../../modules/\@angular/${PACKAGE}/src
rm ${DESTDIR}/facade
mv ${DESTDIR}/facade.old ${DESTDIR}/facade
done < packages.txt

View File

@ -1,4 +1,6 @@
import {spawn} from 'child_process';
import {platform} from 'os';
import {normalize} from 'path';
import {resolve} from 'url';
enum State {
@ -7,7 +9,7 @@ enum State {
error
}
export const TSC = 'node_modules/typescript/bin/tsc';
export const TSC = normalize('node_modules/.bin/tsc') + (/^win/.test(platform()) ? '.cmd' : '');
export type Command = (stdIn: any, stdErr: any) => Promise<number>;
export class TscWatch {