use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class RepoUsingTool method shouldRecompile.
protected boolean shouldRecompile(RepositoryManager repoMgr, String name, String version, ModuleQuery.Type type, boolean checkTime) throws IOException {
ArtifactResult art = getModuleArtifact(repoMgr, name, version, type);
if (art == null) {
return true;
}
File artifile = art.artifact();
// Check if it has META-INF/errors.txt
Properties errors = getMetaInfErrors(artifile);
if (errors != null && !errors.isEmpty()) {
return true;
}
if (checkTime) {
return isModuleArtifactOutOfDate(artifile, name, type);
}
return false;
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class LazyModuleSourceMapper method setupJavaModule.
private void setupJavaModule(ModuleImport moduleImport, LazyModule module, AbstractModelLoader modelLoader, ModuleManager moduleManager, ArtifactResult artifact) {
// we didn't find module.class so it must be a java module if it's not the default module
module.setJava(true);
module.setNativeBackends(Backend.Java.asSet());
modelLoader.loadJava9Module(module, artifact.artifact());
List<ArtifactResult> deps = artifact.dependencies();
boolean forceExport = ModuleUtil.isMavenModule(module.getNameAsString()) && modelLoader.isFullyExportMavenDependencies();
for (ArtifactResult dep : deps) {
// forget runtime, test and even provided
if (dep.moduleScope() != ModuleScope.COMPILE)
continue;
// re-export them anyway
if (dep.optional())
continue;
Module dependency = moduleManager.getOrCreateModule(ModuleManager.splitModuleName(dep.name()), dep.version());
ModuleImport depImport = moduleManager.findImport(module, dependency);
if (depImport == null) {
moduleImport = new ModuleImport(dep.namespace(), dependency, dep.optional(), // allow forcing export but not for optional modules
dep.exported() || forceExport && !dep.optional(), Backend.Java);
module.addImport(moduleImport);
}
}
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class JvmBackendUtil method loadStaticMetamodel.
public static void loadStaticMetamodel(InputStream is, List<String> dexEntries, StaticMetamodelLoader staticMetamodelLoader) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String line;
ModuleSpec module = null;
SortedSet<String> packages = new TreeSet<>();
List<ArtifactResult> imports = new LinkedList<ArtifactResult>();
while ((line = reader.readLine()) != null) {
if (line.startsWith("=")) {
if (module != null)
finishLoadingModule(module, packages, imports, dexEntries, staticMetamodelLoader);
module = ModuleSpec.parse(line.substring(1));
packages.clear();
imports.clear();
continue;
}
boolean _optional = false;
boolean _shared = false;
if (line.startsWith("?")) {
_optional = true;
line = line.substring(1);
}
if (line.startsWith("+")) {
_shared = true;
line = line.substring(1);
}
// SERIOUSLY!!
final boolean optional = _optional;
final boolean shared = _shared;
if (line.startsWith("@")) {
packages.add(line.substring(1));
continue;
}
// it's an import
ModuleSpec importSpec = ModuleSpec.parse(line);
final String namespace = ModuleUtil.getNamespaceFromUri(importSpec.getName());
final String name = ModuleUtil.getModuleNameFromUri(importSpec.getName());
final String version = importSpec.getVersion();
imports.add(new ArtifactResult() {
@Override
public String namespace() {
return namespace;
}
@Override
public String name() {
return name;
}
@Override
public String version() {
return version;
}
@Override
public boolean optional() {
return optional;
}
@Override
public boolean exported() {
return shared;
}
@Override
public ArtifactResultType type() {
// Is this important?
return ArtifactResultType.OTHER;
}
@Override
public VisibilityType visibilityType() {
return VisibilityType.STRICT;
}
@Override
public File artifact() throws RepositoryException {
return null;
}
@Override
public PathFilter filter() {
return null;
}
@Override
public List<ArtifactResult> dependencies() throws RepositoryException {
return null;
}
@Override
public String artifactId() {
return ModuleUtil.getMavenArtifactIdIfMavenModule(name);
}
@Override
public String groupId() {
return ModuleUtil.getMavenGroupIdIfMavenModule(name);
}
@Override
public String classifier() {
return ModuleUtil.getMavenClassifierIfMavenModule(name);
}
@Override
public String repositoryDisplayString() {
return "Android dependency";
}
@Override
public Repository repository() {
return null;
}
@Override
public ModuleScope moduleScope() {
return ModuleScope.COMPILE;
}
@Override
public List<Exclusion> getExclusions() {
return null;
}
});
}
if (module != null)
finishLoadingModule(module, packages, imports, dexEntries, staticMetamodelLoader);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class SmokeTestCase method testOverridesInterpolation.
@Test
public void testOverridesInterpolation() throws Exception {
RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesInterpolation.xml");
ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
Assert.assertNotNull(result);
Assert.assertEquals(2, result.dependencies().size());
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class SmokeTestCase method testOverridesReplaceImport.
@Test
public void testOverridesReplaceImport() throws Exception {
RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesReplaceImport.xml");
ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
Assert.assertNotNull(result);
Assert.assertEquals(2, result.dependencies().size());
ArtifactResult dep = result.dependencies().get(1);
Assert.assertEquals("com.acme.helloworld", dep.name());
Assert.assertEquals("1.0.0", dep.version());
Assert.assertEquals(1, dep.dependencies().size());
}
Aggregations