Skip to content

Init the native engine from bootstrap options.#4787

Merged
benjyw merged 4 commits into
pantsbuild:masterfrom
benjyw:bootstrap_engine
Aug 7, 2017
Merged

Init the native engine from bootstrap options.#4787
benjyw merged 4 commits into
pantsbuild:masterfrom
benjyw:bootstrap_engine

Conversation

@benjyw

@benjyw benjyw commented Aug 4, 2017

Copy link
Copy Markdown
Contributor

Previously the native engine was initialized by a
Native.Factory subsystem. But we want to use the engine
to parse options, meaning that the engine must be initialized
using only bootstrap options.

So this change moves the former subsystem options to be bootstrap
options. We use the old subsystem scope as a prefix for the new global
option names, so their cmd-line and env names don't change, however any
settings in pants.ini will need to move to the global section.

The code was moved out of pants/engine/subsystem into
pants/engine directly. We could have renamed the subsystem
directory to something else, but the relevant target both
depends on and is depended on by targets in the parent dir,
so it should probably just live there (circular deps at the
directory level are icky).

A future change will give BinaryUtil.Factory similar treatment, clearing
the way for initializing the native engine using only bootstrap options.

@benjyw benjyw force-pushed the bootstrap_engine branch 3 times, most recently from de1973c to 90a78c9 Compare August 4, 2017 23:42

@stuhood stuhood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks Benjy!

Before shipping this, would be good to talk to Kris about the "engine as native wheel" option that he had mentioned... it would remove the use of binutils entirely.

Comment thread build-support/bin/native/bootstrap.sh Outdated
@@ -129,8 +129,8 @@ function bootstrap_native_code() {
cp "${native_binary}" "${target_binary}"

# NB: The resource file emitted/over-written below is used by the `Native` subsystem to default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No longer a subsystem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.



# TODO: These aren't tests, so they should be under examples/.
# Should they use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

They are used in the tests, so maybe testprojects/ instead.

"// TODO: finish this tho"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This module was completely broken before I fixed it up, using a method that no longer exists. So nothing is currently exercising this code. And I don't see any references to visualizer anywhere else in the codebase.

@stuhood stuhood requested a review from kwlzn August 5, 2017 01:13
@benjyw benjyw force-pushed the bootstrap_engine branch from 90a78c9 to 2e58d5c Compare August 5, 2017 02:19
Previously the native engine was initialized by a
Native.Factory subsystem.  However we want to use the engine
to parse options, meaning that the engine must be initialized
using only bootstrap options.  So the subsystem options
were moved to the bootstrap options (their cmd-line and env
names don't change, because we use the old subsystem scope
as a prefix for the new global option names, however they
will need to move to the global section in pants.ini).

The code was moved out of pants/engine/subsystem into
pants/engine directly. We could have renamed the subsystem
directory to something else, but the relevant target both
depends on and is depended on by targets in the parent dir,
so it should probably just live there (circular deps at the
directory level are icky).
@benjyw benjyw force-pushed the bootstrap_engine branch from 2e58d5c to bc6e892 Compare August 5, 2017 03:18

@kwlzn kwlzn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, tho I thought we were generally against passing around options "bags" to __init__ methods as is done here for PantsDaemonLauncher. doesn't matter to me either way tho.

@benjyw

benjyw commented Aug 7, 2017

Copy link
Copy Markdown
Contributor Author

I don't remember any discussion of passing around option bags, so I think it's fine, and I think this is better than passing in so many separate option fields...

@benjyw benjyw merged commit d8be9eb into pantsbuild:master Aug 7, 2017
@benjyw benjyw deleted the bootstrap_engine branch August 7, 2017 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants