IDEA-269182 Drop verify-sha256-checksum attribute from RepositoryLibraryProperties

GitOrigin-RevId: 8a9684d4040d19caa50243d36f8034e90bf2b9c5
This commit is contained in:
Vladislav.Yaroshchuk
2022-12-14 18:36:40 +00:00
committed by intellij-monorepo-bot
parent c9e32d0e84
commit 17c7aaddbe
19 changed files with 42 additions and 140 deletions
@@ -657,8 +657,6 @@ language.level.combo.experimental.versions=Experimental Versions
project.or.module.jdk.misconfigured={0, choice, 0#Project|1#Module} JDK is misconfigured
notification.group.build.script.found=Build script found
label.verification.settings=Verification Settings
checkbox.sha256.checksum=S&HA256 checksum
label.bind.remote.repository=&Bind remote repository
repository.library.utils.library.update.title=Repository library update
@@ -75,8 +75,7 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
/* Build verification only for libraries with stable version and if verification is enabled */
if (descriptor.version == RepositoryLibraryDescription.LatestVersionId ||
descriptor.version == RepositoryLibraryDescription.ReleaseVersionId ||
descriptor.version.endsWith(RepositoryLibraryDescription.SnapshotVersionSuffix) ||
!descriptor.isVerifySha256Checksum) {
descriptor.version.endsWith(RepositoryLibraryDescription.SnapshotVersionSuffix)) {
return emptyList()
}
@@ -147,7 +146,7 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
* Libraries with disabled checksums are excluded.
* Global libraries are excluded.
*
* See [JpsMavenRepositoryLibraryDescriptor.ArtifactVerification], [JpsMavenRepositoryLibraryDescriptor.myVerifySha256Checksum].
* See [JpsMavenRepositoryLibraryDescriptor.ArtifactVerification], [JpsMavenRepositoryLibraryDescriptor.isVerifySha256Checksum].
*/
fun rebuildExistingSha256ChecksumsBackground() = BuildSha256SumJob(true, false).runBackground(
JavaUiBundle.message("repository.library.utils.progress.title.building.sha256sum")
@@ -158,7 +157,7 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
*
* Global libraries are excluded.
*
* See [JpsMavenRepositoryLibraryDescriptor.ArtifactVerification], [JpsMavenRepositoryLibraryDescriptor.myVerifySha256Checksum].
* See [JpsMavenRepositoryLibraryDescriptor.ArtifactVerification], [JpsMavenRepositoryLibraryDescriptor.isVerifySha256Checksum].
*/
fun buildMissingSha256ChecksumsBackground() = BuildSha256SumJob(false, true).runBackground(
JavaUiBundle.message("repository.library.utils.progress.title.building.sha256sum")
@@ -168,7 +167,7 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
/**
* Disable SHA256 checksum for all [RepositoryLibraryType] libraries. Global libraries are excluded.
*
* See [JpsMavenRepositoryLibraryDescriptor.ArtifactVerification], [JpsMavenRepositoryLibraryDescriptor.myVerifySha256Checksum].
* See [JpsMavenRepositoryLibraryDescriptor.ArtifactVerification], [JpsMavenRepositoryLibraryDescriptor.isVerifySha256Checksum].
*/
fun removeSha256ChecksumsBackground() = RemoveSha256ChecksumsJob().runBackground(
JavaUiBundle.message("repository.library.utils.progress.title.removing.sha256sum")
@@ -309,7 +308,6 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
.filter { it.type == LibraryRootTypeId.COMPILED }
.map { JpsPathUtil.urlToFile(it.url.url) }
this.isEnableSha256Checksum = true
this.artifactsVerification = buildRepositoryLibraryArtifactsVerification(this.repositoryLibraryDescriptor, verifiableJars)
return this
}
@@ -455,7 +453,6 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
override suspend fun transform() {
filteredProperties.forEach { (entity, properties) ->
properties.isEnableSha256Checksum = false
properties.artifactsVerification = emptyList()
entity.modifyProperties(properties)
}
@@ -78,7 +78,7 @@ public class RepositoryLibraryWithDescriptionEditor
RepositoryLibraryPropertiesModel model = new RepositoryLibraryPropertiesModel(
properties.getVersion(),
artifactKinds, properties.isIncludeTransitiveDependencies(),
properties.getExcludedDependencies(), properties.isEnableSha256Checksum(),
properties.getExcludedDependencies(),
RemoteRepositoriesConfiguration.getInstance(project).getRepositories(), properties.getJarRepositoryId());
boolean isGlobalLibrary = false;
@@ -104,7 +104,6 @@ public class RepositoryLibraryWithDescriptionEditor
myEditorComponent.getProperties().changeVersion(model.getVersion());
myEditorComponent.getProperties().setIncludeTransitiveDependencies(model.isIncludeTransitiveDependencies());
myEditorComponent.getProperties().setExcludedDependencies(model.getExcludedDependencies());
myEditorComponent.getProperties().setEnableSha256Checksum(model.isSha256ChecksumEnabled());
myEditorComponent.getProperties().setJarRepositoryId(model.getRemoteRepositoryId());
if (wasGeneratedName) {
@@ -118,11 +117,6 @@ public class RepositoryLibraryWithDescriptionEditor
);
libraryEditor.removeAllRoots();
if (roots != null) {
myEditorComponent.getProperties().setArtifactsVerification(RepositoryLibraryUtils.buildRepositoryLibraryArtifactsVerification(
properties.getRepositoryLibraryDescriptor(),
roots)
);
libraryEditor.addRoots(roots);
} else {
properties.setArtifactsVerification(Collections.emptyList());
@@ -55,7 +55,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="b217f" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="b217f" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<card name="Loaded"/>
@@ -94,7 +94,7 @@
</grid>
<vspacer id="b095d">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="1bd32" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -146,42 +146,6 @@
</component>
</children>
</grid>
<grid id="59335" binding="myVerificationSettingsPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
</properties>
<border type="none"/>
<children>
<component id="db603" class="com.intellij.ui.components.JBCheckBox" binding="myVerificationSha256ChecksumCheckBox">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="false"/>
<text resource-bundle="messages/JavaUiBundle" key="checkbox.sha256.checksum"/>
</properties>
</component>
<hspacer id="ef082">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="be4bf" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentStyle value="SMALL"/>
<fontColor value="BRIGHTER"/>
<text resource-bundle="messages/JavaUiBundle" key="label.verification.settings"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="ea348" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -58,10 +58,6 @@ public final class RepositoryLibraryPropertiesEditor {
private final ThreeStateCheckBox myIncludeTransitiveDepsCheckBox;
private JPanel myPropertiesPanel;
private JPanel myTransitiveDependenciesPanel;
private JPanel myVerificationSettingsPanel;
private JBCheckBox myVerificationSha256ChecksumCheckBox;
private ComboBox<RemoteRepositoryDescription> myRemoteRepositoryComboBox;
private JPanel myRemoteRepositoryOptionsPanel;
@@ -129,11 +125,9 @@ public final class RepositoryLibraryPropertiesEditor {
myTransitiveDependenciesPanel.setVisible(allowExcludingTransitiveDependencies);
if (globalLibrary) {
myVerificationSettingsPanel.setVisible(false);
myRemoteRepositoryOptionsPanel.setVisible(false);
} else {
RepositoryLibrarySettings intSettings = RepositoryLibrarySettings.getInstanceOrDefaults(project);
myVerificationSettingsPanel.setVisible(intSettings.isSha256ChecksumUiSettingsDisplayed());
myRemoteRepositoryOptionsPanel.setVisible(intSettings.isBindJarRepositoryUiSettingsDisplayed());
}
@@ -267,15 +261,6 @@ public final class RepositoryLibraryPropertiesEditor {
}
});
updateManageDependenciesLink();
myVerificationSha256ChecksumCheckBox.setSelected(model.isSha256ChecksumEnabled());
myVerificationSha256ChecksumCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
model.setVerificationSha256Checksum(myVerificationSha256ChecksumCheckBox.isSelected());
onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
}
});
}
private void updateIncludeTransitiveDepsCheckBoxState() {
@@ -24,13 +24,10 @@ import org.jetbrains.idea.maven.aether.ArtifactKind;
import javax.swing.*;
import java.util.*;
import static org.jetbrains.jps.model.library.JpsMavenRepositoryLibraryDescriptor.VERIFY_SHA256_CHECKSUM_DEFAULT;
public class RepositoryLibraryPropertiesModel {
private String version;
private final EnumSet<ArtifactKind> myArtifactKinds = EnumSet.noneOf(ArtifactKind.class);
private boolean includeTransitiveDependencies;
private boolean mySha256ChecksumEnabled;
private List<String> myExcludedDependencies;
private final List<RemoteRepositoryDescription> myAvailableRemoteRepositories;
private final CollectionComboBoxModel<RemoteRepositoryDescription> myRemoteRepositoryModel;
@@ -47,18 +44,15 @@ public class RepositoryLibraryPropertiesModel {
public RepositoryLibraryPropertiesModel(String version, EnumSet<ArtifactKind> artifactKinds,
boolean includeTransitiveDependencies, List<String> excludedDependencies) {
this(version, artifactKinds, includeTransitiveDependencies, excludedDependencies, VERIFY_SHA256_CHECKSUM_DEFAULT,
Collections.emptyList(), null);
this(version, artifactKinds, includeTransitiveDependencies, excludedDependencies, Collections.emptyList(), null);
}
public RepositoryLibraryPropertiesModel(String version, EnumSet<ArtifactKind> artifactKinds,
boolean includeTransitiveDependencies, List<String> excludedDependencies,
boolean mySha256ChecksumEnabled,
List<RemoteRepositoryDescription> availableRemoteRepositories, String remoteRepositoryId) {
this.version = version;
this.myArtifactKinds.addAll(artifactKinds);
this.includeTransitiveDependencies = includeTransitiveDependencies;
this.mySha256ChecksumEnabled = mySha256ChecksumEnabled;
myExcludedDependencies = new ArrayList<>(excludedDependencies);
myAvailableRemoteRepositories = availableRemoteRepositories;
@@ -75,7 +69,7 @@ public class RepositoryLibraryPropertiesModel {
@Override
public RepositoryLibraryPropertiesModel clone() {
return new RepositoryLibraryPropertiesModel(version, myArtifactKinds, includeTransitiveDependencies,
new ArrayList<>(myExcludedDependencies), mySha256ChecksumEnabled,
new ArrayList<>(myExcludedDependencies),
myAvailableRemoteRepositories, getRemoteRepositoryId());
}
@@ -135,14 +129,6 @@ public class RepositoryLibraryPropertiesModel {
}
}
public boolean isSha256ChecksumEnabled() {
return mySha256ChecksumEnabled;
}
public void setVerificationSha256Checksum(boolean value) {
this.mySha256ChecksumEnabled = value;
}
public EnumSet<ArtifactKind> getArtifactKinds() {
return EnumSet.copyOf(myArtifactKinds);
}
@@ -179,7 +165,6 @@ public class RepositoryLibraryPropertiesModel {
if (includeTransitiveDependencies != model.includeTransitiveDependencies) return false;
if (version != null ? !version.equals(model.version) : model.version != null) return false;
if (!myExcludedDependencies.equals(model.myExcludedDependencies)) return false;
if (mySha256ChecksumEnabled != model.mySha256ChecksumEnabled) return false;
if (!Objects.equals(getRemoteRepositoryId(), model.getRemoteRepositoryId())) return false;
return true;
}
@@ -190,7 +175,6 @@ public class RepositoryLibraryPropertiesModel {
result = 31 * result + (includeTransitiveDependencies ? 1 : 0);
result = 31 * result + (version != null ? version.hashCode() : 0);
result = 31 * result + myExcludedDependencies.hashCode();
result = 31 * result + (mySha256ChecksumEnabled ? 1 : 0);
result = 31 * result + (getRemoteRepositoryId() != null ? getRemoteRepositoryId().hashCode() : 0);
return result;
}
@@ -1,6 +1,6 @@
<component name="libraryTable">
<library name="smallSampleLibRelease" type="repository">
<properties verify-sha256-checksum="true" jar-repository-id="repositoryReleases" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<properties jar-repository-id="repositoryReleases" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<verification>
<artifact url="file://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0/smallSampleLib-1.0.jar">
<sha256sum>f0aaca850dd5e399541a9614da99dd194c122e9252b35dafeb088b77b8baf6b1</sha256sum>
@@ -1,6 +1,6 @@
<component name="libraryTable">
<library name="smallSampleLibSnapshot" type="repository">
<properties verify-sha256-checksum="true" jar-repository-id="repositorySnapshots" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0-SNAPSHOT" />
<properties jar-repository-id="repositorySnapshots" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0-SNAPSHOT" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0-SNAPSHOT/smallSampleLib-1.0-SNAPSHOT.jar!/" />
</CLASSES>
@@ -11,7 +11,7 @@
<orderEntry type="library" name="smallSampleLibSnapshot" level="project" />
<orderEntry type="module-library">
<library name="smallSampleTestLibModuleLevel" type="repository">
<properties verify-sha256-checksum="true" jar-repository-id="repositoryReleases" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<properties jar-repository-id="repositoryReleases" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<verification>
<artifact url="file://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0/smallSampleLib-1.0.jar">
<sha256sum>f0aaca850dd5e399541a9614da99dd194c122e9252b35dafeb088b77b8baf6b1</sha256sum>
@@ -1,6 +1,6 @@
<component name="libraryTable">
<library name="smallSampleLibRelease" type="repository">
<properties verify-sha256-checksum="true" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<properties maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<verification>
<artifact url="file://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0/smallSampleLib-1.0.jar">
<sha256sum>badchecksum</sha256sum>
@@ -1,6 +1,6 @@
<component name="libraryTable">
<library name="smallSampleLibSnapshot" type="repository">
<properties verify-sha256-checksum="true" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0-SNAPSHOT" />
<properties maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0-SNAPSHOT" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0-SNAPSHOT/smallSampleLib-1.0-SNAPSHOT.jar!/" />
</CLASSES>
@@ -11,7 +11,7 @@
<orderEntry type="library" name="smallSampleLibSnapshot" level="project" />
<orderEntry type="module-library">
<library name="smallSampleTestLibModuleLevel" type="repository">
<properties verify-sha256-checksum="true" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<properties maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<verification>
<artifact url="file://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0/smallSampleLib-1.0.jar">
<sha256sum>badchecksumhere</sha256sum>
@@ -1,6 +1,6 @@
<component name="libraryTable">
<library name="smallSampleLibRelease" type="repository">
<properties verify-sha256-checksum="true" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<properties maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<verification>
<artifact url="file://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0/smallSampleLib-1.0.jar">
<sha256sum>f0aaca850dd5e399541a9614da99dd194c122e9252b35dafeb088b77b8baf6b1</sha256sum>
@@ -1,6 +1,6 @@
<component name="libraryTable">
<library name="smallSampleLibSnapshot" type="repository">
<properties verify-sha256-checksum="true" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0-SNAPSHOT" />
<properties maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0-SNAPSHOT" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0-SNAPSHOT/smallSampleLib-1.0-SNAPSHOT.jar!/" />
</CLASSES>
@@ -11,7 +11,7 @@
<orderEntry type="library" name="smallSampleLibSnapshot" level="project" />
<orderEntry type="module-library">
<library name="smallSampleTestLibModuleLevel" type="repository">
<properties verify-sha256-checksum="true" maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<properties maven-id="org.example.repository.library.utils.test:smallSampleLib:1.0">
<verification>
<artifact url="file://$MAVEN_REPOSITORY$/org/example/repository/library/utils/test/smallSampleLib/1.0/smallSampleLib-1.0.jar">
<sha256sum>f0aaca850dd5e399541a9614da99dd194c122e9252b35dafeb088b77b8baf6b1</sha256sum>
@@ -207,7 +207,7 @@ class JarRepositoryManagerTest : UsefulTestCase() {
assertEquals(expected, actual)
}
private fun createDescriptorWithJarRepoId(jarRepoId: String?) = JpsMavenRepositoryLibraryDescriptor("id", false, emptyList(), false,
private fun createDescriptorWithJarRepoId(jarRepoId: String?) = JpsMavenRepositoryLibraryDescriptor("id", false, emptyList(),
emptyList(),
jarRepoId)
private fun getResultingRoots(promise: Promise<MutableList<OrderRoot>>): List<OrderRoot>? {
@@ -96,13 +96,13 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
public void setMavenId(String mavenId) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(mavenId, getPackaging(), isIncludeTransitiveDependencies(),
getExcludedDependencies(), isEnableSha256Checksum(), getArtifactsVerification(),
getExcludedDependencies(), getArtifactsVerification(),
getJarRepositoryId());
}
public void setPackaging(String packaging) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getMavenId(), packaging, isIncludeTransitiveDependencies(),
getExcludedDependencies(), isEnableSha256Checksum(), getArtifactsVerification(),
getExcludedDependencies(), getArtifactsVerification(),
getJarRepositoryId());
}
@@ -114,7 +114,7 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
public void setIncludeTransitiveDependencies(boolean value) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getMavenId(), getPackaging(), value,
getExcludedDependencies(), isEnableSha256Checksum(), getArtifactsVerification(),
getExcludedDependencies(), getArtifactsVerification(),
getJarRepositoryId());
}
@@ -126,21 +126,14 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
public void setJarRepositoryId(String jarRepositoryId) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getMavenId(), getPackaging(), isIncludeTransitiveDependencies(),
getExcludedDependencies(), isEnableSha256Checksum(),
getArtifactsVerification(), jarRepositoryId);
getExcludedDependencies(), getArtifactsVerification(), jarRepositoryId);
}
@Attribute("verify-sha256-checksum")
@Transient
public boolean isEnableSha256Checksum() {
return call(JpsMavenRepositoryLibraryDescriptor::isVerifySha256Checksum, JpsMavenRepositoryLibraryDescriptor.VERIFY_SHA256_CHECKSUM_DEFAULT);
return call(JpsMavenRepositoryLibraryDescriptor::isVerifySha256Checksum, false);
}
@Attribute("verify-sha256-checksum")
public void setEnableSha256Checksum(boolean value) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getMavenId(), getPackaging(), isIncludeTransitiveDependencies(),
getExcludedDependencies(), value, getArtifactsVerification(),
getJarRepositoryId());
}
public String getGroupId() {
return call(JpsMavenRepositoryLibraryDescriptor::getGroupId, null);
@@ -157,7 +150,7 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
public void changeVersion(String version) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getGroupId(), getArtifactId(), version, getPackaging(),
isIncludeTransitiveDependencies(), getExcludedDependencies(),
isEnableSha256Checksum(), getArtifactsVerification(),
getArtifactsVerification(),
getJarRepositoryId());
}
@@ -176,7 +169,7 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
public void setExcludedDependencies(List<String> dependencyMavenIds) {
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getMavenId(), getPackaging(), isIncludeTransitiveDependencies(),
dependencyMavenIds, isEnableSha256Checksum(), getArtifactsVerification(),
dependencyMavenIds, getArtifactsVerification(),
getJarRepositoryId());
}
@@ -189,7 +182,7 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
public void setArtifactsVerification(@Nullable List<ArtifactVerification> artifactsVerification) {
List<ArtifactVerification> effectiveValue = artifactsVerification == null ? Collections.emptyList() : artifactsVerification;
myDescriptor = new JpsMavenRepositoryLibraryDescriptor(getMavenId(), getPackaging(), isIncludeTransitiveDependencies(),
getExcludedDependencies(), isEnableSha256Checksum(), effectiveValue,
getExcludedDependencies(), effectiveValue,
getJarRepositoryId());
}
@@ -228,7 +221,6 @@ public class RepositoryLibraryProperties extends LibraryProperties<RepositoryLib
}
public void disableVerification() {
setEnableSha256Checksum(false);
setArtifactsVerification(Collections.emptyList());
}
@@ -15,6 +15,7 @@
*/
package org.jetbrains.jps.model.library;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -28,8 +29,6 @@ import java.util.Objects;
public class JpsMavenRepositoryLibraryDescriptor {
public static final String DEFAULT_PACKAGING = "jar";
public static final boolean VERIFY_SHA256_CHECKSUM_DEFAULT = false;
private final String myMavenId;
private final String myGroupId;
private final String myArtifactId;
@@ -40,8 +39,6 @@ public class JpsMavenRepositoryLibraryDescriptor {
private final String myJarRepositoryId;
private final boolean myVerifySha256Checksum;
private final List<ArtifactVerification> myArtifactsVerification;
public JpsMavenRepositoryLibraryDescriptor(@NotNull String groupId, @NotNull String artifactId, @NotNull String version) {
@@ -56,23 +53,19 @@ public class JpsMavenRepositoryLibraryDescriptor {
public JpsMavenRepositoryLibraryDescriptor(@NotNull String groupId, @NotNull String artifactId, @NotNull String version,
@NotNull final String packaging, boolean includeTransitiveDependencies,
@NotNull List<String> excludedDependencies) {
this(groupId, artifactId, version, packaging, includeTransitiveDependencies, excludedDependencies,
VERIFY_SHA256_CHECKSUM_DEFAULT, Collections.emptyList());
this(groupId, artifactId, version, packaging, includeTransitiveDependencies, excludedDependencies, Collections.emptyList());
}
public JpsMavenRepositoryLibraryDescriptor(@NotNull String groupId, @NotNull String artifactId, @NotNull String version,
@NotNull final String packaging, boolean includeTransitiveDependencies,
@NotNull List<String> excludedDependencies,
boolean verifySha256Checksum,
@NotNull List<ArtifactVerification> metadata) {
this(groupId, artifactId, version, packaging, includeTransitiveDependencies, excludedDependencies,
verifySha256Checksum, metadata, null);
this(groupId, artifactId, version, packaging, includeTransitiveDependencies, excludedDependencies, metadata, null);
}
public JpsMavenRepositoryLibraryDescriptor(@NotNull String groupId, @NotNull String artifactId, @NotNull String version,
@NotNull final String packaging, boolean includeTransitiveDependencies,
@NotNull List<String> excludedDependencies,
boolean verifySha256Checksum,
@NotNull List<ArtifactVerification> metadata,
@Nullable String jarRepositoryId) {
myGroupId = groupId;
@@ -82,7 +75,6 @@ public class JpsMavenRepositoryLibraryDescriptor {
myIncludeTransitiveDependencies = includeTransitiveDependencies;
myExcludedDependencies = excludedDependencies;
myMavenId = groupId + ":" + artifactId + ":" + version;
myVerifySha256Checksum = verifySha256Checksum;
myArtifactsVerification = metadata;
myJarRepositoryId = jarRepositoryId;
}
@@ -101,25 +93,23 @@ public class JpsMavenRepositoryLibraryDescriptor {
}
public JpsMavenRepositoryLibraryDescriptor(@Nullable String mavenId, @NotNull String packaging, boolean includeTransitiveDependencies, List<String> excludedDependencies) {
this(mavenId, packaging, includeTransitiveDependencies, excludedDependencies, VERIFY_SHA256_CHECKSUM_DEFAULT, Collections.emptyList(),
null);
this(mavenId, packaging, includeTransitiveDependencies, excludedDependencies, Collections.emptyList(), null);
}
public JpsMavenRepositoryLibraryDescriptor(@Nullable String mavenId, boolean includeTransitiveDependencies, List<String> excludedDependencies,
boolean verifySha256Checksum, @NotNull List<ArtifactVerification> artifactsVerification,
@NotNull List<ArtifactVerification> artifactsVerification,
@Nullable String jarRepositoryId) {
this(mavenId, DEFAULT_PACKAGING, includeTransitiveDependencies, excludedDependencies, verifySha256Checksum, artifactsVerification,
this(mavenId, DEFAULT_PACKAGING, includeTransitiveDependencies, excludedDependencies, artifactsVerification,
jarRepositoryId);
}
public JpsMavenRepositoryLibraryDescriptor(@Nullable String mavenId, @NotNull String packaging, boolean includeTransitiveDependencies, List<String> excludedDependencies,
boolean verifySha256Checksum, @NotNull List<ArtifactVerification> artifactsVerification,
@NotNull List<ArtifactVerification> artifactsVerification,
@Nullable String jarRepositoryId) {
myMavenId = mavenId;
myIncludeTransitiveDependencies = includeTransitiveDependencies;
myExcludedDependencies = excludedDependencies;
myPackaging = packaging;
myVerifySha256Checksum = verifySha256Checksum;
myArtifactsVerification = artifactsVerification;
myJarRepositoryId = jarRepositoryId;
@@ -178,13 +168,12 @@ public class JpsMavenRepositoryLibraryDescriptor {
myPackaging.equals(that.myPackaging) &&
myExcludedDependencies.equals(that.myExcludedDependencies) &&
myArtifactsVerification.equals(that.myArtifactsVerification) &&
myVerifySha256Checksum == that.myVerifySha256Checksum &&
Objects.equals(myJarRepositoryId, that.myJarRepositoryId);
}
public int hashCode() {
return Objects.hash(myMavenId, myPackaging, myIncludeTransitiveDependencies, myExcludedDependencies, myArtifactsVerification,
myVerifySha256Checksum, myJarRepositoryId);
myJarRepositoryId);
}
@Override
@@ -193,7 +182,7 @@ public class JpsMavenRepositoryLibraryDescriptor {
}
public boolean isVerifySha256Checksum() {
return myVerifySha256Checksum;
return ContainerUtil.exists(myArtifactsVerification, it -> it.getSha256sum() != null);
}
public List<ArtifactVerification> getArtifactsVerification() {
@@ -312,8 +312,6 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
private static final String EXCLUDE_TAG = "exclude";
private static final String DEPENDENCY_TAG = "dependency";
private static final String VERIFY_SHA25_CHECKSUM_ATTRIBUTE = "verify-sha256-checksum";
private static final String JAR_REPOSITORY_ID_ATTRIBUTE = "jar-repository-id";
private static final String VERIFICATION_TAG = "verification";
@@ -339,7 +337,6 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
String mavenId = elem.getAttributeValue(MAVEN_ID_ATTRIBUTE, (String)null);
boolean includeTransitiveDependencies = Boolean.parseBoolean(elem.getAttributeValue(INCLUDE_TRANSITIVE_DEPS_ATTRIBUTE, "true"));
boolean verifySha256Checksum = Boolean.parseBoolean(elem.getAttributeValue(VERIFY_SHA25_CHECKSUM_ATTRIBUTE, "false"));
String jarRepositoryId = elem.getAttributeValue(JAR_REPOSITORY_ID_ATTRIBUTE);
@@ -349,7 +346,6 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
var verificationProperties = loadArtifactsVerificationProperties(mavenId, elem.getChild(VERIFICATION_TAG));
return new JpsMavenRepositoryLibraryDescriptor(mavenId,
includeTransitiveDependencies, excludedDependencies,
verifySha256Checksum,
verificationProperties,
jarRepositoryId);
}
@@ -367,8 +363,11 @@ public class JpsJavaModelSerializerExtension extends JpsModelSerializerExtension
if (artifactUrl != null) {
Element sha256sumElement = child.getChild(SHA256SUM_TAG);
String sha256sum = sha256sumElement != null ? sha256sumElement.getText() : null;
result.add(new ArtifactVerification(artifactUrl, sha256sum));
if (sha256sum == null) {
LOG.warn("Missing sha256sum attribute for verification artifact tag for descriptor maven-id=" + mavenId);
} else {
result.add(new ArtifactVerification(artifactUrl, sha256sum));
}
} else {
LOG.warn("Missing url attribute for verification artifact tag for descriptor maven-id=" + mavenId);
}