Skip to content

Commit

Permalink
Merge pull request #8205 from apache/delivery
Browse files Browse the repository at this point in the history
Sync delivery to master after 25-rc2
  • Loading branch information
ebarboni authored Feb 7, 2025
2 parents 94f6cb8 + 7593166 commit 9896b32
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@
import org.netbeans.modules.gradle.ProjectTrust;
import org.netbeans.modules.gradle.api.GradleProjects;
import org.netbeans.modules.gradle.api.NbGradleProject;
import org.netbeans.modules.gradle.api.NbGradleProject.LoadOptions;
import org.netbeans.modules.gradle.api.NbGradleProject.Quality;
import org.netbeans.modules.gradle.execute.EscapeProcessingOutputStream;
import org.netbeans.modules.gradle.execute.GradlePlainEscapeProcessor;
import org.netbeans.modules.gradle.options.GradleExperimentalSettings;
import org.netbeans.modules.gradle.spi.GradleSettings;
import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.util.Exceptions;
Expand Down Expand Up @@ -312,6 +313,8 @@ public String getMessage() {
@Override
public Set<FileObject> execute() {
GradleConnector gconn = GradleConnector.newConnector();
JavaRuntimeManager.JavaRuntime defaultRuntime = GradleExperimentalSettings.getDefault().getDefaultJavaRuntime();

target.mkdirs();
InputOutput io = IOProvider.getDefault().getIO(projectName + " (init)", true);
try (ProjectConnection pconn = gconn.forProjectDirectory(target).connect()) {
Expand Down Expand Up @@ -359,7 +362,8 @@ public Set<FileObject> execute() {
OutputStream out = new EscapeProcessingOutputStream(new GradlePlainEscapeProcessor(io, false));
OutputStream err = new EscapeProcessingOutputStream(new GradlePlainEscapeProcessor(io, false))
) {
BuildLauncher gradleInit = pconn.newBuild().forTasks(args.toArray(new String[0]));
BuildLauncher gradleInit = pconn.newBuild().forTasks(args.toArray(String[]::new));
gradleInit.setJavaHome(defaultRuntime.getJavaHome());
if (GradleSettings.getDefault().isOffline()) {
gradleInit = gradleInit.withArguments("--offline");
}
Expand All @@ -370,7 +374,7 @@ public Set<FileObject> execute() {
} catch (IOException iox) {
}
} catch (GradleConnectionException | IllegalStateException ex) {
Exceptions.printStackTrace(ex);
ex.printStackTrace(io.getErr());
} finally {
if (io.getOut() != null) io.getOut().close();
if (io.getErr() != null) io.getErr().close();
Expand Down Expand Up @@ -444,6 +448,7 @@ public Set<FileObject> execute() {
FileUtil.createFolder(dir);
Thread.sleep(200);
} catch (InterruptedException | IOException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
Expand Down Expand Up @@ -479,6 +484,7 @@ public final Set<FileObject> execute() {
}

} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
return Set.of();
Expand Down Expand Up @@ -542,6 +548,7 @@ public Set<FileObject> execute() {
return ret;
}
} catch (IOException | IllegalArgumentException ex) {
Exceptions.printStackTrace(ex);
}
}
return null;
Expand All @@ -568,21 +575,24 @@ public String getMessage() {
@Override
public Set<FileObject> execute() {
GradleConnector gconn = GradleConnector.newConnector();
JavaRuntimeManager.JavaRuntime defaultRuntime = GradleExperimentalSettings.getDefault().getDefaultJavaRuntime();
try (ProjectConnection pconn = gconn.forProjectDirectory(projectDir).connect()) {
List<String> args = new ArrayList<>();
args.add("wrapper"); //NOI18N
if (version != null) {
args.add("--gradle-version"); //NOI18N
args.add(version);
}
BuildLauncher init = pconn.newBuild()
.setJavaHome(defaultRuntime.getJavaHome());
if (GradleSettings.getDefault().isOffline()) {
pconn.newBuild().withArguments("--offline").forTasks(args.toArray(new String[0])).run(); //NOI18N
} else {
pconn.newBuild().forTasks(args.toArray(new String[0])).run();
init = init.withArguments("--offline");
}
init.forTasks(args.toArray(String[]::new)).run();
} catch (GradleConnectionException | IllegalStateException ex) {
// Well for some reason we were not able to load Gradle.
// Ignoring that for now
Exceptions.printStackTrace(ex);
}
gconn.disconnect();
return null;
Expand Down Expand Up @@ -684,7 +694,7 @@ public Set<FileObject> execute() {
DataObject newData = o.createFromTemplate(targetFolder, targetName, tokens);
return important ? Set.of(newData.getPrimaryFile()) : null;
} catch (IOException ex) {

Exceptions.printStackTrace(ex);
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void rePerformLayout(int iters) {
// System.out.println("scene bounds are =" + bounds);
temp = bounds.getWidth() / 1000;
// forceConstant = 0.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
forceConstant = 0.25 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
forceConstant = 1.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
// System.out.println("force constant2=" + forceConstant);
performLayout(false);
}
Expand All @@ -150,7 +150,7 @@ private void init() {
bounds = new Rectangle(magicSizeConstant + (magicSizeMultiplier * nds),
magicSizeConstant + (magicSizeMultiplier * nds)); //g.getMaximumBounds();
temp = bounds.getWidth() / 10;
forceConstant = 0.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
forceConstant = 1.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);

GraphNode<I> rn = scene.getRootGraphNode();
NodeWidget rw = getWidget(rn);
Expand Down Expand Up @@ -382,7 +382,8 @@ private void relayoutNonFixed(NodeWidget w) {
r = 30;
theta = 0;
w.setFixed(false);
while (true) {
// 48 - ~3 times round?
for (int i = 0; i < 48; i++) {
AffineTransform tr = AffineTransform.getRotateInstance(theta);
Point2D d2point = tr.transform(new Point2D.Double(0, r), null);
Point point = new Point((int)d2point.getX() + masterPoint.x, (int)d2point.getY() + masterPoint.y);
Expand All @@ -396,10 +397,9 @@ private void relayoutNonFixed(NodeWidget w) {
if (theta > (Math.PI * 2 - Math.PI / 10)) {
r = r + 30;
theta = theta - Math.PI * 2;
thetaStep = thetaStep * 3 / 4;
thetaStep = thetaStep * 3 / 4;
}
}

}

private NodeWidget getWidget(GraphNode n) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public final class NexusRepositoryIndexManager implements RepositoryIndexerImple

private final NexusRepositoryQueries queries;

static final int MAX_RESULT_COUNT = 1024;
static final int MAX_RESULT_COUNT = 4096;
static final int NO_CAP_RESULT_COUNT = AbstractSearchRequest.UNDEFINED;

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

String buildnumber = System.getProperty("netbeans.buildnumber");
if (buildnumber == null) {
if (buildnumber == null || buildnumber.isBlank() || !buildnumber.contains("-")) {
return; // tests
}
// see org.netbeans.modules.janitor.Janitor for '.lastUsedVersion' format
int ourVersion;
try {
String debugRelease = System.getProperty("maven.indexing.diag.release");
ourVersion = debugRelease != null
? Integer.parseInt(debugRelease)
: Integer.parseInt(buildnumber.split("-")[0]);
: Integer.parseInt(buildnumber.substring(0, buildnumber.lastIndexOf("-")));
} catch (NumberFormatException ignore) {
return;
return; // rc or other dev build
}

Path cacheParent = Places.getCacheDirectory().toPath().getParent();
Expand Down Expand Up @@ -443,7 +444,7 @@ record CacheFolder(Path path, int version) {}
}
}
} catch (Exception ex) {
LOGGER.log(Level.WARNING, "index import failed: {0}", ex.getMessage());
LOGGER.log(Level.WARNING, "index import failed: {0}: {1}", new Object[] {ex.getClass().getName(), ex.getMessage()});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ private ResultImplementation<NBVersionInfo> getVersions(String groupId, String a
.add(new BooleanClause(setBooleanRewrite(new PrefixQuery(new Term(ArtifactInfo.UINFO, id))), BooleanClause.Occur.MUST))
.build();
iterate(repos, (RepositoryInfo repo, IndexingContext context) -> {
IteratorSearchResponse response = repeatedPagedSearch(bq, context, NexusRepositoryIndexManager.MAX_RESULT_COUNT);
// Some projects generated quite a lot of artifacts by now.
// Since this query is sometimes used by code which wants to find the top x most recent artifacts,
// we have to use a relatively high results limit - this doesn't seem to be a performance problem (other queries set no limit)
IteratorSearchResponse response = repeatedPagedSearch(bq, context, 10_000);
if (response != null) {
try {
for (ArtifactInfo ai : response) {
Expand Down
Loading

0 comments on commit 9896b32

Please sign in to comment.