virtualdogbert / enterprise-groovy-plugin

A gradle plugin for adding @CompileStatic by default with optional configurable enforcement.
Apache License 2.0
8 stars 2 forks source link

The plugin crashes when there is no conventions.groovy file #11

Closed demus-nine closed 4 years ago

demus-nine commented 5 years ago

After installing the plugin, before there is a conventions.grovy file, apply in the plugin crashes on line 90. This prevents running any of the setupEnterpriseGroovy*Conventions tasks to generate the file.

I suggest not enabling the console task until there is a file. See patch:

From 32c773482b7c6a6926eaab7e2f575f66f64d5b0f Mon Sep 17 00:00:00 2001 From: Daniel Demus dde@nine.dk Date: Fri, 8 Nov 2019 16:17:07 +0100 Subject: [PATCH] Only enable the console task if a conventions.groovy file exists

Otherwise it throws a filenotfoundexception, and you don't the setupXxxxConventions tasks are also unavailable.

.../groovy/com/virtualdogbert/EnterpriseGroovyPlugin.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/groovy/com/virtualdogbert/EnterpriseGroovyPlugin.groovy b/src/main/groovy/com/virtualdogbert/EnterpriseGroovyPlugin.groovy index b0a1314..cc3d3a2 100644 --- a/src/main/groovy/com/virtualdogbert/EnterpriseGroovyPlugin.groovy +++ b/src/main/groovy/com/virtualdogbert/EnterpriseGroovyPlugin.groovy @@ -79,7 +79,7 @@ class EnterpriseGroovyPlugin implements Plugin { project.compileGroovy.groovyOptions.configurationScript = project.file('conventions.groovy') }

virtualdogbert commented 4 years ago

Thanks, I'll fix it this weekend. I'm thinking of putting the check in the places that uses the config, and putting in defaults, for it the config is not present.

demus-nine commented 4 years ago

Yeah, that would also be a useful solution. You could also check whether there is a conventions.groovy file, and use the template as the alternative. It is after all a valid groovy file.

virtualdogbert commented 4 years ago

Ok, I just pushed a 1.0.4 out give that a try, see if works, and let me know thanks.

virtualdogbert commented 4 years ago

Hey @demus-nine I never heard back from you were you able to give version 1.0.4 a try? Did it work?

virtualdogbert commented 4 years ago

Well, @demus-nine I'm going to close this ticket for now, because I think I fixed the issue, if not you can reopen it or create a new issue. Thanks.