apply from: "${rootDir}/gradle/mwe2-workflows.gradle"

dependencies {
	api project(':org.eclipse.xtext.testing')
	api project(':org.eclipse.xtext.xtext.generator')
	api project(':org.eclipse.xtext.xtext.wizard')
	api project(':org.eclipse.xtext.testlanguages')
	mwe2Implementation project(':org.eclipse.xtext.testlanguages')
	api 'junit:junit'
	api 'org.eclipse.emf:org.eclipse.emf.common'
	api 'org.eclipse.emf:org.eclipse.emf.ecore.xmi'
	optional files('lib/simple.jar')
	// The MWE2 workflow depends on emf-gen, so we have to include it in the test dependencies
	testImplementation sourceSets.mwe2.output
	testImplementation 'args4j:args4j'
	// optional for the utilities but mandatory to run the tests
	testImplementation 'junit:junit'
	testImplementation 'org.junit.jupiter:junit-jupiter-api'
	testImplementation 'org.junit.jupiter:junit-jupiter-engine'
	testImplementation 'org.junit.platform:junit-platform-suite-api'
	testImplementation 'org.junit.platform:junit-platform-runner'
	testImplementation 'org.junit.vintage:junit-vintage-engine'
}

sourceSets.test {
    java.srcDirs = ['src', 'src-gen', 'suites', 'xtend-gen']
}

sourceSets.mwe2 {
	java.srcDirs = ['generator/src', 'emf-gen']
	runtimeClasspath += processTestResources.outputs.files
}
jar.from sourceSets.mwe2.output
sourcesJar {
	from sourceSets.mwe2.allSource
}
task generateTestLanguages(type: XtextGeneratorTask) {
	workflow = file('src/org/eclipse/xtext/GenerateAllTestLanguages.mwe2')
	outputs.dir 'src-gen'
}

test {
	exclude 'org.eclipse.xtext.serializer.contextFinderTest.NestedTypeRecursiveTest.class'
	exclude '**/*Suite.class'
	useJUnitPlatform()
}
