build: fix paths to typings files so tsickle resolves imports correctly

Fixes #15080
This commit is contained in:
Jason Aden 2017-03-15 13:26:09 -07:00 committed by Chuck Jazdzewski
parent 0ab49d4cec
commit 410aa33005
60 changed files with 96 additions and 81 deletions

View File

@ -37,9 +37,16 @@ REMOVE_BENCHPRESS=false
BUILD_EXAMPLES=true
COMPILE_SOURCE=true
TYPECHECK_ALL=true
BUILD_TOOLS=true
for ARG in "$@"; do
case "$ARG" in
--quick-bundle=*)
COMPILE_SOURCE=false
TYPECHECK_ALL=false
BUILD_EXAMPLES=false
BUILD_TOOLS=false
;;
--packages=*)
PACKAGES_STR=${ARG#--packages=}
PACKAGES=( ${PACKAGES_STR//,/ } )
@ -61,6 +68,9 @@ for ARG in "$@"; do
--typecheck=*)
TYPECHECK_ALL=${ARG#--typecheck=}
;;
--tools=*)
BUILD_TOOLS=${ARG#--tools=}
;;
*)
echo "Unknown option $ARG."
exit 1
@ -257,6 +267,7 @@ compilePackage() {
$NGC -p ${1}/tsconfig-build.json
echo "====== Create ${1}/../${package_name}.d.ts re-export file for Closure"
echo "$(cat ${LICENSE_BANNER}) ${N} export * from './${package_name}/index'" > ${2}/../${package_name}.d.ts
echo "{\"alias\": \"./${package_name}/index.metadata.json\"}" > ${2}/../${package_name}.metadata.json
fi
for DIR in ${1}/* ; do
@ -269,15 +280,16 @@ compilePackage() {
}
#######################################
# Renames typings index to package name
# Moves typings and metadata files appropriately
# Arguments:
# param1 - Source directory of typings files
# param2 - Package name
# param1 - Source of typings & metadata files
# param2 - Root of destination directory
# param3 - Package name (needed to correspond to name of d.ts and metadata.json files)
# Returns:
# None
#######################################
moveTypings() {
if [[ -f ${1}/index.d.ts ]]; then
if [[ -f ${1}/index.d.ts && -f ${1}/index.metadata.json ]]; then
mv ${1}/index.d.ts ${1}/${2}.d.ts
mv ${1}/index.metadata.json ${1}/${2}.metadata.json
fi
@ -329,24 +341,25 @@ UGLIFYJS=`pwd`/node_modules/.bin/uglifyjs
TSCONFIG=./tools/tsconfig.json
ROLLUP=`pwd`/node_modules/.bin/rollup
if [[ ${BUILD_TOOLS} == true ]]; then
travisFoldStart "build tools" "no-xtrace"
echo "====== (tools)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} ====="
rm -rf ./dist/tools/
mkdir -p ./dist/tools/
$(npm bin)/tsc -p ${TSCONFIG}
travisFoldStart "build tools"
echo "====== (tools)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} ====="
rm -rf ./dist/tools/
mkdir -p ./dist/tools/
$(npm bin)/tsc -p ${TSCONFIG}
cp ./tools/@angular/tsc-wrapped/package.json ./dist/tools/@angular/tsc-wrapped
travisFoldEnd "build tools"
cp ./tools/@angular/tsc-wrapped/package.json ./dist/tools/@angular/tsc-wrapped
travisFoldEnd "build tools"
fi
if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then
travisFoldStart "clean dist"
travisFoldStart "clean dist" "no-xtrace"
rm -rf ./dist/all/
rm -rf ./dist/packages
travisFoldEnd "clean dist"
travisFoldStart "copy e2e files"
travisFoldStart "copy e2e files" "no-xtrace"
mkdir -p ./dist/all/
echo "====== Copying files needed for e2e tests ====="
@ -384,11 +397,11 @@ if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then
travisFoldEnd "copy e2e files"
TSCONFIG="packages/tsconfig.json"
travisFoldStart "tsc -p ${TSCONFIG}"
travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace"
$NGC -p ${TSCONFIG}
travisFoldEnd "tsc -p ${TSCONFIG}"
TSCONFIG="modules/tsconfig.json"
travisFoldStart "tsc -p ${TSCONFIG}"
travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace"
$NGC -p ${TSCONFIG}
travisFoldEnd "tsc -p ${TSCONFIG}"
@ -403,7 +416,7 @@ fi
for PACKAGE in ${PACKAGES[@]}
do
travisFoldStart "build package: ${PACKAGE}"
travisFoldStart "build package: ${PACKAGE}" "no-xtrace"
PWD=`pwd`
ROOT_DIR=${PWD}/packages
SRC_DIR=${ROOT_DIR}/${PACKAGE}
@ -433,9 +446,12 @@ do
if ! containsElement "${PACKAGE}" "${NODE_PACKAGES[@]}"; then
echo "====== Copy ${PACKAGE} typings"
rsync -a --exclude=*.js --exclude=*.js.map ${OUT_DIR}/ ${NPM_DIR}/typings
moveTypings ${NPM_DIR}/typings ${PACKAGE}
addNgcPackageJson ${NPM_DIR}/typings
rsync -a --exclude=*.js --exclude=*.js.map ${OUT_DIR}/ ${NPM_DIR}
# echo "$(cat ${LICENSE_BANNER}) ${N} export * from './index'" > ${NPM_DIR}/${PACKAGE}.d.ts
# echo "{\"alias\": \"./index.metadata.json\"}" > ${NPM_DIR}/${PACKAGE}.metadata.json
# exit 0
moveTypings ${NPM_DIR} ${PACKAGE}
# addNgcPackageJson ${NPM_DIR}/typings
(
cd ${SRC_DIR}
@ -478,14 +494,14 @@ do
done
if [[ ${BUILD_EXAMPLES} == true ]]; then
travisFoldStart "build examples"
travisFoldStart "build examples" "no-xtrace"
echo "====== Building examples: ./packages/examples/build.sh ====="
./packages/examples/build.sh
travisFoldEnd "build examples"
fi
if [[ ${REMOVE_BENCHPRESS} == true ]]; then
travisFoldStart "remove benchpress"
travisFoldStart "remove benchpress" "no-xtrace"
echo ""
echo "==== Removing benchpress from publication"
rm -r dist/packages-dist/benchpress

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/browser/index.d.ts",
"typings": "../browser.d.ts",
"main": "../bundles/animation-browser.umd.js",
"module": "../@angular/animations/browser.es5.js",
"es2015": "../@angular/animations/browser.js"

View File

@ -1,5 +1,5 @@
{
"typings": "../../typings/animations/testing.d.ts",
"typings": "../testing.d.ts",
"main": "../../bundles/platform-browser-animations-testing.umd.js",
"module": "../../@angular/platform-browser/animations/testing.es5.js",
"es2015": "../../@angular/platform-browser/animations/testing.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/animations.umd.js",
"module": "./@angular/animations.es5.js",
"es2015": "./@angular/animations.js",
"typings": "./typings/animations.d.ts",
"typings": "./animations.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -5,7 +5,7 @@
"main": "./bundles/common.umd.js",
"module": "./@angular/common.es5.js",
"es2015": "./@angular/common.js",
"typings": "./typings/common.d.ts",
"typings": "./common.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/common-testing.umd.js",
"module": "../@angular/common/testing.es5.js",
"es2015": "../@angular/common/testing.js"

View File

@ -208,7 +208,7 @@ export class CompilerHost implements AotCompilerHost {
}
try {
let metadataOrMetadatas = JSON.parse(this.context.readFile(filePath));
while (metadataOrMetadatas.alias) {
while (metadataOrMetadatas && metadataOrMetadatas.alias) {
filePath = path.join(path.dirname(filePath), metadataOrMetadatas.alias);
metadataOrMetadatas = JSON.parse(this.context.readFile(filePath));
}

View File

@ -244,9 +244,7 @@ const FILES: Entry = {
'alias': {
'file.d.ts': dummyModule,
'file.metadata.json': '{ "alias": "sub/index.metadata.json"}',
'sub': {
'index.metadata.json': JSON.stringify(dummyMetadata)
}
'sub': {'index.metadata.json': JSON.stringify(dummyMetadata)}
},
'metadata_versions': {
'v1.d.ts': `

View File

@ -5,7 +5,7 @@
"main": "./bundles/compiler.umd.js",
"module": "./@angular/compiler.es5.js",
"es2015": "./@angular/compiler.js",
"typings": "./typings/compiler.d.ts",
"typings": "./compiler.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/compiler-testing.umd.js",
"module": "../@angular/compiler/testing.es5.js",
"es2015": "../@angular/compiler/testing.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/core.umd.js",
"module": "./@angular/core.es5.js",
"es2015": "./@angular/core.js",
"typings": "./typings/core.d.ts",
"typings": "./core.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/core-testing.umd.js",
"module": "../@angular/core/testing.es5.js",
"es2015": "../@angular/core/testing.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/forms.umd.js",
"module": "./@angular/forms.es5.js",
"es2015": "./@angular/forms.js",
"typings": "./typings/forms.d.ts",
"typings": "./forms.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -5,7 +5,7 @@
"main": "./bundles/http.umd.js",
"module": "./@angular/http.es5.js",
"es2015": "./@angular/http.js",
"typings": "./typings/http.d.ts",
"typings": "./http.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/http-testing.umd.js",
"module": "../@angular/http/testing.es5.js",
"es2015": "../@angular/http/testing.js"

View File

@ -4,7 +4,7 @@
"description": "Angular - language services",
"main": "./bundles/language-service.umd.js",
"module": "./@angular/language-service.es5.js",
"typings": "./typings/language-service.d.ts",
"typings": "./language-service.d.ts",
"author": "angular",
"license": "MIT",
"repository": {

View File

@ -5,7 +5,7 @@
"main": "./bundles/platform-browser-dynamic.umd.js",
"module": "./@angular/platform-browser-dynamic.es5.js",
"es2015": "./@angular/platform-browser-dynamic.js",
"typings": "./typings/platform-browser-dynamic.d.ts",
"typings": "./platform-browser-dynamic.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/platform-browser-dynamic-testing.umd.js",
"module": "../@angular/platform-browser-dynamic/testing.es5.js",
"es2015": "../@angular/platform-browser-dynamic/testing.js"

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/animations/index.d.ts",
"typings": "../animations.d.ts",
"main": "../bundles/platform-browser-animations.umd.js",
"module": "../@angular/platform-browser/animations.es5.js",
"es2015": "../@angular/platform-browser/animations.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/platform-browser.umd.js",
"module": "./@angular/platform-browser.es5.js",
"es2015": "./@angular/platform-browser.js",
"typings": "./typings/platform-browser.d.ts",
"typings": "./platform-browser.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/platform-browser-testing.umd.js",
"module": "../@angular/platform-browser/testing.es5.js",
"es2015": "../@angular/platform-browser/testing.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/platform-server.umd.js",
"module": "./@angular/platform-server.es5.js",
"es2015": "./@angular/platform-server.js",
"typings": "./typings/platform-server.d.ts",
"typings": "./platform-server.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/platform-server-testing.umd.js",
"module": "../@angular/platform-server/testing.es5.js",
"es2015": "../@angular/platform-server/testing.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/platform-webworker-dynamic.umd.js",
"module": "./@angular/platform-webworker-dynamic.es5.js",
"es2015": "./@angular/platform-webworker-dynamic.js",
"typings": "./typings/platform-webworker-dynamic.d.ts",
"typings": "./platform-webworker-dynamic.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -5,7 +5,7 @@
"main": "./bundles/platform-webworker.umd.js",
"module": "./@angular/platform-webworker.es5.js",
"es2015": "./@angular/platform-webworker.js",
"typings": "./typings/platform-webworker.d.ts",
"typings": "./platform-webworker.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -5,7 +5,7 @@
"main": "./bundles/router.umd.js",
"module": "./@angular/router.es5.js",
"es2015": "./@angular/router.js",
"typings": "./typings/router.d.ts",
"typings": "./router.d.ts",
"keywords": [
"angular",
"router"

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/testing/index.d.ts",
"typings": "../testing.d.ts",
"main": "../bundles/router-testing.umd.js",
"module": "../@angular/router/testing.es5.js",
"es2015": "../@angular/router/testing.js"

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/upgrade/index.d.ts",
"typings": "../upgrade.d.ts",
"main": "../bundles/router-upgrade.umd.js",
"module": "../@angular/router/upgrade.es5.js",
"es2015": "../@angular/router/upgrade.js"

View File

@ -5,7 +5,7 @@
"main": "./bundles/upgrade.umd.js",
"module": "./@angular/upgrade.es5.js",
"es2015": "./@angular/upgrade.js",
"typings": "./typings/upgrade.d.ts",
"typings": "./upgrade.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {

View File

@ -1,5 +1,5 @@
{
"typings": "../typings/static/index.d.ts",
"typings": "../static.d.ts",
"main": "../bundles/upgrade-static.umd.js",
"module": "../@angular/upgrade/static.es5.js",
"es2015": "../@angular/upgrade/static.js"

View File

@ -12,10 +12,10 @@
* Entry point for all public APIs of the upgrade/static package, allowing
* Angular 1 and Angular 2+ to run side by side in the same application.
*/
export {downgradeComponent} from '../src/common/downgrade_component';
export {downgradeInjectable} from '../src/common/downgrade_injectable';
export {VERSION} from '../src/common/version';
export {UpgradeComponent} from '../src/static/upgrade_component';
export {UpgradeModule} from '../src/static/upgrade_module';
export {downgradeComponent} from './src/common/downgrade_component';
export {downgradeInjectable} from './src/common/downgrade_injectable';
export {VERSION} from './src/common/version';
export {UpgradeComponent} from './src/static/upgrade_component';
export {UpgradeModule} from './src/static/upgrade_module';
// This file only re-exports content of the `src` folder. Keep it that way.

1
packages/upgrade/static/src Symbolic link
View File

@ -0,0 +1 @@
../src

View File

@ -20,9 +20,11 @@ function travisFoldStart() {
local enterArrow="===> ${foldName} ==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>"
# keep all messages consistently wide 80chars regardless of the foldName
echo ${enterArrow:0:100}
# turn on verbose mode so that we have better visibility into what's going on
# http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html#table_02_01
set -x
if [[ ${2:-} != "no-xtrace" ]]; then
# turn on verbose mode so that we have better visibility into what's going on
# http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html#table_02_01
set -x
fi
}
function travisFoldEnd() {

View File

@ -54,7 +54,8 @@ cp -v package.json $TMP
./node_modules/.bin/ng-xi18n -p tsconfig-xi18n.json --i18nFormat=xlf --locale=fr
./node_modules/.bin/ng-xi18n -p tsconfig-xi18n.json --i18nFormat=xmb --outFile=custom_file.xmb
node test/test_summaries.js
# Removed until #15219 is fixed
# node test/test_summaries.js
node test/test_ngtools_api.js
./node_modules/.bin/jasmine init

View File

@ -1,27 +1,24 @@
const entrypoints = [
'dist/packages-dist/core/typings/core.d.ts', 'dist/packages-dist/core/typings/testing/index.d.ts',
'dist/packages-dist/common/typings/common.d.ts',
'dist/packages-dist/common/typings/testing/index.d.ts',
'dist/packages-dist/core/core.d.ts', 'dist/packages-dist/core/testing.d.ts',
'dist/packages-dist/common/common.d.ts', 'dist/packages-dist/common/testing.d.ts',
// The API surface of the compiler is currently unstable - all of the important APIs are exposed
// via @angular/core, @angular/platform-browser or @angular/platform-browser-dynamic instead.
//'dist/packages-dist/compiler/index.d.ts',
//'dist/packages-dist/compiler/testing.d.ts',
'dist/packages-dist/upgrade/typings/upgrade.d.ts',
'dist/packages-dist/upgrade/typings/static/index.d.ts',
'dist/packages-dist/platform-browser/typings/platform-browser.d.ts',
'dist/packages-dist/platform-browser/typings/testing/index.d.ts',
'dist/packages-dist/platform-browser-dynamic/typings/platform-browser-dynamic.d.ts',
'dist/packages-dist/platform-browser-dynamic/typings/testing/index.d.ts',
'dist/packages-dist/platform-webworker/typings/platform-webworker.d.ts',
'dist/packages-dist/platform-webworker-dynamic/typings/platform-webworker-dynamic.d.ts',
'dist/packages-dist/platform-server/typings/platform-server.d.ts',
'dist/packages-dist/platform-server/typings/testing/index.d.ts',
'dist/packages-dist/http/typings/http.d.ts', 'dist/packages-dist/http/typings/testing/index.d.ts',
'dist/packages-dist/forms/typings/forms.d.ts', 'dist/packages-dist/router/typings/router.d.ts',
'dist/packages-dist/animations/typings/animations.d.ts',
'dist/packages-dist/animations/typings/browser/index.d.ts',
'dist/packages-dist/animations/typings/browser/testing/index.d.ts',
'dist/packages-dist/platform-browser/typings/animations/index.d.ts'
'dist/packages-dist/upgrade/upgrade.d.ts', 'dist/packages-dist/upgrade/static.d.ts',
'dist/packages-dist/platform-browser/platform-browser.d.ts',
'dist/packages-dist/platform-browser/testing.d.ts',
'dist/packages-dist/platform-browser-dynamic/platform-browser-dynamic.d.ts',
'dist/packages-dist/platform-browser-dynamic/testing.d.ts',
'dist/packages-dist/platform-webworker/platform-webworker.d.ts',
'dist/packages-dist/platform-webworker-dynamic/platform-webworker-dynamic.d.ts',
'dist/packages-dist/platform-server/platform-server.d.ts',
'dist/packages-dist/platform-server/testing.d.ts', 'dist/packages-dist/http/http.d.ts',
'dist/packages-dist/http/testing.d.ts', 'dist/packages-dist/forms/forms.d.ts',
'dist/packages-dist/router/router.d.ts', 'dist/packages-dist/animations/animations.d.ts',
'dist/packages-dist/animations/browser.d.ts',
'dist/packages-dist/animations/browser/testing.d.ts',
'dist/packages-dist/platform-browser/animations.d.ts'
];
const publicApiDir = 'tools/public_api_guard';