build scripts: allow specifying path to svg icon in ApplicationInfo.xml files (IDEA-166445)

The svg file will be copied to bin directory and can be found there by CreateDesktopEntryAction and LibNotifyWrapper.
This commit is contained in:
nik
2018-09-27 15:39:06 +03:00
parent b0ed8b9f09
commit 2cc7bc4434
3 changed files with 17 additions and 0 deletions
@@ -39,6 +39,7 @@ class ApplicationInfoProperties {
final String motto
final String companyName
final String shortCompanyName
final String svgRelativePath
final boolean isEAP
@SuppressWarnings(["GrUnresolvedAccess", "GroovyAssignabilityCheck"])
@@ -57,6 +58,7 @@ class ApplicationInfoProperties {
minorVersionMainPart = minorVersion.takeWhile { it != '.' }
isEAP = Boolean.parseBoolean(root.version.first().@eap)
shortCompanyName = root.company.first().@shortName ?: shortenCompanyName(companyName)
svgRelativePath = root.icon.first().@svg
}
String getUpperCaseProductName() { shortProductName.toUpperCase() }
@@ -224,10 +224,24 @@ idea.fatal.error.notification=disabled
}
}
if (buildContext.applicationInfo.svgRelativePath != null) {
buildContext.ant.copy(file: findBrandingResource(buildContext.applicationInfo.svgRelativePath), tofile: "$buildContext.paths.distAll/bin/${buildContext.productProperties.baseFileName}.svg")
}
buildContext.productProperties.copyAdditionalFiles(buildContext, buildContext.paths.distAll)
}
}
private File findBrandingResource(String relativePath) {
def inModule = buildContext.findFileInModuleSources(buildContext.productProperties.applicationInfoModule, relativePath)
if (inModule != null) return inModule
def inResources = buildContext.productProperties.brandingResourcePaths.collect { new File(it, relativePath) }.find { it.exists() }
if (inResources == null) {
buildContext.messages.error("Cannot find '$relativePath' in sources of '$buildContext.productProperties.applicationInfoModule' and in $buildContext.productProperties.brandingResourcePaths")
}
return inResources
}
private void copyLogXml() {
def src = new File("$buildContext.paths.communityHome/bin/log.xml")
def dst = new File("$buildContext.paths.distAll/bin/log.xml")
@@ -279,6 +279,7 @@
<xs:attribute type="xs:string" name="size32"/>
<xs:attribute type="xs:string" name="size128"/>
<xs:attribute type="xs:string" name="ico"/>
<xs:attribute type="xs:string" name="svg"/>
</xs:complexType>
<xs:complexType name="packageType">
<xs:attribute type="xs:string" name="code"/>