{"action":"created","issue":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/issues/222","repository_url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin","labels_url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/issues/222/labels{/name}","comments_url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/issues/222/comments","events_url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/issues/222/events","html_url":"https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/222","id":282487836,"node_id":"MDU6SXNzdWUyODI0ODc4MzY=","number":222,"title":"Extensions disappear with gradle daemon after first run","user":{"login":"iwan-aucamp-cs","id":30151330,"node_id":"MDQ6VXNlcjMwMTUxMzMw","avatar_url":"https://avatars0.githubusercontent.com/u/30151330?v=4","gravatar_id":"","url":"https://api.github.com/users/iwan-aucamp-cs","html_url":"https://github.com/iwan-aucamp-cs","followers_url":"https://api.github.com/users/iwan-aucamp-cs/followers","following_url":"https://api.github.com/users/iwan-aucamp-cs/following{/other_user}","gists_url":"https://api.github.com/users/iwan-aucamp-cs/gists{/gist_id}","starred_url":"https://api.github.com/users/iwan-aucamp-cs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwan-aucamp-cs/subscriptions","organizations_url":"https://api.github.com/users/iwan-aucamp-cs/orgs","repos_url":"https://api.github.com/users/iwan-aucamp-cs/repos","events_url":"https://api.github.com/users/iwan-aucamp-cs/events{/privacy}","received_events_url":"https://api.github.com/users/iwan-aucamp-cs/received_events","type":"User","site_admin":false},"labels":[{"id":980857412,"node_id":"MDU6TGFiZWw5ODA4NTc0MTI=","url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/labels/1.5.x","name":"1.5.x","color":"c2e0c6","default":false},{"id":28226994,"node_id":"MDU6TGFiZWwyODIyNjk5NA==","url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":43,"created_at":"2017-12-15T16:57:17Z","updated_at":"2018-10-12T09:58:26Z","closed_at":null,"author_association":"NONE","body":"When using extensions like asciidoctor-diagram they are only available for the first build under gradle daemon - on subsequent executions they are missing.\r\n\r\nI have set up a project to reproduce this here: https://gitlab.com/iwan.aucamp/public-scratchpad/tree/master/asciidoctor-gradle-diagrams_issue\r\n\r\nOutput:\r\n\r\n```\r\niwana@iwana-nb.concurrent.systems:~\r\n$ tar -jxf <(curl --silent https://gitlab.com/iwan.aucamp/public-scratchpad/repository/master/archive.tar.bz2) --strip-components=1 --wildcards -C /var/tmp/ '*/asciidoctor-gradle-diagrams_issue/'\r\niwana@iwana-nb.concurrent.systems:~\r\n$ (\r\n> cd /var/tmp/asciidoctor-gradle-diagrams_issue/\r\n> ./gradlew --stop \r\n> ./gradlew clean asciidoctor\r\n> ./gradlew clean asciidoctor\r\n> )\r\nStopping Daemon(s)\r\n1 Daemon stopped\r\nStarting a Gradle Daemon, 10 stopped Daemons could not be reused, use --status for details\r\n\r\nBUILD SUCCESSFUL in 9s\r\n2 actionable tasks: 1 executed, 1 up-to-date\r\n\r\n> Task :asciidoctor \r\nasciidoctor: WARNING: test-article.asciidoc: line 63: invalid style for listing block: graphviz\r\nasciidoctor: WARNING: test-article.asciidoc: line 97: invalid style for listing block: plantuml\r\n\r\n\r\nBUILD SUCCESSFUL in 0s\r\n2 actionable tasks: 2 executed\r\n```\r\n\r\nThe reason this is happening is because the extentions (i.e. `Asciidoctor::Extensions.instance_variable_get(:@groups)`) is being cleared after the task executes:\r\n\r\nhttps://github.com/asciidoctor/asciidoctor-gradle-plugin/blob/64aac8a/src/main/groovy/org/asciidoctor/gradle/AsciidoctorTask.groovy#L886\r\n\r\n```\r\n            if (asciidoctor) {\r\n                asciidoctor.unregisterAllExtensions()\r\n            }\r\n```\r\n\r\nI'm not clear why this is being done though though - this was changed in https://github.com/asciidoctor/asciidoctor-gradle-plugin/pull/213 ( https://github.com/asciidoctor/asciidoctor-gradle-plugin/commit/0b9d614fb10fcf79747588e0a8257fca5b96033a )\r\n\r\nRemoving `asciidoctor.unregisterAllExtensions()` makes the problem go away but I'm not entirely clear why it was added in the first place. It seems like this would also cause problems with multiple asciidoctor tasks."},"comment":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/issues/comments/429272902","html_url":"https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/222#issuecomment-429272902","issue_url":"https://api.github.com/repos/asciidoctor/asciidoctor-gradle-plugin/issues/222","id":429272902,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTI3MjkwMg==","user":{"login":"dcp65","id":6068269,"node_id":"MDQ6VXNlcjYwNjgyNjk=","avatar_url":"https://avatars2.githubusercontent.com/u/6068269?v=4","gravatar_id":"","url":"https://api.github.com/users/dcp65","html_url":"https://github.com/dcp65","followers_url":"https://api.github.com/users/dcp65/followers","following_url":"https://api.github.com/users/dcp65/following{/other_user}","gists_url":"https://api.github.com/users/dcp65/gists{/gist_id}","starred_url":"https://api.github.com/users/dcp65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcp65/subscriptions","organizations_url":"https://api.github.com/users/dcp65/orgs","repos_url":"https://api.github.com/users/dcp65/repos","events_url":"https://api.github.com/users/dcp65/events{/privacy}","received_events_url":"https://api.github.com/users/dcp65/received_events","type":"User","site_admin":false},"created_at":"2018-10-12T09:58:26Z","updated_at":"2018-10-12T09:58:26Z","author_association":"NONE","body":"Sorry. My fault. I was applying the asciidoctor.convert plugin in the wrong place in my build file. \r\n\r\nHowever, now I'm getting a different error:\r\n\r\n```\r\nException in thread \"main\" java.lang.NoSuchMethodError: org.asciidoctor.extension.JavaExtensionRegistry.docinfoProcessor(Lorg/asciidoctor/extension/DocinfoProcessor;)V\r\n        at io.spring.asciidoctor.SpringAsciidoctorExtensionRegistry.register(SpringAsciidoctorExtensionRegistry.java:31)\r\n        at org.asciidoctor.extension.internal.ExtensionRegistryExecutor.registerAllExtensions(ExtensionRegistryExecutor.java:21)\r\n        at org.asciidoctor.internal.JRubyAsciidoctor.registerExtensions(JRubyAsciidoctor.java:118)\r\n        at org.asciidoctor.internal.JRubyAsciidoctor.processRegistrations(JRubyAsciidoctor.java:107)\r\n        at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:87)\r\n        at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:83)\r\n        at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:823)\r\n        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.getAsciidoctorInstance(AsciidoctorJavaExec.groovy:80)\r\n        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:42)\r\n        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:128)\r\n```\r\n\r\nHere's my build.gradle:\r\n\r\n```\r\nbuildscript {\r\n    dependencies {\r\n        classpath \"io.github.swagger2markup:swagger2markup-gradle-plugin:1.3.3\"\r\n        classpath \"io.github.swagger2markup:swagger2markup-import-files-ext:1.3.3\"\r\n    }\r\n}\r\n\r\nrepositories {\r\n    maven {\r\n        url 'https://repo.spring.io/release'\r\n    }\r\n    jcenter()\r\n}\r\n\r\nplugins {\r\n    id 'org.asciidoctor.jvm.base' version '2.0.0-alpha.3' apply false\r\n}\r\n\r\napply plugin: 'org.asciidoctor.convert'\r\n\r\ndependencies {\r\n    asciidoctor 'io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE'\r\n    asciidoctor 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'\r\n}\r\n\r\next {\r\n    asciiDocOutputDir = file(\"${buildDir}/asciidoc/generated\")\r\n    docBuildDir = file(\"${project.buildDir}/doc\")\r\n}\r\n\r\napply plugin: 'io.github.swagger2markup'\r\n\r\nconvertSwagger2markup {\r\n    swaggerInput System.getProperty(\"swaggerDef\", \"src/swagger/swagger.json\")\r\n    outputDir asciiDocOutputDir\r\n    config = [\r\n            'swagger2markup.pathsGroupedBy': 'TAGS',\r\n            'swagger2markup.extensions.dynamicPaths.contentPath' : file('src/asciidoc/extensions/paths').absolutePath\r\n    ]\r\n}\r\n\r\nasciidoctor {\r\n    dependsOn(convertSwagger2markup)\r\n    separateOutputDirs = false\r\n    sourceDir = file(\"src/asciidoc/\")\r\n    sources {\r\n        include myguide.adoc'\r\n    }\r\n    resources {\r\n        from(sourceDir) {\r\n            include 'images/**'\r\n        }\r\n        from(sourceDir) {\r\n            include 'assets/js/**'\r\n        }\r\n    }\r\n\r\n    outputDir docBuildDir\r\n    backends = ['html5', 'pdf']\r\n    attributes = [\r\n            'doctype'           : 'book',\r\n            'toc'               : 'left',\r\n            'toclevels'         : '3',\r\n            'source-highlighter': 'prettify',\r\n            'revnumber'         : '2.1',\r\n            'docinfo'           : 'shared',\r\n            'pdf-stylesdir'     : 'theme',\r\n            'pdf-style'         : 'mystyle',\r\n            'generated'         : asciiDocOutputDir\r\n    ]\r\n}\r\n\r\n```"}}
{"actor":{"display_login":"dcp65"}}