Skip to content

Commit bb77d89

Browse files
Merge pull request #280 from angular/master
Pass LLVM linker flags to librustc_llvm build
2 parents db8b811 + 23553d1 commit bb77d89

File tree

37 files changed

+683
-408
lines changed

37 files changed

+683
-408
lines changed

.circleci/config.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ anchor_1_win: &defaults_win
2828
resource_class: windows.medium
2929
shell: powershell.exe -ExecutionPolicy Bypass
3030
machine:
31-
image: windows-server-2019
31+
image: windows-server-2019
3232

3333
# After checkout, rebase on top of target branch.
3434
anchor_2: &post_checkout
@@ -37,8 +37,8 @@ anchor_2: &post_checkout
3737
command: >
3838
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
3939
# User is required for rebase.
40-
git config user.name "angular-ci"
41-
git config user.email "angular-ci"
40+
git config user.name "angular-ci"
41+
git config user.email "angular-ci"
4242
# Rebase PR on top of target branch.
4343
node tools/rebase-pr.js angular/angular-cli ${CIRCLE_PR_NUMBER}
4444
else
@@ -67,7 +67,7 @@ anchor_5: &env_win
6767
name: Setup windows node environment
6868
command: ./.circleci/windows-env.ps1
6969
anchor_6: &ignore_pull_requests
70-
filters:
70+
filters:
7171
branches:
7272
ignore:
7373
- /pull\/.*/
@@ -200,8 +200,11 @@ jobs:
200200
- attach_workspace: *attach_options
201201
- run:
202202
name: Decrypt Credentials
203+
# Note: when changing the image, you might have to re-encrypt the credentials with a
204+
# matching version of openssl.
205+
# See https://stackoverflow.com/a/43847627/2116927 for more info.
203206
command: |
204-
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token
207+
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token -md md5
205208
- run:
206209
name: Deployment to Snapshot
207210
command: |
@@ -225,9 +228,9 @@ jobs:
225228
# Docs: https://github.com/CircleCI-Public/windows-preview-docs
226229
test-win:
227230
<<: *defaults_win
228-
# Skipping cache and workspace for now because it takes 10x longer than on linux.
231+
# Skipping cache and workspace for now because it takes 10x longer than on linux.
229232
# TODO: when/if CircleCI makes them faster, use cache and workspaces fully.
230-
# Notes:
233+
# Notes:
231234
# - windows needs its own cache key because binaries in node_modules are different.
232235
# - windows might need its own workspace for the same reason.
233236
# - get cache dir on windows via `yarn cache dir` (was `C:\Users\circleci\AppData\Local\Yarn\Cache\v4` last time)
@@ -240,10 +243,10 @@ jobs:
240243
- run: yarn install --frozen-lockfile
241244
# Build and test should be on their own jobs, but restoring workspaces is too slow
242245
# so we do it here.
243-
- run: yarn admin -- build
244-
- run: yarn test -- --full
246+
- run: yarn admin -- build
247+
- run: yarn test -- --full
245248
# Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.
246-
- run: if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/{basic,ivy}/**" }
249+
- run: if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/{basic,ivy}/**" }
247250

248251
e2e-cli-win:
249252
<<: *defaults_win
@@ -256,8 +259,8 @@ jobs:
256259
- run: node --version
257260
- run: yarn --version
258261
- run: yarn install --frozen-lockfile
259-
- run: yarn admin -- build
260-
- run: node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
262+
- run: yarn admin -- build
263+
- run: node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
261264

262265
workflows:
263266
version: 2

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@
7979
"typescript": "3.4.5"
8080
},
8181
"devDependencies": {
82-
"@angular/compiler": "^8.0.0-beta.14",
83-
"@angular/compiler-cli": "^8.0.0-beta.14",
82+
"@angular/compiler": "~8.1.0-next.1",
83+
"@angular/compiler-cli": "~8.1.0-next.1",
8484
"@bazel/bazel": "0.24.1",
8585
"@bazel/buildifier": "^0.22.0",
8686
"@bazel/jasmine": "~0.26.0",
8787
"@bazel/karma": "~0.26.0",
8888
"@bazel/typescript": "~0.26.0",
8989
"@ngtools/json-schema": "^1.1.0",
9090
"@types/browserslist": "^4.4.0",
91-
"@types/caniuse-api": "^3.0.0",
91+
"@types/caniuse-lite": "^1.0.0",
9292
"@types/copy-webpack-plugin": "^4.4.1",
9393
"@types/express": "^4.16.0",
9494
"@types/glob": "^7.0.0",
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
Uses the [webpack](https://webpack.js.org/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
2-
A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--prod` option.
1+
The command can be used to build a project of type "application" or "library".
2+
When used to build a library, a different builder is invoked, and only the `ts-config`, `configuration`, and `watch` options are applied.
3+
All other options apply only to building applications.
4+
5+
The application builder uses the [webpack](https://webpack.js.org/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
6+
A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--configuration="production"` or the `--prod="true"` option.
37

48
The configuration options generally correspond to the command options.
5-
You can override individual configuration defaults by specifying the corresponding options on the command line.
9+
You can override individual configuration defaults by specifying the corresponding options on the command line.
610
The command can accept option names given in either dash-case or camelCase.
711
Note that in the configuration file, you must specify names in camelCase.
812

913
Some additional options can only be set through the configuration file,
1014
either by direct editing or with the `ng config` command.
11-
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
15+
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
1216
Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
1317

1418
For further details, see [Workspace Configuration](guide/workspace-config).

packages/angular/cli/commands/update-impl.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,24 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
346346
checkCleanGit() {
347347
try {
348348
const result = execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
349+
if (result.trim().length === 0) {
350+
return true;
351+
}
349352

350-
return result.trim().length === 0;
351-
} catch {
352-
return true;
353-
}
353+
// Only files inside the workspace root are relevant
354+
for (const entry of result.split('\n')) {
355+
const relativeEntry = path.relative(
356+
path.resolve(this.workspace.root),
357+
path.resolve(entry.slice(3).trim()),
358+
);
359+
360+
if (!relativeEntry.startsWith('..') && !path.isAbsolute(relativeEntry)) {
361+
return false;
362+
}
363+
}
364+
365+
} catch { }
366+
367+
return true;
354368
}
355369
}

packages/angular_devkit/architect/node/node-modules-architect-host.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
104104
if (targetSpec === undefined) {
105105
return null;
106106
}
107-
if (target.configuration && !targetSpec['configurations']) {
108-
throw new Error('Configuration not set in the workspace.');
107+
if (
108+
target.configuration
109+
&& !(targetSpec['configurations'] && targetSpec['configurations'][target.configuration])
110+
) {
111+
throw new Error(`Configuration '${target.configuration}' is not set in the workspace.`);
109112
}
110113

111114
return {

packages/angular_devkit/architect/src/architect.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ export class Architect {
361361
options: json.JsonObject,
362362
scheduleOptions: ScheduleOptions = {},
363363
): Promise<BuilderRun> {
364-
if (!/^[^:]+:[^:]+$/.test(name)) {
364+
// The below will match 'project:target:configuration'
365+
if (!/^[^:]+:[^:]+(:[^:]+)?$/.test(name)) {
365366
throw new Error('Invalid builder name: ' + JSON.stringify(name));
366367
}
367368

packages/angular_devkit/architect/src/index_spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ describe('architect', () => {
106106
await run.stop();
107107
});
108108

109+
it(`errors when target configuration doesn't exists`, async () => {
110+
try {
111+
await architect.scheduleBuilder('test:test:invalid', {});
112+
throw new Error('should have thrown');
113+
} catch (err) {
114+
expect(err.message).toContain('Job name "test:test:invalid" does not exist.');
115+
}
116+
});
117+
109118
it('errors when builder cannot be resolved', async () => {
110119
try {
111120
await architect.scheduleBuilder('non:existent', {});

packages/angular_devkit/build_angular/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"@ngtools/webpack": "0.0.0",
1515
"ajv": "6.10.0",
1616
"autoprefixer": "9.6.0",
17-
"browserslist": "4.6.1",
18-
"caniuse-api": "3.0.0",
17+
"browserslist": "4.6.2",
18+
"caniuse-lite": "1.0.30000974",
1919
"circular-dependency-plugin": "5.0.2",
2020
"clean-css": "4.2.1",
2121
"copy-webpack-plugin": "5.0.3",
@@ -57,18 +57,18 @@
5757
"worker-plugin": "3.1.0"
5858
},
5959
"devDependencies": {
60-
"@angular/animations": "^8.0.0-beta.14",
61-
"@angular/cdk": "^7.3.4",
62-
"@angular/common": "^8.0.0-beta.14",
63-
"@angular/compiler": "^8.0.0-beta.14",
64-
"@angular/compiler-cli": "^8.0.0-beta.14",
65-
"@angular/core": "^8.0.0-beta.14",
66-
"@angular/material": "^7.3.4",
67-
"@angular/platform-browser": "^8.0.0-beta.14",
68-
"@angular/platform-browser-dynamic": "^8.0.0-beta.14",
69-
"@angular/platform-server": "^8.0.0-beta.14",
70-
"@angular/router": "^8.0.0-beta.14",
71-
"@angular/service-worker": "^8.0.0-beta.14",
60+
"@angular/animations": "~8.1.0-next.1",
61+
"@angular/cdk": "^8.0.0",
62+
"@angular/common": "~8.1.0-next.1",
63+
"@angular/compiler": "~8.1.0-next.1",
64+
"@angular/compiler-cli": "~8.1.0-next.1",
65+
"@angular/core": "~8.1.0-next.1",
66+
"@angular/material": "^8.0.0",
67+
"@angular/platform-browser": "~8.1.0-next.1",
68+
"@angular/platform-browser-dynamic": "~8.1.0-next.1",
69+
"@angular/platform-server": "~8.1.0-next.1",
70+
"@angular/router": "~8.1.0-next.1",
71+
"@angular/service-worker": "~8.1.0-next.1",
7272
"codelyzer": "^5.0.0",
7373
"bootstrap": "^4.0.0",
7474
"font-awesome": "^4.7.0",
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
1-
/**
2-
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
3-
* load <script nomodule> anyway. This snippet solve this problem, but only for script
4-
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
5-
*
6-
* Again: this will **not** prevent inline script, e.g.:
7-
* <script nomodule>alert('no modules');</script>.
8-
*
9-
* This workaround is possible because Safari supports the non-standard 'beforeload' event.
10-
* This allows us to trap the module and nomodule load.
11-
*
12-
* Note also that `nomodule` is supported in later versions of Safari - it's just 10.1 that
13-
* omits this attribute.
14-
*/
15-
(function() {
1+
(function () {
162
var check = document.createElement('script');
173
if (!('noModule' in check) && 'onbeforeload' in check) {
184
var support = false;
19-
document.addEventListener('beforeload', function(e) {
5+
document.addEventListener('beforeload', function (e) {
206
if (e.target === check) {
217
support = true;
228
} else if (!e.target.hasAttribute('nomodule') || !support) {
@@ -30,4 +16,4 @@
3016
document.head.appendChild(check);
3117
check.remove();
3218
}
33-
}());
19+
}());

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import {
1818
debug,
1919
} from 'webpack';
2020
import { RawSource } from 'webpack-sources';
21-
import { AssetPatternClass } from '../../../browser/schema';
22-
import { isEs5SupportNeeded } from '../../../utils/differential-loading';
21+
import { AssetPatternClass, ExtraEntryPoint } from '../../../browser/schema';
22+
import { BuildBrowserFeatures } from '../../../utils/build-browser-features';
2323
import { BundleBudgetPlugin } from '../../plugins/bundle-budget';
2424
import { CleanCssWebpackPlugin } from '../../plugins/cleancss-webpack-plugin';
2525
import { NamedLazyChunksPlugin } from '../../plugins/named-chunks-plugin';
@@ -40,7 +40,7 @@ export const buildOptimizerLoader: string = g['_DevKitIsLocal']
4040

4141
// tslint:disable-next-line:no-big-function
4242
export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
43-
const { root, projectRoot, buildOptions } = wco;
43+
const { root, projectRoot, buildOptions, tsConfig } = wco;
4444
const { styles: stylesOptimization, scripts: scriptsOptimization } = buildOptions.optimization;
4545
const {
4646
styles: stylesSourceMap,
@@ -67,25 +67,39 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
6767
}
6868

6969
if (wco.buildOptions.platform !== 'server') {
70-
const es5Polyfills = path.join(__dirname, '..', 'es5-polyfills.js');
71-
const es5JitPolyfills = path.join(__dirname, '..', 'es5-jit-polyfills.js');
72-
if (targetInFileName) {
73-
// For differential loading we don't need to have 2 polyfill bundles
74-
if (buildOptions.scriptTargetOverride === ScriptTarget.ES2015) {
75-
entryPoints['polyfills'] = [path.join(__dirname, '..', 'safari-nomodule.js')];
76-
} else {
77-
entryPoints['polyfills'] = [es5Polyfills];
78-
if (!buildOptions.aot) {
79-
entryPoints['polyfills'].push(es5JitPolyfills);
70+
const buildBrowserFeatures = new BuildBrowserFeatures(
71+
projectRoot,
72+
tsConfig.options.target || ScriptTarget.ES5,
73+
);
74+
if ((buildOptions.scriptTargetOverride || tsConfig.options.target) === ScriptTarget.ES5) {
75+
if (buildOptions.es5BrowserSupport ||
76+
(
77+
buildOptions.es5BrowserSupport === undefined &&
78+
buildBrowserFeatures.isEs5SupportNeeded()
79+
)
80+
) {
81+
// The nomodule polyfill needs to be inject prior to any script and be
82+
// outside of webpack compilation because otherwise webpack will cause the
83+
// script to be wrapped in window["webpackJsonp"] which causes this to fail.
84+
if (buildBrowserFeatures.isNoModulePolyfillNeeded()) {
85+
const noModuleScript: ExtraEntryPoint = {
86+
bundleName: 'polyfills-nomodule-es5',
87+
input: path.join(__dirname, '..', 'safari-nomodule.js'),
88+
};
89+
buildOptions.scripts = buildOptions.scripts
90+
? [...buildOptions.scripts, noModuleScript]
91+
: [noModuleScript];
8092
}
81-
}
82-
} else {
83-
// For NON differential loading we want to have 2 polyfill bundles
84-
if (buildOptions.es5BrowserSupport
85-
|| (buildOptions.es5BrowserSupport === undefined && isEs5SupportNeeded(projectRoot))) {
86-
entryPoints['polyfills-es5'] = [es5Polyfills];
93+
94+
// For differential loading we don't need to generate a seperate polyfill file
95+
// because they will be loaded exclusivly based on module and nomodule
96+
const polyfillsChunkName = buildBrowserFeatures.isDifferentialLoadingNeeded()
97+
? 'polyfills'
98+
: 'polyfills-es5';
99+
100+
entryPoints[polyfillsChunkName] = [path.join(__dirname, '..', 'es5-polyfills.js')];
87101
if (!buildOptions.aot) {
88-
entryPoints['polyfills-es5'].push(es5JitPolyfills);
102+
entryPoints[polyfillsChunkName].push(path.join(__dirname, '..', 'es5-jit-polyfills.js'));
89103
}
90104
}
91105
}

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/utils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@
88
// tslint:disable
99
// TODO: cleanup this file, it's copied as is from Angular CLI.
1010

11-
import * as path from 'path';
1211
import { basename, normalize } from '@angular-devkit/core';
1312
import { ExtraEntryPoint, ExtraEntryPointClass } from '../../../browser/schema';
1413
import { SourceMapDevToolPlugin } from 'webpack';
1514
import { ScriptTarget } from 'typescript';
1615

17-
export const ngAppResolve = (resolvePath: string): string => {
18-
return path.resolve(process.cwd(), resolvePath);
19-
};
20-
2116
export interface HashFormat {
2217
chunk: string;
2318
extract: string;

packages/angular_devkit/build_angular/src/angular-cli-files/utilities/package-chunk-sort.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function generateEntryPoints(
2626
};
2727

2828
const entryPoints = [
29+
'polyfills-nomodule-es5',
2930
'polyfills-es5',
3031
'polyfills',
3132
'sw-register',

packages/angular_devkit/build_angular/src/browser/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import {
5757
statsWarningsToString,
5858
} from '../angular-cli-files/utilities/stats';
5959
import { ExecutionTransformer } from '../transforms';
60-
import { deleteOutputDir, isEs5SupportNeeded } from '../utils';
60+
import { BuildBrowserFeatures, deleteOutputDir } from '../utils';
6161
import { Version } from '../utils/version';
6262
import { generateBrowserWebpackConfigFromContext } from '../utils/webpack-browser-config';
6363
import { Schema as BrowserBuilderSchema } from './schema';
@@ -202,9 +202,13 @@ export function buildWebpackBrowser(
202202
const tsConfigPath = path.resolve(getSystemPath(workspace.root), options.tsConfig);
203203
const tsConfig = readTsconfig(tsConfigPath);
204204

205-
if (isEs5SupportNeeded(projectRoot) &&
206-
tsConfig.options.target !== ScriptTarget.ES5 &&
207-
tsConfig.options.target !== ScriptTarget.ES2015) {
205+
const target = tsConfig.options.target || ScriptTarget.ES5;
206+
const buildBrowserFeatures = new BuildBrowserFeatures(
207+
getSystemPath(projectRoot),
208+
target,
209+
);
210+
211+
if (target > ScriptTarget.ES2015 && buildBrowserFeatures.isDifferentialLoadingNeeded()) {
208212
context.logger.warn(tags.stripIndent`
209213
WARNING: Using differential loading with targets ES5 and ES2016 or higher may
210214
cause problems. Browsers with support for ES2015 will load the ES2016+ scripts

0 commit comments

Comments
 (0)