Skip to content

Commit

Permalink
super
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Nov 18, 2010
1 parent 7a6a2d8 commit c133a9a
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@

/pdePlugin/build
/pdePlugin/.gradle
/pdePlugin/.project
/pdePlugin/.classpath
Expand Up @@ -31,8 +31,7 @@ public abstract class PdeConvention {
Project project;
Map customValues;

String archiveNamePrefix;
String timestamp;

String buildDirectory;
String builderDir;
List<String> pluginsSrcDirList;
Expand Down Expand Up @@ -148,16 +147,7 @@ public abstract class PdeConvention {
return normPathForAnt(publishDirectory)
}

public String getCustomProperty(String key) {
return customValues.get(key);
}

public String getArchiveNamePrefix() {
if (archiveNamePrefix == null) {
archiveNamePrefix = "${buildId}-${jobVersion}.${timestamp}"
}
return archiveNamePrefix;
}




Expand All @@ -166,7 +156,16 @@ public abstract class PdeConvention {
println "* PDE PARAMETERS *"
println "===================================================="
println "Job version : " + (jobVersion == null ? "" : jobVersion);
println "Timestamp : " + (timestamp == null ? "" : timestamp);
println "BuildId : " + (buildId == null ? "" : buildId);
if (getType() == BuildType.product) {
println "Product : " + ((ProductPdeConvention) this).getProductName();
println "Archive Name Prefix : " + ((ProductPdeConvention) this).getArchiveNamePrefix();
} else {
println "Built Features : ";
for (String feat : ((FeaturePdeConvention) this).getFeatures()) {
println " -> " + feat;
}
}
println ""
println "Build directory : " + (getBuildDirectory() == null ? "" : getBuildDirectory());
println "Launcher Path : " + (getEclipseLauncher() == null ? "" : getEclipseLauncher());
Expand Down
Expand Up @@ -33,6 +33,7 @@ import org.gradle.api.Project
public class ProductPdeConvention extends PdeConvention {

private String productName
private String archiveNamePrefix;

ProductPdeConvention(Project project, Map customValues) {
super(project, customValues)
Expand All @@ -42,6 +43,13 @@ public class ProductPdeConvention extends PdeConvention {
return this.productName;
}

public String getArchiveNamePrefix() {
if (archiveNamePrefix == null) {
archiveNamePrefix = "${buildId}-${jobVersion}.${buildId}"
}
return archiveNamePrefix;
}

@Override
public BuildType getType() {
return BuildType.product;
Expand Down
Expand Up @@ -54,27 +54,27 @@ class AntPdeBuild {
args << "-buildfile \"${launcher}/plugins/org.eclipse.pde.build/scripts/build.xml\""
}

args << "-DbuildDirectory=${conv.getBuildDirectory()}"
args << "-Dbuilder=${conv.getBuilderDir()}"
args << "-DbuildDirectory=\"${conv.getBuildDirectory()}\""
args << "-Dbuilder=\"${conv.getBuilderDir()}\""

args << "-Dtimestamp=${conv.getTimestamp()}"
args << "-Dbase=${conv.getBase()}"
args << "-DbaseLocation=${conv.getBaseLocation()}"
args << "-Dconfigs=${conv.getEnvConfigs()}"
args << "-DarchiveNamePrefix=${conv.getArchiveNamePrefix()}"
args << "-DjavacSource=${conv.getJavacSource()}"
args << "-DjavacTarget=${conv.getJavacTarget()}"
args << "-DbuildId=${conv.getBuildId()}"
args << "-Dbase=\"${conv.getBase()}\""
args << "-DbaseLocation=\"${conv.getBaseLocation()}\""
args << "-DjavacSource=\"${conv.getJavacSource()}\""
args << "-DjavacTarget=\"${conv.getJavacTarget()}\""
args << "-DbuildId=\"${conv.getBuildId()}\""

if (conv.getType() == BuildType.product) {
def productFile = (ProductPdeConvention) conv.getProductName()
args << "-Dproduct=${productFile}"
def productFile = ((ProductPdeConvention) conv).getProductName()
def archive = ((ProductPdeConvention) conv).getArchiveNamePrefix()
args << "-Dproduct=\"${productFile}\""
args << "-Dconfigs=\"${conv.getEnvConfigs()}\""
args << "-DarchiveNamePrefix=\"${archive}\""
}

//---------- Build the pluginPath
if (conv.getExtLocations() && !conv.getUsePreviousLinks()) {
String pluginPath = conv.getExtLocations().join(File.pathSeparator)
args << "-DpluginPath=${pluginPath}"
args << "-DpluginPath=\"${pluginPath}\""
}

//Built from the given property file
Expand Down
Expand Up @@ -27,28 +27,37 @@ import groovy.util.AntBuilder;

import com.thalesgroup.gradle.pde.BuildType;
import com.thalesgroup.gradle.pde.PdeConvention;
import com.thalesgroup.gradle.pde.FeaturePdeConvention;

class AntPdeDeploy {

void execute(PdeConvention conv, AntBuilder ant) {

def zipDir = "${conv.getBuildDirectory()}/I.${conv.getBuildId()}"
def zipFileName = "${zipDir}/${conv.getArchiveNamePrefix()}";

if (conv.getType() == BuildType.product && conv.getEnvConfigs() != null) {
def conf = conv.getEnvConfigs().replace(' ', '');
conf = conf.replace(',', '.');
if (!"*.*.*".equals(conf)) {
zipFileName << "-${conf}"
}
}
zipFileName << ".zip"

//delete the publish directory
println "Deleting ${zipFileName} file..."
println "Deleting ${conv.getPublishDirectory()} file..."
ant.delete(dir: conv.getPublishDirectory())


ant.unzip(dest: conv.getPublishDirectory(), src: zipFileName)
def zipDir = "${conv.getBuildDirectory()}/${conv.getBuildId()}"

if (conv.getType() == BuildType.product) {
def zipFileName = "${zipDir}/${conv.getArchiveNamePrefix()}";

if (conv.getEnvConfigs()) {
def conf = conv.getEnvConfigs().replace(' ', '');
conf = conf.replace(',', '.');
if (!"*.*.*".equals(conf)) {
zipFileName << "-${conf}"
}
}
zipFileName << ".zip"
ant.unzip(dest: conv.getPublishDirectory(), src: zipFileName)
} else {
for (String feat : ((FeaturePdeConvention) conv).getFeatures()) {
def zipFileName = "${zipDir}/${feat}-${conv.getBuildId()}.zip";
ant.unzip(dest: conv.getPublishDirectory(), src: zipFileName)
}
}
}

}
12 changes: 6 additions & 6 deletions pdePlugin/src/main/resources/build.properties
Expand Up @@ -28,7 +28,7 @@ product=/plugin or feature id/path/to/.product
runPackager=true

#Set the name of the archive that will result from the product build.
archiveNamePrefix=${buildID}
#archiveNamePrefix=${buildID}

# The prefix that will be used in the generated archive.
archivePrefix=eclipse
Expand Down Expand Up @@ -124,20 +124,20 @@ buildDirectory=${user.home}/eclipse.build

# Type of build. Used in naming the build output. Typically this value is
# one of I, N, M, S, ...
buildType=I
#buildType=I

# ID of the build. Used in naming the build output.
buildId=TestBuild
buildId=

# Label for the build. Used in naming the build output
buildLabel=${buildType}.${buildId}
buildLabel=${buildId}

# Timestamp for the build. Used in naming the build output
timestamp=007
timestamp=${buildId}

#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
#The value will only be applied to plugin or features indicating build.properties, qualifier = context
#forceContextQualifier=<the value for the qualifier>
forceContextQualifier=${buildId}

#Enable / disable the generation of a suffix for the features that use .qualifier.
#The generated suffix is computed according to the content of the feature
Expand Down

0 comments on commit c133a9a

Please sign in to comment.