pdebuild-ant

16:50:54.403 INFO  jd.cli.Main - Decompiling pdebuild-ant.jar
package org.eclipse.pde.internal.build.generator;

import java.net.URISyntaxException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.jarprocessor.Utils;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.internal.build.publisher.compatibility.GeneratorApplication;
import org.eclipse.pde.internal.build.publisher.compatibility.IncrementalGenerator;
import org.eclipse.pde.internal.build.tasks.TaskMessages;

public class GeneratorTask
  extends Task
{
  private static final String ANT_PREFIX = "${";
  protected PublisherInfo info = null;
  private GeneratorApplication generator = null;
  private String mode;
  
  public void execute()
    throws BuildException
  {
    try
    {
      IncrementalGenerator incremental = new IncrementalGenerator();
      incremental.setMode(mode);
      incremental.run(generator, info);
      if (!"incremental".equals(mode))
      {
        info = null;
        generator = null;
      }
    }
    catch (Exception e)
    {
      throw new BuildException(TaskMessages.error_callingGenerator, e);
    }
  }
  
  protected PublisherInfo getInfo()
  {
    if (info == null) {
      info = new PublisherInfo();
    }
    return info;
  }
  
  protected GeneratorApplication getGenerator()
  {
    if (generator == null) {
      generator = new GeneratorApplication();
    }
    return generator;
  }
  
  public void setAppend(String value)
  {
    getGenerator().setAppend(Boolean.valueOf(value).booleanValue());
  }
  
  public void setArtifactRepository(String location)
  {
    if ((location != null) && (!location.startsWith("${"))) {
      try
      {
        getGenerator().setArtifactLocation(URIUtil.fromString(location));
      }
      catch (URISyntaxException localURISyntaxException)
      {
        throw new IllegalArgumentException(NLS.bind(TaskMessages.error_artifactRepoNotURI, location));
      }
    }
  }
  
  public void setArtifactRepositoryName(String name)
  {
    getGenerator().setArtifactRepositoryName(name);
  }
  
  public void setBase(String value)
  {
    if (generator == null) {
      generator = new GeneratorApplication();
    }
  }
  
  public void setBundles(String value)
  {
    if (generator == null) {
      generator = new GeneratorApplication();
    }
  }
  
  public void setCompress(String value)
  {
    getGenerator().setCompress(Boolean.valueOf(value).booleanValue());
  }
  
  public void setConfig(String value)
  {
    getGenerator().setOperation(3);
    getGenerator().setSource(value);
  }
  
  public void setInplace(String value)
  {
    getGenerator().setOperation(2);
    getGenerator().setSource(value);
  }
  
  public void setSource(String location)
  {
    getGenerator().setOperation(1);
    getGenerator().setSource(location);
  }
  
  public void setUpdateSite(String value)
  {
    getGenerator().setOperation(4);
    getGenerator().setSource(value);
  }
  
  public void setExe(String value)
  {
    if (info == null) {
      info = new PublisherInfo();
    }
  }
  
  public void setFeatures(String value)
  {
    if (generator == null) {
      generator = new GeneratorApplication();
    }
  }
  
  public void setFlavor(String flavor)
  {
    if ((flavor != null) && (!flavor.startsWith("${"))) {
      getGenerator().setFlavor(flavor);
    }
  }
  
  public void setLauncherConfig(String launcherConfig)
  {
    if ((launcherConfig != null) && (!launcherConfig.startsWith("${")))
    {
      String[] array = Utils.toStringArray(launcherConfig, "_");
      if (array.length >= 3)
      {
        StringBuffer config = new StringBuffer(array[1]);
        config.append('.');
        config.append(array[0]);
        config.append('.');
        config.append(array[2]);
        if (array.length > 3)
        {
          config.append('_');
          config.append(array[3]);
        }
        getInfo().setConfigurations(new String[] { config.toString() });
      }
    }
  }
  
  public void setMetadataRepository(String location)
  {
    if ((location != null) && (!location.startsWith("${"))) {
      try
      {
        getGenerator().setMetadataLocation(URIUtil.fromString(location));
      }
      catch (URISyntaxException localURISyntaxException)
      {
        throw new IllegalArgumentException(NLS.bind(TaskMessages.error_metadataRepoNotURI, location));
      }
    }
  }
  
  public void setMetadataRepositoryName(String name)
  {
    if ((name != null) && (!name.startsWith("${"))) {
      getGenerator().setMetadataRepositoryName(name);
    }
  }
  
  public void setNoDefaultIUs(String value)
  {
    if (info == null) {
      info = new PublisherInfo();
    }
  }
  
  public void setP2OS(String value)
  {
    if (info == null) {
      info = new PublisherInfo();
    }
  }
  
  public void setProductFile(String file)
  {
    if ((file != null) && (!file.startsWith("${"))) {
      getGenerator().setProductFile(file);
    }
  }
  
  public void setPublishArtifactRepository(boolean value)
  {
    int options = getInfo().getArtifactOptions();
    if (value) {
      info.setArtifactOptions(options | 0x1);
    } else {
      info.setArtifactOptions(options & 0xFFFFFFFE);
    }
  }
  
  public void setPublishArtifacts(boolean value)
  {
    int options = getInfo().getArtifactOptions();
    if (value) {
      info.setArtifactOptions(options | 0x2);
    } else {
      info.setArtifactOptions(options & 0xFFFFFFFD);
    }
  }
  
  public void setRoot(String root)
  {
    if ((root == null) || (root.startsWith("${"))) {
      return;
    }
    getGenerator().setRoodId(root);
  }
  
  public void setRootVersion(String rootVersion)
  {
    if ((rootVersion == null) || (rootVersion.startsWith("${"))) {
      return;
    }
    getGenerator().setRootVersion(rootVersion);
  }
  
  public void setMode(String mode)
  {
    this.mode = mode;
  }
  
  public void setVersionAdvice(String advice)
  {
    if ((advice != null) && (!advice.startsWith("${"))) {
      getGenerator().setVersionAdvice(advice);
    }
  }
  
  public void setSite(String site)
  {
    if ((site == null) || (site.startsWith("${"))) {
      return;
    }
    try
    {
      getGenerator().setSite(URIUtil.fromString(site));
    }
    catch (URISyntaxException localURISyntaxException)
    {
      throw new IllegalArgumentException(NLS.bind(TaskMessages.error_locationNotURI, site));
    }
  }
  
  public void setSiteVersion(String version)
  {
    if ((version == null) || (version.startsWith("${"))) {
      return;
    }
    getGenerator().setSiteVersion(version);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.build.generator.GeneratorTask
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.build.publisher;

import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.URIUtil;

public class AbstractPublisherTask$RepoEntry
{
  private URI repoLocation;
  private Boolean metadata = null;
  private Boolean artifact = null;
  
  public boolean isMetadataRepository()
  {
    if (metadata != null) {
      return metadata.booleanValue();
    }
    return !Boolean.TRUE.equals(artifact);
  }
  
  public boolean isArtifactRepository()
  {
    if (artifact != null) {
      return artifact.booleanValue();
    }
    return !Boolean.TRUE.equals(metadata);
  }
  
  public URI getRepositoryLocation()
  {
    return repoLocation;
  }
  
  public void setLocation(String location)
  {
    try
    {
      repoLocation = URIUtil.fromString(location);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      throw new IllegalArgumentException("Repository location (" + location + ") must be a URL.");
    }
  }
  
  public void setMetadata(boolean metadata)
  {
    this.metadata = Boolean.valueOf(metadata);
  }
  
  public void setArtifact(boolean artifact)
  {
    this.artifact = Boolean.valueOf(artifact);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.build.publisher.AbstractPublisherTask.RepoEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.build.publisher;

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.pde.internal.build.AbstractScriptGenerator;

public abstract class AbstractPublisherTask
  extends Task
{
  protected static final String ANT_PREFIX = "${";
  protected URI metadataLocation;
  protected String metadataRepoName;
  protected URI artifactLocation;
  protected String artifactRepoName;
  protected String baseDirectory;
  
  public static class RepoEntry
  {
    private URI repoLocation;
    private Boolean metadata = null;
    private Boolean artifact = null;
    
    public boolean isMetadataRepository()
    {
      if (metadata != null) {
        return metadata.booleanValue();
      }
      return !Boolean.TRUE.equals(artifact);
    }
    
    public boolean isArtifactRepository()
    {
      if (artifact != null) {
        return artifact.booleanValue();
      }
      return !Boolean.TRUE.equals(metadata);
    }
    
    public URI getRepositoryLocation()
    {
      return repoLocation;
    }
    
    public void setLocation(String location)
    {
      try
      {
        repoLocation = URIUtil.fromString(location);
      }
      catch (URISyntaxException localURISyntaxException)
      {
        throw new IllegalArgumentException("Repository location (" + location + ") must be a URL.");
      }
    }
    
    public void setMetadata(boolean metadata)
    {
      this.metadata = Boolean.valueOf(metadata);
    }
    
    public void setArtifact(boolean artifact)
    {
      this.artifact = Boolean.valueOf(artifact);
    }
  }
  
  protected boolean compress = false;
  protected boolean append = true;
  protected boolean reusePackedFiles = false;
  protected PublisherInfo publisherInfo = null;
  private Properties buildProperties = null;
  protected String overrides = null;
  protected List contextMetadataRepositories = new ArrayList();
  protected List contextArtifactRepositories = new ArrayList();
  
  protected Properties getBuildProperties()
  {
    if (buildProperties != null) {
      return buildProperties;
    }
    Properties overrideProperties = null;
    if (overrides != null)
    {
      File overrideFile = new File(overrides);
      if (overrideFile.exists()) {
        try
        {
          overrideProperties = AbstractScriptGenerator.readProperties(overrideFile.getParent(), overrideFile.getName(), 0);
        }
        catch (CoreException localCoreException1) {}
      }
    }
    Properties properties = null;
    try
    {
      properties = AbstractScriptGenerator.readProperties(baseDirectory, "build.properties", 0);
    }
    catch (CoreException localCoreException2)
    {
      return null;
    }
    buildProperties = new Properties();
    for (Iterator iterator = properties.keySet().iterator(); iterator.hasNext();)
    {
      String key = (String)iterator.next();
      String value = properties.getProperty(key);
      buildProperties.put(key, getProject().replaceProperties(value));
    }
    if (overrideProperties != null) {
      for (Iterator iterator = overrideProperties.keySet().iterator(); iterator.hasNext();)
      {
        String key = (String)iterator.next();
        String value = overrideProperties.getProperty(key);
        buildProperties.put(key, getProject().replaceProperties(value));
      }
    }
    return buildProperties;
  }
  
  protected BuildPublisherApplication createPublisherApplication()
  {
    BuildPublisherApplication application = new BuildPublisherApplication();
    application.setMetadataLocation(metadataLocation);
    application.setArtifactLocation(artifactLocation);
    application.setAppend(append);
    application.setCompress(compress);
    
    URI[] metadata = (URI[])contextMetadataRepositories.toArray(new URI[contextMetadataRepositories.size()]);
    URI[] artifacts = (URI[])contextArtifactRepositories.toArray(new URI[contextArtifactRepositories.size()]);
    application.setContextRepositories(metadata, artifacts);
    
    return application;
  }
  
  public void setArtifactRepository(String location)
  {
    try
    {
      artifactLocation = URIUtil.fromString(location);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      throw new IllegalArgumentException("Artifact repository location (" + location + ") must be a URL.");
    }
  }
  
  public void setArtifactRepositoryName(String value)
  {
    artifactRepoName = value;
  }
  
  public void setMetadataRepository(String location)
  {
    try
    {
      metadataLocation = URIUtil.fromString(location);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      throw new IllegalArgumentException("Metadata repository location (" + location + ") must be a URL.");
    }
  }
  
  public void setMetadataRepositoryName(String value)
  {
    metadataRepoName = value;
  }
  
  public void setRepository(String value)
  {
    setMetadataRepository(value);
    setArtifactRepository(value);
  }
  
  public void setAppend(String value)
  {
    append = Boolean.valueOf(value).booleanValue();
  }
  
  public void setCompress(String value)
  {
    compress = Boolean.valueOf(value).booleanValue();
  }
  
  public void setReusePackedFiles(String reusePackedFiles)
  {
    this.reusePackedFiles = Boolean.valueOf(reusePackedFiles).booleanValue();
  }
  
  public void setBaseDirectory(String baseDirectory)
  {
    if ((baseDirectory != null) && (baseDirectory.length() > 0) && (!baseDirectory.startsWith("${"))) {
      this.baseDirectory = baseDirectory;
    }
  }
  
  public void setOverrides(String overrides)
  {
    if ((overrides != null) && (overrides.length() > 0) && (!overrides.startsWith("${"))) {
      this.overrides = overrides;
    }
  }
  
  protected PublisherInfo getPublisherInfo()
  {
    if (publisherInfo == null)
    {
      publisherInfo = new PublisherInfo();
      publisherInfo.setArtifactOptions(2);
    }
    return publisherInfo;
  }
  
  public void addConfiguredContextRepository(RepoEntry repo)
  {
    if (repo.isMetadataRepository()) {
      contextMetadataRepositories.add(repo.getRepositoryLocation());
    }
    if (repo.isArtifactRepository()) {
      contextArtifactRepositories.add(repo.getRepositoryLocation());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.build.publisher.AbstractPublisherTask
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.build.publisher;

import org.eclipse.equinox.internal.p2.engine.Phase;
import org.eclipse.equinox.internal.p2.engine.PhaseSet;
import org.eclipse.equinox.internal.p2.engine.phases.Collect;
import org.eclipse.equinox.internal.p2.engine.phases.Install;
import org.eclipse.equinox.p2.internal.repository.tools.Repo2Runnable;

class BrandP2Task$1
  extends Repo2Runnable
{
  final BrandP2Task this$0;
  
  BrandP2Task$1(BrandP2Task paramBrandP2Task)
  {
    this$0 = paramBrandP2Task;
  }
  
  protected PhaseSet getPhaseSet()
  {
    return new BrandP2Task.2(this, new Phase[] { new Collect(100), new Install(100) });
  }
  
  protected PhaseSet getNativePhase()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.build.publisher.BrandP2Task.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.build.publisher;

import org.eclipse.equinox.internal.p2.engine.Phase;
import org.eclipse.equinox.internal.p2.engine.PhaseSet;

class BrandP2Task$2
  extends PhaseSet
{
  final BrandP2Task.1 this$1;
  
  BrandP2Task$2(BrandP2Task.1 param1, Phase[] $anonymous0)
  {
    super($anonymous0);this$1 = param1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.build.publisher.BrandP2Task.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.build.publisher;

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.engine.Phase;
import org.eclipse.equinox.internal.p2.engine.PhaseSet;
import org.eclipse.equinox.internal.p2.engine.phases.Collect;
import org.eclipse.equinox.internal.p2.engine.phases.Install;
import org.eclipse.equinox.internal.p2.metadata.TouchpointData;
import org.eclipse.equinox.internal.p2.metadata.TouchpointInstruction;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.tools.Repo2Runnable;
import org.eclipse.equinox.p2.internal.repository.tools.tasks.IUDescription;
import org.eclipse.equinox.p2.internal.repository.tools.tasks.Repo2RunnableTask;
import org.eclipse.equinox.p2.metadata.ITouchpointData;
import org.eclipse.equinox.p2.metadata.ITouchpointInstruction;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.internal.build.BrandingIron;
import org.eclipse.pde.internal.build.Utils;
import org.eclipse.pde.internal.build.tasks.Config;
import org.eclipse.pde.internal.build.tasks.TaskMessages;

public class BrandP2Task
  extends Repo2RunnableTask
{
  private Config config = null;
  private String launcherName = null;
  private String tempFolder = null;
  private String iconsList = null;
  private String launcherProvider = null;
  private String productId = null;
  private String productVersion = Version.emptyVersion.toString();
  private URI metadataURI = null;
  private URI artifactURI = null;
  private boolean removeMetadataRepo = true;
  private boolean removeArtifactRepo = true;
  private List ius = null;
  private static final String CHMOD = "chmod";
  private static final String LN = "ln";
  private static final String LINK_TARGET = "linkTarget";
  private static final String LINK_NAME = "linkName";
  private static final String TARGET_FILE = "targetFile";
  private static final String INSTALL = "install";
  private static final String CONFIGURE = "configure";
  
  public BrandP2Task()
  {
    application = new Repo2Runnable()
    {
      protected PhaseSet getPhaseSet()
      {
        return new BrandP2Task.2(this, new Phase[] { new Collect(100), new Install(100) });
      }
      
      protected PhaseSet getNativePhase()
      {
        return null;
      }
    };
  }
  
  /* Error */
  public void execute()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 51	org/eclipse/pde/internal/build/publisher/BrandP2Task:launcherName	Ljava/lang/String;
    //   4: ifnull +22 -> 26
    //   7: aload_0
    //   8: getfield 51	org/eclipse/pde/internal/build/publisher/BrandP2Task:launcherName	Ljava/lang/String;
    //   11: ldc 97
    //   13: invokevirtual 99	java/lang/String:startsWith	(Ljava/lang/String;)Z
    //   16: ifne +10 -> 26
    //   19: aload_0
    //   20: getfield 49	org/eclipse/pde/internal/build/publisher/BrandP2Task:config	Lorg/eclipse/pde/internal/build/tasks/Config;
    //   23: ifnonnull +4 -> 27
    //   26: return
    //   27: aload_0
    //   28: getfield 57	org/eclipse/pde/internal/build/publisher/BrandP2Task:launcherProvider	Ljava/lang/String;
    //   31: ifnull +15 -> 46
    //   34: aload_0
    //   35: getfield 57	org/eclipse/pde/internal/build/publisher/BrandP2Task:launcherProvider	Ljava/lang/String;
    //   38: ldc 97
    //   40: invokevirtual 99	java/lang/String:startsWith	(Ljava/lang/String;)Z
    //   43: ifeq +9 -> 52
    //   46: aload_0
    //   47: ldc 105
    //   49: putfield 57	org/eclipse/pde/internal/build/publisher/BrandP2Task:launcherProvider	Ljava/lang/String;
    //   52: invokestatic 107	org/eclipse/pde/internal/build/BundleHelper:getDefault	()Lorg/eclipse/pde/internal/build/BundleHelper;
    //   55: getstatic 113	org/eclipse/equinox/p2/core/IProvisioningAgent:SERVICE_NAME	Ljava/lang/String;
    //   58: invokevirtual 118	org/eclipse/pde/internal/build/BundleHelper:acquireService	(Ljava/lang/String;)Ljava/lang/Object;
    //   61: checkcast 114	org/eclipse/equinox/p2/core/IProvisioningAgent
    //   64: astore_1
    //   65: aload_1
    //   66: ifnonnull +14 -> 80
    //   69: new 122	org/apache/tools/ant/BuildException
    //   72: dup
    //   73: getstatic 124	org/eclipse/pde/internal/build/tasks/TaskMessages:error_agentService	Ljava/lang/String;
    //   76: invokespecial 129	org/apache/tools/ant/BuildException:<init>	(Ljava/lang/String;)V
    //   79: athrow
    //   80: aload_1
    //   81: getstatic 132	org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager:SERVICE_NAME	Ljava/lang/String;
    //   84: invokeinterface 135 2 0
    //   89: checkcast 133	org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager
    //   92: astore_2
    //   93: aload_2
    //   94: ifnonnull +14 -> 108
    //   97: new 122	org/apache/tools/ant/BuildException
    //   100: dup
    //   101: getstatic 138	org/eclipse/pde/internal/build/tasks/TaskMessages:error_metadataRepoManagerService	Ljava/lang/String;
    //   104: invokespecial 129	org/apache/tools/ant/BuildException:<init>	(Ljava/lang/String;)V
    //   107: athrow
    //   108: aload_1
    //   109: getstatic 141	org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager:SERVICE_NAME	Ljava/lang/String;
    //   112: invokeinterface 135 2 0
    //   117: checkcast 142	org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager
    //   120: astore_3
    //   121: aload_3
    //   122: ifnonnull +14 -> 136
    //   125: new 122	org/apache/tools/ant/BuildException
    //   128: dup
    //   129: getstatic 144	org/eclipse/pde/internal/build/tasks/TaskMessages:error_artifactRepoManagerService	Ljava/lang/String;
    //   132: invokespecial 129	org/apache/tools/ant/BuildException:<init>	(Ljava/lang/String;)V
    //   135: athrow
    //   136: aload_0
    //   137: aload_2
    //   138: invokespecial 147	org/eclipse/pde/internal/build/publisher/BrandP2Task:loadMetadataRepository	(Lorg/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager;)Lorg/eclipse/equinox/p2/repository/metadata/IMetadataRepository;
    //   141: astore 4
    //   143: aload_0
    //   144: aload_3
    //   145: invokespecial 151	org/eclipse/pde/internal/build/publisher/BrandP2Task:loadArtifactRepository	(Lorg/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager;)Lorg/eclipse/equinox/p2/repository/artifact/IArtifactRepository;
    //   148: astore 5
    //   150: aload_0
    //   151: aload_0
    //   152: invokevirtual 155	org/eclipse/pde/internal/build/publisher/BrandP2Task:getRootFolder	()Ljava/lang/String;
    //   155: invokespecial 158	org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask:setDestination	(Ljava/lang/String;)V
    //   158: aload_0
    //   159: invokespecial 161	org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask:execute	()V
    //   162: aload_0
    //   163: getfield 81	org/eclipse/pde/internal/build/publisher/BrandP2Task:ius	Ljava/util/List;
    //   166: invokeinterface 163 1 0
    //   171: iconst_1
    //   172: if_icmpne +90 -> 262
    //   175: aload_0
    //   176: invokevirtual 169	org/eclipse/pde/internal/build/publisher/BrandP2Task:callBrandingIron	()V
    //   179: aload_0
    //   180: aload 4
    //   182: aload 5
    //   184: aload_0
    //   185: getfield 81	org/eclipse/pde/internal/build/publisher/BrandP2Task:ius	Ljava/util/List;
    //   188: iconst_0
    //   189: invokeinterface 172 2 0
    //   194: checkcast 176	org/eclipse/equinox/p2/metadata/IInstallableUnit
    //   197: invokevirtual 178	org/eclipse/pde/internal/build/publisher/BrandP2Task:publishBrandedIU	(Lorg/eclipse/equinox/p2/repository/metadata/IMetadataRepository;Lorg/eclipse/equinox/p2/repository/artifact/IArtifactRepository;Lorg/eclipse/equinox/p2/metadata/IInstallableUnit;)V
    //   200: new 182	java/io/File
    //   203: dup
    //   204: aload_0
    //   205: invokevirtual 155	org/eclipse/pde/internal/build/publisher/BrandP2Task:getRootFolder	()Ljava/lang/String;
    //   208: invokespecial 184	java/io/File:<init>	(Ljava/lang/String;)V
    //   211: invokestatic 185	org/eclipse/equinox/internal/p2/core/helpers/FileUtils:deleteAll	(Ljava/io/File;)V
    //   214: goto +48 -> 262
    //   217: astore 6
    //   219: aload_0
    //   220: invokevirtual 191	org/eclipse/pde/internal/build/publisher/BrandP2Task:getProject	()Lorg/apache/tools/ant/Project;
    //   223: aload 6
    //   225: invokevirtual 195	org/apache/tools/ant/BuildException:getMessage	()Ljava/lang/String;
    //   228: iconst_1
    //   229: invokevirtual 198	org/apache/tools/ant/Project:log	(Ljava/lang/String;I)V
    //   232: aload_0
    //   233: aload_2
    //   234: aload_3
    //   235: invokespecial 204	org/eclipse/pde/internal/build/publisher/BrandP2Task:cleanupRepositories	(Lorg/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager;Lorg/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager;)V
    //   238: aload_0
    //   239: aconst_null
    //   240: putfield 81	org/eclipse/pde/internal/build/publisher/BrandP2Task:ius	Ljava/util/List;
    //   243: goto +30 -> 273
    //   246: astore 7
    //   248: aload_0
    //   249: aload_2
    //   250: aload_3
    //   251: invokespecial 204	org/eclipse/pde/internal/build/publisher/BrandP2Task:cleanupRepositories	(Lorg/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager;Lorg/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager;)V
    //   254: aload_0
    //   255: aconst_null
    //   256: putfield 81	org/eclipse/pde/internal/build/publisher/BrandP2Task:ius	Ljava/util/List;
    //   259: aload 7
    //   261: athrow
    //   262: aload_0
    //   263: aload_2
    //   264: aload_3
    //   265: invokespecial 204	org/eclipse/pde/internal/build/publisher/BrandP2Task:cleanupRepositories	(Lorg/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager;Lorg/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager;)V
    //   268: aload_0
    //   269: aconst_null
    //   270: putfield 81	org/eclipse/pde/internal/build/publisher/BrandP2Task:ius	Ljava/util/List;
    //   273: return
    // Line number table:
    //   Java source line #74	-> byte code offset #0
    //   Java source line #75	-> byte code offset #26
    //   Java source line #77	-> byte code offset #27
    //   Java source line #78	-> byte code offset #46
    //   Java source line #80	-> byte code offset #52
    //   Java source line #81	-> byte code offset #65
    //   Java source line #82	-> byte code offset #69
    //   Java source line #83	-> byte code offset #80
    //   Java source line #84	-> byte code offset #93
    //   Java source line #85	-> byte code offset #97
    //   Java source line #86	-> byte code offset #108
    //   Java source line #87	-> byte code offset #121
    //   Java source line #88	-> byte code offset #125
    //   Java source line #90	-> byte code offset #136
    //   Java source line #91	-> byte code offset #143
    //   Java source line #94	-> byte code offset #150
    //   Java source line #96	-> byte code offset #158
    //   Java source line #97	-> byte code offset #162
    //   Java source line #98	-> byte code offset #175
    //   Java source line #99	-> byte code offset #179
    //   Java source line #100	-> byte code offset #200
    //   Java source line #102	-> byte code offset #217
    //   Java source line #103	-> byte code offset #219
    //   Java source line #105	-> byte code offset #232
    //   Java source line #106	-> byte code offset #238
    //   Java source line #104	-> byte code offset #246
    //   Java source line #105	-> byte code offset #248
    //   Java source line #106	-> byte code offset #254
    //   Java source line #107	-> byte code offset #259
    //   Java source line #105	-> byte code offset #262
    //   Java source line #106	-> byte code offset #268
    //   Java source line #108	-> byte code offset #273
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	274	0	this	BrandP2Task
    //   64	45	1	agent	org.eclipse.equinox.p2.core.IProvisioningAgent
    //   92	172	2	metadataManager	IMetadataRepositoryManager
    //   120	145	3	artifactManager	IArtifactRepositoryManager
    //   141	40	4	metadataRepo	IMetadataRepository
    //   148	35	5	artifactRepo	IArtifactRepository
    //   217	7	6	e	BuildException
    //   246	14	7	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   150	214	217	org/apache/tools/ant/BuildException
    //   150	232	246	finally
  }
  
  private void cleanupRepositories(IMetadataRepositoryManager metadataManager, IArtifactRepositoryManager artifactManager)
  {
    URI destination = new Path(getRootFolder()).toFile().toURI();
    if (metadataManager != null)
    {
      if (removeMetadataRepo) {
        metadataManager.removeRepository(metadataURI);
      }
      metadataManager.removeRepository(destination);
    }
    if (artifactManager != null)
    {
      if (removeArtifactRepo) {
        artifactManager.removeRepository(artifactURI);
      }
      artifactManager.removeRepository(destination);
    }
  }
  
  private IArtifactRepository loadArtifactRepository(IArtifactRepositoryManager manager)
    throws BuildException
  {
    if (artifactURI == null) {
      throw new BuildException(TaskMessages.error_noArtifactRepo);
    }
    removeArtifactRepo = (!manager.contains(artifactURI));
    
    IArtifactRepository repo = null;
    try
    {
      repo = manager.loadRepository(artifactURI, null);
    }
    catch (ProvisionException localProvisionException)
    {
      throw new BuildException(NLS.bind(TaskMessages.error_loadRepository, artifactURI.toString()));
    }
    if (!repo.isModifiable()) {
      throw new BuildException(NLS.bind(TaskMessages.error_unmodifiableRepository, artifactURI.toString()));
    }
    return repo;
  }
  
  private IMetadataRepository loadMetadataRepository(IMetadataRepositoryManager manager)
    throws BuildException
  {
    if (metadataURI == null) {
      throw new BuildException(TaskMessages.error_noMetadataRepo);
    }
    removeMetadataRepo = (!manager.contains(metadataURI));
    
    IMetadataRepository repo = null;
    try
    {
      repo = manager.loadRepository(metadataURI, null);
    }
    catch (ProvisionException localProvisionException)
    {
      throw new BuildException(NLS.bind(TaskMessages.error_loadRepository, metadataURI.toString()));
    }
    if (!repo.isModifiable()) {
      throw new BuildException(NLS.bind(TaskMessages.error_unmodifiableRepository, metadataURI.toString()));
    }
    return repo;
  }
  
  protected String getProviderIUName()
  {
    return launcherProvider + "_root." + getConfigString();
  }
  
  protected List prepareIUs()
  {
    String iuName = getProviderIUName();
    IUDescription task = (IUDescription)super.createIu();
    task.setId(iuName);
    
    ius = super.prepareIUs();
    
    return ius;
  }
  
  protected void callBrandingIron()
  {
    if (!new File(getRootFolder()).exists()) {
      return;
    }
    BrandingIron iron = new BrandingIron();
    iron.setName(launcherName);
    iron.setIcons(iconsList);
    iron.setRoot(getRootFolder());
    iron.setOS(config.getOs());
    try
    {
      iron.brand();
    }
    catch (Exception e)
    {
      getProject().log(TaskMessages.error_branding, e, 1);
    }
  }
  
  protected String getRootFolder()
  {
    return tempFolder + "/p2.branding/" + getProviderIUName();
  }
  
  private String getConfigString()
  {
    return config.getWs() + '.' + config.getOs() + '.' + config.getArch();
  }
  
  /* Error */
  protected void publishBrandedIU(IMetadataRepository metadataRepo, IArtifactRepository artifactRepo, org.eclipse.equinox.p2.metadata.IInstallableUnit originalIU)
  {
    // Byte code:
    //   0: new 284	java/lang/StringBuffer
    //   3: dup
    //   4: aload_0
    //   5: getfield 59	org/eclipse/pde/internal/build/publisher/BrandP2Task:productId	Ljava/lang/String;
    //   8: invokestatic 286	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   11: invokespecial 290	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   14: ldc_w 291
    //   17: invokevirtual 293	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   20: aload_0
    //   21: invokespecial 297	org/eclipse/pde/internal/build/publisher/BrandP2Task:getConfigString	()Ljava/lang/String;
    //   24: invokevirtual 293	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   27: invokevirtual 300	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   30: astore 4
    //   32: aload_0
    //   33: getfield 71	org/eclipse/pde/internal/build/publisher/BrandP2Task:productVersion	Ljava/lang/String;
    //   36: invokestatic 367	org/eclipse/equinox/p2/metadata/Version:parseVersion	(Ljava/lang/String;)Lorg/eclipse/equinox/p2/metadata/Version;
    //   39: astore 5
    //   41: aload 5
    //   43: getstatic 61	org/eclipse/equinox/p2/metadata/Version:emptyVersion	Lorg/eclipse/equinox/p2/metadata/Version;
    //   46: invokevirtual 371	java/lang/Object:equals	(Ljava/lang/Object;)Z
    //   49: ifeq +11 -> 60
    //   52: aload_3
    //   53: invokeinterface 377 1 0
    //   58: astore 5
    //   60: new 381	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription
    //   63: dup
    //   64: invokespecial 383	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:<init>	()V
    //   67: astore 6
    //   69: aload 6
    //   71: aload_3
    //   72: invokeinterface 384 1 0
    //   77: invokevirtual 387	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setSingleton	(Z)V
    //   80: aload 6
    //   82: aload 4
    //   84: invokevirtual 391	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setId	(Ljava/lang/String;)V
    //   87: aload 6
    //   89: aload 5
    //   91: invokevirtual 392	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setVersion	(Lorg/eclipse/equinox/p2/metadata/Version;)V
    //   94: aload 6
    //   96: iconst_1
    //   97: anewarray 396	org/eclipse/equinox/p2/metadata/IProvidedCapability
    //   100: dup
    //   101: iconst_0
    //   102: aload 4
    //   104: aload 5
    //   106: invokestatic 398	org/eclipse/equinox/spi/p2/publisher/PublisherHelper:createSelfCapability	(Ljava/lang/String;Lorg/eclipse/equinox/p2/metadata/Version;)Lorg/eclipse/equinox/p2/metadata/IProvidedCapability;
    //   109: aastore
    //   110: invokevirtual 404	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setCapabilities	([Lorg/eclipse/equinox/p2/metadata/IProvidedCapability;)V
    //   113: aload 6
    //   115: aload_3
    //   116: invokeinterface 408 1 0
    //   121: invokevirtual 412	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setTouchpointType	(Lorg/eclipse/equinox/p2/metadata/ITouchpointType;)V
    //   124: aload 6
    //   126: aload_3
    //   127: invokeinterface 416 1 0
    //   132: invokevirtual 420	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setFilter	(Lorg/eclipse/equinox/p2/metadata/expression/IMatchExpression;)V
    //   135: aload_0
    //   136: aload_3
    //   137: invokeinterface 424 1 0
    //   142: invokespecial 428	org/eclipse/pde/internal/build/publisher/BrandP2Task:brandTouchpointData	(Ljava/util/Collection;)Ljava/util/List;
    //   145: astore 7
    //   147: iconst_0
    //   148: istore 8
    //   150: goto +23 -> 173
    //   153: aload 6
    //   155: aload 7
    //   157: iload 8
    //   159: invokeinterface 172 2 0
    //   164: checkcast 432	org/eclipse/equinox/p2/metadata/ITouchpointData
    //   167: invokevirtual 434	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:addTouchpointData	(Lorg/eclipse/equinox/p2/metadata/ITouchpointData;)V
    //   170: iinc 8 1
    //   173: iload 8
    //   175: aload 7
    //   177: invokeinterface 163 1 0
    //   182: if_icmplt -29 -> 153
    //   185: aload_2
    //   186: ldc_w 438
    //   189: aload 6
    //   191: invokevirtual 440	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:getId	()Ljava/lang/String;
    //   194: aload 6
    //   196: invokevirtual 443	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:getVersion	()Lorg/eclipse/equinox/p2/metadata/Version;
    //   199: invokeinterface 444 4 0
    //   204: astore 8
    //   206: aload 6
    //   208: iconst_1
    //   209: anewarray 448	org/eclipse/equinox/p2/metadata/IArtifactKey
    //   212: dup
    //   213: iconst_0
    //   214: aload 8
    //   216: aastore
    //   217: invokevirtual 450	org/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription:setArtifacts	([Lorg/eclipse/equinox/p2/metadata/IArtifactKey;)V
    //   220: aload 6
    //   222: invokestatic 454	org/eclipse/equinox/p2/metadata/MetadataFactory:createInstallableUnit	(Lorg/eclipse/equinox/p2/metadata/MetadataFactory$InstallableUnitDescription;)Lorg/eclipse/equinox/p2/metadata/IInstallableUnit;
    //   225: astore 9
    //   227: aload_1
    //   228: iconst_1
    //   229: anewarray 176	org/eclipse/equinox/p2/metadata/IInstallableUnit
    //   232: dup
    //   233: iconst_0
    //   234: aload 9
    //   236: aastore
    //   237: invokestatic 460	java/util/Arrays:asList	([Ljava/lang/Object;)Ljava/util/List;
    //   240: invokeinterface 466 2 0
    //   245: new 470	org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor
    //   248: dup
    //   249: aload 8
    //   251: invokespecial 472	org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor:<init>	(Lorg/eclipse/equinox/p2/metadata/IArtifactKey;)V
    //   254: astore 10
    //   256: aconst_null
    //   257: astore 11
    //   259: new 475	java/util/zip/ZipOutputStream
    //   262: dup
    //   263: aload_2
    //   264: aload 10
    //   266: invokeinterface 477 2 0
    //   271: invokespecial 481	java/util/zip/ZipOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   274: astore 11
    //   276: new 182	java/io/File
    //   279: dup
    //   280: aload_0
    //   281: invokevirtual 155	org/eclipse/pde/internal/build/publisher/BrandP2Task:getRootFolder	()Ljava/lang/String;
    //   284: invokespecial 184	java/io/File:<init>	(Ljava/lang/String;)V
    //   287: astore 12
    //   289: new 182	java/io/File
    //   292: dup
    //   293: aload 12
    //   295: ldc_w 484
    //   298: invokespecial 486	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   301: invokevirtual 489	java/io/File:delete	()Z
    //   304: pop
    //   305: new 182	java/io/File
    //   308: dup
    //   309: aload 12
    //   311: ldc_w 492
    //   314: invokespecial 486	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   317: 
1 2 3 4 5 6

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd