Skip to content

Unable to use --extract in a workspace? #237

@osa1

Description

@osa1

Does --extract support workspaces? I can't figure out how to use it in a workspace.

I'm trying it with https://github.com/google/protobuf.dart. I want to extract the API for protobuf. Using the master branch I get this: (in the repo root)

$ dart-apitool extract --input protobuf
Preparing protobuf
Copying sources from protobuf
Could not find workspace for package protobuf
Could not find workspace for package /tmp/JITPPV
Error: PathNotFoundException: Cannot open file, path = 'protobuf/.dart_tool/package_config.json' (OS Error: No such file or directory, errno = 2)

If I use . as the input I get this:

$ dart-apitool extract --input .
 Preparing .
Copying sources from .
Omitting pub get (package config already present)
Analyzing .
Cleaning up
{
    "version": 3,
    "packageApi": {
        "packageName": "workspace",
        "packageVersion": null,
        "packagePath": "/tmp/NSKLVJ",
        "interfaceDeclarations": [],
        "executableDeclarations": [],
        "fieldDeclarations": [],
        "typeAliasDeclarations": [],
        "semantics": [
            "containsPlatformConstraints"
        ],
        "iosPlatformConstraints": null,
        "androidPlatformConstraints": null,
        "sdkType": "dart",
        "minSdkVersion": "3.7.0",
        "packageDependencies": []
    },
    "missingEntryPoints": []
}

Which doesn't show the API so I'm guessing it's not doing anything?

What's the expected output of this command when it works? It might be useful to show it in the README.

I also can't figure out how to extract APIs using git://... as --input. As an example, what's the full command for generating the API of https://github.com/dart-lang/core/tree/main/pkgs/collection ? I think the syntax shown in the README with git://https://... is probably wrong as they generate "Unknown package ref".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions