1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
Description: Backport DependencyConstraint (needed for kotlin)
Author: Samyak Jain <samyak.jn11@gmail.com>
---
Origin: https://github.com/gradle/gradle/blob/master/subprojects/core-api/src/main/java/org/gradle/api/artifacts/DependencyConstraint.java
--- /dev/null
+++ gradle-4.4.1/subprojects/core-api/src/main/java/org/gradle/api/artifacts/DependencyConstraint.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.gradle.api.artifacts;
+
+import org.gradle.api.Action;
+import org.gradle.api.attributes.AttributeContainer;
+import org.gradle.api.attributes.HasConfigurableAttributes;
+
+import javax.annotation.Nullable;
+
+/**
+ * Represents a constraints over all, including transitive, dependencies.
+ *
+ * @since 4.5
+ */
+public interface DependencyConstraint extends ModuleVersionSelector, HasConfigurableAttributes<DependencyConstraint> {
+
+ /**
+ * Configures the version constraint for this dependency constraint.
+ *
+ * @param configureAction the configuration action for the module version
+ */
+ void version(Action<? super MutableVersionConstraint> configureAction);
+
+ /**
+ * Returns a reason why this dependency constraint should be used, in particular with regards to its version. The dependency report will use it to explain why a specific dependency was selected, or why a
+ * specific dependency version was used.
+ *
+ * @return a reason to use this dependency constraint
+ * @since 4.6
+ */
+ @Nullable
+ String getReason();
+
+ /**
+ * Sets the reason why this dependency constraint should be used.
+ *
+ * @since 4.6
+ */
+ void because(@Nullable String reason);
+
+ /**
+ * Returns the attributes for this constraint. Mutation of the attributes of a constraint must be done through
+ * the {@link #attributes(Action)} method.
+ *
+ * @return the attributes container for this dependency
+ *
+ * @since 4.8
+ */
+ @Override
+ AttributeContainer getAttributes();
+
+ /**
+ * Mutates the attributes of this constraint. Attributes are used during dependency resolution to select the appropriate
+ * target variant, in particular when a single component provides different variants.
+ *
+ * @param configureAction the attributes mutation action
+ *
+ * @since 4.8
+ */
+ @Override
+ DependencyConstraint attributes(Action<? super AttributeContainer> configureAction);
+
+ /**
+ * Returns the version constraint to be used during selection.
+ * @return the version constraint
+ */
+ VersionConstraint getVersionConstraint();
+}
|