- changed 58 files
Implement Gradle metadata marker in published pom/ivy filesThis commit implements a performance optimization for Gradle metadata.Given that today there's no library published in any repository withGradle metadata, it's much more likely to find a POM (or Ivy) metadatafile for an external dependency, rather than a Gradle metadata file.If we decided to add `gradleMetadata()` sources by default to allrepositories, then we would probably introduce a performance regressionto a lot of builds, because we would first try to get Gradle metadata,then fail, and search for POM/Ivy files.To avoid this, whenever a library is going to be published with Gradlemetadata, we will introduce a _marker_ in the published POM or Ivyfile. When Gradle _resolves_ such a dependency, it will parse the POMfile and look for the marker. If it finds it, then it will _redirect_to use Gradle metadata instead. This means that when Gradle metadata ispresent, we will pay the price of looking for a POM or Ivy file first,start parsing, only to discover we should parse Gradle metadata. Thisshould be ok in the beginning, knowing that if `gradleMetadata()` isadded, then we would systematically look at Gradle metadata first.This means that this is a _temporary_ solution, until Gradle metadatabecomes widespread. So "temporary" should be understood as severalmonths, if not years.The marker introduced in POM and Ivy files is _neutral_ for both Ivyand Maven. By this we mean that it uses an XML comment. While not supernice, we couldn't use a custom namespace because both Ivy and Mavenfail when parsing this. Properties were considered too, but Ivy doesn'tsupport them so for consistency both models use comments.It's worth noting that we will still _completely parse_ the POM or Ivydescriptor. It's a waste of time, but it helps in case we find a markerbut that for some reason the Gradle metadata file is absent. In thiscase we fallback on the model we found.This change also introduces a change in the semantics of the incubatingmetadata sources API: those should be considered _hints_, and not strongstatements anymore.Finally, should a producer want to avoid publishing Gradle metadata,it's now possible to disable the task that creates the metadata file.