Skip to content

Commit

Permalink
Deployment of an addon should not depend on whether or not it has loc…
Browse files Browse the repository at this point in the history
…al resource (it may only have exported dependencies, etc)
  • Loading branch information
lincolnthree committed Jul 23, 2013
1 parent 9b4febe commit 87b75d1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public Boolean call() throws Exception
File descriptor = getAddonDescriptor(addon);
try
{
if (resources != null && resources.iterator().hasNext())
if (resources != null)
{
for (File resource : resources)
{
Expand All @@ -150,26 +150,29 @@ public Boolean call() throws Exception
Node addonXml = getXmlRoot(descriptor);
Node dependenciesNode = addonXml.getOrCreate(DEPENDENCIES_TAG_NAME);

for (AddonDependencyEntry dependency : dependencies)
if (dependencies != null)
{
String name = dependency.getName();
Node dep = null;
for (Node node : dependenciesNode.get(DEPENDENCY_TAG_NAME))
for (AddonDependencyEntry dependency : dependencies)
{
if (name.equals(node.getAttribute(ATTR_NAME)))
String name = dependency.getName();
Node dep = null;
for (Node node : dependenciesNode.get(DEPENDENCY_TAG_NAME))
{
dep = node;
break;
if (name.equals(node.getAttribute(ATTR_NAME)))
{
dep = node;
break;
}
}
if (dep == null)
{
dep = dependenciesNode.createChild(DEPENDENCY_TAG_NAME);
dep.attribute(ATTR_NAME, name);
}
dep.attribute(ATTR_VERSION, dependency.getVersionRange());
dep.attribute(ATTR_EXPORT, dependency.isExported());
dep.attribute(ATTR_OPTIONAL, dependency.isOptional());
}
if (dep == null)
{
dep = dependenciesNode.createChild(DEPENDENCY_TAG_NAME);
dep.attribute(ATTR_NAME, name);
}
dep.attribute(ATTR_VERSION, dependency.getVersionRange());
dep.attribute(ATTR_EXPORT, dependency.isExported());
dep.attribute(ATTR_OPTIONAL, dependency.isOptional());
}

FileOutputStream fos = null;
Expand Down Expand Up @@ -464,9 +467,8 @@ public Boolean call() throws Exception
{
File addonBaseDir = getAddonBaseDir(addon);
File addonDescriptorFile = getAddonDescriptorFile(addon);
List<File> addonResources = getAddonResources(addon);

return addonBaseDir.exists() && addonDescriptorFile.exists() && !addonResources.isEmpty();
return addonBaseDir.exists() && addonDescriptorFile.exists();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void testDeployAddonEntryNoDependenciesOrResources() throws Exception

Assert.assertFalse(repository.isDeployed(addon));
repository.deploy(addon, new ArrayList<AddonDependencyEntry>(), new ArrayList<File>());
Assert.assertFalse(repository.isDeployed(addon));
Assert.assertTrue(repository.isDeployed(addon));

Assert.assertFalse(repository.isEnabled(addon));
repository.enable(addon);
Expand Down

0 comments on commit 87b75d1

Please sign in to comment.