public class PdeProductBuildTask extends DefaultTask
Runs PDE build to make an RCP application or a P2 repository.
WARNING: This part of Goomph currently has the following precondition: your project must have the property VER_ECLIPSE=4.5.2 (or some other version), and you must have installed that Eclipse using Wuff. We will remove this restriction in the future.
import com.diffplug.gradle.*
import com.diffplug.gradle.pde.*
import com.diffplug.common.swt.os.*
task diffplugP2(type: PdeProductBuildTask) {
// the directory which will contain the results of the build
buildDir(P2_BUILD_DIR)
// copy the product file and its referenced images
copyProductAndImgs('../com.diffplug.core', 'plugins/com.diffplug.core')
// set the plugins to be the delta pack (implicit)
// and the combined targetplatform / obfuscation result
setPluginPath(PDE_PREP_DIR)
// if multiple versions of a plugin are detected between the pluginPath / targetplatform,
// you must list the plugin name, and all versions which are available. only the first
// plugin will be included in the final product build
resolveWithFirst('org.apache.commons.codec', '1.9.0', '1.6.0.v201305230611')
resolveWithFirst('org.apache.commons.logging', '1.2.0', '1.1.1.v201101211721')
// set the build properties to be as shown
addBuildProperty('topLevelElementType', 'product')
addBuildProperty('topLevelElementId', APP_ID)
addBuildProperty('product', '/com.diffplug.core/' + APP_ID)
addBuildProperty('runPackager', 'false')
addBuildProperty('groupConfigurations', 'true')
addBuildProperty('filteredDependencyCheck', 'true')
addBuildProperty('resolution.devMode', 'true')
// configure some P2 pieces
addBuildProperty('p2.build.repo', 'file:' + project.file(P2_REPO_DIR).absolutePath)
addBuildProperty('p2.gathering', 'true')
addBuildProperty('skipDirector', 'true')
// configure gradle's staleness detector
inputs.dir(PDE_PREP_DIR)
outputs.dir(P2_REPO_DIR)
doLast {
// artifact compression reduces content.xml from ~1MB to ~100kB
def compressXml = { name ->
def xml = project.file(P2_REPO_DIR + "/${name}.xml")
def jar = project.file(P2_REPO_DIR + "/${name}.jar")
ZipUtil.zip(xml, "${name}.xml", jar)
xml.delete()
}
compressXml('artifacts')
compressXml('content')
}
}
Task.NamerTASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE| Constructor and Description |
|---|
PdeProductBuildTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBuildProperty(String key,
String value)
Adds a property to the build properties file.
|
void |
build() |
void |
buildDir(Object buildDir)
The directory from which plugins will be pulled, besides the delta pack.
|
void |
copyProductAndImgs(Object src,
String dstRelPath)
Copies the product and imgs from the given directory to the given path within the build directory.
|
protected File |
getBuildDir() |
protected File |
getPluginPath() |
void |
productFilename(String productFile)
The name of the product file.
|
void |
resolveWithFirst(String pluginName,
String... versions)
Resolves conflicts at the given plugin with the given versions.
|
void |
setFeatureFolder(Object featureFolder)
The directory from which plugins will be pulled, besides the delta pack.
|
void |
setPluginPath(Object pluginPath)
The directory from which plugins will be pulled, besides the delta pack.
|
static void |
setProductFileVersions(File productFile,
String version,
List<String> lines,
com.diffplug.gradle.pde.PluginCatalog catalog)
Given a list of lines from the product file, this method changes them in-place to specify the specific version from the plugin path.
|
addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setName, setOnlyIf, setOnlyIf, setProject, setProperty, setShouldRunAfter, shouldRunAfter, toStringpublic void buildDir(Object buildDir)
The directory from which plugins will be pulled, besides the delta pack.
@OutputDirectory protected File getBuildDir()
public void productFilename(String productFile)
The name of the product file.
public void setPluginPath(Object pluginPath)
The directory from which plugins will be pulled, besides the delta pack.
protected File getPluginPath()
public void setFeatureFolder(Object featureFolder)
The directory from which plugins will be pulled, besides the delta pack.
public void addBuildProperty(String key, String value)
Adds a property to the build properties file.
public void resolveWithFirst(String pluginName, String... versions)
Resolves conflicts at the given plugin with the given versions.
public void copyProductAndImgs(Object src, String dstRelPath)
Copies the product and imgs from the given directory to the given path within the build directory.