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

Introduce a Gradle inspector #6782

Merged
merged 5 commits into from
Apr 4, 2023
Merged

Commits on Mar 31, 2023

  1. fix(PackageManager): Default to only enabled managers

    This is a fixup for 38db2a5.
    
    Signed-off-by: Sebastian Schuberth <[email protected]>
    sschuberth committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    bcd9f85 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2023

  1. feat(package-managers): Add beginnings of a Gradle inspector

    Start a novel approach based on a stand-alone Gradle plugin (written in
    Kotlin) to analyze Gradle projects. The goal is to address shortcomings of
    the current implementation:
    
    - The `init.gradle` script cannot be debugged (only `buildSrc` and
      stand-alone plugins can [1]).
    
    - The dynamically typed Groovy code is hard to maintain.
    
    - Analysis of modern Android apps throws exceptions due to ambiguous
      configuration / variant selection.
    
    - Binary artifacts are unnecessarily resolved.
    
    - Maven is used to resolve metadata about artifacts, imitating Gradle's
      resolution logic / repositories to query.
    
    At this stage the analysis only builds up the dependency tree to limit
    the complexity of this initial implementation. Parsing of package
    metadata will be added in follow-up changes.
    
    Also, the new `GradleInspector` plugin is disabled by default for now to
    not interfere with the existing `Gradle` plugin.
    
    Resolves #6158.
    
    [1]: https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic
    
    Signed-off-by: Sebastian Schuberth <[email protected]>
    sschuberth committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    9a9e665 View commit details
    Browse the repository at this point in the history
  2. feat(gradle-inspector): Parse package metadata from Maven POMs

    Explicitly resolve parent POMs to ensure they are available as XML files
    in the Gradle cache. Based on that, build the effective POMs for all
    dependencies in order to parse package metadata from them. As the POMs are
    retrieved from the Gradle cache, no download via Maven is involved.
    
    Note that the Maven-model-specific code is mostly based on code from
    `MavenSupport`, adjusted to work with slightly different classes.
    
    Signed-off-by: Sebastian Schuberth <[email protected]>
    sschuberth committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    65b2f91 View commit details
    Browse the repository at this point in the history
  3. feat(gradle-inspector): Create remote artifacts for packages

    Create remote artifacts based on the POM URLs. The hashes for the
    artifacts are retrieved from the respective accompanying text files,
    without downloading the artifact itself.
    
    Note that this approach will fail for private Maven repository even if
    Gradle is configured with the credentials, as this download happens
    directly via OkHttp.
    
    Signed-off-by: Sebastian Schuberth <[email protected]>
    sschuberth committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    60ff668 View commit details
    Browse the repository at this point in the history
  4. feat(OrtModelBuilder): Ignore Android dependencies metadata configura…

    …tions
    
    For these configurations often Gradle itself has resolution failures. As
    their sole purpose is to describe the dependencies that are compiled into
    an Android app, just ignore them as that is what ORT itself analyzes.
    
    Signed-off-by: Sebastian Schuberth <[email protected]>
    sschuberth committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    3448b81 View commit details
    Browse the repository at this point in the history