Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Architect API #13463

Merged
merged 11 commits into from
Feb 19, 2019
Merged

New Architect API #13463

merged 11 commits into from
Feb 19, 2019

Conversation

hansl
Copy link
Contributor

@hansl hansl commented Jan 17, 2019

For now just a proof of concept, but this branch will be reused for the final implementation.

@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@hansl hansl force-pushed the architect-poc branch 2 times, most recently from e39bf1c to 933628a Compare February 13, 2019 19:58
@hansl hansl requested review from clydin and kyliau February 13, 2019 22:32
@hansl hansl added the target: major This PR is targeted for the next major release label Feb 13, 2019
@angular angular deleted a comment from ngbot bot Feb 14, 2019
@hansl hansl force-pushed the architect-poc branch 4 times, most recently from f3e9a20 to cb2cd52 Compare February 14, 2019 22:36

return {
...targetSpec['options'],
...(target.configuration ? targetSpec['configurations'][target.configuration] : 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, is calling spread operator on a number actually valid syntax?
I tried it in TS playground and it complains about "Spread types may only be created from object types."
https://www.typescriptlang.org/play/#src=console.log(%7B%20...(1%20%2B%201%20%3D%3D%3D%202%20%3F%203%20%3A%204)%20%7D)%3B

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per offline discussion, { ...0 } is valid javascript.

info: info,
options: buildOptions,
...(options.target ? { target: options.target } : {}),
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: refactor this object so it doesn't have to be repeated below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -6,4 +6,5 @@
* found in the LICENSE file at https://angular.io/license
*/
export * from './text';
export * from './caps';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is in the architect CLI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see the progress bar stuff).

hansl and others added 11 commits February 19, 2019 11:13
It was only used when manually testing the old Architect.
It was possible to overwrite the metadata of the logger itself (name, path)
when calling "log()". This should not happen. If there is a need to overwrite
the loggers metadata itself one should use "next()" and construct or forward
their own log entry.
Current behaviour is to have logs forwarded, but this is flawed because on the
job side the logger is actually re-created. This allows logs to be actually part
of the caller side logging infrastructure.
The new API has been described in this design doc:
https://docs.google.com/document/d/1SpN_2XEooI9_CPjqspAcNEBjVY874OWPZqOenjuF0qo/view

This first drafts add support for the API (given some deep imports). It is
still in draft mode but is committed to make it available to people to
start testing and moving their own builders.

This API rebuilds (not backward compatible) the Architect API package. To
use it people will need to import "@angular-devkit/architect/src/index2"
to start using it. A reference builder will be added in the next commit.

There are 2 pieces missing from this commit that will be added in the
same PR; 1) the architect-host and CLI to test, and 2) a reference
builder moved from the old API to the new one. These will be part of
the same PR.

Finally, there are missing tests in this package, but everything tested
manually and automatically works so far. Test coverage will be added
before the package is considered finished.

Due to a desire to keep architect, our tests and the scope of this PR
limited and keep the two APIs separated, every clashing files will
have a "2" suffix added to it. Once all builders have been moved and
we are sure everything works, all those files will be moved to their
final destination and the old API will be removed, in one PR.
This host resolves using the package resolution and reading the targets
from the workspace API.
Four builders were added;
- true, always succeed
- false, always fails
- concat, runs all targets or builders in succession
- allOf, runs all targets or builders in parallel
It is only new files and the old builder is still available. The new
one can only be used by the new Architect API.
Move the entire Architect CLI to use the new API, and report progress using
a progress bar for each worker currently executing. Shows log at the end
of the execution.

This is meant to be used as a debugging tool to help people move their builders
to the new API.
Also tighten the types a bit, and add a test that failed before and works now.
If a system wants to have logging it should multiplex it itself on a channel.

Also changed the previous Architect commits to remove usage of Logs and move
to a "log" channel.
@hansl
Copy link
Contributor Author

hansl commented Feb 19, 2019

Just force pushed the fixups into their commits. This is ready to merge pending CI.

@kyliau kyliau merged commit 1aa1b47 into angular:master Feb 19, 2019
@hansl hansl deleted the architect-poc branch February 19, 2019 21:52
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants