configurations {
	epsilon
}

repositories {
	mavenCentral()
}

dependencies {
	epsilon 'org.eclipse.epsilon:org.eclipse.epsilon.workflow:2.5.0'
	epsilon 'org.eclipse.epsilon:org.eclipse.epsilon.workflow.emf:2.5.0'
	epsilon 'org.eclipse.epsilon:org.eclipse.epsilon.eunit.cmp.emf:2.5.0'
}

task setupEpsilonTasks {
	// Set up the core Epsilon tasks
	ant.taskdef(resource: 'org/eclipse/epsilon/workflow/tasks/tasks.xml', 
		classpath: configurations.epsilon.asPath, loaderref: 'epsilon')
	// Set up the Epsilon EMF tasks
	ant.taskdef(resource: 'org/eclipse/epsilon/workflow/tasks/emf/tasks.xml', 
		classpath: configurations.epsilon.asPath, loaderref: 'epsilon')
	// Set logging level to info so that EOL's println() is not suppressed
	ant.lifecycleLogLevel = 'INFO'
}

task run {
	dependsOn tasks.setupEpsilonTasks
	// Load the library.model EMF model
	ant.'epsilon.emf.loadModel'(name: 'Library', 
		modelfile: 'library.model', metamodelfile: 'library.ecore')

	// Run library.eol against it
	ant.'epsilon.eol'(src: 'library.eol'){ model(ref: 'Library') }

	// Run library.eunit
	ant.'epsilon.eunit'(src: 'library.eunit'){
		modelTasks() {
			ant.'epsilon.emf.loadModel'(name: 'A', metamodelfile: 'library.ecore',
				read: 'false', store: 'false', modelfile: 'dummyA.model')
			ant.'epsilon.emf.loadModel'(name: 'B', metamodelfile: 'library.ecore',
				read: 'false', store: 'false', modelfile: 'dummyB.model')
		}
		comparators() {
			comparator(classname:
				'org.eclipse.epsilon.eunit.cmp.emf.EMFModelComparator')
		}
	}
}
