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

No target roots found in build graph #544

Open
slvrtrn opened this issue Jul 9, 2020 · 3 comments
Open

No target roots found in build graph #544

slvrtrn opened this issue Jul 9, 2020 · 3 comments

Comments

@slvrtrn
Copy link

slvrtrn commented Jul 9, 2020

Hello. I am trying to contribute to this plugin https://github.com/scalapb/scalapb-pants and make it a little bit more IDEA friendly. Right now, it is not possible to import it in the IDEA 2020.1.3 with Pants plugin 1.15.1

If I comment out all the Scala BUILD definitions (leaving only the Python ones cause I want all the syntax highlighting there to redefine custom targets definitions for V1 & V2), I am getting the following error

No target roots found in build graph. Please make sure Pants export version >= 1.0.9

Output of ./pants export :: provides some Python targets though

▶ ./pants export ::
{
    "version": "1.1.0",
    "targets": {
        "//:scalapb_pants_plugin": {
            "targets": [
                "src/python:plugin"
            ],
            "libraries": [],
            "roots": [],
            "id": ".scalapb_pants_plugin",
            "target_type": "SOURCE",
            "is_code_gen": false,
            "is_synthetic": false,
            "pants_target_type": "target",
            "globs": {
                "globs": []
            },
            "transitive": true,
            "scope": "default",
            "is_target_root": true
        },
        "src/python:plugin": {
            "targets": [
                "3rdparty/python:pantsbuild.pants"
            ],
            "libraries": [],
            "roots": [
                {
                    "source_root": "/Users/serge/work/scalapb-pants/src/python/scalapb/pants/targets",
                    "package_prefix": "scalapb.pants.targets"
                },
                {
                    "source_root": "/Users/serge/work/scalapb-pants/src/python/scalapb/pants/tasks",
                    "package_prefix": "scalapb.pants.tasks"
                },
                {
                    "source_root": "/Users/serge/work/scalapb-pants/src/python/scalapb/pants",
                    "package_prefix": "scalapb.pants"
                }
            ],
            "id": "src.python.plugin",
            "target_type": "SOURCE",
            "is_code_gen": false,
            "is_synthetic": false,
            "pants_target_type": "python_library",
            "globs": {
                "globs": [
                    "src/python/./scalapb/pants/**/*.py"
                ]
            },
            "transitive": true,
            "scope": "default",
            "is_target_root": true,
            "python_interpreter": "CPython-3.7.3"
        }
// etc... 3rdparty modules and everything else

pants.toml that I am using now looks like

[GLOBAL]
v1 = true
v2 = false
pants_version = "1.29.0"
print_exception_stacktrace = true
enable_pantsd = false

pythonpath = ['%(buildroot)s/src/python']

backend_packages.add = [
    'pants.backend.python',
    'scalapb.pants',
]
backend_packages.remove = [
    'pants.backend.python.lint.isort',
]

[python-setup]
interpreter_constraints = [
    'CPython>=3.7',
]

[source]
root_patterns = [
    '%(buildroot)s/src/python',
    '%(buildroot)s/examples',
]

[scala]
version = 2.12

[jvm-platform]
default_platform = "java11"
platforms = """
{
  'java11': {'source': '11', 'target': '11', 'args': [] },
}
"""

if I uncomment Scala BUILD definitions back, I am getting this

FAILURE: Modulizable targets must not contain any synthetic target, but in this case the following synthetic targets depend on other non-synthetic modules:
{ScalaLibrary(.pants.d/gen/scalapb-gen/9c44cc2743fa/examples.simple.dep_proto/current:examples.simple.dep_proto), ScalaLibrary(.pants.d/gen/scalapb-gen/9c44cc2743fa/examples.simple.simple_proto/current:examples.simple.simple_proto), ScalaLibrary(.pants.d/gen/scalapb-gen/9c44cc2743fa/examples.client.client_proto/current:examples.client.client_proto), ScalaLibrary(.pants.d/gen/scalapb-gen/9c44cc2743fa/examples.grpc.service_proto/current:examples.grpc.service_proto)}
One approach that may help is to reduce the scope of the import to further avoid synthetic targets.

everything is working fine from the console though (I am unable to compile and run the example project using ./pants run examples/simple:main command)

@wisechengyi
Copy link
Collaborator

wisechengyi commented Jul 10, 2020

During import, did you select the intellij compiler option? If so, that's still experimental.

So either you can unselect that option, or if you are able to consume the twitter's stable branch: https://github.com/pantsbuild/pants/tree/1.25.x-twtr, it contains an option to warn instead of error pantsbuild/pants#9745

@slvrtrn
Copy link
Author

slvrtrn commented Jul 13, 2020

@wisechengyi No, Intellij compiler option is not selected during import.

@wisechengyi
Copy link
Collaborator

Sorry I meant the other option:

pants.settings.text.import.deps.as.jars=Import source dependencies as jars [Experimental. Pants >= 1.23.0rc1 required]

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

2 participants