-
Notifications
You must be signed in to change notification settings - Fork 53
[BUILD][E] Create update-site via gradle #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
47e6b23
467780c
04ed238
af5f722
01b2b47
1479857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,18 @@ | ||
| plugins { | ||
| id("saros.gradle.eclipse.plugin") | ||
| id("saros.gradle.eclipse.plugin") | ||
| id("com.diffplug.p2.asmaven") // Provides the class FeaturesAndBundlesPublisher | ||
| } | ||
|
|
||
| import com.diffplug.gradle.p2.FeaturesAndBundlesPublisher | ||
| import com.diffplug.gradle.p2.CategoryPublisher | ||
| import com.diffplug.gradle.pde.EclipseRelease | ||
|
|
||
| val versionQualifier = ext.get("versionQualifier") as String | ||
| val eclipseVersionNr = ext.get("eclipseVersion") as String | ||
|
|
||
| configurations { | ||
| val testConfig by getting {} | ||
| val testImplementation by getting { | ||
| getByName("testImplementation") { | ||
| extendsFrom(testConfig) | ||
| } | ||
| } | ||
|
|
@@ -18,6 +24,7 @@ sarosEclipse { | |
| isCreateBundleJar = true | ||
| isAddDependencies = true | ||
| pluginVersionQualifier = versionQualifier | ||
| eclipseVersion = eclipseVersionNr | ||
| } | ||
|
|
||
| sourceSets { | ||
|
|
@@ -74,4 +81,130 @@ tasks { | |
| from(rootProject.file("log4j2.xml")) | ||
| from(rootProject.file("saros_log4j2.xml")) | ||
| } | ||
|
|
||
| /* Eclipse release tasks | ||
| * | ||
| * The following tasks provide the functionality of creating | ||
| * an eclipse update-site (via "updateSite") or dropin (via "dropin"). | ||
| * The creation of the update-site uses as recommended the eclipse's | ||
| * P2Directory. You can find a how-to here: | ||
| * http://maksim.sorokin.dk/it/2010/11/26/creating-a-p2-repository-from-features-and-plugins/ | ||
| * | ||
| * Instead of calling the P2Director via CLI we use the goomph | ||
| * plugin's classes that provide an abstraction layer of the P2Director. | ||
| */ | ||
|
|
||
| val updateSiteDirPath = "build/update-site" | ||
|
|
||
| /* Step 0 of update-site creation | ||
| * | ||
| * Creates the structure: | ||
| * update-site/ | ||
| * |- features/ | ||
| * |- feature.xml | ||
| * |- plugins/ | ||
| * |- saros.core.jar | ||
| * |- saros.eclipse.jar | ||
| * |- site.xml | ||
| */ | ||
| val updateSitePreparation by registering(Copy::class) { | ||
| dependsOn(":saros.core:jar", ":saros.eclipse:jar") | ||
|
|
||
| into(updateSiteDirPath) | ||
| into("features") { | ||
| from("feature/feature.xml") | ||
| } | ||
| into("plugins") { | ||
| from(project.tasks.findByName("jar")) | ||
| from(project(":saros.core").tasks.findByName("jar")) | ||
| } | ||
| from("update/site.xml") | ||
| } | ||
|
|
||
| /* Step 1 of update-site creation | ||
| * | ||
| * Creates the basic p2-Repository, but it is | ||
| * not usable as update-site, because the plugins | ||
| * are not visible to users. | ||
| * | ||
| * equivalent to P2Director call with: | ||
| * <code> | ||
| * org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \ | ||
| * -source <project dir>/build/update-site \ | ||
| * -compress \ | ||
| * -inplace \ | ||
| * -append \ | ||
| * -publishArtifacts | ||
| * </code> | ||
| */ | ||
| val updateSiteFeaturesAndBundlesPublishing by registering { | ||
| dependsOn(updateSitePreparation) | ||
| doLast { | ||
| with(FeaturesAndBundlesPublisher()) { | ||
| source(project.file(updateSiteDirPath)) | ||
| compress() | ||
| inplace() | ||
| append() | ||
| publishArtifacts() | ||
| runUsingBootstrapper() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /* Step 2 of update-site creation | ||
| * | ||
| * Adds the meta-data to the repository to make | ||
| * the plugin accessible for users. | ||
| * | ||
| * equivalent to P2Director call with: | ||
| * <code> | ||
| * org.eclipse.equinox.p2.publisher.CategoryPublisher \ | ||
| * -metadataRepository file:<project dir>/build/update-site \ | ||
| * -categoryDefinition file:<project dir>/build/update-site/site.xml | ||
| * </code> | ||
| */ | ||
| val updateSiteCategoryPublishing by registering { | ||
| dependsOn(updateSiteFeaturesAndBundlesPublishing) | ||
| doLast { | ||
| with(CategoryPublisher(EclipseRelease.official(eclipseVersionNr))) { | ||
| metadataRepository(project.file(updateSiteDirPath)) | ||
| categoryDefinition(project.file("$updateSiteDirPath/site.xml")) | ||
| runUsingPdeInstallation() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /* Step 3 of update-site creation | ||
| * | ||
| * The creation-process is already completed after | ||
| * step 2, but this task removes the meta-data which | ||
| * were necessary for update-site creation but are | ||
| * not part of the update-site. | ||
| */ | ||
| val updateSite by registering(Delete::class) { | ||
| dependsOn(updateSiteCategoryPublishing) | ||
|
|
||
| delete("$updateSiteDirPath/features/feature.xml") | ||
| delete(fileTree("$updateSiteDirPath/plugins") { | ||
| // Remove all bundles without version (which is appended during update-site build) | ||
| exclude("*_*.jar") | ||
| }) | ||
| delete("$updateSiteDirPath/site.xml") | ||
| } | ||
|
|
||
| /* Creates a dropin at build/dropin | ||
| * | ||
| * Creates an update-site, removes the superfluous meta-data | ||
| * and creates a zip. | ||
| */ | ||
| register("dropin", Zip::class) { | ||
| dependsOn(updateSite) | ||
|
|
||
| archiveFileName.set("saros-eclipse-dropin.zip") | ||
| destinationDirectory.set(project.file("build/dropin")) | ||
|
|
||
| from(updateSiteDirPath) { | ||
| exclude("*.jar") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this exclude the jar files?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It excludes the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have expected that the cleanup was already done in l.167 - l.176.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cleanup you mention removes all metadata that are not part of the update-site, but these metadata are part of the update-site, but not part of the dropin. |
||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.