Build: Make idea/eclipse project generation build generated resources for plugins

This adds a generated-resources dir that the plugin properties are
generated into. This must be outside of the build dir, since intellij
has build as "excluded".

closes #14392
This commit is contained in:
Ryan Ernst 2015-11-02 10:14:04 -08:00
parent 5104365a92
commit b7f8e5c1df
4 changed files with 12 additions and 5 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ work/
logs/ logs/
.DS_Store .DS_Store
build/ build/
generated-resources/
**/.local* **/.local*
docs/html/ docs/html/
docs/build.log docs/build.log

View File

@ -153,7 +153,7 @@ allprojects {
apply plugin: 'idea' apply plugin: 'idea'
} }
if (hasProperty('projectsPrefix') == false) { if (projectsPrefix.isEmpty()) {
idea { idea {
project { project {
languageLevel = sourceCompatibility languageLevel = sourceCompatibility

View File

@ -84,9 +84,11 @@ class PluginBuildPlugin extends BuildPlugin {
static Task configureBundleTask(Project project) { static Task configureBundleTask(Project project) {
PluginPropertiesTask buildProperties = project.tasks.create(name: 'pluginProperties', type: PluginPropertiesTask) PluginPropertiesTask buildProperties = project.tasks.create(name: 'pluginProperties', type: PluginPropertiesTask)
File pluginMetadata = project.file("src/main/plugin-metadata") File pluginMetadata = project.file("src/main/plugin-metadata")
project.processTestResources { project.sourceSets.test {
from buildProperties output.dir(buildProperties.propertiesFile.parentFile, builtBy: 'pluginProperties')
from pluginMetadata resources {
srcDir pluginMetadata
}
} }
Task bundle = project.tasks.create(name: 'bundlePlugin', type: Zip, dependsOn: [project.jar, buildProperties]) Task bundle = project.tasks.create(name: 'bundlePlugin', type: Zip, dependsOn: [project.jar, buildProperties])
bundle.configure { bundle.configure {

View File

@ -33,9 +33,13 @@ class PluginPropertiesTask extends DefaultTask {
PluginPropertiesExtension extension PluginPropertiesExtension extension
Map<String, String> properties = new HashMap<>() Map<String, String> properties = new HashMap<>()
File generatedResourcesDir = new File(project.projectDir, "generated-resources")
PluginPropertiesTask() { PluginPropertiesTask() {
extension = project.extensions.create('esplugin', PluginPropertiesExtension, project) extension = project.extensions.create('esplugin', PluginPropertiesExtension, project)
project.clean {
delete generatedResourcesDir
}
project.afterEvaluate { project.afterEvaluate {
if (extension.description == null) { if (extension.description == null) {
throw new InvalidUserDataException('description is a required setting for esplugin') throw new InvalidUserDataException('description is a required setting for esplugin')
@ -54,7 +58,7 @@ class PluginPropertiesTask extends DefaultTask {
} }
@OutputFile @OutputFile
File propertiesFile = new File(project.buildDir, "plugin" + File.separator + "plugin-descriptor.properties") File propertiesFile = new File(generatedResourcesDir, "plugin-descriptor.properties")
void fillProperties() { void fillProperties() {
// TODO: need to copy the templated plugin-descriptor with a dependent task, since copy requires a file (not uri) // TODO: need to copy the templated plugin-descriptor with a dependent task, since copy requires a file (not uri)