ResourceLoader nativeLoader = new NativeLibraryResourceLoader(new File(moduleFile.getParent(), "lib"));
builder.addResourceRoot(ResourceLoaderSpec.createResourceLoaderSpec(nativeLoader));
Graph.Vertex<ModuleIdentifier, Boolean> vertex = graph.createVertex(moduleIdentifier, moduleIdentifier);
DependencySpec lds = DependencySpec.createLocalDependencySpec();
builder.addDependency(lds); // local resources
deps.add(lds);
if (isDefault == false) {
Node<ArtifactResult> root = new Node<>();
for (ArtifactResult i : artifact.dependencies()) {
final String name = i.name();
// route logging to JBoss LogManager
if (isLogging(deps, builder, i)) {
continue;
}
// skip JDK modules
if (JDK_MODULE_NAMES.contains(name)) {
continue;
}
if (i.importType() == ImportType.OPTIONAL) {
Node<ArtifactResult> current = root;
String[] tokens = name.split("\\.");
for (String token : tokens) {
Node<ArtifactResult> child = current.getChild(token);
if (child == null)
child = current.addChild(token);
current = child;
}
current.setValue(i);
} else {
DependencySpec mds = createModuleDependency(i);
builder.addDependency(mds);
deps.add(mds);
}
ModuleIdentifier mi = createModuleIdentifier(i);
Graph.Vertex<ModuleIdentifier, Boolean> dv = graph.createVertex(mi, mi);
Graph.Edge.create(i.importType() == ImportType.EXPORT, vertex, dv);
}
if (root.isEmpty() == false) {
LocalLoader onDemandLoader = new OnDemandLocalLoader(moduleIdentifier, this, root);
builder.setFallbackLoader(onDemandLoader);
}
}
// automagically import the JDK module
builder.addDependency(JDK_DEPENDENCY);
// no need to track system deps -- cannot be updated anyway
createModuleDependency(vertex, deps, builder, LANGUAGE, false);
// add runtime utils
final DependencySpec sds = DependencySpec.createModuleDependencySpec(
PathFilters.match(CEYLON_RUNTIME_PATH),
PathFilters.rejectAll(),
this,
RUNTIME,
true