Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 35cdc1131635596c610499122e409ac69cc14ed5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
configurations {
	etrice_c
	etrice_cpp
	etrice_java
	
	modelpath_c
	modelpath_cpp
	modelpath_java
}

dependencies {
	etrice_c project(':plugins:org.eclipse.etrice.generator.c')
	etrice_cpp project(':plugins:org.eclipse.etrice.generator.cpp')
	etrice_java project(':plugins:org.eclipse.etrice.generator.java')
	
	etrice_c project(':plugins:org.eclipse.etrice.generator.contractmonitor')
	etrice_cpp project(':plugins:org.eclipse.etrice.generator.contractmonitor')
	etrice_java project(':plugins:org.eclipse.etrice.generator.contractmonitor')
}

/**
 * Creates an eTrice generator task.
 * @param name the name of the new task
 * @param lang one of the following languages 'c', 'cpp', 'java'
 * @param models a list of models passed to the generator
 * @param genDir the generation directory
 * @param options the eTrice generator options
 * @return the generator task
 */
ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] ->
	return tasks.create(name: name, type: JavaExec) {
		// accessible for later use
		ext.lang = lang
		ext.modelpath = configurations."modelpath_$lang"
		
		main = "org.eclipse.etrice.generator.${lang}.Main"
		classpath = configurations."etrice_$lang"
		args '-clean', '-msc_instr'
		args '-genDir', genDir
		args options	
		if(!modelpath.isEmpty()) {
			args '-modelpath', modelpath.asPath
		}
		args models
	}
}

Back to the top