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

jreleaser / jreleaser / #512

27 Jul 2025 05:51PM UTC coverage: 45.153% (-0.7%) from 45.803%
#512

push

github

aalmiray
feat(core): Add a --deploy flag to config

Closes #1946

3 of 11 new or added lines in 4 files covered. (27.27%)

845 existing lines in 34 files now uncovered.

23625 of 52322 relevant lines covered (45.15%)

0.45 hits per line

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

46.67
/core/jreleaser-engine/src/main/java/org/jreleaser/engine/context/ContextCreator.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.engine.context;
19

20
import org.jreleaser.bundle.RB;
21
import org.jreleaser.config.JReleaserConfigLoader;
22
import org.jreleaser.logging.JReleaserLogger;
23
import org.jreleaser.model.JReleaserException;
24
import org.jreleaser.model.api.JReleaserCommand;
25
import org.jreleaser.model.api.JReleaserContext.Mode;
26
import org.jreleaser.model.internal.JReleaserContext;
27
import org.jreleaser.model.internal.JReleaserModel;
28
import org.jreleaser.util.PlatformUtils;
29

30
import java.nio.file.Path;
31
import java.util.List;
32

33
/**
34
 * @author Andres Almiray
35
 * @since 0.1.0
36
 */
37
@org.jreleaser.infra.nativeimage.annotations.NativeImage
38
public final class ContextCreator {
39
    private ContextCreator() {
40
        // noop
41
    }
42

43
    public static JReleaserContext create(JReleaserLogger logger,
44
                                          JReleaserContext.Configurer configurer,
45
                                          Mode mode,
46
                                          JReleaserCommand command,
47
                                          Path configFile,
48
                                          Path basedir,
49
                                          Path settings,
50
                                          Path outputDirectory,
51
                                          boolean yolo,
52
                                          boolean dryrun,
53
                                          boolean gitRootSearch,
54
                                          boolean strict,
55
                                          List<String> selectedPlatforms,
56
                                          List<String> rejectedPlatforms) {
UNCOV
57
        return create(logger,
×
58
            configurer,
59
            mode,
60
            command,
UNCOV
61
            resolveModel(logger, configFile),
×
62
            basedir,
63
            settings,
64
            outputDirectory,
65
            yolo,
66
            dryrun,
67
            gitRootSearch,
68
            strict,
69
            selectedPlatforms,
70
            rejectedPlatforms);
71
    }
72

73
    public static JReleaserContext create(JReleaserLogger logger,
74
                                          JReleaserContext.Configurer configurer,
75
                                          Mode mode,
76
                                          JReleaserCommand command,
77
                                          JReleaserModel model,
78
                                          Path basedir,
79
                                          Path settings,
80
                                          Path outputDirectory,
81
                                          boolean yolo,
82
                                          boolean dryrun,
83
                                          boolean gitRootSearch,
84
                                          boolean strict,
85
                                          List<String> selectedPlatforms,
86
                                          List<String> rejectedPlatforms) {
87
        JReleaserContext context = new JReleaserContext(
1✔
88
            logger,
89
            configurer,
90
            mode,
91
            command,
92
            model,
93
            basedir,
94
            settings,
95
            outputDirectory,
96
            yolo,
97
            dryrun,
98
            gitRootSearch,
99
            strict,
100
            selectedPlatforms,
101
            rejectedPlatforms);
102

103
        PlatformUtils.resolveCurrentPlatform(logger);
1✔
104
        logger.info(RB.$("context.creator.git_root_search", context.isGitRootSearch()));
1✔
105
        ModelConfigurer.configure(context);
1✔
106

107
        return context;
1✔
108
    }
109

110
    public static JReleaserModel resolveModel(JReleaserLogger logger, Path configFile) {
111
        try {
112
            logger.info(RB.$("context.creator.reading_configuration"));
1✔
113
            return JReleaserConfigLoader.loadConfig(configFile);
1✔
114
        } catch (JReleaserException e) {
×
115
            logger.trace(e);
×
UNCOV
116
            throw e;
×
UNCOV
117
        } catch (Exception e) {
×
UNCOV
118
            logger.trace(e);
×
UNCOV
119
            throw new JReleaserException(RB.$("ERROR_context_creator_parse_configuration", configFile.toAbsolutePath()), e);
×
120
        }
121
    }
122
}
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