Skip to content

Commit

Permalink
Merge pull request #122 from xtext/revert-118-83-relative-OutputDirec…
Browse files Browse the repository at this point in the history
…tory

Revert "#83 Relatives path of OutputConfiguration and add test case."
  • Loading branch information
oehme authored Jul 4, 2018
2 parents 3ed967b + e68da89 commit fed99b9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.google.inject.Guice
import java.io.Closeable
import java.io.File
import java.net.URLClassLoader
import java.nio.file.Paths
import java.util.List
import java.util.Set
import java.util.concurrent.ConcurrentHashMap
Expand Down Expand Up @@ -251,8 +250,7 @@ class XtextGradleBuilder implements IncrementalXtextBuilder {
gradleRequest.generatorConfigsByLanguage.mapValues[
outputConfigs.map[gradleOutputConfig|
new OutputConfiguration(gradleOutputConfig.outletName) => [
outputDirectory = Paths.get(gradleRequest.projectDir.absolutePath).relativize(Paths.get(
gradleOutputConfig.target.absolutePath)).toString
outputDirectory = gradleOutputConfig.target.absolutePath
]
].toSet
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,40 +62,4 @@ class BuildingAMultiModuleXtendProject extends AbstractXtendIntegrationTest {
result.hasRunGeneratorFor(downStream)
}

@Test
def void activeAnnotationsCanGenerateFilesUsingOutputConfigurations() {
upStreamProject.createFile('src/main/java/com/example/Generate.xtend', '''
package com.example
import java.util.List
import org.eclipse.xtend.lib.macro.AbstractClassProcessor
import org.eclipse.xtend.lib.macro.CodeGenerationContext
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration
class GenerateProcessor extends AbstractClassProcessor {
override doGenerateCode(List<? extends ClassDeclaration> annotatedSourceElements, extension CodeGenerationContext context) {
for (clazz : annotatedSourceElements) {
val filePath = clazz.compilationUnit.filePath
val folder = context.getTargetFolder(filePath)
val file = folder.append("Test.info")
file.contents = clazz.getSimpleName
}
}
}
''')
upStreamProject.createFile('src/main/java/com/example/GenerateProcessor.xtend', '''
package com.example
import org.eclipse.xtend.lib.macro.Active
@Active(GenerateProcessor)
annotation Generate {}
''')
downStreamProject.createFile('src/main/java/com/example/HelloWorld.xtend', '''
package com.example
@Generate
class HelloWorld {}
''')

build('build')

file('downStream/build/xtend/main/Test.info').shouldExist
}

}

0 comments on commit fed99b9

Please sign in to comment.