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

[internal] Use "file addresses" internally for some files and resources targets #13188

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

shell_library(name="scripts", sources=["cargo", "pants"])

# We use this to establish the build root, rather than `./pants`, because we cannot safely use the
# latter as the sentinel filename per https://github.com/pantsbuild/pants/pull/8105.
files(name='build_root', sources=["BUILD_ROOT"])

files(name='gitignore', sources=['.gitignore'])
files(name='pants_toml', sources=['pants.toml'])
# We use `BUILD_ROOT` to establish the build root, rather than `./pants`, per
# https://github.com/pantsbuild/pants/pull/8105.
files(name="files", sources=["BUILD_ROOT", ".gitignore", "pants.toml"])
38 changes: 8 additions & 30 deletions src/python/pants/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@
python_library(
name='entry_point',
sources=['__main__.py'],
dependencies=[
'src/python/pants/bin:pants_loader',
],
dependencies=['src/python/pants/bin:pants_loader'],
)

python_distribution(
name='pants-packaged',
dependencies=[
':dummy_c',
':entry_point',
':version',
':py_typed',
],
dependencies=[':entry_point', ':resources'],
# Because we have native code, this will cause the wheel to use whatever the ABI is for the
# interpreter used to run setup.py, e.g. `cp36m-macosx_10_15_x86_64`.
sdist = False,
Expand All @@ -38,15 +31,6 @@ python_distribution(
},
)

# NB: we use this to avoid clang/gcc complaining `error: no input files` when building
# `:pants-packaged`. We don't actually need to use any meaningful file here, though, because we
# use `entry_points` to link to the actual native code, so clang/gcc do not need to build any
# native code. This is just a dummy file.
resources(
name="dummy_c",
sources=['dummy.c'],
)

python_library(
name='conftest',
sources=['conftest.py'],
Expand All @@ -55,17 +39,11 @@ python_library(
python_library(
name='version',
sources=['version.py'],
dependencies = [
':version-resource',
],
dependencies=["./VERSION:resources"],
)

resources(
name='version-resource',
sources=['VERSION'],
)

resources(
name="py_typed",
sources=["py.typed"],
)
# NB: we use `dummy.c` to avoid clang/gcc complaining `error: no input files` when building
# `:pants-packaged`. We don't actually need to use any meaningful file here, though, because we
# use `entry_points` to link to the actual native code, so clang/gcc do not need to build any
# native code. This is just a dummy file.
resources(name="resources", sources=["VERSION", "py.typed", "dummy.c"])
4 changes: 1 addition & 3 deletions src/python/pants/base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ python_library()
python_tests(
name="tests",
sources=['*_test.py', '!exception_sink_test.py', '!*_integration_test.py'],
dependencies = [
'//:build_root',
],
dependencies=["//BUILD_ROOT:files"],
)

python_tests(
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/help/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python_library()
python_tests(
name='tests',
sources=['*_test.py', '!*_integration_test.py'],
dependencies=["//:build_root"],
dependencies=["//BUILD_ROOT:files"],
)

python_tests(name="integration", sources=["*_integration_test.py"], timeout=360)
4 changes: 2 additions & 2 deletions src/python/pants/option/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ python_tests(
name="tests",
dependencies=[
# Used by `options_bootstrapper_test` and `config_test`.
'//:build_root',
'//:pants_toml',
'//BUILD_ROOT:files',
'//pants.toml:files',
],
timeout=300,
)
4 changes: 2 additions & 2 deletions src/python/pants/testutil/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ python_library(
python_library(
name="rule_runner",
sources=["rule_runner.py", "test_base.py"],
dependencies=["//:build_root"],
dependencies=["//BUILD_ROOT:files"],
)

python_library(
name = 'pants_integration_test',
sources = ['pants_integration_test.py'],
dependencies = [
'//:build_root',
"//BUILD_ROOT:files",
'src/python/pants:entry_point'
],
)
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/vcs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python_tests(
name='changed_integration',
sources=['changed_integration_test.py'],
dependencies=[
'//:gitignore',
'//.gitignore:files',
'testprojects/src/python:python_targets_directory',
'testprojects/src/python:sources_directory',
],
Expand Down
2 changes: 1 addition & 1 deletion tests/python/pants_test/init/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python_tests(
timeout = 360,
dependencies=[
# Used by `test_options_initializer`.
'//:build_root',
"//BUILD_ROOT:files",
],
)

Expand Down
5 changes: 1 addition & 4 deletions tests/python/pants_test/pantsd/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_tests(
sources=['test_*.py'],
dependencies=["//:build_root"],
)
python_tests(sources=['test_*.py'], dependencies=["//BUILD_ROOT:files"])

python_library(
name = 'pantsd_integration_test_base',
Expand Down