You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/12/07 08:01:32 UTC

[GitHub] [maven-resolver] slawekjaranowski commented on a diff in pull request #226: [MRESOLVER-300] Alternate transform API

slawekjaranowski commented on code in PR #226:
URL: https://github.com/apache/maven-resolver/pull/226#discussion_r1041861295


##########
maven-resolver-api/src/main/java/org/eclipse/aether/transform/Identity.java:
##########
@@ -0,0 +1,87 @@
+package org.eclipse.aether.transform;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Identity {@link TransformedArtifact}, {@link ArtifactTransformer} and {@link ArtifactTransformerManager}.
+ *
+ * @since 1.9.3
+ */
+public final class Identity
+{
+    /**
+     * Identity {@link TransformedArtifact}.
+     */
+    public static final class IdentityTransformedArtifact extends TransformedArtifact
+    {
+        private final Artifact artifact;
+
+        public IdentityTransformedArtifact( Artifact artifact )
+        {
+            this.artifact = requireNonNull( artifact );
+        }

Review Comment:
   Must be public class and constructor?



##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDeployer.java:
##########
@@ -263,42 +270,73 @@ private DeployResult deploy( SyncContext syncContext, RepositorySystemSession se
                 processedMetadata.put( metadata, null );
             }
 
-            for ( ListIterator<Artifact> iterator = artifacts.listIterator(); iterator.hasNext(); )
+            MultiProcessor<TransformedArtifact> multiProcessor = new MultiProcessor<>( TransformedArtifact::close );
+            try
             {
-                Artifact artifact = iterator.next();
-
-                for ( MetadataGenerator generator : generators )
+                for ( ListIterator<Artifact> iterator = artifacts.listIterator(); iterator.hasNext(); )
                 {
-                    artifact = generator.transformArtifact( artifact );
-                }
-
-                iterator.set( artifact );
+                    Artifact artifact = iterator.next();
 
-                Collection<FileTransformer> fileTransformers =
-                        fileTransformerManager.getTransformersForArtifact( artifact );
-                if ( !fileTransformers.isEmpty() )
-                {
-                    for ( FileTransformer fileTransformer : fileTransformers )
+                    for ( MetadataGenerator generator : generators )
                     {
-                        Artifact targetArtifact = fileTransformer.transformArtifact( artifact );
+                        artifact = generator.transformArtifact( artifact );
+                    }
 
-                        ArtifactUpload upload = new ArtifactUpload( targetArtifact, artifact.getFile(),
-                                fileTransformer );
-                        upload.setTrace( trace );
-                        upload.setListener( new ArtifactUploadListener( catapult, upload ) );
-                        artifactUploads.add( upload );
+                    iterator.set( artifact );
+
+                    Collection<FileTransformer> fileTransformers =
+                            fileTransformerManager.getTransformersForArtifact( artifact );
+                    if ( !fileTransformers.isEmpty() )

Review Comment:
   New artifactTransformer will be only processed when fileTransformers are empty - do I good see?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org