gnodet commented on code in PR #12694:
URL: https://github.com/apache/maven/pull/12694#discussion_r4079618800


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/AbstractUpgradeStrategy.java:
##########
@@ -424,55 +318,29 @@ protected Path findCommonRoot(Set<Path> pomPaths) {
         return commonRoot;
     }
 
-    /**
-     * Returns the effective model for the given POM path.
-     *
-     * <p>Consults {@link #effectiveModelCache} first (populated by the {@code 
BUILD_PROJECT}
-     * reactor pass in {@link #prebuildReactorModels}). If the path is not in 
the cache
-     * (e.g. an external parent that was not part of the reactor), falls back 
to a
-     * {@code BUILD_EFFECTIVE} call on {@link #sharedModelBuilderSession}, 
which still
-     * benefits from the {@code mappedSources} populated during the reactor 
build.</p>
-     *
-     * @param context the upgrade context (used for debug logging)
-     * @param pomPath the path to the POM file
-     * @return the effective model, never {@code null}
-     */
-    protected Model buildEffectiveModel(UpgradeContext context, Path pomPath) {
-        Path key = pomPath.toAbsolutePath().normalize();
-
-        // Fast path: reactor pre-build already has this model.
-        Map<Path, Model> cache = effectiveModelCache;
-        if (cache != null) {
-            Model cached = cache.get(key);
-            if (cached != null) {
-                context.debug("Effective model cache hit: " + pomPath);
-                return cached;
-            }
+    protected void cleanupTempDirectory(Path tempDir) {
+        try {
+            Files.walk(tempDir)

Review Comment:
   Resolved: the temporary directory approach was removed entirely in the 
squash commit `abd26c76a9` ("feat: logging foundation"). 
`PluginUpgradeStrategy` now builds effective models directly from the on-disk 
POMs — no temp copy, no `cleanupTempDirectory`, no `Files.walk` stream.



##########
impl/maven-core/src/test/java/org/apache/maven/project/MavenProjectGetArtifactsTest.java:
##########
@@ -1,87 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.project;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.LockSupport;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-
-class MavenProjectGetArtifactsTest {
-
-    @Test
-    void concurrentGetArtifactsDoesNotExposeAHalfBuiltSet() throws Exception {
-        MavenProject project = new MavenProject();
-        Set<Artifact> resolved = new LinkedHashSet<>();
-        for (int i = 0; i < 200; i++) {
-            resolved.add(new DefaultArtifact("g", "a" + i, "1", "compile", 
"jar", "", null));
-        }
-        project.setResolvedArtifacts(resolved);
-        project.setArtifactFilter(artifact -> {
-            LockSupport.parkNanos(TimeUnit.MICROSECONDS.toNanos(50));
-            return true;
-        });
-
-        int readers = 4;
-        ExecutorService pool = Executors.newFixedThreadPool(readers);
-        CountDownLatch start = new CountDownLatch(1);
-        List<Future<?>> futures = new ArrayList<>();
-        try {
-            for (int i = 0; i < readers; i++) {
-                futures.add(pool.submit(() -> {
-                    start.await();
-                    Set<Artifact> artifacts = project.getArtifacts();
-                    assertEquals(resolved.size(), artifacts.size());
-                    AtomicInteger seen = new AtomicInteger();
-                    artifacts.forEach(artifact -> seen.incrementAndGet());
-                    assertEquals(resolved.size(), seen.get());
-                    return null;
-                }));
-            }
-            start.countDown();
-            for (Future<?> future : futures) {
-                try {
-                    future.get(30, TimeUnit.SECONDS);
-                } catch (ExecutionException e) {
-                    throw e.getCause() instanceof Exception ? (Exception) 
e.getCause() : e;
-                }
-            }
-        } finally {
-            pool.shutdownNow();
-        }
-
-        assertFalse(project.getArtifacts().isEmpty());
-        assertEquals(resolved.size(), project.getArtifacts().size());
-    }
-}

Review Comment:
   Resolved: `MavenProjectGetArtifactsTest` is present in the current branch at 
`impl/maven-core/src/test/java/org/apache/maven/project/MavenProjectGetArtifactsTest.java`.
 It was restored in the squash commit `abd26c76a9`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to