diff --git a/xtext-gradle-plugin/src/integTest/java/org/xtext/gradle/test/BuildingAMultiModuleXtendProject.xtend b/xtext-gradle-plugin/src/integTest/java/org/xtext/gradle/test/BuildingAMultiModuleXtendProject.xtend index ac3ef2f..12bc38c 100644 --- a/xtext-gradle-plugin/src/integTest/java/org/xtext/gradle/test/BuildingAMultiModuleXtendProject.xtend +++ b/xtext-gradle-plugin/src/integTest/java/org/xtext/gradle/test/BuildingAMultiModuleXtendProject.xtend @@ -63,4 +63,34 @@ class BuildingAMultiModuleXtendProject extends AbstractXtendIntegrationTest { snapshot.assertChangedClasses("B") } + @Test + def void activeAnnotationsCanReadResourcesByDefault() { + upStreamProject.file("src/main/java/ReadingAnnotation.xtend") << ''' + import org.eclipse.xtend.lib.macro.* + @Active(ReadingProcessor) + annotation ReadingAnnotation {} + ''' + upStreamProject.file("src/main/java/ReadingProcessor.xtend") << ''' + import org.eclipse.xtend.lib.macro.* + import org.eclipse.xtend.lib.macro.declaration.* + class ReadingProcessor extends AbstractClassProcessor { + override doValidate(ClassDeclaration annotatedClass, @Extension ValidationContext context) { + val exists = context.getProjectSourceFolders(annotatedClass.compilationUnit.filePath).exists [ folder | + context.exists(folder.append(annotatedClass.simpleName + '.txt')) + ] + if (!exists) { + context.addError(annotatedClass, 'No corresponding text file found') + } + } + } + ''' + downStreamProject.file("src/main/java/Foo.xtend") << ''' + @ReadingAnnotation class Foo {} + ''' + downStreamProject.file("src/main/resources/Foo.txt") << ''' + FOO! + ''' + build('build') + } + } \ No newline at end of file diff --git a/xtext-gradle-plugin/src/main/java/org/xtext/gradle/XtextBuilderPlugin.xtend b/xtext-gradle-plugin/src/main/java/org/xtext/gradle/XtextBuilderPlugin.xtend index b08154f..bf3dc74 100644 --- a/xtext-gradle-plugin/src/main/java/org/xtext/gradle/XtextBuilderPlugin.xtend +++ b/xtext-gradle-plugin/src/main/java/org/xtext/gradle/XtextBuilderPlugin.xtend @@ -129,9 +129,11 @@ class XtextBuilderPlugin implements Plugin { xtext.sourceSets.maybeCreate(javaSourceSet.name) => [ xtextSourceSet | val generatorTask = project.tasks.getByName(xtextSourceSet.generatorTaskName) as XtextGenerate xtextSourceSet.srcDirs([javaSourceSet.java.srcDirs] as Callable>) + xtextSourceSet.srcDirs([javaSourceSet.resources.srcDirs] as Callable>) javaSourceSet.allSource.srcDirs([ val dslSources = new LinkedHashSet(xtextSourceSet.srcDirs) dslSources.removeAll(javaSourceSet.java.srcDirs) + dslSources.removeAll(javaSourceSet.resources.srcDirs) dslSources ] as Callable>) javaSourceSet.java.srcDirs([