mozilla-mobile / gradle-apilint

Gradle Plugin that tracks the API of an Android library and helps maintain backward compatibility.
Mozilla Public License 2.0
8 stars 9 forks source link

Report files and lines for the sources of conflicts #61

Closed ncalexan closed 5 years ago

ncalexan commented 5 years ago

Integrating API lint into Mozilla's Phabricator CI (see Bug 1512487) comes with some requirements. Fundamentally, Phab can only display lint issues as comments anchored to a file and a line, and then only when the file and line are actually part of the commit in question.

Can we teach API lint to report the file and line of changed signatures? I feel like that information is probably already present but not captured in output by default, but I know there are layers of APIs in between the sources and the outputs, and maybe the source mapping is lost too early to achieve this.

agi90 commented 5 years ago

We definitely do have this piece of information, any element in the Doclet API has a SourcePosition object that gives you what you want.

We would need to build a source map file that apilint can then use to figure out where each class/method is, but it shouldn't be too complicated.

agi90 commented 5 years ago

The source map can probably just be a json file with something like:

{
    "org.mozilla.geckoview.GeckoView": {
        "class": {
            "column": "...",
            "file": "...",
            "line": "..."
        },
        "members": {
            "method public void coverUntilFirstPaint(int)": {
                "column": "...",
                "file": "...",
                "line": "..."
            },
        }
    },
    "org.mozilla.geckoview.GeckoSession": {
    },
}