Java Code Examples for org.apache.ivy.core.module.descriptor.Artifact#getType()
The following examples show how to use
org.apache.ivy.core.module.descriptor.Artifact#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultLocalComponentMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private DefaultLocalArtifactMetaData(ComponentIdentifier componentIdentifier, String displayName, Artifact artifact, File file) { this.componentIdentifier = componentIdentifier; Map<String, String> attrs = new HashMap<String, String>(); attrs.putAll(artifact.getExtraAttributes()); attrs.put("file", file == null ? "null" : file.getAbsolutePath()); this.id = new DefaultLocalArtifactIdentifier(componentIdentifier, displayName, artifact.getName(), artifact.getType(), artifact.getExt(), attrs); this.artifact = artifact; this.file = file; }
Example 2
Source File: DefaultLocalComponentMetaData.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private DefaultLocalArtifactMetaData(ComponentIdentifier componentIdentifier, String displayName, Artifact artifact, File file) { this.componentIdentifier = componentIdentifier; Map<String, String> attrs = new HashMap<String, String>(); attrs.putAll(artifact.getExtraAttributes()); attrs.put("file", file == null ? "null" : file.getAbsolutePath()); this.id = new DefaultLocalArtifactIdentifier(componentIdentifier, displayName, artifact.getName(), artifact.getType(), artifact.getExt(), attrs); this.artifact = artifact; this.file = file; }
Example 3
Source File: PomModuleDescriptorWriter.java From ant-ivy with Apache License 2.0 | 5 votes |
private static void setModuleVariables(ModuleDescriptor md, IvyVariableContainer variables, PomWriterOptions options) { ModuleRevisionId mrid = md.getModuleRevisionId(); variables.setVariable("ivy.pom.groupId", mrid.getOrganisation(), true); String artifactId = options.getArtifactName(); if (artifactId == null) { artifactId = mrid.getName(); } String packaging = options.getArtifactPackaging(); if (packaging == null) { // find artifact to determine the packaging Artifact artifact = findArtifact(md, artifactId); if (artifact == null) { // no suitable artifact found, default to 'pom' packaging = "pom"; } else { packaging = artifact.getType(); } } variables.setVariable("ivy.pom.artifactId", artifactId, true); variables.setVariable("ivy.pom.packaging", packaging, true); if (mrid.getRevision() != null) { variables.setVariable("ivy.pom.version", mrid.getRevision(), true); } if (options.getDescription() != null) { variables.setVariable("ivy.pom.description", options.getDescription(), true); } else if (!isNullOrEmpty(md.getDescription())) { variables.setVariable("ivy.pom.description", md.getDescription(), true); } if (md.getHomePage() != null) { variables.setVariable("ivy.pom.url", md.getHomePage(), true); } }
Example 4
Source File: NameSpaceHelper.java From ant-ivy with Apache License 2.0 | 5 votes |
public static Artifact transform(Artifact artifact, NamespaceTransformer t) { if (t.isIdentity()) { return artifact; } ModuleRevisionId mrid = t.transform(artifact.getModuleRevisionId()); if (artifact.getModuleRevisionId().equals(mrid)) { return artifact; } return new DefaultArtifact(mrid, artifact.getPublicationDate(), artifact.getName(), artifact.getType(), artifact.getExt(), artifact.getUrl(), artifact.getQualifiedExtraAttributes()); }
Example 5
Source File: DefaultIvyArtifactName.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultIvyArtifactName(Artifact a) { this(a.getName(), a.getType(), a.getExt(), a.getAttributes()); }
Example 6
Source File: DefaultModuleComponentArtifactIdentifier.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultModuleComponentArtifactIdentifier(ModuleComponentIdentifier componentIdentifier, Artifact artifact) { this(componentIdentifier, artifact.getName(), artifact.getType(), artifact.getExt(), artifact.getExtraAttributes()); }
Example 7
Source File: DefaultModuleVersionArtifactIdentifier.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultModuleVersionArtifactIdentifier(ModuleComponentIdentifier componentIdentifier, Artifact artifact) { this(componentIdentifier, artifact.getName(), artifact.getType(), artifact.getExt(), artifact.getExtraAttributes()); }
Example 8
Source File: DefaultIvyArtifactName.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultIvyArtifactName(Artifact a) { this(a.getName(), a.getType(), a.getExt(), a.getAttributes()); }
Example 9
Source File: DefaultModuleComponentArtifactIdentifier.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultModuleComponentArtifactIdentifier(ModuleComponentIdentifier componentIdentifier, Artifact artifact) { this(componentIdentifier, artifact.getName(), artifact.getType(), artifact.getExt(), artifact.getExtraAttributes()); }
Example 10
Source File: DefaultModuleVersionArtifactIdentifier.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultModuleVersionArtifactIdentifier(ModuleComponentIdentifier componentIdentifier, Artifact artifact) { this(componentIdentifier, artifact.getName(), artifact.getType(), artifact.getExt(), artifact.getExtraAttributes()); }
Example 11
Source File: PublishEventsTest.java From ant-ivy with Apache License 2.0 | 4 votes |
public void progress(IvyEvent event) { PublishEventsTest test = (PublishEventsTest) IvyContext.getContext().peek( PublishEventsTest.class.getName()); InstrumentedResolver resolver = (InstrumentedResolver) test.ivy.getSettings() .getResolver("default"); assertNotNull("instrumented resolver configured", resolver); assertNotNull("got a reference to the current unit test case", test); // test the proper sequence of events by comparing the number of pre-events, // post-events, and actual publications. assertTrue("event is of correct base type", event instanceof PublishEvent); PublishEvent pubEvent = (PublishEvent) event; Artifact expectedArtifact = test.currentTestCase.expectedArtifact; File expectedData = test.currentTestCase.expectedData; assertSameArtifact("event records correct artifact", expectedArtifact, pubEvent.getArtifact()); try { assertEquals("event records correct file", expectedData.getCanonicalPath(), pubEvent.getData().getCanonicalPath()); assertEquals("event records correct overwrite setting", test.expectedOverwrite, pubEvent.isOverwrite()); assertSame("event presents correct resolver", resolver, pubEvent.getResolver()); String[] attributes = {"organisation", "module", "revision", "artifact", "type", "ext", "resolver", "overwrite"}; String[] values = {"apache", "PublishEventsTest", "1.0-dev", expectedArtifact.getName(), expectedArtifact.getType(), expectedArtifact.getExt(), "default", String.valueOf(test.expectedOverwrite)}; for (int i = 0; i < attributes.length; ++i) { assertEquals("event declares correct value for " + attributes[i], values[i], event.getAttributes().get(attributes[i])); } // we test file separately, since it is hard to guarantee an exact path match, but // we want to make sure that both paths point to the same canonical location on the // filesystem String filePath = event.getAttributes().get("file"); assertEquals("event declares correct value for file", expectedData.getCanonicalPath(), new File(filePath).getCanonicalPath()); } catch (IOException ioe) { throw new RuntimeException(ioe); } }