diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2fcb4401..8fa9040f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,12 +23,12 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: - distribution: 'adopt' - java-version: '11' + distribution: 'temurin' + java-version: '17' - name: Setup Gradle uses: gradle/gradle-build-action@v2 with: - gradle-version: 7.4.1 + gradle-version: 7.6 - name: Setup NodeJS uses: actions/setup-node@v3 with: diff --git a/build.gradle b/build.gradle index 1a51f9a6..d697d1b2 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ import java.net.http.HttpResponse import java.nio.file.Paths plugins { - id "org.jetbrains.intellij" version "1.13.2" + id "org.jetbrains.intellij" version "1.14.2" id "java" id "maven-publish" id "de.undercouch.download" version "5.3.0" @@ -13,15 +13,15 @@ plugins { group 'com.jfrog.ide' version currentVersion -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 def testPython = project.gradle.startParameter.taskNames.contains("pythonTests") def intellijType = testPython ? "IC" : "IU" intellij { version = sandboxVersion type = intellijType - plugins = ['gradle', 'maven', 'Groovy', 'properties', 'java', 'Kotlin', 'org.jetbrains.plugins.go:221.5080.210', "PythonCore:221.5080.216"] + plugins = ['gradle', 'maven', 'Groovy', 'properties', 'java', 'Kotlin', 'org.jetbrains.plugins.go:223.8617.56', "PythonCore:223.8617.56"] pluginName = 'JFrog' updateSinceUntilBuild = false } @@ -47,18 +47,18 @@ repositories { def buildInfoVersion = '2.41.1' dependencies { - implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.14.0' + implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.2' implementation group: 'org.jfrog.buildinfo', name: 'build-info-extractor', version: buildInfoVersion implementation group: 'org.jfrog.buildinfo', name: 'build-info-client', version: buildInfoVersion - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.0' + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2' implementation group: 'org.jfrog.buildinfo', name: 'build-info-api', version: buildInfoVersion implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.11.4' implementation group: 'com.jfrog.xray.client', name: 'xray-client-java', version: '0.14.1' implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4' implementation group: 'org.jfrog.filespecs', name: 'file-specs-java', version: '1.1.2' - implementation group: 'com.jfrog.ide', name: 'ide-plugins-common', version: '2.2.0' + implementation group: 'com.jfrog.ide', name: 'ide-plugins-common', version: '2.2.x-20230709.145459-1' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.11' - implementation group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' + implementation group: 'com.google.guava', name: 'guava', version: '32.0.1-jre' testImplementation group: 'org.mockito', name: 'mockito-inline', version: '4.2.0' testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.2.0' } diff --git a/gradle.properties b/gradle.properties index 4fc4bf2c..b726326c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ webviewVersion=0.2.1 -sandboxVersion=2022.1 +sandboxVersion=2022.3.2 webviewChecksum=5dc4bd0d2e2b5dd8eeadf713fc10ac2b1bac6acf11b34861b74d25c7e0800c51 currentVersion=2.2.x-SNAPSHOT diff --git a/release/pipelines.release.yml b/release/pipelines.release.yml index 7a6346ec..c109e4b6 100644 --- a/release/pipelines.release.yml +++ b/release/pipelines.release.yml @@ -4,9 +4,10 @@ pipelines: runtime: type: image image: - custom: - name: releases-docker.jfrog.io/jfrog-ecosystem-integration-env - tag: 1.10.1 + auto: + language: java + versions: + - "17" environmentVariables: readOnly: NEXT_VERSION: 0.0.0 diff --git a/release/pipelines.snapshot.yml b/release/pipelines.snapshot.yml index b0061f9f..b2be80e0 100644 --- a/release/pipelines.snapshot.yml +++ b/release/pipelines.snapshot.yml @@ -4,9 +4,10 @@ pipelines: runtime: type: image image: - custom: - name: releases-docker.jfrog.io/jfrog-ecosystem-integration-env - tag: 1.10.1 + auto: + language: java + versions: + - "17" steps: - name: Snapshot diff --git a/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java b/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java index 280a76c5..fdb9275e 100644 --- a/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java +++ b/src/main/java/com/jfrog/ide/idea/scan/ScannerBase.java @@ -163,7 +163,7 @@ private void scanAndUpdate(ProgressIndicator indicator) { scanInterrupted.set(true); } catch (Exception e) { scanInterrupted.set(true); - logError(log, "Xray Scan failed", e, true); + logError(log, "Xray scan failed", e, true); } } diff --git a/src/main/java/com/jfrog/ide/idea/scan/SourceCodeScannerManager.java b/src/main/java/com/jfrog/ide/idea/scan/SourceCodeScannerManager.java index 07dc5e94..4727f5b0 100644 --- a/src/main/java/com/jfrog/ide/idea/scan/SourceCodeScannerManager.java +++ b/src/main/java/com/jfrog/ide/idea/scan/SourceCodeScannerManager.java @@ -132,7 +132,7 @@ public void onThrowable(@NotNull Throwable error) { } private void sourceCodeScanAndUpdate(ProgressIndicator indicator, Runnable checkCanceled, Logger log) { - indicator.setText("Running advance source code scanning"); + indicator.setText("Running advanced source code scanning"); double fraction = 0; for (ScanBinaryExecutor scanner : scanners) { checkCanceled.run(); diff --git a/src/main/java/com/jfrog/ide/idea/ui/JFrogCiToolWindow.java b/src/main/java/com/jfrog/ide/idea/ui/JFrogCiToolWindow.java index 03e110b3..fc2e7455 100644 --- a/src/main/java/com/jfrog/ide/idea/ui/JFrogCiToolWindow.java +++ b/src/main/java/com/jfrog/ide/idea/ui/JFrogCiToolWindow.java @@ -41,7 +41,8 @@ import java.util.stream.Collectors; import static com.jfrog.ide.idea.ui.JFrogToolWindow.*; -import static com.jfrog.ide.idea.ui.utils.ComponentUtils.*; +import static com.jfrog.ide.idea.ui.utils.ComponentUtils.createDisabledTextLabel; +import static com.jfrog.ide.idea.ui.utils.ComponentUtils.createNoBuildsView; import static org.apache.commons.lang3.StringUtils.isAnyBlank; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -143,7 +144,7 @@ public JPanel createActionToolbar() { // Add builds selector BuildsMenu buildsMenu = new BuildsMenu(project); - ((CiComponentsTree) componentsTree).setBuildsMenu(buildsMenu); + componentsTree.setBuildsMenu(buildsMenu); toolbarPanel.add(buildsMenu.getBuildButton()); // Create parent toolbar containing the builds and the component tree toolbars @@ -189,7 +190,7 @@ private Set getIssuesToDisplay(List selectedNodes) { public void registerListeners() { // Xray credentials were set listener - appBusConnection.subscribe(ApplicationEvents.ON_CONFIGURATION_DETAILS_CHANGE, () -> + appBusConnection.subscribe(ApplicationEvents.ON_CONFIGURATION_DETAILS_CHANGE, (ApplicationEvents) () -> ApplicationManager.getApplication().invokeLater(this::onConfigurationChange)); // Component selection listener @@ -205,13 +206,13 @@ public void registerListeners() { issuesTable.addTableSelectionListener(moreInfoPanel); componentsTree.addOnProjectChangeListener(projectBusConnection); - projectBusConnection.subscribe(ApplicationEvents.ON_CI_FILTER_CHANGE, () -> ApplicationManager.getApplication().invokeLater(() -> { + projectBusConnection.subscribe(ApplicationEvents.ON_CI_FILTER_CHANGE, (ApplicationEvents) () -> ApplicationManager.getApplication().invokeLater(() -> { CiComponentsTree.getInstance(project).applyFiltersForAllProjects(); updateIssuesTable(); })); - projectBusConnection.subscribe(ApplicationEvents.ON_SCAN_CI_STARTED, () -> ApplicationManager.getApplication().invokeLater(this::resetViews)); - projectBusConnection.subscribe(BuildEvents.ON_SELECTED_BUILD, this::setBuildDetails); - projectBusConnection.subscribe(ApplicationEvents.ON_BUILDS_CONFIGURATION_CHANGE, () -> ApplicationManager.getApplication().invokeLater(this::onConfigurationChange)); + projectBusConnection.subscribe(ApplicationEvents.ON_SCAN_CI_STARTED, (ApplicationEvents) () -> ApplicationManager.getApplication().invokeLater(this::resetViews)); + projectBusConnection.subscribe(BuildEvents.ON_SELECTED_BUILD, (BuildEvents) this::setBuildDetails); + projectBusConnection.subscribe(ApplicationEvents.ON_BUILDS_CONFIGURATION_CHANGE, (ApplicationEvents) () -> ApplicationManager.getApplication().invokeLater(this::onConfigurationChange)); } /** @@ -258,14 +259,9 @@ private void setBuildStatus(BuildGeneralInfo buildGeneralInfo) { return; } switch (buildGeneralInfo.getStatus()) { - case PASSED: - setTextAndIcon(buildStatus, "Status: Success", AllIcons.RunConfigurations.TestPassed); - return; - case FAILED: - setTextAndIcon(buildStatus, "Status: Failed", AllIcons.RunConfigurations.TestFailed); - return; - default: - setTextAndIcon(buildStatus, "Status: Unknown", AllIcons.RunConfigurations.TestUnknown); + case PASSED -> setTextAndIcon(buildStatus, "Status: Success", AllIcons.RunConfigurations.TestPassed); + case FAILED -> setTextAndIcon(buildStatus, "Status: Failed", AllIcons.RunConfigurations.TestFailed); + default -> setTextAndIcon(buildStatus, "Status: Unknown", AllIcons.RunConfigurations.TestUnknown); } } @@ -333,7 +329,7 @@ private JComponent createComponentsTreeView() { componentsTreeTitle.setFont(componentsTreeTitle.getFont().deriveFont(TITLE_FONT_SIZE)); componentsTreePanel.add(componentsTreeTitle, BorderLayout.LINE_START); JPanel treePanel = new JBPanel<>(new GridLayout()).withBackground(UIUtil.getTableBackground()); - TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(componentsTree, ComponentUtils::getPathSearchString, true); + TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(componentsTree, true, ComponentUtils::getPathSearchString); treePanel.add(treeSpeedSearch.getComponent(), BorderLayout.WEST); JScrollPane treeScrollPane = ScrollPaneFactory.createScrollPane(treePanel); treeScrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_BAR_SCROLLING_UNITS); diff --git a/src/main/java/com/jfrog/ide/idea/ui/JFrogLocalToolWindow.java b/src/main/java/com/jfrog/ide/idea/ui/JFrogLocalToolWindow.java index 5695bd89..46e31390 100644 --- a/src/main/java/com/jfrog/ide/idea/ui/JFrogLocalToolWindow.java +++ b/src/main/java/com/jfrog/ide/idea/ui/JFrogLocalToolWindow.java @@ -15,21 +15,12 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; -import com.intellij.ui.HyperlinkLabel; -import com.intellij.ui.IdeBorderFactory; -import com.intellij.ui.OnePixelSplitter; -import com.intellij.ui.ScrollPaneFactory; -import com.intellij.ui.SideBorder; -import com.intellij.ui.TreeSpeedSearch; +import com.intellij.ui.*; import com.intellij.ui.components.JBLabel; import com.intellij.ui.components.JBPanel; import com.intellij.ui.jcef.JBCefApp; import com.intellij.util.ui.UIUtil; -import com.jfrog.ide.common.nodes.ApplicableIssueNode; -import com.jfrog.ide.common.nodes.FileIssueNode; -import com.jfrog.ide.common.nodes.IssueNode; -import com.jfrog.ide.common.nodes.LicenseViolationNode; -import com.jfrog.ide.common.nodes.VulnerabilityNode; +import com.jfrog.ide.common.nodes.*; import com.jfrog.ide.idea.actions.CollapseAllAction; import com.jfrog.ide.idea.actions.ExpandAllAction; import com.jfrog.ide.idea.actions.GoToSettingsAction; @@ -118,7 +109,7 @@ public JPanel createActionToolbar() { */ public void registerListeners(JComponent browserComponent) { // Xray credentials were set listener - appBusConnection.subscribe(ApplicationEvents.ON_CONFIGURATION_DETAILS_CHANGE, () -> ApplicationManager.getApplication().invokeLater(this::onConfigurationChange)); + appBusConnection.subscribe(ApplicationEvents.ON_CONFIGURATION_DETAILS_CHANGE, (ApplicationEvents) () -> ApplicationManager.getApplication().invokeLater(this::onConfigurationChange)); // Wrap the browser component in a Panel to avoid display issues that may occur in some versions of IntelliJ in Windows. JPanel browserWrapper = new JBPanel<>(); @@ -136,7 +127,7 @@ public void registerListeners(JComponent browserComponent) { updateIssueOrLicenseInWebview(selectedIssue); verticalSplit.setSecondComponent(browserWrapper); }); - projectBusConnection.subscribe(ApplicationEvents.ON_SCAN_LOCAL_STARTED, () -> { + projectBusConnection.subscribe(ApplicationEvents.ON_SCAN_LOCAL_STARTED, (ApplicationEvents) () -> { setLeftPanelContent(compTreeView); ApplicationManager.getApplication().invokeLater(this::resetViews); }); @@ -163,7 +154,6 @@ private void refreshView() { setLeftPanelContent(compTreeView); } - @SuppressWarnings("UnstableApiUsage") private JComponent createReadyEnvView() { JPanel readyEnvPanel = new JBPanel<>(); readyEnvPanel.setLayout(new BoxLayout(readyEnvPanel, BoxLayout.PAGE_AXIS)); @@ -182,7 +172,6 @@ private JComponent createReadyEnvView() { return ComponentUtils.createUnsupportedPanel(readyEnvPanel); } - @SuppressWarnings("UnstableApiUsage") private JComponent createJcefNotSupportedView() { JPanel jcefNotSupportedPanel = new JBPanel<>(); jcefNotSupportedPanel.setLayout(new BoxLayout(jcefNotSupportedPanel, BoxLayout.PAGE_AXIS)); @@ -248,7 +237,7 @@ private JComponent initVulnerabilityInfoBrowser() throws IOException, URISyntaxE */ private JComponent createComponentsTreeView() { JPanel treePanel = new JBPanel<>(new GridLayout()).withBackground(UIUtil.getTableBackground()); - TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(componentsTree, ComponentUtils::getPathSearchString, true); + TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(componentsTree, true, ComponentUtils::getPathSearchString); treeSpeedSearch.getComponent().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); treePanel.add(treeSpeedSearch.getComponent(), BorderLayout.WEST); JScrollPane treeScrollPane = ScrollPaneFactory.createScrollPane(treePanel); @@ -258,18 +247,15 @@ private JComponent createComponentsTreeView() { } private void updateIssueOrLicenseInWebview(IssueNode issueNode) { - if (issueNode instanceof VulnerabilityNode) { - VulnerabilityNode issue = (VulnerabilityNode) issueNode; + if (issueNode instanceof VulnerabilityNode issue) { webviewManager.sendMessage(MessageType.SHOW_PAGE, WebviewObjectConverter.convertIssueToDepPage(issue)); } else if (issueNode instanceof ApplicableIssueNode) { ApplicableIssueNode node = (ApplicableIssueNode) issueNode; webviewManager.sendMessage(MessageType.SHOW_PAGE, WebviewObjectConverter.convertIssueToDepPage(node.getIssue())); navigateToFile(node); - } else if (issueNode instanceof LicenseViolationNode) { - LicenseViolationNode license = (LicenseViolationNode) issueNode; + } else if (issueNode instanceof LicenseViolationNode license) { webviewManager.sendMessage(MessageType.SHOW_PAGE, WebviewObjectConverter.convertLicenseToDepPage(license)); - } else if (issueNode instanceof FileIssueNode) { - FileIssueNode node = (FileIssueNode) issueNode; + } else if (issueNode instanceof FileIssueNode node) { webviewManager.sendMessage(MessageType.SHOW_PAGE, WebviewObjectConverter.convertFileIssueToIssuePage(node)); navigateToFile(node); } diff --git a/src/main/java/com/jfrog/ide/idea/ui/JFrogToolWindow.java b/src/main/java/com/jfrog/ide/idea/ui/JFrogToolWindow.java index ada9b4f9..be272a6f 100644 --- a/src/main/java/com/jfrog/ide/idea/ui/JFrogToolWindow.java +++ b/src/main/java/com/jfrog/ide/idea/ui/JFrogToolWindow.java @@ -5,7 +5,6 @@ import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentFactory; import com.intellij.ui.content.ContentManager; -import com.jfrog.ide.idea.log.Logger; import org.jetbrains.annotations.NotNull; @@ -26,7 +25,7 @@ void initToolWindow(@NotNull ToolWindow toolWindow, @NotNull Project project, bo } private void addContent(ContentManager contentManager, JFrogLocalToolWindow jfrogLocalContent, JFrogCiToolWindow jfrogBuildsContent) { - ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); + ContentFactory contentFactory = ContentFactory.getInstance(); Content localContent = contentFactory.createContent(jfrogLocalContent, "Local", false); contentManager.addContent(localContent); Content buildsContent = contentFactory.createContent(jfrogBuildsContent, "CI", false); diff --git a/src/main/java/com/jfrog/ide/idea/ui/utils/ComponentUtils.java b/src/main/java/com/jfrog/ide/idea/ui/utils/ComponentUtils.java index 336c026e..7c062f79 100644 --- a/src/main/java/com/jfrog/ide/idea/ui/utils/ComponentUtils.java +++ b/src/main/java/com/jfrog/ide/idea/ui/utils/ComponentUtils.java @@ -35,7 +35,6 @@ public static JLabel createDisabledTextLabel(String text) { return label; } - @SuppressWarnings("UnstableApiUsage") public static JComponent createNoCredentialsView() { JPanel noCredentialsPanel = new JBPanel<>(); noCredentialsPanel.setLayout(new BoxLayout(noCredentialsPanel, BoxLayout.PAGE_AXIS)); @@ -78,7 +77,6 @@ public static void addCenteredComponent(JPanel panel, JComponent component) { panel.add(component); } - @SuppressWarnings("UnstableApiUsage") public static JComponent createNoBuildsView() { HyperlinkLabel link = new HyperlinkLabel(); link.setTextWithHyperlink("No builds detected. To start viewing your builds please follow this guide."); diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index d1ac3142..c497b345 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -37,7 +37,7 @@ ]]> - + com.intellij.modules.lang com.intellij.gradle org.intellij.groovy diff --git a/src/test/java/com/jfrog/ide/idea/scan/DummyCircularDepSDK.java b/src/test/java/com/jfrog/ide/idea/scan/DummyCircularDepPyPkgManager.java similarity index 94% rename from src/test/java/com/jfrog/ide/idea/scan/DummyCircularDepSDK.java rename to src/test/java/com/jfrog/ide/idea/scan/DummyCircularDepPyPkgManager.java index 641ae061..8b0c08f1 100644 --- a/src/test/java/com/jfrog/ide/idea/scan/DummyCircularDepSDK.java +++ b/src/test/java/com/jfrog/ide/idea/scan/DummyCircularDepPyPkgManager.java @@ -1,6 +1,7 @@ package com.jfrog.ide.idea.scan; import com.intellij.openapi.module.Module; +import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.python.packaging.PyPackage; import com.jetbrains.python.packaging.PyPackageManager; @@ -13,13 +14,17 @@ import java.util.List; import java.util.Set; -public class DummyCircularDepSDK extends PyPackageManager { +public class DummyCircularDepPyPkgManager extends PyPackageManager { public static final String DIRECT_DEPENDENCY_NAME = "root"; public static final String DIRECT_DEPENDENCY_VERSION = "1.0.0"; public static final String CIRCULAR_DEPENDENCY_A = "a"; public static final String CIRCULAR_DEPENDENCY_B = "b"; public static final String CIRCULAR_DEPENDENCY_VERSION = "2.0.0"; + public DummyCircularDepPyPkgManager(@NotNull Sdk sdk) { + super(sdk); + } + @Override public void installManagement() { diff --git a/src/test/java/com/jfrog/ide/idea/scan/PypiScannerTest.java b/src/test/java/com/jfrog/ide/idea/scan/PypiScannerTest.java index 3e539a4e..af60c418 100644 --- a/src/test/java/com/jfrog/ide/idea/scan/PypiScannerTest.java +++ b/src/test/java/com/jfrog/ide/idea/scan/PypiScannerTest.java @@ -132,7 +132,7 @@ public void testBuildTree() throws IOException { public void testBuildTreeCircularDependency() throws IOException { try (MockedStatic mockController = Mockito.mockStatic(PyPackageManager.class)) { - mockController.when(() -> PyPackageManager.getInstance(pythonSdk)).thenReturn(new DummyCircularDepSDK()); + mockController.when(() -> PyPackageManager.getInstance(pythonSdk)).thenReturn(new DummyCircularDepPyPkgManager(pythonSdk)); PypiScanner pypiScanner = new PypiScanner(getProject(), pythonSdk, executorService, new GraphScanLogic(new NullLog())); // Check root SDK node @@ -143,20 +143,20 @@ public void testBuildTreeCircularDependency() throws IOException { // The expected tree: root -> a-> b -> a // Check root - String directDepId = DummyCircularDepSDK.DIRECT_DEPENDENCY_NAME + ":" + DummyCircularDepSDK.DIRECT_DEPENDENCY_VERSION; + String directDepId = DummyCircularDepPyPkgManager.DIRECT_DEPENDENCY_NAME + ":" + DummyCircularDepPyPkgManager.DIRECT_DEPENDENCY_VERSION; DepTreeNode root = getAndAssertChild(results, results.getRootNode(), directDepId); assertSize(1, root.getChildren()); - String depIdA = DummyCircularDepSDK.CIRCULAR_DEPENDENCY_A + ":" + DummyCircularDepSDK.CIRCULAR_DEPENDENCY_VERSION; + String depIdA = DummyCircularDepPyPkgManager.CIRCULAR_DEPENDENCY_A + ":" + DummyCircularDepPyPkgManager.CIRCULAR_DEPENDENCY_VERSION; DepTreeNode a = getAndAssertChild(results, root, depIdA); // Check dependency "a" assertSize(1, a.getChildren()); - String depIdB = DummyCircularDepSDK.CIRCULAR_DEPENDENCY_B + ":" + DummyCircularDepSDK.CIRCULAR_DEPENDENCY_VERSION; + String depIdB = DummyCircularDepPyPkgManager.CIRCULAR_DEPENDENCY_B + ":" + DummyCircularDepPyPkgManager.CIRCULAR_DEPENDENCY_VERSION; DepTreeNode b = getAndAssertChild(results, a, depIdB); // Check dependency "b" assertSize(1, b.getChildren()); - getAndAssertChild(results, b, DummyCircularDepSDK.CIRCULAR_DEPENDENCY_A + ":" + DummyCircularDepSDK.CIRCULAR_DEPENDENCY_VERSION); + getAndAssertChild(results, b, DummyCircularDepPyPkgManager.CIRCULAR_DEPENDENCY_A + ":" + DummyCircularDepPyPkgManager.CIRCULAR_DEPENDENCY_VERSION); } } } diff --git a/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.jar b/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..943f0cbf 100644 Binary files a/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.jar and b/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.properties b/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.properties index 5028f28f..f398c33c 100644 --- a/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.properties +++ b/src/test/resources/gradle/wrapper/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/test/resources/gradle/wrapper/gradlew b/src/test/resources/gradle/wrapper/gradlew index 83f2acfd..65dcd68d 100755 --- a/src/test/resources/gradle/wrapper/gradlew +++ b/src/test/resources/gradle/wrapper/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,78 +17,113 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -105,84 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/src/test/resources/gradle/wrapper/gradlew.bat b/src/test/resources/gradle/wrapper/gradlew.bat index 9618d8d9..93e3f59f 100644 --- a/src/test/resources/gradle/wrapper/gradlew.bat +++ b/src/test/resources/gradle/wrapper/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +25,14 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal