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

org.jreleaser.ant.tasks.JReleaserReleaseTask 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 0.1.0
 */
public class JReleaserReleaseTask extends AbstractDistributionAwareJReleaserTask {
    private final List deployerTypes = new ArrayList<>();
    private final List excludedDeployerTypes = new ArrayList<>();
    private final List deployerNames = new ArrayList<>();
    private final List excludedDeployerNames = new ArrayList<>();
    private final List uploaderTypes = new ArrayList<>();
    private final List excludedUploaderTypes = new ArrayList<>();
    private final List uploaderNames = new ArrayList<>();
    private final List excludedUploaderNames = new ArrayList<>();
    private final List catalogers = new ArrayList<>();
    private final List excludedCatalogers = new ArrayList<>();

    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);
        }
    }

    public void setUploaderTypes(String uploaderTypes) {
        this.uploaderTypes.addAll(expandAndCollect(uploaderTypes));
    }

    public void setExcludedUploaderTypes(String excludedUploaderTypes) {
        this.excludedUploaderTypes.addAll(expandAndCollect(excludedUploaderTypes));
    }

    public void setUploaderNames(String uploaderNames) {
        this.uploaderNames.addAll(expandAndCollect(uploaderNames));
    }

    public void setExcludedUploaderNames(String excludedUploaderNames) {
        this.excludedUploaderNames.addAll(expandAndCollect(excludedUploaderNames));
    }

    public void setUploaderTypes(List uploaderTypes) {
        if (null != uploaderTypes) {
            this.uploaderTypes.addAll(uploaderTypes);
        }
    }

    public void setExcludedUploaderTypes(List excludedUploaderTypes) {
        if (null != excludedUploaderTypes) {
            this.excludedUploaderTypes.addAll(excludedUploaderTypes);
        }
    }

    public void setUploaderNames(List uploaderNames) {
        if (null != uploaderNames) {
            this.uploaderNames.addAll(uploaderNames);
        }
    }

    public void setExcludedUploaderNames(List excludedUploaderNames) {
        if (null != excludedUploaderNames) {
            this.excludedUploaderNames.addAll(excludedUploaderNames);
        }
    }

    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);
        }
    }

    @Override
    protected void doExecute(JReleaserContext context) {
        context.setIncludedDeployerTypes(collectEntries(deployerTypes, true));
        context.setExcludedDeployerTypes(collectEntries(excludedDeployerTypes, true));
        context.setIncludedDeployerNames(deployerNames);
        context.setExcludedDeployerNames(excludedDeployerNames);
        context.setIncludedUploaderTypes(collectEntries(uploaderTypes, true));
        context.setExcludedUploaderTypes(collectEntries(excludedUploaderTypes, true));
        context.setIncludedUploaderNames(uploaderNames);
        context.setExcludedUploaderNames(excludedUploaderNames);
        context.setIncludedCatalogers(collectEntries(catalogers, true));
        context.setExcludedCatalogers(collectEntries(excludedCatalogers, true));
        Workflows.release(setupContext(context)).execute();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy