forked from twitter/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Requirements on language-specific sources should be optional. (pantsb…
…uild#6375) E.g., a repo may have java without scala or vice versa. This only works today because we implicitly expect codegen tasks (which produce java and scala), and the deferred sources mapper task, to be registered. But not having them registered is a totally reasonable thing to do (e.g., it improves start up time because there are fewer options to parse). This extends the logic of pantsbuild#6357. The goal is to be able to run pants with just the backends you want. In fact, once this is possible we should remove all the default registrations (keeping, say, just graph_info and project_info) and require you to opt in to whatever lang-specific backends you need. Debatably, many more, possibly even all, requirements should be optional. But that's a bigger issue, for another day.
- Loading branch information
Showing
9 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/python/pants_test/backend/jvm/test_backend_independence_integration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# coding=utf-8 | ||
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
from pants_test.pants_run_integration_test import PantsRunIntegrationTest | ||
|
||
|
||
class BackendIndependenceTest(PantsRunIntegrationTest): | ||
"""Verifies that this backend works with no other backends present.""" | ||
|
||
@classmethod | ||
def hermetic(cls): | ||
return True | ||
|
||
def test_independent_test_run(self): | ||
pants_run = self.run_pants( | ||
command=['test', 'examples/tests/java/org/pantsbuild/example/hello/greet'], | ||
config={ | ||
'GLOBAL': { | ||
'pythonpath': ['%(buildroot)s/pants-plugins/src/python'], | ||
# We need the internal backend for the repo specifications in the example BUILD files. | ||
# TODO: Don't use the real pants repos in example code, which are ideally self-contained. | ||
'backend_packages': ['pants.backend.jvm', 'internal_backend.repositories'], | ||
} | ||
} | ||
) | ||
self.assert_success(pants_run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/python/pants_test/backend/python/test_backend_independence_integration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# coding=utf-8 | ||
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
from pants_test.pants_run_integration_test import PantsRunIntegrationTest | ||
|
||
|
||
class BackendIndependenceTest(PantsRunIntegrationTest): | ||
"""Verifies that this backend works with no other backends present.""" | ||
|
||
@classmethod | ||
def hermetic(cls): | ||
return True | ||
|
||
def test_independent_test_run(self): | ||
pants_run = self.run_pants( | ||
command=['test', 'examples/tests/python/example_test/hello/greet'], | ||
config={ | ||
'GLOBAL': { | ||
'pythonpath': [], | ||
'backend_packages': ['pants.backend.python'], | ||
} | ||
} | ||
) | ||
self.assert_success(pants_run) |