You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/12/07 08:02:00 UTC

[jira] [Commented] (MRESOLVER-300) Introduce new API as replacement for FileTransform API

    [ https://issues.apache.org/jira/browse/MRESOLVER-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17644202#comment-17644202 ] 

ASF GitHub Bot commented on MRESOLVER-300:
------------------------------------------

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?





> Introduce new API as replacement for FileTransform API
> ------------------------------------------------------
>
>                 Key: MRESOLVER-300
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-300
>             Project: Maven Resolver
>          Issue Type: New Feature
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Assignee: Tamas Cservenak
>            Priority: Major
>             Fix For: 1.9.3
>
>
> Introduce new API as replacement for deprecated FileTransform API.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)