1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.artifact.buildinfo;
20
21 import java.io.File;
22 import java.io.IOException;
23
24 import org.codehaus.plexus.util.FileUtils;
25
26
27
28
29
30 public class NotReproduciblePluginsDocumentationTest {
31 private static final String LS = System.lineSeparator();
32 private static final String DELIMITER = "~~ content generated by NotReproduciblePluginsDocumentationTest";
33
34 public void testBasic() throws IOException {
35 File pluginIssuesApt = new File("src/site/apt/plugin-issues.apt");
36 String content = FileUtils.fileRead(pluginIssuesApt, "UTF-8");
37 content = content.substring(0, content.indexOf(DELIMITER) + DELIMITER.length());
38
39 StringBuilder sb = new StringBuilder(content);
40 sb.append(LS);
41 sb.append(
42 "*---------+-------------------------------------------------------------------+-------+--------------+"
43 + LS);
44 sb.append(
45 "| | <<plugin>> | <<minimum version>> | <<comments>>");
46 String groupId = null;
47 for (String line : FileUtils.loadFile(
48 new File(
49 "src/main/resources/org/apache/maven/plugins/artifact/buildinfo/not-reproducible-plugins.properties"))) {
50 if (!line.startsWith("#")) {
51 sb.append(LS
52 + "*--------+--------------------------------------------------------------------+-------+--------------+"
53 + LS);
54 int index = line.indexOf('=');
55 String plugin = line.substring(0, index);
56 String status = line.substring(index + 1);
57
58 index = plugin.indexOf('+');
59 if (index < 0) {
60 groupId = "org.apache.maven.plugins";
61 sb.append("| org.apache.maven.plugins | {{{/plugins/" + plugin + "/}" + plugin + "}} ");
62 } else {
63 groupId = plugin.substring(0, index);
64 plugin = plugin.substring(index + 1);
65 sb.append("| " + groupId + " | " + plugin + " ");
66 }
67 if (status.startsWith("fail:")) {
68 sb.append("| - | no fixed release available, see {{{" + status.substring(5) + "}reference}}");
69 } else {
70 sb.append("| " + status + " | ");
71 }
72 continue;
73 }
74 if (groupId == null) {
75 continue;
76 }
77 sb.append(line.substring(1));
78 }
79 sb.append(LS
80 + "*----------+------------------------------------------------------------------+-------+--------------+"
81 + LS);
82
83 FileUtils.fileWrite(pluginIssuesApt, "UTF-8", sb.toString());
84 }
85 }