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

IllegalStateException Failed to find end of block comment #5

Closed
msrd0 opened this issue Oct 15, 2017 · 8 comments
Closed

IllegalStateException Failed to find end of block comment #5

msrd0 opened this issue Oct 15, 2017 · 8 comments

Comments

@msrd0
Copy link

msrd0 commented Oct 15, 2017

I'm trying to use this plugin together with generated sources. The header of the generated source file looks like this:

/* GENERATED FILE - DO NOT EDIT */

Running the licenseFormat task I get the following exception:

Failed to update license header in generated/file.kt
java.lang.IllegalStateException: Failed to find end of block comment in /home/user/git/project/generated/file.kt

The entire stack trace is attached.

Since I absolutely don't care about the header of a generated file, I tried excluding the generated directory:

license {
	// ...
	exclude '**/generated/**'
}

However, this didn't change anything

@stephan-gh
Copy link
Member

stephan-gh commented Oct 15, 2017

How do you include the generated sources in the Gradle build. Do you just add it as separate source directory or as entirely new source set?

Note that these exclusions are based on the source directory, not on the root project directory. You can only use them to exclude specific packages or files with a special name.

Let's consider the following example:

src/main/java
    - net/minecrell/test/Test.java
generated
    - net/minecrell/test/gen/Generated.java

You could exclude net/minecrell/test/gen/** (the package) but you cannot exclude using **/generated/** directly. The exclusions only match the file path within the source directory.

Nevertheless, licenser shouldn't fail on files with this header. I will check if I can reproduce this problem and see if I can find a solution.

@msrd0
Copy link
Author

msrd0 commented Oct 15, 2017

I added it to the existing source set. What would you suggest to exclude all files in that directory?

@stephan-gh
Copy link
Member

stephan-gh commented Oct 16, 2017

If you can, the best solution would be to generate the sources in a special package only for generated sources. That way you can just exclude the package as shown above.

@msrd0
Copy link
Author

msrd0 commented Oct 16, 2017

Well, the generated files are kotlin, so the package can be different from the folders. In my case the generated files just end up in the root directory of the generated source folder, so I'd need a way to exclude an entire source folder.

@stephan-gh
Copy link
Member

@msrd0 If the folder doesn't matter for the package, couldn't you just add them into an additional "generated" directory? That way you can exclude them normally.

Currently, there is no way to exclude specific source directories of a source set, you can only exclude files/directories within a source set.

@msrd0
Copy link
Author

msrd0 commented Oct 18, 2017

Ok thanks for the explanation. Still I'd love to see a feature to exclude certain source directories, not only subdirectories

@stephan-gh
Copy link
Member

@msrd0 I see your point. Feel free to open a new issue for adding that feature and I will consider it as soon as I have time. :)

@msrd0
Copy link
Author

msrd0 commented Oct 18, 2017

There you go: #6

@stephan-gh stephan-gh added this to the 0.4 milestone Jun 30, 2018
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