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

Some Resources in maven layout get the wrong source root, should be picking up 'src/test/resources' and 'src/main/resources' over 'src' #2536

Closed
ericzundel opened this issue Nov 11, 2015 · 8 comments

Comments

@ericzundel
Copy link
Member

I have some tests that have some '.java' files on the resource path. This is not so strange as it sounds - they are used to test an annotation processor.

e.g.

foo/src/main/resources/com/example/Metrics.java

foo/src/main/resources/BUILD included them in a resources() target and a test target had a dependency on them.

In 0.0.53, these resources were visible, but as of 0.0.57 they are not. I suspect something is filtering them out of the classpath, thinking they are generated sources from an annotation processor, but for these resources that is not the case.

Still investigating this, that might not be the issue...

@ericzundel ericzundel changed the title Resources with names ending in .java are no longer on the classpath Some Resources in maven layout get the wrong source root, should be picking up 'src/test/resources' and 'src/main/resources' over 'src' Nov 11, 2015
@ericzundel
Copy link
Member Author

I think this is a source roots problem:

One of our files is written to:

.pants.d/resources/prepare/common-annotation-processors.tests.src.test.resources.resources/bc8572527ebf/test/resources/aop/BadVisibility.java

The file is in common-annotation-processors/tests/src/test/resources . Look at the path written to the build cache. There is a directory test/resources after the sha in the path that I didn't expect to be there.

Before this change, the file was written to:

.pants.d/resources/prepare/fd25894586b06db15abfc6266ece1d0bfbcd21e4-TaskIdentityFingerprintStrategy_25888fb3bc8e/aop/BadVisibility.java

@ericzundel
Copy link
Member Author

I think I see what might be the problem. This source code is under

common-annotation-procesors/tests/src/test/resources

I think maybe the 'tests' or 'tests/src' in the path preceding may be fooling the source root code. We have several projects like this and now I see that others are also failing in the upgrade, (I was just focused in on this one because we just recently got it to work.)

This works around the problem:

[source]
source_roots: {
    "common-annotation-processors/tests/src/main/resources": ["java"]
  }

FYI @benjyw do you think there is a better solution to this?

@stuhood
Copy link
Member

stuhood commented Nov 11, 2015

You could remove the 'tests/*' source root pattern, or rename those
directories to not match that pattern.
On Nov 11, 2015 5:56 AM, "Eric Ayers" [email protected] wrote:

I think I see what might be the problem. This source code is under

common-annotation-procesors/tests/src/test/resources

I think maybe the 'tests' or 'tests/src' in the path preceding may be
fooling the source root code. We have several projects like this and now I
see that others are also failing in the upgrade, (I was just focused in on
this one because we just recently got it to work.)

This works around the problem:

[source]
source_roots: {
"common-annotation-processors/tests/src/main/resources": ["java"]
}

FYI @benjyw https://github.com/benjyw do you think there is a better
solution to this?


Reply to this email directly or view it on GitHub
#2536 (comment).

@ericzundel
Copy link
Member Author

Thanks @stuhood. This is better:

[source]
test_root_patterns: [
    "test/*",
    "src/test/*"
  ]

@benjyw
Copy link
Contributor

benjyw commented Nov 14, 2015

That seems like the right solution to me. The source root code was working as advertised, with the defaults it was given.

@ericzundel
Copy link
Member Author

Well, the odd part about this is that common-annotation-processors/tests/src/main/java and common-annotation-processors/tests/src/main/proto seem to work the way I want it to so the break is hard to pin back to source roots.

@benjyw
Copy link
Contributor

benjyw commented Nov 18, 2015

My guess is that java "worked" because you didn't need correct source roots for them (because you weren't bundling that code).

@stuhood
Copy link
Member

stuhood commented Jan 26, 2016

@ericzundel : Sounds like this was Not A Bug?

@stuhood stuhood closed this as completed Apr 10, 2017
asherf added a commit to asherf/pants that referenced this issue Feb 3, 2021
[setuptools](https://github.com/pypa/setuptools/blob/main/CHANGES.rst)
v53.0.0
-------

Breaking Changes
^^^^^^^^^^^^^^^^
* pantsbuild#1527: Removed bootstrap script. Now Setuptools requires pip or another pep517-compliant builder such as 'build' to build. Now Setuptools can be installed from Github main branch.

v52.0.0
-------

Breaking Changes
^^^^^^^^^^^^^^^^
* pantsbuild#2537: Remove fallback support for fetch_build_eggs using easy_install. Now pip is required for setup_requires to succeed.
* pantsbuild#2544: Removed 'easy_install' top-level model (runpy entry point) and 'easy_install' console script.
* pantsbuild#2545: Removed support for eggsecutables.

Changes
^^^^^^^
* pantsbuild#2459: Tests now run in parallel via pytest-xdist, completing in about half the time. Special thanks to :user:`webknjaz` for hard work implementing test isolation. To run without parallelization, disable the plugin with ``tox -- -p no:xdist``.

v51.3.3
-------

Misc
^^^^
* pantsbuild#2539: Fix AttributeError in Description validation.

v51.3.2
-------

Misc
^^^^
* pantsbuild#1390: Validation of Description field now is more lenient, emitting a warning and mangling the value to be valid (replacing newlines with spaces).

v51.3.1
-------

Misc
^^^^
* pantsbuild#2536: Reverted tag deduplication handling.

v51.3.0
-------

Changes
^^^^^^^
* pantsbuild#1390: Newlines in metadata description/Summary now trigger a ValueError.
* pantsbuild#2481: Define ``create_module()`` and ``exec_module()`` methods in ``VendorImporter``
  to get rid of ``ImportWarning`` -- by :user:`hroncok`
* pantsbuild#2489: ``pkg_resources`` behavior for zipimport now matches the regular behavior, and finds
  ``.egg-info`` (previoulsy would only find ``.dist-info``) -- by :user:`thatch`
* pantsbuild#2529: Fixed an issue where version tags may be added multiple times

v51.2.0
-------

Changes
^^^^^^^
* pantsbuild#2493: Use importlib.import_module() rather than the deprectated loader.load_module()
  in pkg_resources namespace delaration -- by :user:`encukou`

Documentation changes
^^^^^^^^^^^^^^^^^^^^^
* pantsbuild#2525: Fix typo in the document page about entry point. -- by :user:`jtr109`

Misc
^^^^
* pantsbuild#2534: Avoid hitting network during test_easy_install.

v51.1.2
-------

Misc
^^^^
* pantsbuild#2505: Disable inclusion of package data as it causes 'tests' to be included as data.

v51.1.1
-------

Misc
^^^^
* pantsbuild#2534: Avoid hitting network during test_virtualenv.test_test_command.

v51.1.0
-------

Changes
^^^^^^^
* pantsbuild#2486: Project adopts jaraco/skeleton for shared package maintenance.

Misc
^^^^
* pantsbuild#2477: Restore inclusion of rst files in sdist.
* pantsbuild#2484: Setuptools has replaced the master branch with the main branch.
* pantsbuild#2485: Fixed failing test when pip 20.3+ is present.
  -- by :user:`yan12125`
* pantsbuild#2487: Fix tests with pytest 6.2
  -- by :user:`yan12125`

v51.0.0
-------

Breaking Changes
^^^^^^^^^^^^^^^^
* pantsbuild#2435: Require Python 3.6 or later.

Documentation changes
^^^^^^^^^^^^^^^^^^^^^
* pantsbuild#2430: Fixed inconsistent RST title nesting levels caused by pantsbuild#2399
  -- by :user:`webknjaz`
* pantsbuild#2430: Fixed a typo in Sphinx docs that made docs dev section disappear
  as a result of PR pantsbuild#2426 -- by :user:`webknjaz`

Misc
^^^^
* pantsbuild#2471: Removed the tests that guarantee that the vendored dependencies can be built by distutils.

v50.3.2
-------

Documentation changes
^^^^^^^^^^^^^^^^^^^^^
* pantsbuild#2394: Extended towncrier news template to include change note categories.
  This allows to see what types of changes a given version introduces
  -- by :user:`webknjaz`
* pantsbuild#2427: Started enforcing strict syntax and reference validation
  in the Sphinx docs -- by :user:`webknjaz`
* pantsbuild#2428: Removed redundant Sphinx ``Makefile`` support -- by :user:`webknjaz`

Misc
^^^^
* pantsbuild#2401: Enabled test results reporting in AppVeyor CI
  -- by :user:`webknjaz`
* pantsbuild#2420: Replace Python 3.9.0 beta with 3.9.0 final on GitHub Actions.
* pantsbuild#2421: Python 3.9 Trove classifier got added to the dist metadata
  -- by :user:`webknjaz`

v50.3.1
-------

Documentation changes
^^^^^^^^^^^^^^^^^^^^^
* pantsbuild#2093: Finalized doc revamp.
* pantsbuild#2097: doc: simplify index and group deprecated files
* pantsbuild#2102: doc overhaul step 2: break main doc into multiple sections
* pantsbuild#2111: doc overhaul step 3: update userguide
* pantsbuild#2395: Added a ``:user:`` role to Sphinx config -- by :user:`webknjaz`
* pantsbuild#2395: Added an illustrative explanation about the change notes to fragments dir -- by :user:`webknjaz`

Misc
^^^^
* pantsbuild#2379: Travis CI test suite now tests against PPC64.
* pantsbuild#2413: Suppress EOF errors (and other exceptions) when importing lib2to3.

[Wheel](https://github.com/pypa/wheel/blob/4fb47f98550f3f43fc0b8c73f518592124ae21bd/docs/news.rst)
**0.36.2 (2020-12-13)**

- Updated vendored ``packaging`` library to v20.8
- Fixed wheel sdist missing ``LICENSE.txt``
- Don't use default ``macos/arm64`` deployment target in calculating the
  platform tag for fat binaries (PR by Ronald Oussoren)

**0.36.1 (2020-12-04)**

- Fixed ``AssertionError`` when ``MACOSX_DEPLOYMENT_TARGET`` was set to ``11``
  (PR by Grzegorz Bokota and François-Xavier Coudert)
- Fixed regression introduced in 0.36.0 on Python 2.7 when a custom generator
  name was passed as unicode (Scikit-build)
  (``TypeError: 'unicode' does not have the buffer interface``)

**0.36.0 (2020-12-01)**

- Added official Python 3.9 support
- Updated vendored ``packaging`` library to v20.7
- Switched to always using LF as line separator when generating ``WHEEL`` files
  (on Windows, CRLF was being used instead)
- The ABI tag is taken from  the sysconfig SOABI value. On PyPy the SOABI value
  is ``pypy37-pp73`` which is not compliant with PEP 3149, as it should have
  both the API tag and the platform tag. This change future-proofs any change
  in PyPy's SOABI tag to make sure only the ABI tag is used by wheel.
- Fixed regression and test for ``bdist_wheel --plat-name``. It was ignored for
  C extensions in v0.35, but the regression was not detected by tests.
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

No branches or pull requests

3 participants