File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed
main/groovy/org/grails/plugins
test/groovy/org/codehaus/groovy/grails/plugins Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -125,19 +125,14 @@ public boolean isEnabled(String[] profiles) {
125125 }
126126
127127 protected Resource readPluginConfiguration (Class <?> pluginClass ) {
128- Resource ymlUrlResource = getConfigurationResource (pluginClass , PLUGIN_YML_PATH );
129- Resource groovyUrlResource = getConfigurationResource (pluginClass , PLUGIN_GROOVY_PATH );
128+ Resource ymlResource = getConfigurationResource (pluginClass , PLUGIN_YML_PATH );
129+ Resource groovyResource = getConfigurationResource (pluginClass , PLUGIN_GROOVY_PATH );
130130
131- Boolean groovyUrlResourceExists = groovyUrlResource != null && groovyUrlResource .exists ();
132-
133- if (ymlUrlResource != null && ymlUrlResource .exists ()) {
134- if (groovyUrlResourceExists ) {
135- throw new RuntimeException ("A plugin may define a plugin.yml or a plugin.groovy, but not both" );
136- }
137- return ymlUrlResource ;
131+ if (ymlResource != null && ymlResource .exists ()) {
132+ return ymlResource ;
138133 }
139- if (groovyUrlResourceExists ) {
140- return groovyUrlResource ;
134+ if (groovyResource != null && groovyResource . exists () ) {
135+ return groovyResource ;
141136 }
142137 return null ;
143138 }
Original file line number Diff line number Diff line change @@ -51,15 +51,16 @@ class BinaryPluginSpec extends Specification {
5151 cssResource == null
5252 }
5353
54- def " Test plugin with both plugin.yml and plugin.groovy throws exception" () {
54+ // This should never occur because the GrailsPluginGradlePlugin.groovy should catch it
55+ def " Test plugin with both plugin.yml and plugin.groovy, yml is used" () {
5556 when :
5657 def descriptor = new BinaryGrailsPluginDescriptor (new ByteArrayResource (testBinary. getBytes(' UTF-8' )), [' org.codehaus.groovy.grails.plugins.TestBinaryResource' ])
5758 MockConfigBinaryGrailsPlugin . YAML_EXISTS = true
5859 MockConfigBinaryGrailsPlugin . GROOVY_EXISTS = true
59- new MockConfigBinaryGrailsPlugin (descriptor)
60+ def binaryPlugin = new MockConfigBinaryGrailsPlugin (descriptor)
6061
6162 then :
62- thrown( RuntimeException )
63+ binaryPlugin . propertySource . getProperty( ' foo ' ) == " bar "
6364 }
6465
6566 def " Test plugin with only plugin.yml" () {
You can’t perform that action at this time.
0 commit comments