• 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

0.0
/core/jreleaser-engine/src/main/java/org/jreleaser/engine/context/ModelAutoConfigurer.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.logging.JReleaserLogger;
22
import org.jreleaser.model.Active;
23
import org.jreleaser.model.JReleaserException;
24
import org.jreleaser.model.JReleaserVersion;
25
import org.jreleaser.model.UpdateSection;
26
import org.jreleaser.model.api.JReleaserCommand;
27
import org.jreleaser.model.api.JReleaserContext.Mode;
28
import org.jreleaser.model.internal.JReleaserContext;
29
import org.jreleaser.model.internal.JReleaserModel;
30
import org.jreleaser.model.internal.common.Artifact;
31
import org.jreleaser.model.internal.release.BaseReleaser;
32
import org.jreleaser.model.internal.release.CodebergReleaser;
33
import org.jreleaser.model.internal.release.GithubReleaser;
34
import org.jreleaser.model.internal.release.GitlabReleaser;
35
import org.jreleaser.model.internal.util.Artifacts;
36
import org.jreleaser.model.spi.release.Repository;
37
import org.jreleaser.sdk.git.GitSdk;
38
import org.jreleaser.util.Env;
39

40
import java.io.IOException;
41
import java.nio.file.Path;
42
import java.util.ArrayList;
43
import java.util.LinkedHashSet;
44
import java.util.List;
45
import java.util.Set;
46

47
import static java.util.Objects.requireNonNull;
48
import static org.jreleaser.util.StringUtils.isNotBlank;
49

50
/**
51
 * @author Andres Almiray
52
 * @since 0.3.0
53
 */
54
public final class ModelAutoConfigurer {
55
    private static final String GLOB_PREFIX = "glob:";
56
    private static final String REGEX_PREFIX = "regex:";
57

UNCOV
58
    private final List<String> authors = new ArrayList<>();
×
UNCOV
59
    private final List<String> files = new ArrayList<>();
×
UNCOV
60
    private final List<String> globs = new ArrayList<>();
×
UNCOV
61
    private final List<String> selectedPlatforms = new ArrayList<>();
×
UNCOV
62
    private final List<String> rejectedPlatforms = new ArrayList<>();
×
UNCOV
63
    private final Set<UpdateSection> updateSections = new LinkedHashSet<>();
×
64
    private JReleaserLogger logger;
65
    private Path basedir;
66
    private Path outputDirectory;
67
    private Boolean dryrun;
68
    private Boolean gitRootSearch;
69
    private Boolean strict;
70
    private String projectName;
71
    private String projectVersion;
72
    private String projectVersionPattern;
73
    private String projectSnapshotPattern;
74
    private String projectSnapshotLabel;
75
    private boolean projectSnapshotFullChangelog;
76
    private String projectCopyright;
77
    private String projectDescription;
78
    private String projectInceptionYear;
79
    private String projectStereotype;
80
    private String tagName;
81
    private String previousTagName;
82
    private String releaseName;
83
    private String milestoneName;
84
    private String branch;
85
    private Boolean prerelease;
86
    private String prereleasePattern;
87
    private Boolean draft;
88
    private boolean overwrite;
89
    private boolean update;
90
    private boolean skipTag;
91
    private boolean skipRelease;
92
    private boolean skipChecksums;
93
    private String changelog;
94
    private boolean changelogFormatted;
95
    private String username;
96
    private String commitAuthorName;
97
    private String commitAuthorEmail;
98
    private boolean signing;
99
    private boolean armored;
100

UNCOV
101
    private ModelAutoConfigurer() {
×
102
        // noop
UNCOV
103
    }
×
104

105
    public ModelAutoConfigurer logger(JReleaserLogger logger) {
UNCOV
106
        this.logger = logger;
×
UNCOV
107
        return this;
×
108
    }
109

110
    public ModelAutoConfigurer basedir(Path basedir) {
UNCOV
111
        this.basedir = basedir;
×
UNCOV
112
        return this;
×
113
    }
114

115
    public ModelAutoConfigurer outputDirectory(Path outputDirectory) {
UNCOV
116
        this.outputDirectory = outputDirectory;
×
UNCOV
117
        return this;
×
118
    }
119

120
    public ModelAutoConfigurer dryrun(Boolean dryrun) {
UNCOV
121
        this.dryrun = dryrun;
×
UNCOV
122
        return this;
×
123
    }
124

125
    public ModelAutoConfigurer gitRootSearch(Boolean gitRootSearch) {
UNCOV
126
        this.gitRootSearch = gitRootSearch;
×
UNCOV
127
        return this;
×
128
    }
129

130
    public ModelAutoConfigurer strict(Boolean strict) {
UNCOV
131
        this.strict = strict;
×
UNCOV
132
        return this;
×
133
    }
134

135
    public ModelAutoConfigurer projectName(String projectName) {
UNCOV
136
        this.projectName = projectName;
×
UNCOV
137
        return this;
×
138
    }
139

140
    public ModelAutoConfigurer projectVersion(String projectVersion) {
UNCOV
141
        this.projectVersion = projectVersion;
×
UNCOV
142
        return this;
×
143
    }
144

145
    public ModelAutoConfigurer projectVersionPattern(String projectVersionPattern) {
UNCOV
146
        this.projectVersionPattern = projectVersionPattern;
×
UNCOV
147
        return this;
×
148
    }
149

150
    public ModelAutoConfigurer projectSnapshotPattern(String projectSnapshotPattern) {
UNCOV
151
        this.projectSnapshotPattern = projectSnapshotPattern;
×
UNCOV
152
        return this;
×
153
    }
154

155
    public ModelAutoConfigurer projectSnapshotLabel(String projectSnapshotLabel) {
UNCOV
156
        this.projectSnapshotLabel = projectSnapshotLabel;
×
UNCOV
157
        return this;
×
158
    }
159

160
    public ModelAutoConfigurer projectSnapshotFullChangelog(boolean projectSnapshotFullChangelog) {
UNCOV
161
        this.projectSnapshotFullChangelog = projectSnapshotFullChangelog;
×
UNCOV
162
        return this;
×
163
    }
164

165
    public ModelAutoConfigurer projectCopyright(String projectCopyright) {
UNCOV
166
        this.projectCopyright = projectCopyright;
×
UNCOV
167
        return this;
×
168
    }
169

170
    public ModelAutoConfigurer projectDescription(String projectDescription) {
UNCOV
171
        this.projectDescription = projectDescription;
×
UNCOV
172
        return this;
×
173
    }
174

175
    public ModelAutoConfigurer projectInceptionYear(String projectInceptionYear) {
UNCOV
176
        this.projectInceptionYear = projectInceptionYear;
×
UNCOV
177
        return this;
×
178
    }
179

180
    public ModelAutoConfigurer projectStereotype(String projectStereotype) {
UNCOV
181
        this.projectStereotype = projectStereotype;
×
UNCOV
182
        return this;
×
183
    }
184

185
    public ModelAutoConfigurer tagName(String tagName) {
UNCOV
186
        this.tagName = tagName;
×
UNCOV
187
        return this;
×
188
    }
189

190
    public ModelAutoConfigurer previousTagName(String previousTagName) {
UNCOV
191
        this.previousTagName = previousTagName;
×
UNCOV
192
        return this;
×
193
    }
194

195
    public ModelAutoConfigurer branch(String branch) {
UNCOV
196
        this.branch = branch;
×
UNCOV
197
        return this;
×
198
    }
199

200
    public ModelAutoConfigurer releaseName(String releaseName) {
UNCOV
201
        this.releaseName = releaseName;
×
UNCOV
202
        return this;
×
203
    }
204

205
    public ModelAutoConfigurer milestoneName(String milestoneName) {
UNCOV
206
        this.milestoneName = milestoneName;
×
UNCOV
207
        return this;
×
208
    }
209

210
    public ModelAutoConfigurer prerelease(Boolean prerelease) {
UNCOV
211
        this.prerelease = prerelease;
×
UNCOV
212
        return this;
×
213
    }
214

215
    public ModelAutoConfigurer prereleasePattern(String prereleasePattern) {
UNCOV
216
        this.prereleasePattern = prereleasePattern;
×
UNCOV
217
        return this;
×
218
    }
219

220
    public ModelAutoConfigurer draft(Boolean draft) {
UNCOV
221
        this.draft = draft;
×
UNCOV
222
        return this;
×
223
    }
224

225
    public ModelAutoConfigurer overwrite(boolean overwrite) {
UNCOV
226
        this.overwrite = overwrite;
×
UNCOV
227
        return this;
×
228
    }
229

230
    public ModelAutoConfigurer update(boolean update) {
UNCOV
231
        this.update = update;
×
UNCOV
232
        return this;
×
233
    }
234

235
    public ModelAutoConfigurer updateSections(Set<UpdateSection> updateSections) {
UNCOV
236
        this.updateSections.clear();
×
UNCOV
237
        if (null != updateSections && !updateSections.isEmpty()) {
×
238
            updateSections.forEach(this::updateSection);
×
239
        }
UNCOV
240
        return this;
×
241
    }
242

243
    public ModelAutoConfigurer updateSection(UpdateSection updateSection) {
244
        if (null != updateSection) {
×
245
            this.updateSections.add(updateSection);
×
246
        }
247
        return this;
×
248
    }
249

250
    public ModelAutoConfigurer skipTag(boolean skipTag) {
UNCOV
251
        this.skipTag = skipTag;
×
UNCOV
252
        return this;
×
253
    }
254

255
    public ModelAutoConfigurer skipRelease(boolean skipRelease) {
UNCOV
256
        this.skipRelease = skipRelease;
×
UNCOV
257
        return this;
×
258
    }
259

260
    public ModelAutoConfigurer skipChecksums(boolean skipChecksums) {
UNCOV
261
        this.skipChecksums = skipChecksums;
×
UNCOV
262
        return this;
×
263
    }
264

265
    public ModelAutoConfigurer changelog(String changelog) {
UNCOV
266
        this.changelog = changelog;
×
UNCOV
267
        return this;
×
268
    }
269

270
    public ModelAutoConfigurer changelogFormatted(boolean changelogFormatted) {
UNCOV
271
        this.changelogFormatted = changelogFormatted;
×
UNCOV
272
        return this;
×
273
    }
274

275
    public ModelAutoConfigurer username(String username) {
UNCOV
276
        this.username = username;
×
UNCOV
277
        return this;
×
278
    }
279

280
    public ModelAutoConfigurer commitAuthorName(String commitAuthorName) {
UNCOV
281
        this.commitAuthorName = commitAuthorName;
×
UNCOV
282
        return this;
×
283
    }
284

285
    public ModelAutoConfigurer commitAuthorEmail(String commitAuthorEmail) {
UNCOV
286
        this.commitAuthorEmail = commitAuthorEmail;
×
UNCOV
287
        return this;
×
288
    }
289

290
    public ModelAutoConfigurer signing(boolean signing) {
UNCOV
291
        this.signing = signing;
×
UNCOV
292
        return this;
×
293
    }
294

295
    public ModelAutoConfigurer armored(boolean armored) {
UNCOV
296
        this.armored = armored;
×
UNCOV
297
        return this;
×
298
    }
299

300
    public ModelAutoConfigurer authors(List<String> authors) {
UNCOV
301
        this.authors.clear();
×
UNCOV
302
        if (null != authors && !authors.isEmpty()) {
×
303
            authors.forEach(this::file);
×
304
        }
UNCOV
305
        return this;
×
306
    }
307

308
    public ModelAutoConfigurer author(String author) {
309
        if (isNotBlank(author)) {
×
310
            this.authors.add(author.trim());
×
311
        }
312
        return this;
×
313
    }
314

315
    public ModelAutoConfigurer files(List<String> files) {
UNCOV
316
        this.files.clear();
×
UNCOV
317
        if (null != files && !files.isEmpty()) {
×
318
            files.forEach(this::file);
×
319
        }
UNCOV
320
        return this;
×
321
    }
322

323
    public ModelAutoConfigurer file(String file) {
324
        if (isNotBlank(file)) {
×
325
            this.files.add(file.trim());
×
326
        }
327
        return this;
×
328
    }
329

330
    public ModelAutoConfigurer globs(List<String> globs) {
UNCOV
331
        this.globs.clear();
×
UNCOV
332
        if (null != globs && !globs.isEmpty()) {
×
333
            globs.forEach(this::glob);
×
334
        }
UNCOV
335
        return this;
×
336
    }
337

338
    public ModelAutoConfigurer glob(String glob) {
339
        if (isNotBlank(glob)) {
×
340
            if (glob.startsWith(GLOB_PREFIX) || glob.startsWith(REGEX_PREFIX)) {
×
341
                this.globs.add(glob.trim());
×
342
            } else {
343
                this.globs.add(GLOB_PREFIX + glob.trim());
×
344
            }
345
        }
346
        return this;
×
347
    }
348

349
    public ModelAutoConfigurer selectedPlatforms(List<String> platforms) {
UNCOV
350
        this.selectedPlatforms.clear();
×
UNCOV
351
        if (null != platforms && !platforms.isEmpty()) {
×
352
            platforms.forEach(this::selectedPlatform);
×
353
        }
UNCOV
354
        return this;
×
355
    }
356

357
    public ModelAutoConfigurer selectedPlatform(String platform) {
358
        if (isNotBlank(platform)) {
×
359
            this.selectedPlatforms.add(platform.trim());
×
360
        }
361
        return this;
×
362
    }
363

364
    public ModelAutoConfigurer rejectedPlatforms(List<String> platforms) {
UNCOV
365
        this.rejectedPlatforms.clear();
×
UNCOV
366
        if (null != platforms && !platforms.isEmpty()) {
×
367
            platforms.forEach(this::rejectedPlatform);
×
368
        }
UNCOV
369
        return this;
×
370
    }
371

372
    public ModelAutoConfigurer rejectedPlatform(String platform) {
373
        if (isNotBlank(platform)) {
×
374
            this.rejectedPlatforms.add(platform.trim());
×
375
        }
376
        return this;
×
377
    }
378

379
    public JReleaserContext autoConfigure() {
UNCOV
380
        requireNonNull(logger, "Argument 'logger' ust not be null");
×
UNCOV
381
        requireNonNull(basedir, "Argument 'basedir' ust not be null");
×
UNCOV
382
        requireNonNull(outputDirectory, "Argument 'outputDirectory' ust not be null");
×
383

UNCOV
384
        logger.info("JReleaser {}", JReleaserVersion.getPlainVersion());
×
UNCOV
385
        JReleaserVersion.banner(logger.getTracer());
×
UNCOV
386
        logger.info(RB.$("context.configurer.auto-config.on"));
×
UNCOV
387
        logger.increaseIndent();
×
UNCOV
388
        logger.info(RB.$("context.configurer.basedir.set"), basedir.toAbsolutePath());
×
UNCOV
389
        dumpAutoConfig();
×
UNCOV
390
        logger.decreaseIndent();
×
UNCOV
391
        return createAutoConfiguredContext();
×
392
    }
393

394
    private JReleaserContext createAutoConfiguredContext() {
UNCOV
395
        return ContextCreator.create(
×
396
            logger,
397
            JReleaserContext.Configurer.CLI,
398
            Mode.FULL,
399
            JReleaserCommand.RELEASE,
UNCOV
400
            autoConfiguredModel(basedir),
×
401
            basedir,
402
            outputDirectory,
UNCOV
403
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.DRY_RUN, dryrun),
×
UNCOV
404
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.GIT_ROOT_SEARCH, gitRootSearch),
×
UNCOV
405
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.STRICT, strict),
×
406
            selectedPlatforms,
407
            rejectedPlatforms);
408
    }
409

410
    private boolean resolveBoolean(String key, Boolean value) {
UNCOV
411
        if (null != value) return value;
×
UNCOV
412
        String resolvedValue = Env.resolve(key, "");
×
UNCOV
413
        return isNotBlank(resolvedValue) && Boolean.parseBoolean(resolvedValue);
×
414
    }
415

416
    private void dumpAutoConfig() {
UNCOV
417
        if (isNotBlank(projectName)) logger.info("- project.name: {}", projectName);
×
UNCOV
418
        if (isNotBlank(projectVersion)) logger.info("- project.version: {}", projectVersion);
×
UNCOV
419
        if (isNotBlank(projectVersionPattern)) logger.info("- project.version.pattern: {}", projectVersionPattern);
×
UNCOV
420
        if (isNotBlank(projectSnapshotPattern)) logger.info("- project.snapshot.pattern: {}", projectSnapshotPattern);
×
UNCOV
421
        if (isNotBlank(projectSnapshotLabel)) logger.info("- project.snapshot.label: {}", projectSnapshotLabel);
×
UNCOV
422
        if (projectSnapshotFullChangelog) logger.info("- project.snapshot.full.changelog: true");
×
UNCOV
423
        if (isNotBlank(projectDescription)) logger.info("- project.description: {}", projectDescription);
×
UNCOV
424
        if (isNotBlank(projectCopyright)) logger.info("- project.copyright: {}", projectCopyright);
×
UNCOV
425
        if (isNotBlank(projectInceptionYear)) logger.info("- project.inceptionYear: {}", projectInceptionYear);
×
UNCOV
426
        if (isNotBlank(projectStereotype)) logger.info("- project.stereotype: {}", projectStereotype);
×
UNCOV
427
        if (!authors.isEmpty()) {
×
428
            for (String author : authors) {
×
429
                logger.info("- author: {}", author);
×
430
            }
×
431
        }
UNCOV
432
        if (isNotBlank(username)) logger.info("- release.username: {}", username);
×
UNCOV
433
        if (isNotBlank(tagName)) logger.info("- release.tagName: {}", tagName);
×
UNCOV
434
        if (isNotBlank(previousTagName)) logger.info("- release.previousTagName: {}", previousTagName);
×
UNCOV
435
        if (isNotBlank(branch)) logger.info("- release.branch: {}", branch);
×
UNCOV
436
        if (isNotBlank(releaseName)) logger.info("- release.releaseName: {}", releaseName);
×
UNCOV
437
        if (isNotBlank(milestoneName)) logger.info("- release.milestone.name: {}", milestoneName);
×
UNCOV
438
        if (overwrite) logger.info("- release.overwrite: true");
×
UNCOV
439
        if (update) logger.info("- release.update: true");
×
UNCOV
440
        if (!updateSections.isEmpty()) logger.info("- release.updateSections: " + updateSections);
×
UNCOV
441
        if (skipTag) logger.info("- release.skipTag: true");
×
UNCOV
442
        if (skipRelease) logger.info("- release.skipRelease: true");
×
UNCOV
443
        if (skipChecksums) logger.info("- checksums.disabled: true");
×
UNCOV
444
        if (null != prerelease && prerelease) logger.info("- release.prerelease: true");
×
UNCOV
445
        if (isNotBlank(prereleasePattern)) logger.info("- release.prerelease.pattern: {}", prereleasePattern);
×
UNCOV
446
        if (null != draft && draft) logger.info("- release.draft: true");
×
UNCOV
447
        if (isNotBlank(changelog)) logger.info(" - release.changelog: {}", changelog);
×
UNCOV
448
        if (changelogFormatted) logger.info("- release.changelog.formatted: true");
×
UNCOV
449
        if (isNotBlank(commitAuthorName)) logger.info("- release.commitAuthor.name: {}", commitAuthorName);
×
UNCOV
450
        if (isNotBlank(commitAuthorEmail)) logger.info("- release.commitAuthor.email: {}", commitAuthorEmail);
×
UNCOV
451
        if (signing) logger.info("- signing.enabled: true");
×
UNCOV
452
        if (armored) logger.info("- signing.armored: true");
×
UNCOV
453
        if (!files.isEmpty()) {
×
454
            for (String file : files) {
×
455
                logger.info("- file: {}", basedir.relativize(basedir.resolve(file)));
×
456
            }
×
457
        }
UNCOV
458
        if (!globs.isEmpty()) {
×
459
            for (String glob : globs) {
×
460
                logger.info("- glob: {}", glob);
×
461
            }
×
462
        }
UNCOV
463
        if (!selectedPlatforms.isEmpty()) {
×
464
            for (String platform : selectedPlatforms) {
×
465
                logger.info("- platform: {}", platform);
×
466
            }
×
467
        }
UNCOV
468
        if (!rejectedPlatforms.isEmpty()) {
×
469
            for (String platform : rejectedPlatforms) {
×
470
                logger.info("- !platform: {}", platform);
×
471
            }
×
472
        }
UNCOV
473
    }
×
474

475
    private JReleaserModel autoConfiguredModel(Path basedir) {
UNCOV
476
        JReleaserModel model = new JReleaserModel();
×
UNCOV
477
        model.getProject().setName(projectName);
×
UNCOV
478
        model.getProject().setDescription(projectDescription);
×
UNCOV
479
        model.getProject().setCopyright(projectCopyright);
×
UNCOV
480
        model.getProject().setStereotype(projectStereotype);
×
UNCOV
481
        model.getProject().setInceptionYear(projectInceptionYear);
×
UNCOV
482
        model.getProject().setAuthors(authors);
×
UNCOV
483
        model.getProject().setVersion(projectVersion);
×
UNCOV
484
        model.getProject().setVersionPattern(projectVersionPattern);
×
UNCOV
485
        model.getProject().getSnapshot().setPattern(projectSnapshotPattern);
×
UNCOV
486
        model.getProject().getSnapshot().setLabel(projectSnapshotLabel);
×
UNCOV
487
        model.getProject().getSnapshot().setFullChangelog(projectSnapshotFullChangelog);
×
488

489
        try {
UNCOV
490
            boolean grs = resolveBoolean(org.jreleaser.model.api.JReleaserContext.GIT_ROOT_SEARCH, gitRootSearch);
×
UNCOV
491
            Repository repository = GitSdk.of(basedir, grs).getRemote();
×
UNCOV
492
            BaseReleaser<?, ?> service = null;
×
UNCOV
493
            switch (repository.getKind()) {
×
494
                case GITHUB:
UNCOV
495
                    service = new GithubReleaser();
×
UNCOV
496
                    model.getRelease().setGithub((GithubReleaser) service);
×
UNCOV
497
                    service.getPrerelease().setEnabled(prerelease);
×
UNCOV
498
                    service.getPrerelease().setPattern(prereleasePattern);
×
UNCOV
499
                    ((GithubReleaser) service).setDraft(draft);
×
UNCOV
500
                    break;
×
501
                case GITLAB:
502
                    service = new GitlabReleaser();
×
503
                    model.getRelease().setGitlab((GitlabReleaser) service);
×
504
                    break;
×
505
                case CODEBERG:
506
                    service = new CodebergReleaser();
×
507
                    model.getRelease().setCodeberg((CodebergReleaser) service);
×
508
                    service.getPrerelease().setEnabled(prerelease);
×
509
                    service.getPrerelease().setPattern(prereleasePattern);
×
510
                    ((CodebergReleaser) service).setDraft(draft);
×
511
                    break;
×
512
                default:
513
                    throw new JReleaserException(RB.$("ERROR_context_configurer_unsupported_url", repository.getHttpUrl()));
×
514
            }
515

UNCOV
516
            service.setUsername(username);
×
UNCOV
517
            service.setTagName(tagName);
×
UNCOV
518
            service.setPreviousTagName(previousTagName);
×
UNCOV
519
            service.setReleaseName(releaseName);
×
UNCOV
520
            service.getMilestone().setName(milestoneName);
×
UNCOV
521
            service.setOverwrite(overwrite);
×
UNCOV
522
            service.getUpdate().setEnabled(update);
×
UNCOV
523
            if (!updateSections.isEmpty()) {
×
524
                if (!update) {
×
525
                    throw new JReleaserException(RB.$("ERROR_context_configurer_update_not_set"));
×
526
                }
527
                service.getUpdate().setSections(updateSections);
×
528
            }
UNCOV
529
            service.setSkipTag(skipTag);
×
UNCOV
530
            service.setSkipRelease(skipRelease);
×
UNCOV
531
            if (isNotBlank(branch)) service.setBranch(branch);
×
UNCOV
532
            if (isNotBlank(changelog)) service.getChangelog().setExternal(changelog);
×
UNCOV
533
            if (isNotBlank(commitAuthorName)) service.getCommitAuthor().setName(commitAuthorName);
×
UNCOV
534
            if (isNotBlank(commitAuthorEmail)) service.getCommitAuthor().setEmail(commitAuthorEmail);
×
UNCOV
535
            if (changelogFormatted) service.getChangelog().setFormatted(Active.ALWAYS);
×
536
        } catch (IOException e) {
×
537
            throw new JReleaserException(e.getMessage());
×
UNCOV
538
        }
×
539

UNCOV
540
        if (skipChecksums) {
×
541
            model.getChecksum().setArtifacts(false);
×
542
            model.getChecksum().setFiles(false);
×
543
            model.getSigning().setChecksums(false);
×
544
        }
545

UNCOV
546
        if (signing) {
×
547
            model.getSigning().setActive(Active.ALWAYS);
×
548
            model.getSigning().setArmored(armored);
×
549
        }
550

UNCOV
551
        if (!files.isEmpty()) {
×
552
            for (String file : files) {
×
553
                model.getFiles().addArtifact(Artifact.of(basedir.resolve(file)));
×
554
            }
×
555
        }
556

UNCOV
557
        if (!globs.isEmpty()) {
×
558
            model.getFiles().addArtifacts(Artifacts.resolveFiles(logger, basedir, globs));
×
559
        }
560

UNCOV
561
        return model;
×
562
    }
563

564
    public static ModelAutoConfigurer builder() {
UNCOV
565
        return new ModelAutoConfigurer();
×
566
    }
567
}
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