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

build error with: Fatal error during transformation #22

Closed
f-julian opened this issue Apr 8, 2020 · 1 comment
Closed

build error with: Fatal error during transformation #22

f-julian opened this issue Apr 8, 2020 · 1 comment
Labels

Comments

@f-julian
Copy link

f-julian commented Apr 8, 2020

Hi we use this plugin in a project with a lot of gradle modules. Sometime we get build errors with this error:

Fatal error during transformation using /home/jenkins/workdir/workspace/amodule/build/quality-configs/spotbugs/html-report-style.xsl: The processing instruction target matching "[xX][mM][lL]" is not allowed.

If we look in the html-report-style.xsl we see the same content two times like:

?xml` version="1.0" encoding="UTF-8"?>
...
xsl:stylesheet version="1.0"
...
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>  <--- again!
...

I did some digging in the source code and i think it could be a concurrency problem:
:spotbugsMain and :spotbugsTest are executed at the same time for one module

so
ru.vyarus.gradle.plugin.quality.ConfigLoader#copyConfig
is executed by two threads

private File copyConfig(File parent, String path, boolean override) {
        File target = new File(parent, path)
        if (target.exists() && !override) {
            return target
        }
        if (!target.parentFile.exists() && !target.parentFile.mkdirs()) {
            throw new IllegalStateException("Failed to create directories: $target.parentFile.absolutePath")
        }
        InputStream stream = getClass().getResourceAsStream("/ru/vyarus/quality/config/$path")
        if (stream == null) {
            throw new IllegalStateException("Default config file not found in classpath: $path")
        }
        target << stream.text
        return target
    }

This could explain the observed behavior.

What do you think?
Even with lots of gradle modules and a lot of builds this does not happen often so it's hard to come up with a testcase for this.

Thx

@xvik
Copy link
Owner

xvik commented Apr 8, 2020

Hi! Agree, that's the only possible reason. This part must be synchronized.

@xvik xvik added the bug label Apr 8, 2020
@xvik xvik closed this as completed in d66f676 Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants