Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to setIncludes when I extends AsciidoctorTask in java custom plugin #256

Closed
tobato opened this issue Oct 13, 2018 · 3 comments
Closed

Comments

@tobato
Copy link

tobato commented Oct 13, 2018

hi:

in gradle we can set Source like this

tasks.withType(AsciidoctorTask) { task ->
    attributes attrs
    sources {
        include 'index.adoc'
    }
}

But now, I need to extends AsciidoctorTask in java, and in my custom tasks

// custom AsciidoctorTask tasks
project.getTasks()
            .create(taskName, AsciidoctorTask.class, (AsciidoctorTask task) -> {
                   // config source
                    task.sources(
                            new Closure<PatternSet>(null){
                        @Override
                        public PatternSet call() {
                            PatternSet patternSet = new PatternSet();
                            patternSet.include("index.adoc");
                            //patternSet.exclude("/resources/");
                            return patternSet;
                        }
                    });
...
}

but it is not work!

// custom AsciidoctorTask tasks
project.getTasks()
            .create(taskName, AsciidoctorTask.class, (AsciidoctorTask task) -> {
                   //set Source by deprecated function
                    task.setSourceDocumentNames("index.adoc");
                    });
...
}

this is work, but has warn message like this

Asciidoctor: setSourceDocumentNames is deprecated and will be removed in a future version. Use setIncludes instead. Files are converted to patterns. Some might not convert correctly. FileCollections will not convert

How Can I correctly config setIncludes() in java ?

@ysb33r
Copy link
Member

ysb33r commented Oct 13, 2018

Are trying to extend AsciidoctorTask from the 1.5.x series?

@tobato
Copy link
Author

tobato commented Oct 16, 2018

we extend from 1.5.8

dependencies {
        // Asciidoctor
        classpath "org.asciidoctor:asciidoctor-gradle-plugin:1.5.8"
       ...
    }

@ysb33r ysb33r mentioned this issue Mar 22, 2019
28 tasks
@ysb33r
Copy link
Member

ysb33r commented Apr 11, 2019

I suggest you upgrade to v2.0.0 and extend org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask ro org.asciidoctor.gradle.jvm.AsciidoctorTask. If you still have issue feel free to open a new issue.

@ysb33r ysb33r closed this as completed Apr 11, 2019
@ysb33r ysb33r added the wontfix label Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants