Skip to content

Allow taskToRun to be passed as a command line argument via -PchangedProjectsTask.taskToRun #5

@mklueh

Description

@mklueh

I thought I'd open a new issue for this one :)

It would be handy if you could just pass the task you want to run as an command-line argument. That way you can run multiple tasks with this plugin via CI.

    private String getPathToTask(Project project) {
        String taskToRun = Extensions
                .getTaskToRunParameter(project)
                .orElse(extension.getTaskToRun().getOrNull());

        if (project.isRootProject()) {
            return String.format(":%s", taskToRun);
        } else {
            return String.format("%s:%s", project.getPath(), taskToRun);
        }
    }
    public static Optional<String> getTaskToRunParameter(Project project) {
        return Optional.of(project)
                .map(Project::getRootProject)
                .map(p -> p.findProperty(TASK_TO_RUN))
                .map(String.class::cast);
    }

Not tested yet and not sure if this works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions