dependencies {
	testImplementation 'org.junit.jupiter:junit-jupiter-api'
	testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
	testImplementation "org.eclipse.xtext:org.eclipse.xtext.testing:${xtextVersion}"
	testImplementation "org.eclipse.xtext:org.eclipse.xtext.xbase.testing:${xtextVersion}"
	api "org.eclipse.xtext:org.eclipse.xtext:${xtextVersion}"
	api "org.eclipse.xtext:org.eclipse.xtext.xbase:${xtextVersion}"
}
configurations {
	mwe2 {
		extendsFrom compileClasspath
	}
}

dependencies {
	mwe2 'org.eclipse.emf:org.eclipse.emf.mwe2.launch'
	mwe2 "org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}"
	mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}"
	mwe2 'org.eclipse.xtext:xtext-antlr-generator'
}

task generateXtextLanguage(type: JavaExec) {
	mainClass = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
	classpath = configurations.mwe2
	inputs.file "src/main/java/mydsl/GenerateMyDsl.mwe2"
	inputs.file "src/main/java/mydsl/MyDsl.xtext"
	outputs.dir "src/main/xtext-gen"
	args += "src/main/java/mydsl/GenerateMyDsl.mwe2"
	args += "-p"
	args += "rootPath=/${projectDir}/.."
}

test {
	useJUnitPlatform()
}
processResources.dependsOn(generateXtextLanguage)
generateXtext.dependsOn(generateXtextLanguage)
clean.dependsOn(cleanGenerateXtextLanguage)
eclipse.classpath.plusConfigurations += [configurations.mwe2]
