484043: Create a p2 repository project

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=484043
Signed-off-by: Lorenzo Bettini <lorenzo.bettini@gmail.com>
This commit is contained in:
Lorenzo Bettini 2016-04-06 13:04:25 +02:00
parent 7f48d5d34c
commit a4a5907adb
4 changed files with 122 additions and 2 deletions

View file

@ -0,0 +1,73 @@
/*******************************************************************************
* Copyright (c) 2016 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.xtext.wizard
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
/**
* @author Lorenzo Bettini - Initial contribution and API
*/
@FinalFieldsConstructor
class P2RepositoryProject extends ProjectDescriptor {
override getNameQualifier() {
".repository"
}
override isEclipsePluginProject() {
false
}
override isPartOfGradleBuild() {
false
}
override isPartOfMavenBuild() {
true
}
override isEnabled() {
super.enabled && config.runtimeProject.isEclipsePluginProject
}
override getFiles() {
val files = newArrayList
files += super.files
files += file(Outlet.ROOT, "category.xml", categoryXml)
files
}
override getSourceFolders() {
#{}
}
def categoryXml() '''
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="«config.sdkProject.name»" version="0.0.0">
<category name="main"/>
</feature>
<feature id="«config.sdkProject.name».source" version="0.0.0">
<category name="main.source"/>
</feature>
<category-def name="main" label="«config.language.simpleName»"/>
<category-def name="main.source" label="«config.language.simpleName» (Sources)"/>
</site>
'''
override buildGradle() {
throw new UnsupportedOperationException("Eclipse repositories are not yet supported in Gradle")
}
override pom() {
super.pom => [
packaging = "eclipse-repository"
]
}
}

View file

@ -230,6 +230,49 @@ class ParentProjectDescriptor extends ProjectDescriptor {
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
«IF config.p2Project.enabled»
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<goals>
<goal>plugin-source</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attach-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
«ENDIF»
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>

View file

@ -36,7 +36,9 @@ class SdkFeatureProject extends ProjectDescriptor {
}
override isEnabled() {
super.enabled && config.runtimeProject.isEclipsePluginProject
(super.enabled && config.runtimeProject.isEclipsePluginProject)
||
config.p2Project.enabled
}
override getFiles() {

View file

@ -40,6 +40,7 @@ class WizardConfiguration {
val parentProject = new ParentProjectDescriptor(this)
val targetPlatformProject = new TargetPlatformProject(this)
val sdkProject = new SdkFeatureProject(this)
val p2Project = new P2RepositoryProject(this)
def Set<ProjectDescriptor> getEnabledProjects() {
val productionProjects = #[
@ -50,7 +51,8 @@ class WizardConfiguration {
intellijProject,
webProject,
targetPlatformProject,
sdkProject
sdkProject,
p2Project
].filter[enabled]
val testProjects = productionProjects