aboutsummaryrefslogtreecommitdiff
path: root/runners/maven-plugin/src/main/kotlin/SourceLinkMapItem.kt
blob: ee2354aa252040fcf9841f015b5b6f599b96eb00 (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
66
67
68
69
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

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>
 * ```
 */
public 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)
    public 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)
    public 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")
    public var lineSuffix: String? = null
}