/** * Add the given set of input resources to the "input resources" decoration * associated to the given node. * * @param node a node. * @param resources the resources to add. May be <code>null</code>. */ public static void addInputResources(final Node node, final Set<InputResource> resources) { if (resources == null) return; final Set<InputResource> previousResources = getInputResources(node); if (previousResources == null) { node.astSetDecoration(INPUT_RESOURCES_DECORATION, new HashSet<InputResource>(resources)); } else { previousResources.addAll(resources); } }
public boolean isUpToDate(final URL url, final Collection<InputResource> inputs, final Map<Object, Object> context) throws MalformedURLException { return isUpToDate(InputResourcesHelper.getTimestamp(url), inputs, context); }
/** * Add the given resource to the "input resources" decoration associated to * the given node. * * @param node a node. * @param resource a resource (ADL name, IDL file name, etc...). * @return <code>true</code> if the given resource has been actually added to * the set of input resources (i.e. if the set of input resources did * not contain the given resource). */ public static boolean addInputResource(final Node node, final InputResource resource) { Set<InputResource> resources = getInputResources(node); if (resources == null) { resources = new HashSet<InputResource>(); node.astSetDecoration(INPUT_RESOURCES_DECORATION, resources); } return resources.add(resource); }
public void visit(final Definition definition, final java.util.Map<Object, Object> context) throws ADLException { if (!(definition instanceof ImplementationContainer)) return; final Source[] sources = ((ImplementationContainer) definition) .getSources(); if (sources.length <= 1) return; final File headerFile = outputFileLocatorItf.getCSourceOutputFile( getImplHeaderFileName(definition), context); if (!inputResourceLocatorItf.isUpToDate(headerFile, InputResourcesHelper .getInputResources(definition), context)) { try { SourceFileWriter.writeToFile(headerFile, getFileContent(definition)); } catch (final IOException e) { throw new CompilerError(IOErrors.WRITE_ERROR, e, headerFile .getAbsolutePath()); } } }
protected long getTimestamp(final InputResource resource, final Map<Object, Object> context) throws MalformedURLException { long timestamp = resource.getTimestamp(); if (timestamp == -1) { final URL url = findResource(resource, context); if (url != null) timestamp = InputResourcesHelper.getTimestamp(url); else timestamp = Long.MAX_VALUE; resource.setTimestamp(timestamp); } return timestamp; }
public void visit(final Definition definition, final Map<Object, Object> context) throws ADLException { final File outputFile = outputFileLocatorItf.getCSourceOutputFile( getHeaderFileName(definition), context); if (!inputResourceLocatorItf.isUpToDate(outputFile, InputResourcesHelper .getInputResources(definition), context)) { final StringTemplate st = getInstanceOf("ComponentDefinitionHeader"); st.setAttribute("definition", definition); try { SourceFileWriter.writeToFile(outputFile, st.toString()); } catch (final IOException e) { throw new CompilerError(IOErrors.WRITE_ERROR, e, outputFile .getAbsolutePath()); } } }
.getInputResources(definition), context)) {
public void visit(final IDL idl, final Map<Object, Object> context) throws ADLException { final String headerFileName; if (idl.getName().startsWith("/")) { headerFileName = PathHelper.replaceExtension(idl.getName(), IDT_FILE_EXT); } else { headerFileName = PathHelper.fullyQualifiedNameToPath(idl.getName(), ITF_FILE_EXT); } final File headerFile = outputFileLocatorItf.getCSourceOutputFile( headerFileName, context); if (!inputResourceLocatorItf.isUpToDate(headerFile, InputResourcesHelper .getInputResources(idl), context)) { final StringTemplate st = getInstanceOf("idlFile"); st.setAttribute("idl", idl); try { writeToFile(headerFile, st.toString()); } catch (final IOException e) { throw new CompilerError(IOErrors.WRITE_ERROR, e, headerFile .getAbsolutePath()); } } }
.getInputResources(definition), context)) {