aboutsummaryrefslogtreecommitdiff
path: root/src/gradlecomp/java
diff options
context:
space:
mode:
authorGabriel Harris-Rouquette <gabizou@me.com>2021-01-17 16:49:22 -0800
committerLexManos <LexManos@gmail.com>2021-01-17 17:28:00 -0800
commit631cd05e726092c51e95b52bb8a8bb6a2ae2cc42 (patch)
tree7508b126e2287f78a4d8f59c80c200f7c2d52646 /src/gradlecomp/java
parent5725530e7e8b379d506ca737e9ddd0f00c7f1e32 (diff)
downloadArtifactural-631cd05e726092c51e95b52bb8a8bb6a2ae2cc42.tar.gz
Artifactural-631cd05e726092c51e95b52bb8a8bb6a2ae2cc42.tar.bz2
Artifactural-631cd05e726092c51e95b52bb8a8bb6a2ae2cc42.zip
Bump project to Gradle 6.8
Diffstat (limited to 'src/gradlecomp/java')
-rw-r--r--src/gradlecomp/java/com/amadornes/artifactural/gradle/Gradle410RepositoryAdapter.java42
-rw-r--r--src/gradlecomp/java/com/amadornes/artifactural/gradle/GradleRepositoryAdapter.java52
-rw-r--r--src/gradlecomp/java/com/amadornes/artifactural/gradle/ReflectionUtils.java2
3 files changed, 20 insertions, 76 deletions
diff --git a/src/gradlecomp/java/com/amadornes/artifactural/gradle/Gradle410RepositoryAdapter.java b/src/gradlecomp/java/com/amadornes/artifactural/gradle/Gradle410RepositoryAdapter.java
deleted file mode 100644
index ceaf989..0000000
--- a/src/gradlecomp/java/com/amadornes/artifactural/gradle/Gradle410RepositoryAdapter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Artifactural
- * Copyright (c) 2018.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation version 2.1
- * of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package com.amadornes.artifactural.gradle;
-
-import com.amadornes.artifactural.api.repository.Repository;
-import org.gradle.api.internal.artifacts.repositories.DefaultMavenLocalArtifactRepository;
-import org.gradle.api.internal.artifacts.repositories.descriptor.FlatDirRepositoryDescriptor;
-import org.gradle.api.internal.artifacts.repositories.descriptor.RepositoryDescriptor;
-import org.gradle.api.model.ObjectFactory;
-
-import java.util.ArrayList;
-
-public class Gradle410RepositoryAdapter extends GradleRepositoryAdapter {
-
- Gradle410RepositoryAdapter(ObjectFactory objectFactory, Repository repository, DefaultMavenLocalArtifactRepository local) {
- super(objectFactory, repository, local);
- }
-
-
- @Override
- public RepositoryDescriptor getDescriptor() {
- return new FlatDirRepositoryDescriptor("ArtifacturalRepository", new ArrayList<>());
- }
-
-}
diff --git a/src/gradlecomp/java/com/amadornes/artifactural/gradle/GradleRepositoryAdapter.java b/src/gradlecomp/java/com/amadornes/artifactural/gradle/GradleRepositoryAdapter.java
index 669ad4c..51def33 100644
--- a/src/gradlecomp/java/com/amadornes/artifactural/gradle/GradleRepositoryAdapter.java
+++ b/src/gradlecomp/java/com/amadornes/artifactural/gradle/GradleRepositoryAdapter.java
@@ -31,6 +31,7 @@ import org.gradle.api.artifacts.component.ComponentArtifactIdentifier;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.artifacts.dsl.RepositoryHandler;
import org.gradle.api.internal.artifacts.BaseRepositoryFactory;
+import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers;
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ConfiguredModuleComponentRepository;
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleComponentRepositoryAccess;
import org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact;
@@ -52,9 +53,11 @@ import org.gradle.internal.component.external.model.MutableModuleComponentResolv
import org.gradle.internal.component.model.ComponentArtifactMetadata;
import org.gradle.internal.component.model.ComponentOverrideMetadata;
import org.gradle.internal.component.model.ComponentResolveMetadata;
-import org.gradle.internal.component.model.ModuleSource;
+import org.gradle.internal.component.model.ConfigurationMetadata;
+import org.gradle.internal.component.model.ModuleSources;
import org.gradle.internal.nativeintegration.filesystem.FileSystem;
import org.gradle.internal.nativeintegration.services.FileSystems;
+import org.gradle.internal.reflect.Instantiator;
import org.gradle.internal.resolve.result.BuildableArtifactResolveResult;
import org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult;
import org.gradle.internal.resolve.result.BuildableComponentArtifactsResolveResult;
@@ -68,7 +71,6 @@ import org.gradle.internal.resource.local.LocalFileStandInExternalResource;
import org.gradle.internal.resource.local.LocallyAvailableExternalResource;
import org.gradle.internal.resource.metadata.ExternalResourceMetaData;
import org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor;
-import org.gradle.util.GradleVersion;
import java.io.File;
import java.io.IOException;
@@ -92,16 +94,7 @@ public class GradleRepositoryAdapter extends AbstractArtifactRepository implemen
GradleRepositoryAdapter repo;
- // On Gradle 4.10 above, we need to use the constructor with the 'ObjectFactory' parameter
- // (which can be safely passed as null - see BaseMavenInstaller).
- // We use Gradle410RepositoryAdapter, which actually overrides 'getDescriptor'
- if (GradleVersion.current().compareTo(GradleVersion.version("4.10")) >= 0) {
- repo = new Gradle410RepositoryAdapter(null, repository, maven);
- } else {
- // On versions of gradle older than 4.10, we use the no-arg super constructor
- repo = new GradleRepositoryAdapter(repository, maven);
- }
-
+ repo = new GradleRepositoryAdapter(repository, maven);
repo.setName(name);
handler.add(repo);
return repo;
@@ -171,6 +164,13 @@ public class GradleRepositoryAdapter extends AbstractArtifactRepository implemen
@Override public boolean isDynamicResolveMode() { return resolver.isDynamicResolveMode(); }
@Override public boolean isLocal() { return resolver.isLocal(); }
+ @Override
+ public void setComponentResolvers(ComponentResolvers resolver) { }
+ @Override
+ public Instantiator getComponentMetadataInstantiator() {
+ return resolver.getComponentMetadataInstantiator();
+ }
+
private ModuleComponentRepositoryAccess wrap(ModuleComponentRepositoryAccess delegate) {
return new ModuleComponentRepositoryAccess() {
@Override
@@ -188,13 +188,13 @@ public class GradleRepositoryAdapter extends AbstractArtifactRepository implemen
}
@Override
- public void listModuleVersions(ModuleDependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) {
- delegate.listModuleVersions(dependency, result);
+ public void resolveArtifacts(ComponentResolveMetadata component, ConfigurationMetadata variant, BuildableComponentArtifactsResolveResult result) {
+ delegate.resolveArtifacts(component, variant, result);
}
@Override
- public void resolveArtifacts(ComponentResolveMetadata component, BuildableComponentArtifactsResolveResult result) {
- delegate.resolveArtifacts(component, result);
+ public void listModuleVersions(ModuleDependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) {
+ delegate.listModuleVersions(dependency, result);
}
@Override
@@ -203,10 +203,11 @@ public class GradleRepositoryAdapter extends AbstractArtifactRepository implemen
}
@Override
- public void resolveArtifact(ComponentArtifactMetadata artifact, ModuleSource moduleSource, BuildableArtifactResolveResult result) {
- delegate.resolveArtifact(artifact, moduleSource, result);
+ public void resolveArtifact(ComponentArtifactMetadata artifact, ModuleSources moduleSources, BuildableArtifactResolveResult result) {
+ delegate.resolveArtifact(artifact, moduleSources, result);
}
+
@Override
public MetadataFetchingCost estimateMetadataFetchingCost(ModuleComponentIdentifier moduleComponentIdentifier) {
return delegate.estimateMetadataFetchingCost(moduleComponentIdentifier);
@@ -216,21 +217,8 @@ public class GradleRepositoryAdapter extends AbstractArtifactRepository implemen
};
}
- // This method will be deleted entirely in build.gradle
- // In order for this class to compile, this method needs to exist
- // at compile-time. However, the class 'RepositoryDescriptor' doesn't
- // exist in Gradle 4.9. If we try to classload a class
- // that contains RepositoryDescriptor as a method return type,
- // the JVM will try to classload RepositoryDescriptor, leading
- // to a NoClassDefFoundError
-
- // To fix this, we strip out this method at build time.
- // At runtime, we instantiate Gradle410RepositoryAdapter
- // when we're running on Gradle 4.10 on above.
- // This ensures that 'getDescriptor' exists on Gradle 4.10,
- // and doesn't existon Gradle 4.9
public RepositoryDescriptor getDescriptor() {
- throw new Error("This method should be been stripped at build time!");
+ return new FlatDirRepositoryDescriptor("ArtifacturalRepository", new ArrayList<>());
}
diff --git a/src/gradlecomp/java/com/amadornes/artifactural/gradle/ReflectionUtils.java b/src/gradlecomp/java/com/amadornes/artifactural/gradle/ReflectionUtils.java
index 9ee484c..1bef580 100644
--- a/src/gradlecomp/java/com/amadornes/artifactural/gradle/ReflectionUtils.java
+++ b/src/gradlecomp/java/com/amadornes/artifactural/gradle/ReflectionUtils.java
@@ -21,8 +21,6 @@ package com.amadornes.artifactural.gradle;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.function.Function;
import java.util.function.UnaryOperator;
public class ReflectionUtils {