Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 49 additions & 5 deletions gradle/scripts/verifier.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "de.undercouch:gradle-download-task:4.0.2"
classpath "de.undercouch:gradle-download-task:4.0.4"
}
}


import de.undercouch.gradle.tasks.download.DownloadAction
import org.gradle.api.internal.ConventionTask

import java.util.regex.Pattern


/**
* Runs the IntelliJ plugin verifier.
Expand Down Expand Up @@ -37,10 +40,14 @@ class PluginVerifierRunner extends ConventionTask {
* The identifiers of the IDEs to verify against.
*/
private List<String> ides = new ArrayList<String>()
/**
* Base URL to resolve IDEs at; "releases/" or "snapshots/" will be appended later.
*/
private String repoUrl = "https://www.jetbrains.com/intellij-repository/"
/**
* The version of the plugin verifier to use.
*/
private String verifierVersion = "1.222"
private String verifierVersion = "1.241"


@Input
Expand All @@ -61,6 +68,15 @@ class PluginVerifierRunner extends ConventionTask {
this.ides = ides
}

@Input
String getRepoUrl() {
return repoUrl
}

void setRepoUrl(String repoUrl) {
this.repoUrl = repoUrl
}

@Input
String getVerifierVersion() {
return verifierVersion
Expand Down Expand Up @@ -109,6 +125,8 @@ class PluginVerifierRunner extends ConventionTask {
* @return the link to the resolved archive
*/
File resolveIde(String identifier) {
project.repositories.maven { it.url = "${repoUrl}/${releaseType(identifier)}" }

logger.lifecycle("Resolving $identifier")
def dependency = project.dependencies.create(identifierToDependency(identifier))
def configuration = project.configurations.detachedConfiguration(dependency)
Expand Down Expand Up @@ -144,15 +162,41 @@ class PluginVerifierRunner extends ConventionTask {
}


/**
* Matches snapshots of major releases.
*
* Code taken from https://github.com/JetBrains/gradle-intellij-plugin/blob/a4fc011/src/main/groovy/org/jetbrains/intellij/Utils.groovy.
*/
private static def MAJOR_VERSION_PATTERN = Pattern.compile("(RIDER-)?\\d{4}\\.\\d-SNAPSHOT")

/**
* Returns the release type of the given version number.
*
* Code taken from https://github.com/JetBrains/gradle-intellij-plugin/blob/a4fc011/src/main/groovy/org/jetbrains/intellij/Utils.groovy.
*
* @param version the version number to determine the release type of
* @return the release type of the given version number
*/
private static String releaseType(String version) {
if (version.endsWith("-EAP-SNAPSHOT") || version.endsWith("-EAP-CANDIDATE-SNAPSHOT")
|| version.endsWith("-CUSTOM-SNAPSHOT") || MAJOR_VERSION_PATTERN.matcher(version).matches()) {
return "snapshots"
} else if (version.endsWith("-SNAPSHOT")) {
return "nightly"
} else {
return "releases"
}
}

/**
* Translates a user-friendly identifier to a Maven-style dependency.
*
* @param identifier the user-friendly identifier
* @return a Maven-style dependency
* @throws IllegalArgumentException if the identifier was not recognized
*/
static String identifierToDependency(String identifier) {
def (type, version) = identifier.split("-")
private static String identifierToDependency(String identifier) {
def (type, version) = identifier.split("-", 2)

def dependencyGroup
def dependencyName
Expand Down