aboutsummaryrefslogtreecommitdiff
path: root/runners/maven-plugin/src/main/kotlin/SourceLinkMapItem.kt
blob: 621b38d85c1736bd20f558280574c53d0699cdd0 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.jetbrains.dokka.maven

import org.apache.maven.plugins.annotations.Parameter

/**
 * Configuration block that allows adding a `source` link to each signature
 * which leads to [path] with a specific line number (configurable by setting [lineSuffix]),
 * letting documentation readers find source code for each declaration.
 *
 * Example:
 *
 * ```xml
 * <sourceLinks>
 *     <link>
 *         <path>${project.basedir}/src</path>
 *         <url>https://github.com/kotlin/dokka/tree/master/src</url>
 *         <lineSuffix>#L</lineSuffix>
 *     </link>
 * </sourceLinks>
 * ```
 */
class SourceLinkMapItem {

    /**
     * Path to the local source directory. The path must be relative to the root of current project.
     *
     * Example:
     *
     * ```xml
     * <path>${project.basedir}/src</path>
     * ```
     */
    @Parameter(name = "path", required = true)
    var path: String = ""

    /**
     * URL of source code hosting service that can be accessed by documentation readers,
     * like GitHub, GitLab, Bitbucket, etc. This URL will be used to generate
     * source code links of declarations.
     *
     * Example:
     *
     * ```xml
     * <url>https://github.com/username/projectname/tree/master/src</url>
     * ```
     */
    @Parameter(name = "url", required = true)
    var url: String = ""

    /**
     * Suffix used to append source code line number to the URL. This will help readers navigate
     * not only to the file, but to the specific line number of the declaration.
     *
     * The number itself will be appended to the specified suffix. For instance,
     * if this property is set to `#L` and the line number is 10, resulting URL suffix
     * will be `#L10`
     *
     * Suffixes used by popular services:
     * - GitHub: `#L`
     * - GitLab: `#L`
     * - Bitbucket: `#lines-`
     */
    @Parameter(name = "lineSuffix")
    var lineSuffix: String? = null
}