1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.objectweb.fractal.cecilia.adl.compiler.gnu;
25
26 import java.io.File;
27 import java.util.ArrayList;
28 import java.util.List;
29 import java.util.Map;
30
31 import org.objectweb.fractal.api.Component;
32 import org.objectweb.fractal.cecilia.adl.compiler.AbstractCompilationTaskFactory;
33 import org.objectweb.fractal.task.core.TaskException;
34
35 public class GnuCompilationTaskFactory extends AbstractCompilationTaskFactory {
36
37
38
39
40
41 @Override
42 protected Component createCompileTask(final Object id,
43 final String compileCommand, final List<String> flags, final File outputDir,
44 final Map<Object, Object> context) throws TaskException {
45 return taskFactoryItf.newPrimitiveTask(new GnuDepCompilerTask(
46 compileCommand, outputDir, flags), id);
47 }
48
49 @Override
50 protected Component createLinkTask(final Object id, final String linkCommand,
51 final String linkedFileName, List<String> flags, final File outputDir,
52 final int nbJobs, final Map<Object, Object> context) throws TaskException {
53 final String ldScript = tryGetContextStringArg("linker-script", context);
54 if (ldScript != null) {
55 flags.add("-T");
56 flags.add(ldScript);
57 }
58 return taskFactoryItf.newPrimitiveTask(new GnuLinkerTask(linkCommand,
59 linkedFileName, outputDir, flags, nbJobs), id);
60 }
61
62 @Override
63 protected Component createArchiveTask(final Object id,
64 final String archiveCommand, final String archiveFileName,
65 final List<String> flags, final File outputDir,
66 final Map<Object, Object> context) throws TaskException {
67 return taskFactoryItf.newPrimitiveTask(new GnuArchiverTask(archiveCommand,
68 archiveFileName, outputDir, flags), id);
69 }
70 }