-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide support for corporate repositories.
Also, upgrade documentr to newer version, as the old one fails to generate output with cryptic message.
- Loading branch information
1 parent
ec6edcf
commit b3ea92d
Showing
11 changed files
with
265 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/groovy/org/jetbrains/intellij/dependency/CustomPluginsRepository.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.jetbrains.intellij.dependency | ||
|
||
import org.gradle.api.Project | ||
import org.jetbrains.annotations.NotNull | ||
import org.jetbrains.annotations.Nullable | ||
import org.jetbrains.intellij.Utils | ||
|
||
class CustomPluginsRepository implements PluginsRepository { | ||
|
||
private final Project project | ||
private final String repoUrl | ||
private final Node pluginsXml | ||
|
||
CustomPluginsRepository(@NotNull Project project, @NotNull String repoUrl) { | ||
this.project = project | ||
def pluginsXmlUrl | ||
if (repoUrl.endsWith(".xml")) { | ||
this.repoUrl = repoUrl.substring(0, repoUrl.lastIndexOf('/')) | ||
pluginsXmlUrl = repoUrl | ||
} else { | ||
this.repoUrl = repoUrl | ||
pluginsXmlUrl = repoUrl + "/updatePlugins.xml" | ||
} | ||
Utils.debug(project, "Loading list of plugins from: ${pluginsXmlUrl}") | ||
pluginsXml = Utils.parseXml(new URI("${pluginsXmlUrl}").toURL().openStream()) | ||
} | ||
|
||
@Nullable | ||
File resolve(@NotNull String id, @NotNull String version, @Nullable String channel) { | ||
String downloadUrl = pluginsXml.category."idea-plugin" | ||
.find { it.id.text().equalsIgnoreCase(id) && it.version.text() == version } | ||
?."download-url"?.text() | ||
if (downloadUrl == null) return null | ||
|
||
return Utils.downloadZipArtifact(project, repoUrl, | ||
downloadUrl.replace("${version}.zip", "[revision].[ext]"), | ||
"com.jetbrains.plugins:$id:$version") | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/main/groovy/org/jetbrains/intellij/dependency/MavenPluginsRepository.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.jetbrains.intellij.dependency | ||
|
||
import org.gradle.api.Project | ||
import org.jetbrains.annotations.NotNull | ||
import org.jetbrains.annotations.Nullable | ||
import org.jetbrains.intellij.Utils | ||
|
||
class MavenPluginsRepository implements PluginsRepository { | ||
|
||
private final Project project | ||
private final String repoUrl | ||
|
||
MavenPluginsRepository(@NotNull Project project, @NotNull String repoUrl) { | ||
this.repoUrl = repoUrl | ||
this.project = project | ||
} | ||
|
||
@Nullable | ||
File resolve(@NotNull String id, @NotNull String version, @Nullable String channel) { | ||
def dependency = project.dependencies.create(PluginDependencyManager.pluginDependency(id, version, channel)) | ||
|
||
Utils.debug(project, "Adding Maven repository to download $dependency - $repoUrl") | ||
def mavenRepo = project.repositories.maven { it.url = repoUrl } | ||
|
||
def pluginFile = null | ||
try { | ||
def configuration = project.configurations.detachedConfiguration(dependency) | ||
pluginFile = configuration.singleFile | ||
} catch (Exception ignored) { | ||
} | ||
|
||
Utils.debug(project, "Removing Maven repository $repoUrl") | ||
project.repositories.remove(mavenRepo) | ||
|
||
return pluginFile | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.