All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jreleaser.ant.tasks.JReleaserCatalogTask Maven / Gradle / Ivy

There is a newer version: 1.15.0
Show newest version
/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2020-2024 The JReleaser authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jreleaser.ant.tasks;

import org.jreleaser.model.internal.JReleaserContext;
import org.jreleaser.workflow.Workflows;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Andres Almiray
 * @since 1.5.0
 */
public class JReleaserCatalogTask extends AbstractDistributionAwareJReleaserTask {
    private final List catalogers = new ArrayList<>();
    private final List excludedCatalogers = new ArrayList<>();
    private final List deployerTypes = new ArrayList<>();
    private final List excludedDeployerTypes = new ArrayList<>();
    private final List deployerNames = new ArrayList<>();
    private final List excludedDeployerNames = new ArrayList<>();

    public void setCatalogers(String catalogers) {
        this.catalogers.addAll(expandAndCollect(catalogers));
    }

    public void setExcludedCatalogers(String excludedCatalogers) {
        this.excludedCatalogers.addAll(expandAndCollect(excludedCatalogers));
    }

    public void setCatalogers(List catalogers) {
        if (null != catalogers) {
            this.catalogers.addAll(catalogers);
        }
    }

    public void setExcludedCatalogers(List excludedCatalogers) {
        if (null != excludedCatalogers) {
            this.excludedCatalogers.addAll(excludedCatalogers);
        }
    }

    public void setDeployerTypes(String deployerTypes) {
        this.deployerTypes.addAll(expandAndCollect(deployerTypes));
    }

    public void setExcludedDeployerTypes(String excludedDeployerTypes) {
        this.excludedDeployerTypes.addAll(expandAndCollect(excludedDeployerTypes));
    }

    public void setDeployerNames(String deployerNames) {
        this.deployerNames.addAll(expandAndCollect(deployerNames));
    }

    public void setExcludedDeployerNames(String excludedDeployerNames) {
        this.excludedDeployerNames.addAll(expandAndCollect(excludedDeployerNames));
    }

    public void setDeployerTypes(List deployerTypes) {
        if (null != deployerTypes) {
            this.deployerTypes.addAll(deployerTypes);
        }
    }

    public void setExcludedDeployerTypes(List excludedDeployerTypes) {
        if (null != excludedDeployerTypes) {
            this.excludedDeployerTypes.addAll(excludedDeployerTypes);
        }
    }

    public void setDeployerNames(List deployerNames) {
        if (null != deployerNames) {
            this.deployerNames.addAll(deployerNames);
        }
    }

    public void setExcludedDeployerNames(List excludedDeployerNames) {
        if (null != excludedDeployerNames) {
            this.excludedDeployerNames.addAll(excludedDeployerNames);
        }
    }

    @Override
    protected JReleaserContext setupContext(JReleaserContext context) {
        super.setupContext(context);
        context.setIncludedCatalogers(collectEntries(catalogers, true));
        context.setExcludedCatalogers(collectEntries(excludedCatalogers, true));
        context.setIncludedDeployerTypes(collectEntries(deployerTypes, true));
        context.setExcludedDeployerTypes(collectEntries(excludedDeployerTypes, true));
        context.setIncludedDeployerNames(deployerNames);
        context.setExcludedDeployerNames(excludedDeployerNames);
        return context;
    }

    @Override
    protected void doExecute(JReleaserContext context) {
        Workflows.catalog(setupContext(context)).execute();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy