Skip to content

Commit

Permalink
Replaced removeSuffixIfPresent by removeSuffix because the first one …
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBartash committed Oct 13, 2024
1 parent e274188 commit eb773d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import org.jetbrains.intellij.platform.gradle.flow.StopShimServerAction
import org.jetbrains.intellij.platform.gradle.get
import org.jetbrains.intellij.platform.gradle.models.toBundledIvyArtifactsRelativeTo
import org.jetbrains.intellij.platform.gradle.services.ShimManagerService
import org.jetbrains.kotlin.util.removeSuffixIfPresent
import java.net.URI
import java.nio.file.Path
import kotlin.io.path.Path
Expand Down Expand Up @@ -236,7 +235,7 @@ class IntelliJPlatformRepositoriesHelper(
.absolute()
.normalize()
.invariantSeparatorsPathString
.removeSuffixIfPresent("/")
.removeSuffix("/")

ivyPattern("$ivyPath/[organization]-[module]-[revision].[ext]")

Expand Down Expand Up @@ -345,7 +344,7 @@ class IntelliJPlatformRepositoriesHelper(
.absolute()
.normalize()
.invariantSeparatorsPathString
.removeSuffixIfPresent("/")
.removeSuffix("/")

ivyPattern("$ivyPath/[organization]-[module]-[revision].[ext]")

Expand Down Expand Up @@ -382,7 +381,7 @@ class IntelliJPlatformRepositoriesHelper(
// - "ext" (IvyModule#ext) is an optional file extension, e.g. "jar". It is optional only because files
// do not always have extensions. For directories, it would be "directory", but, in this case we never
// expect to have a directory, always only files.
val optionalPath = absNormArtifactLocationPath.invariantSeparatorsPathString.removeSuffixIfPresent("/")
val optionalPath = absNormArtifactLocationPath.invariantSeparatorsPathString.removeSuffix("/")
artifactPattern("$optionalPath/([type]/)[artifact](.[ext])")

content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import nl.adaptivity.xmlutil.serialization.XmlElement
import nl.adaptivity.xmlutil.serialization.XmlSerialName
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.intellij.platform.gradle.artifacts.transform.CollectorTransformer
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesHelper
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformRepositoriesExtension
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformRepositoriesHelper
import org.jetbrains.kotlin.util.removeSuffixIfPresent
import java.nio.file.Path
import kotlin.io.path.absolute
import kotlin.io.path.extension
Expand Down Expand Up @@ -162,7 +160,7 @@ private fun Path.toArtifactRelativeTo(basePath: Path?): IvyModule.Artifact {
val extString = absNormalizedPath.extension
val absPathStringWithoutLeading = absNormalizedPath.containingDirPathStringRelativeTo(absNormalizedBasePath)
// Remove the extension, if present, because the artifact pattern adds it.
val fileNameWithoutExt = absNormalizedPath.fileName.toString().removeSuffixIfPresent(".$extString")
val fileNameWithoutExt = absNormalizedPath.fileName.toString().removeSuffix(".$extString")

return IvyModule.Artifact(
type = absPathStringWithoutLeading,
Expand Down Expand Up @@ -218,4 +216,4 @@ private fun Path.containingDirPathStringRelativeTo(basePath: Path? = null): Stri
private fun String.removeLeadingPathSeparator() = when {
OperatingSystem.current().isWindows -> replaceFirst(Regex("^[a-zA-Z]:/"), "")
else -> removePrefix("/")
}
}

0 comments on commit eb773d4

Please sign in to comment.