• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jreleaser / jreleaser / #475

03 Apr 2025 10:50AM UTC coverage: 40.322% (-8.9%) from 49.193%
#475

push

github

aalmiray
feat(release): Support Forgejo as releaser

Closes #1842

Closes #1843

182 of 1099 new or added lines in 45 files covered. (16.56%)

4239 existing lines in 333 files now uncovered.

20797 of 51577 relevant lines covered (40.32%)

0.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.91
/core/jreleaser-model-impl/src/main/java/org/jreleaser/model/internal/common/ExtraProperties.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 *
4
 * Copyright 2020-2025 The JReleaser authors.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     https://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
package org.jreleaser.model.internal.common;
19

20
import org.jreleaser.util.StringUtils;
21

22
import java.io.Serializable;
23
import java.util.LinkedHashMap;
24
import java.util.Map;
25

26
import static org.jreleaser.util.StringUtils.isNotBlank;
27
import static org.jreleaser.util.StringUtils.isTrue;
28
import static org.jreleaser.util.StringUtils.splitValue;
29

30
/**
31
 * @author Andres Almiray
32
 * @since 0.1.0
33
 */
34
public interface ExtraProperties extends Serializable {
35
    String prefix();
36

37
    Map<String, Object> getExtraProperties();
38

39
    void setExtraProperties(Map<String, Object> properties);
40

41
    void addExtraProperties(Map<String, Object> properties);
42

43
    default void addExtraProperty(String key, Object value) {
44
        boolean valueIsNotBlank = value instanceof CharSequence && isNotBlank(String.valueOf(value));
1✔
45
        if (valueIsNotBlank || null != value) {
1✔
46
            getExtraProperties().put(key, value);
1✔
47
        }
48
    }
1✔
49

50
    default Map<String, Object> resolvedExtraProperties() {
51
        return resolvedExtraProperties(prefix());
1✔
52
    }
53

54
    default Map<String, Object> resolvedExtraProperties(String prefix) {
55
        Map<String, Object> props = new LinkedHashMap<>();
1✔
56

57
        getExtraProperties().forEach((key, value) -> {
1✔
58
            if (null == value) return;
1✔
59

60
            boolean split = key.endsWith("_split");
1✔
61
            String k = key;
1✔
62
            Object v = value;
1✔
63

64
            if (split) {
1✔
65
                k = key.substring(0, key.length() - "_split".length());
×
66
                v = splitValue(String.valueOf(value));
×
67
            }
68

69
            if (key.startsWith(prefix)) {
1✔
70
                props.put(k, v);
×
71
            } else {
72
                props.put(prefix + StringUtils.capitalize(k), v);
1✔
73
            }
74
        });
1✔
75

76
        return props;
1✔
77
    }
78

79
    default String getExtraProperty(String key) {
UNCOV
80
        if (getExtraProperties().containsKey(key)) {
×
81
            return String.valueOf(getExtraProperties().get(key));
×
82
        }
UNCOV
83
        return null;
×
84
    }
85

86
    default boolean extraPropertyIsTrue(String key) {
87
        return getExtraProperties().containsKey(key) && isTrue(getExtraProperties().get(key));
1✔
88
    }
89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc