use of org.gradle.language.nativeplatform.internal.IncludeDirectives in project gradle by gradle.
the class NativeCompiler method maybeGetPCHArgs.
protected List<String> maybeGetPCHArgs(final T spec, File sourceFile) {
if (spec.getPreCompiledHeader() == null) {
return Lists.newArrayList();
}
final IncludeDirectives includes = spec.getSourceFileIncludeDirectives().get(sourceFile);
final String header = spec.getPreCompiledHeader();
List<Include> headers = includes.getAll();
boolean usePCH = !headers.isEmpty() && header.equals(headers.get(0).getValue());
if (usePCH) {
return getPCHArgs(spec);
} else {
boolean containsHeader = CollectionUtils.any(headers, new Spec<Include>() {
@Override
public boolean isSatisfiedBy(Include include) {
return include.getValue().equals(header);
}
});
if (containsHeader) {
logger.log(LogLevel.WARN, getCantUsePCHMessage(spec.getPreCompiledHeader(), sourceFile));
}
return Lists.newArrayList();
}
}
use of org.gradle.language.nativeplatform.internal.IncludeDirectives in project gradle by gradle.
the class DefaultSourceIncludesResolver method resolveMacro.
private void resolveMacro(MacroLookup visibleMacros, Expression expression, ExpressionVisitor visitor, TokenLookup tokenLookup) {
boolean found = false;
for (IncludeDirectives includeDirectives : visibleMacros) {
Iterable<Macro> macros = includeDirectives.getMacros(expression.getValue());
for (Macro macro : macros) {
found = true;
resolveExpression(visibleMacros, macro, visitor, tokenLookup);
}
}
if (!found) {
visitor.visitIdentifier(new SimpleExpression(expression.getValue(), IncludeType.IDENTIFIER));
}
}
use of org.gradle.language.nativeplatform.internal.IncludeDirectives in project gradle by gradle.
the class DefaultSourceIncludesResolver method resolveMacroFunction.
private void resolveMacroFunction(MacroLookup visibleMacros, Expression expression, ExpressionVisitor visitor, TokenLookup tokenLookup) {
boolean found = false;
for (IncludeDirectives includeDirectives : visibleMacros) {
Iterable<MacroFunction> macroFunctions = includeDirectives.getMacroFunctions(expression.getValue());
for (MacroFunction macro : macroFunctions) {
List<Expression> arguments = expression.getArguments();
if (arguments.isEmpty() && macro.getParameterCount() == 1) {
// Provide an implicit empty argument
arguments = Collections.singletonList(SimpleExpression.EMPTY_EXPRESSIONS);
}
if (macro.getParameterCount() == arguments.size()) {
found = true;
Expression result = macro.evaluate(arguments);
resolveExpression(visibleMacros, result, visitor, tokenLookup);
}
}
}
if (!found) {
visitor.visitUnresolved();
}
}
Aggregations