1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.forgerock.doc.maven;
18
19 import org.apache.maven.plugin.MojoExecutionException;
20 import org.apache.maven.plugin.MojoFailureException;
21 import org.apache.maven.plugins.annotations.LifecyclePhase;
22 import org.apache.maven.plugins.annotations.Mojo;
23 import org.forgerock.doc.maven.pre.ArtifactBuilder;
24 import org.forgerock.doc.maven.pre.AsciidocToDocBook;
25 import org.forgerock.doc.maven.pre.Branding;
26 import org.forgerock.doc.maven.pre.CommonContent;
27 import org.forgerock.doc.maven.pre.ConditionalText;
28 import org.forgerock.doc.maven.pre.CurrentDocId;
29 import org.forgerock.doc.maven.pre.CustomCss;
30 import org.forgerock.doc.maven.pre.CreateThumbs;
31 import org.forgerock.doc.maven.pre.Dpi;
32 import org.forgerock.doc.maven.pre.Filter;
33 import org.forgerock.doc.maven.pre.HeaderColor;
34 import org.forgerock.doc.maven.pre.ImageData;
35 import org.forgerock.doc.maven.pre.JCite;
36 import org.forgerock.doc.maven.pre.KeepTogether;
37 import org.forgerock.doc.maven.pre.ModifiableCopy;
38 import org.forgerock.doc.maven.pre.PlantUml;
39 import org.forgerock.doc.maven.pre.XCite;
40
41
42
43
44 @Mojo(name = "process", defaultPhase = LifecyclePhase.PRE_SITE)
45 public class PreProcessMojo extends AbstractDocbkxMojo {
46
47
48
49
50
51
52
53 @Override
54 public void execute() throws MojoExecutionException, MojoFailureException {
55
56 if (getBuildDirectory() == null) {
57 throw new MojoExecutionException("No build directory available.");
58 }
59
60 if (!getBuildDirectory().exists()) {
61 if (!getBuildDirectory().mkdir()) {
62 throw new MojoExecutionException("Could not create build directory");
63 }
64 }
65
66
67 new Branding(this).execute();
68
69
70 new ModifiableCopy(this).execute();
71 new ConditionalText(this).execute();
72
73 if (!doUsePreProcessedSources()) {
74 new CommonContent(this).execute();
75 new AsciidocToDocBook(this).execute();
76 new JCite(this).execute();
77 new XCite(this).execute();
78 new Filter(this).execute();
79 new ImageData(this).execute();
80 new HeaderColor(this).execute();
81 new PlantUml(this).execute();
82 if (getFormats().contains(Format.pdf) || getFormats().contains(Format.rtf)) {
83 new KeepTogether(this).execute();
84 new Dpi(this).execute();
85 }
86 if (getFormats().contains(Format.bootstrap)) {
87 new CreateThumbs(this).execute();
88 }
89 new CurrentDocId(this).execute();
90 new CustomCss(this).execute();
91 }
92
93 if (doCreateArtifacts()) {
94 new ArtifactBuilder(this).execute();
95 }
96 }
97 }