configurations {
	epsilon
}

repositories {
	maven {
		url "https://repo.eclipse.org/content/repositories/acceleo-releases/"
	}
	maven {
		url "https://oss.sonatype.org/content/repositories/snapshots"
	}
	mavenCentral()
}

dependencies {
	epsilon('org.eclipse.epsilon:org.eclipse.epsilon.emc.uml:2.5.0') {
		// UML2 is broken on Maven Central
        exclude group: 'org.eclipse.uml2'
    }
    epsilon 'org.eclipse.epsilon:org.eclipse.epsilon.workflow:2.5.0'
    
    // Fetch the UML2 dependencies from repo.eclipse.org instead
	epsilon 'org.eclipse.uml2:org.eclipse.uml2.uml:5.0.1.v20140910-1354'
	epsilon 'org.eclipse.uml2:org.eclipse.uml2.common:2.0.1.v20140910-1354'
	epsilon 'org.eclipse.uml2:org.eclipse.uml2.types:2.0.0.v20140910-1354'
}

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 logging level to info so that EOL's println() is not suppressed
	ant.lifecycleLogLevel = 'INFO'
}

task run {
	dependsOn tasks.setupEpsilonTasks

	// Load a UML model from model.uml
	ant.'epsilon.loadModel'(name: 'UML', impl: 'org.eclipse.epsilon.emc.uml.UmlModel'){
		parameter(name: 'modelFile', file: 'model.uml')
	}

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

}