mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Ability to specify separate versions for non-bundled plugins
This commit is contained in:
committed by
Andrey Vlasovskikh
parent
1fe7b39958
commit
2d57e53ff0
+11
-6
@@ -260,7 +260,8 @@ class DistributionJARsBuilder {
|
||||
}
|
||||
def patchedPluginXmlDir = "$buildContext.paths.temp/patched-plugin-xml/$plugin.mainModule"
|
||||
ant.copy(file: pluginXmlPath, todir: "$patchedPluginXmlDir/META-INF")
|
||||
setPluginVersionAndSince("$patchedPluginXmlDir/META-INF/plugin.xml", buildContext.buildNumber,
|
||||
setPluginVersionAndSince("$patchedPluginXmlDir/META-INF/plugin.xml", getPluginVersion(plugin),
|
||||
buildContext.buildNumber,
|
||||
productLayout.prepareCustomPluginRepositoryForPublishedPlugins,
|
||||
productLayout.pluginModulesWithRestrictedCompatibleBuildRange.contains(plugin.mainModule))
|
||||
layoutBuilder.patchModuleOutput(plugin.mainModule, patchedPluginXmlDir)
|
||||
@@ -272,7 +273,7 @@ class DistributionJARsBuilder {
|
||||
def nonBundledPluginsArtifacts = "$buildContext.paths.artifacts/plugins"
|
||||
pluginsToPublish.each { plugin ->
|
||||
def directory = plugin.directoryName
|
||||
String suffix = productLayout.prepareCustomPluginRepositoryForPublishedPlugins ? "" : "-${buildContext.buildNumber}"
|
||||
String suffix = productLayout.prepareCustomPluginRepositoryForPublishedPlugins ? "" : "-${getPluginVersion(plugin)}"
|
||||
ant.zip(destfile: "$nonBundledPluginsArtifacts/$directory${suffix}.zip") {
|
||||
zipfileset(dir: "$pluginsToPublishDir/$directory", prefix: directory)
|
||||
}
|
||||
@@ -283,6 +284,10 @@ class DistributionJARsBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private String getPluginVersion(PluginLayout plugin) {
|
||||
return plugin.version != null ? plugin.version : buildContext.buildNumber
|
||||
}
|
||||
|
||||
private List<PluginLayout> getPluginsByModules(Collection<String> modules) {
|
||||
def allNonTrivialPlugins = buildContext.productProperties.productLayout.allNonTrivialPlugins
|
||||
def allOptionalModules = allNonTrivialPlugins.collectMany {it.optionalModules}
|
||||
@@ -453,10 +458,10 @@ class DistributionJARsBuilder {
|
||||
new LayoutBuilder(buildContext.ant, buildContext.project, COMPRESS_JARS)
|
||||
}
|
||||
|
||||
private void setPluginVersionAndSince(String pluginXmlPath, String buildNumber, boolean setExactNumberInUntilBuild, boolean useRestrictedCompatibleBuildRange) {
|
||||
private void setPluginVersionAndSince(String pluginXmlPath, String version, String buildNumber, boolean setExactNumberInUntilBuild, boolean useRestrictedCompatibleBuildRange) {
|
||||
buildContext.ant.replaceregexp(file: pluginXmlPath,
|
||||
match: "<version>[\\d.]*</version>",
|
||||
replace: "<version>${buildNumber}</version>")
|
||||
replace: "<version>${version}</version>")
|
||||
def sinceBuild
|
||||
def untilBuild
|
||||
if (!setExactNumberInUntilBuild && buildNumber.matches(/(\d+\.)+\d+/)) {
|
||||
@@ -481,12 +486,12 @@ class DistributionJARsBuilder {
|
||||
replace: "<idea-version since-build=\"${sinceBuild}\"")
|
||||
buildContext.ant.replaceregexp(file: pluginXmlPath,
|
||||
match: "<change-notes>\\s*<\\!\\[CDATA\\[\\s*Plugin version: \\\$\\{version\\}",
|
||||
replace: "<change-notes>\n<![CDATA[\nPlugin version: ${buildNumber}")
|
||||
replace: "<change-notes>\n<![CDATA[\nPlugin version: ${version}")
|
||||
def file = new File(pluginXmlPath)
|
||||
def text = file.text
|
||||
def anchor = text.contains("</id>") ? "</id>" : "</name>"
|
||||
if (!text.contains("<version>")) {
|
||||
file.text = text.replace(anchor, "${anchor}\n <version>${buildNumber}</version>")
|
||||
file.text = text.replace(anchor, "${anchor}\n <version>${version}</version>")
|
||||
text = file.text
|
||||
}
|
||||
if (!text.contains("<idea-version since-build")) {
|
||||
|
||||
@@ -27,6 +27,7 @@ class PluginLayout extends BaseLayout {
|
||||
String directoryName
|
||||
final Set<String> optionalModules = new LinkedHashSet<>()
|
||||
private boolean doNotCreateSeparateJarForLocalizableResources
|
||||
String version
|
||||
|
||||
private PluginLayout(String mainModule) {
|
||||
this.mainModule = mainModule
|
||||
@@ -48,6 +49,7 @@ class PluginLayout extends BaseLayout {
|
||||
body.delegate = spec
|
||||
body()
|
||||
layout.directoryName = spec.directoryName
|
||||
layout.version = spec.version
|
||||
spec.withModule(mainModuleName, spec.mainJarName)
|
||||
if (layout.doNotCreateSeparateJarForLocalizableResources) {
|
||||
layout.modulesWithLocalizableResourcesInCommonJar.clear()
|
||||
@@ -80,6 +82,10 @@ class PluginLayout extends BaseLayout {
|
||||
* Name of the main plugin JAR file
|
||||
*/
|
||||
String mainJarName
|
||||
/**
|
||||
* Version of the plugin if it differs from the global build number
|
||||
*/
|
||||
String version
|
||||
|
||||
PluginLayoutSpec(PluginLayout layout) {
|
||||
super(layout)
|
||||
|
||||
Reference in New Issue
Block a user