Skip to content

Inner dsl block example is not working or something missing #374

@vinz486

Description

@vinz486

This is all what I need to create a inner data extension block?

import java.io.File;
import org.gradle.api.Action;

public class SiteExtension {
    private File outputDir;
    private final CustomData customData = new CustomData();

    public void setOutputDir(File outputDir) {
        this.outputDir = outputDir;
    }

    public File getOutputDir() {
        return outputDir;
    }

    public CustomData getCustomData() {
        return customData;
    }

    public void customData(Action<? super CustomData> action) {
        action.execute(customData);
    }
}

(and a pojo CustomData class)

Who, when and how method "customData" is called?

Simply creating extension:
project.getExtensions().create("name", SiteExtension.class);

Does not work.

What should be done? In the whole Gradle guide is absolutely not clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions