Skip to content

Commit 0f82d96

Browse files
authored
Merge pull request #8204 from apache/delivery
Sync delivery to release250 for 25-rc2
2 parents 340da06 + 7593166 commit 0f82d96

File tree

7 files changed

+180
-94
lines changed

7 files changed

+180
-94
lines changed

extide/gradle/src/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@
5959
import org.netbeans.modules.gradle.ProjectTrust;
6060
import org.netbeans.modules.gradle.api.GradleProjects;
6161
import org.netbeans.modules.gradle.api.NbGradleProject;
62-
import org.netbeans.modules.gradle.api.NbGradleProject.LoadOptions;
6362
import org.netbeans.modules.gradle.api.NbGradleProject.Quality;
6463
import org.netbeans.modules.gradle.execute.EscapeProcessingOutputStream;
6564
import org.netbeans.modules.gradle.execute.GradlePlainEscapeProcessor;
65+
import org.netbeans.modules.gradle.options.GradleExperimentalSettings;
6666
import org.netbeans.modules.gradle.spi.GradleSettings;
67+
import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
6768
import org.openide.loaders.DataFolder;
6869
import org.openide.loaders.DataObject;
6970
import org.openide.util.Exceptions;
@@ -312,6 +313,8 @@ public String getMessage() {
312313
@Override
313314
public Set<FileObject> execute() {
314315
GradleConnector gconn = GradleConnector.newConnector();
316+
JavaRuntimeManager.JavaRuntime defaultRuntime = GradleExperimentalSettings.getDefault().getDefaultJavaRuntime();
317+
315318
target.mkdirs();
316319
InputOutput io = IOProvider.getDefault().getIO(projectName + " (init)", true);
317320
try (ProjectConnection pconn = gconn.forProjectDirectory(target).connect()) {
@@ -359,7 +362,8 @@ public Set<FileObject> execute() {
359362
OutputStream out = new EscapeProcessingOutputStream(new GradlePlainEscapeProcessor(io, false));
360363
OutputStream err = new EscapeProcessingOutputStream(new GradlePlainEscapeProcessor(io, false))
361364
) {
362-
BuildLauncher gradleInit = pconn.newBuild().forTasks(args.toArray(new String[0]));
365+
BuildLauncher gradleInit = pconn.newBuild().forTasks(args.toArray(String[]::new));
366+
gradleInit.setJavaHome(defaultRuntime.getJavaHome());
363367
if (GradleSettings.getDefault().isOffline()) {
364368
gradleInit = gradleInit.withArguments("--offline");
365369
}
@@ -370,7 +374,7 @@ public Set<FileObject> execute() {
370374
} catch (IOException iox) {
371375
}
372376
} catch (GradleConnectionException | IllegalStateException ex) {
373-
Exceptions.printStackTrace(ex);
377+
ex.printStackTrace(io.getErr());
374378
} finally {
375379
if (io.getOut() != null) io.getOut().close();
376380
if (io.getErr() != null) io.getErr().close();
@@ -444,6 +448,7 @@ public Set<FileObject> execute() {
444448
FileUtil.createFolder(dir);
445449
Thread.sleep(200);
446450
} catch (InterruptedException | IOException ex) {
451+
Exceptions.printStackTrace(ex);
447452
}
448453
return null;
449454
}
@@ -479,6 +484,7 @@ public final Set<FileObject> execute() {
479484
}
480485

481486
} catch (IOException ex) {
487+
Exceptions.printStackTrace(ex);
482488
}
483489
}
484490
return Set.of();
@@ -542,6 +548,7 @@ public Set<FileObject> execute() {
542548
return ret;
543549
}
544550
} catch (IOException | IllegalArgumentException ex) {
551+
Exceptions.printStackTrace(ex);
545552
}
546553
}
547554
return null;
@@ -568,21 +575,24 @@ public String getMessage() {
568575
@Override
569576
public Set<FileObject> execute() {
570577
GradleConnector gconn = GradleConnector.newConnector();
578+
JavaRuntimeManager.JavaRuntime defaultRuntime = GradleExperimentalSettings.getDefault().getDefaultJavaRuntime();
571579
try (ProjectConnection pconn = gconn.forProjectDirectory(projectDir).connect()) {
572580
List<String> args = new ArrayList<>();
573581
args.add("wrapper"); //NOI18N
574582
if (version != null) {
575583
args.add("--gradle-version"); //NOI18N
576584
args.add(version);
577585
}
586+
BuildLauncher init = pconn.newBuild()
587+
.setJavaHome(defaultRuntime.getJavaHome());
578588
if (GradleSettings.getDefault().isOffline()) {
579-
pconn.newBuild().withArguments("--offline").forTasks(args.toArray(new String[0])).run(); //NOI18N
580-
} else {
581-
pconn.newBuild().forTasks(args.toArray(new String[0])).run();
589+
init = init.withArguments("--offline");
582590
}
591+
init.forTasks(args.toArray(String[]::new)).run();
583592
} catch (GradleConnectionException | IllegalStateException ex) {
584593
// Well for some reason we were not able to load Gradle.
585594
// Ignoring that for now
595+
Exceptions.printStackTrace(ex);
586596
}
587597
gconn.disconnect();
588598
return null;
@@ -684,7 +694,7 @@ public Set<FileObject> execute() {
684694
DataObject newData = o.createFromTemplate(targetFolder, targetName, tokens);
685695
return important ? Set.of(newData.getPrimaryFile()) : null;
686696
} catch (IOException ex) {
687-
697+
Exceptions.printStackTrace(ex);
688698
}
689699
}
690700
return null;

java/java.graph/src/org/netbeans/modules/java/graph/FruchtermanReingoldLayout.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void rePerformLayout(int iters) {
137137
// System.out.println("scene bounds are =" + bounds);
138138
temp = bounds.getWidth() / 1000;
139139
// forceConstant = 0.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
140-
forceConstant = 0.25 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
140+
forceConstant = 1.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
141141
// System.out.println("force constant2=" + forceConstant);
142142
performLayout(false);
143143
}
@@ -150,7 +150,7 @@ private void init() {
150150
bounds = new Rectangle(magicSizeConstant + (magicSizeMultiplier * nds),
151151
magicSizeConstant + (magicSizeMultiplier * nds)); //g.getMaximumBounds();
152152
temp = bounds.getWidth() / 10;
153-
forceConstant = 0.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
153+
forceConstant = 1.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
154154

155155
GraphNode<I> rn = scene.getRootGraphNode();
156156
NodeWidget rw = getWidget(rn);
@@ -382,7 +382,8 @@ private void relayoutNonFixed(NodeWidget w) {
382382
r = 30;
383383
theta = 0;
384384
w.setFixed(false);
385-
while (true) {
385+
// 48 - ~3 times round?
386+
for (int i = 0; i < 48; i++) {
386387
AffineTransform tr = AffineTransform.getRotateInstance(theta);
387388
Point2D d2point = tr.transform(new Point2D.Double(0, r), null);
388389
Point point = new Point((int)d2point.getX() + masterPoint.x, (int)d2point.getY() + masterPoint.y);
@@ -396,10 +397,9 @@ private void relayoutNonFixed(NodeWidget w) {
396397
if (theta > (Math.PI * 2 - Math.PI / 10)) {
397398
r = r + 30;
398399
theta = theta - Math.PI * 2;
399-
thetaStep = thetaStep * 3 / 4;
400+
thetaStep = thetaStep * 3 / 4;
400401
}
401402
}
402-
403403
}
404404

405405
private NodeWidget getWidget(GraphNode n) {

java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexManager.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public final class NexusRepositoryIndexManager implements RepositoryIndexerImple
164164

165165
private final NexusRepositoryQueries queries;
166166

167-
static final int MAX_RESULT_COUNT = 1024;
167+
static final int MAX_RESULT_COUNT = 4096;
168168
static final int NO_CAP_RESULT_COUNT = AbstractSearchRequest.UNDEFINED;
169169

170170
@SuppressWarnings("this-escape")
@@ -400,17 +400,18 @@ boolean loadIndexingContext(final RepositoryInfo info) throws IOException {
400400
private void tryMoveRemoteIndexFromOldCache(RepositoryInfo info) {
401401

402402
String buildnumber = System.getProperty("netbeans.buildnumber");
403-
if (buildnumber == null) {
403+
if (buildnumber == null || buildnumber.isBlank() || !buildnumber.contains("-")) {
404404
return; // tests
405405
}
406+
// see org.netbeans.modules.janitor.Janitor for '.lastUsedVersion' format
406407
int ourVersion;
407408
try {
408409
String debugRelease = System.getProperty("maven.indexing.diag.release");
409410
ourVersion = debugRelease != null
410411
? Integer.parseInt(debugRelease)
411-
: Integer.parseInt(buildnumber.split("-")[0]);
412+
: Integer.parseInt(buildnumber.substring(0, buildnumber.lastIndexOf("-")));
412413
} catch (NumberFormatException ignore) {
413-
return;
414+
return; // rc or other dev build
414415
}
415416

416417
Path cacheParent = Places.getCacheDirectory().toPath().getParent();
@@ -443,7 +444,7 @@ record CacheFolder(Path path, int version) {}
443444
}
444445
}
445446
} catch (Exception ex) {
446-
LOGGER.log(Level.WARNING, "index import failed: {0}", ex.getMessage());
447+
LOGGER.log(Level.WARNING, "index import failed: {0}: {1}", new Object[] {ex.getClass().getName(), ex.getMessage()});
447448
}
448449
}
449450
}

java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryQueries.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ private ResultImplementation<NBVersionInfo> getVersions(String groupId, String a
248248
.add(new BooleanClause(setBooleanRewrite(new PrefixQuery(new Term(ArtifactInfo.UINFO, id))), BooleanClause.Occur.MUST))
249249
.build();
250250
iterate(repos, (RepositoryInfo repo, IndexingContext context) -> {
251-
IteratorSearchResponse response = repeatedPagedSearch(bq, context, NexusRepositoryIndexManager.MAX_RESULT_COUNT);
251+
// Some projects generated quite a lot of artifacts by now.
252+
// Since this query is sometimes used by code which wants to find the top x most recent artifacts,
253+
// we have to use a relatively high results limit - this doesn't seem to be a performance problem (other queries set no limit)
254+
IteratorSearchResponse response = repeatedPagedSearch(bq, context, 10_000);
252255
if (response != null) {
253256
try {
254257
for (ArtifactInfo ai : response) {

0 commit comments

Comments
 (0)