ProjectDependencyDescriptorFactoryTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Force AbstractTestDirectoryProvider to use Class (#12431)

Closes https://github.com/gradle/gradle-private/issues/2988

This PR adds `className` to `AbstractTestDirectoryProvider` so there'll be no more `unknown-test-class`.

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 407 more files in changeset.
Fix tests

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 372 more files in changeset.
Further invalid dependency declaration

* Prevent combining artifact and target configuration declaration

Fixes #10532

    • -3
    • +21
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 4 more files in changeset.
Further invalid dependency declaration

* Prevent combining artifact and target configuration declaration

Fixes #10532

    • -3
    • +21
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 5 more files in changeset.
Further invalid dependency declaration

* Prevent combining artifact and target configuration declaration

Fixes #10532

    • -3
    • +21
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 5 more files in changeset.
Further invalid dependency declaration

* Prevent combining artifact and target configuration declaration

Fixes #10532

    • -3
    • +21
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 4 more files in changeset.
Support requested capabilities on external dependencies

This commit adds support for having requested capabilities

part of the module component selector, for external dependencies.

This means that if a component is using Gradle metadata, we can

read requested capabilities and honor them during selection.

This reworks where requested capabilities are stored, and in

particular moves them to the `ComponentSelector`, making them

properly part of the identity of a dependency. As such, two

dependencies requiring two different variants by using distinct

capabilities will now properly appear as two different dependencies

in the dependency graph, instead of two variants of the same

dependency.

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 63 more files in changeset.
Checkstyle fix

The license header has one end-line semicolon that can't be removed

when converting Java -> Groovy...

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 2 more files in changeset.
JMock -> Spock

    • -31
    • +23
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 4 more files in changeset.
Add support for dependency attributes on project dependencies

There was an inconsistency with dependency attributes, that could be used to

select an external dependency, but not a project dependency. This commit aligns

what is possible for both.

    • -1
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 15 more files in changeset.
Change `ProjectComponentIdentifier` and `ProjectComponentSelector` implementations to carry enough information to report the correct display name and project name. Change more places to delegate to the `BuildState` for a particular build to determine these values for a given project, rather than duplicating the logic to calculate these things.

    • -1
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 43 more files in changeset.
Use the `BuildIdentifier` that was assigned to a build when it was registered to refer to that build is most places.

- The build identifier was previously being unpacked to a name string in a few places and recreated from this, potentially losing some context and making too many assumptions about the uniqueness of the name.

- The project dependencies in `LocalComponentMetadata` are no longer transformed to map the build identifier to a "foreign" build identifier. The original build identifier is used instead.

- A "foreign" build identifier is still included in the `LocalComponentMetadata` to make the `isCurrentBuild()` work correctly in the resolution result. This method should go away at some point or at least the "foreign" build identifier should move closer to the result implementation rather than living in the metadata.

    • -2
    • +6
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 22 more files in changeset.
Ensure that LocalComponentDependencyMetadata retains a reference to it's owner ID

In order to remove the `fromComponent` parameter from `DependencyMetadata.selectConfigurations()`

each dependency instance must have the context of the component that it is sourced from.

This change ensures that locally defined dependencies always have the context of the

creating component.

    • -1
    • +4
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 20 more files in changeset.
Remove unit test uses of DependencyMetadata.requested

    • -3
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 14 more files in changeset.
Rename `DefaultVersionConstraint` to `DefaultMutableVersionConstraint`

... and use the immutable version whenever possible.

    • -2
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 63 more files in changeset.
Make `ModuleComponentSelector` the source of truth for version constraints

This commit pushes `VersionConstraint` as a primary concept in `ModuleComponentSelector`. It replaces the (now)

deprecated `getVersion` call, which didn't reflect all possible constraints on a version. This change has several

consequences:

- version constraints now need to be "serializable"

- version constraints now consist of a preferred version and a list of rejected versions

- only a single item in the rejection list is supported

- Gradle module metadata parsing now generates a prefer/reject list

- Gradle module metadata writing does **not** yet support writing prefer/reject

- the module metadata binary format has been bumped to support prefer/reject in module descriptors

- metadata rules can say `useTarget(VersionConstraint)`

Issue #3312

    • -1
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 93 more files in changeset.
Detangle module exclusions from dependency metadata

This commit detangles the module exlusions, needed by the dependency graph visitor, from the

dependency metadata. We now keep exclusions in their original form (`Exclude`) instead of

having two representations of the same thing for different purposes. This allows us to push

the `ModuleExclusions` service down to build scope, which avoids memory leaks.

This also simplifies the code, and delegates the responsibility of caching the result of

exclusions to the module exclusions service.

    • -4
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 23 more files in changeset.
Turn `ModuleExclusions` into a build scoped service

    • -1
    • +4
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 53 more files in changeset.
Fix failing tests by passing the `Configuration` context to the dependency set

This commit fixes the "non fluid" dependencies use case by introducing a way to pass the consumer context

to the dependency resolution engine when constructing task dependencies. This is done by adding the

`Configuration` instance to `DefaultDependencySet`, and by adding a method to `ProjectDependencyInternal`

so that we can use the attributes to choose the appropriate configuration.

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 15 more files in changeset.
Remove `setDependentConfiguration`

This commit removes the `setDependentConfiguration` in favor of passing context, because a `Dependency` can be used

in various configurations, so there's no unique dependent configuration.

It's work in progress and it breaks the test suite, especially for the "non fluid" dependencies case.

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 23 more files in changeset.
Remove deprecated methods on TestUtil (#672)

In order to use project builder correctly without having

leaking files on windows it is necessary to initialize

the test fixture for NativeServices and clean up

the test directory after building.

AbstractProjectBuilderSpec provides a nice base class

for Groovy tests.

I removed the deprecated methods since using them leads

to files lying around. Migrating all the usages to the "new"

way ensures it is used correctly.

    • -1
    • +7
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 97 more files in changeset.
Rename `o.g.i.c.model.*{MetaData => Metadata}`

    • -2
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 162 more files in changeset.
Changed unit tests to use Project or ProjectInternal instead of the implementation classes.

    • -2
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 32 more files in changeset.
Reuse mockery from parent class

    • -2
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 2 more files in changeset.
Don’t create an Ivy ModuleDescriptor for resolved local projects!

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 26 more files in changeset.
DependencyMetaData wraps methods on Ivy DependencyDescriptor in most cases

- We no longer use any DependencyDescriptor methods internally, except in a few

remaining unit tests

- DependencyMetaData.getDescriptor() is still exposed in order to construct an

Ivy ModuleDescriptor for publishing

    • -6
    • +5
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 11 more files in changeset.
Added back check for StartParameter.isBuildDependencies() in ProjectDependency.resolve()

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 5 more files in changeset.
Merge pull request 'Configuration re-resolution, take 3/2' (#429) into dependency-substitution

    • -1
    • +1
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 3 more files in changeset.
Use StartParameter.buildProjectDependencies directly instead of via DefaultProjectDependency field

* Previously, when ‘—no-build’ was on, we could avoid having to even

evaluate a project dependency’s project. Now it’s not possible, as we

need the project to be evaluated in order to run substitution rules.

* Still, the test was showing a real problem: we were still running the

tasks of the dependent project even with ‘--no-build’ turned on,

because we simply ignored

DefaultProjectDependency.buildProjectDependencies.

The fix includes updating the test, so that we don’t expect the

dependency project not to be evaluated anymore.

It also became possible to remove

DefaultProjectDependency.buildProjectDependencies, and instead pass

StartParameter.buildProjectDependencies directly to

DefaultDependencyResolver.

This way we can simply not collect any project dependency information

during dependency resolution, and thus

DefaultConfiguration.resolveNow() won’t add any task dependencies.

    • -2
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 8 more files in changeset.
Implement Configuration.whenEmpty()

Adding the ability to specify default dependencies in a more structured

manner than using ResolvableDependencies.beforeResolve()

    • -1
    • +2
    ./ProjectDependencyDescriptorFactoryTest.groovy
  1. … 4 more files in changeset.