This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch bridge-backward-compat-shims
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 57947932da508939f592f8125b1afa72dff68004
Author: James Fredley <[email protected]>
AuthorDate: Thu Mar 12 20:14:41 2026 -0400

    Add backward-compatibility bridge shims for plugin configuration refactoring
    
    Restore deprecated APIs removed in the conditionalPluginConfiguration
    branch so the refactoring can land in 7.1.x without breaking existing
    public API consumers. All bridges delegate to the new implementations
    and are marked @Deprecated(forRemoval = true, since = "7.1") for
    clean removal in 8.0.0.
    
    Bridge shims added:
    - GrailsPluginManager: setLoadCorePlugins(), setPluginFilter() (no-op)
    - DefaultGrailsPluginManager: 3 old constructors delegating to
      DefaultGrailsPluginDiscovery
    - GrailsApplicationPostProcessor: old 3-param constructor and
      customizePluginManager() stub
    - org.grails.plugins.ExcludingPluginFilter: extends new filter
    - org.grails.plugins.PluginFilterRetriever: extends new retriever
    - org.grails.plugins.BinaryGrailsPluginDescriptor: wraps new record
    - org.grails.plugins.CorePluginFinder: stub with 
UnsupportedOperationException
    
    Assisted-by: Claude Code <[email protected]>
---
 .../config/GrailsApplicationPostProcessor.groovy   | 18 +++++
 .../grails/plugins/DefaultGrailsPluginManager.java | 31 ++++++++
 .../groovy/grails/plugins/GrailsPluginManager.java | 20 +++++
 .../plugins/AbstractGrailsPluginManager.java       | 19 +++++
 .../plugins/BinaryGrailsPluginDescriptor.java      | 59 ++++++++++++++
 .../org/grails/plugins/CorePluginFinder.java       | 68 ++++++++++++++++
 .../org/grails/plugins/ExcludingPluginFilter.java  | 45 +++++++++++
 .../org/grails/plugins/PluginFilterRetriever.java  | 93 ++++++++++++++++++++++
 8 files changed, 353 insertions(+)

diff --git 
a/grails-core/src/main/groovy/grails/boot/config/GrailsApplicationPostProcessor.groovy
 
b/grails-core/src/main/groovy/grails/boot/config/GrailsApplicationPostProcessor.groovy
index 10e72fbc9c..b5cba7f1c8 100644
--- 
a/grails-core/src/main/groovy/grails/boot/config/GrailsApplicationPostProcessor.groovy
+++ 
b/grails-core/src/main/groovy/grails/boot/config/GrailsApplicationPostProcessor.groovy
@@ -98,6 +98,24 @@ class GrailsApplicationPostProcessor implements 
BeanDefinitionRegistryPostProces
         }
     }
 
+    /**
+     * @deprecated Use {@link 
#GrailsApplicationPostProcessor(GrailsApplicationLifeCycle, ApplicationContext, 
GrailsPluginDiscovery, Class[])} instead.
+     * Plugin discovery is now provided explicitly. This constructor creates a 
default discovery instance.
+     * Will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    GrailsApplicationPostProcessor(GrailsApplicationLifeCycle lifeCycle, 
ApplicationContext applicationContext, Class...classes) {
+        this(lifeCycle, applicationContext, new 
org.apache.grails.core.plugins.DefaultGrailsPluginDiscovery(), classes)
+    }
+
+    /**
+     * @deprecated Plugin manager customization is now handled through {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery}.
+     * This method is a no-op and will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    protected void customizePluginManager(GrailsPluginManager pluginManager) {
+    }
+
     protected final void initializeGrailsApplication(ApplicationContext 
applicationContext) {
         if (applicationContext == null) {
             throw new IllegalStateException('ApplicationContext should not be 
null')
diff --git 
a/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java 
b/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java
index b77781c655..86d292805e 100644
--- a/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java
+++ b/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java
@@ -41,6 +41,7 @@ import org.springframework.core.io.Resource;
 import grails.core.GrailsApplication;
 import grails.core.support.ParentApplicationContextAware;
 import grails.plugins.exceptions.PluginException;
+import org.apache.grails.core.plugins.DefaultGrailsPluginDiscovery;
 import org.apache.grails.core.plugins.GrailsPluginDescriptor;
 import org.apache.grails.core.plugins.GrailsPluginDiscovery;
 import org.apache.grails.core.plugins.GrailsPluginInfo;
@@ -93,6 +94,36 @@ public class DefaultGrailsPluginManager extends 
AbstractGrailsPluginManager {
         super(application, pluginDiscovery);
     }
 
+    /**
+     * @deprecated Use {@link #DefaultGrailsPluginManager(GrailsApplication, 
GrailsPluginDiscovery)} instead.
+     * Plugin discovery is now handled by {@link GrailsPluginDiscovery}. This 
constructor creates a default
+     * discovery instance. Will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public DefaultGrailsPluginManager(String resourcePath, GrailsApplication 
application) {
+        this(application, new DefaultGrailsPluginDiscovery());
+    }
+
+    /**
+     * @deprecated Use {@link #DefaultGrailsPluginManager(GrailsApplication, 
GrailsPluginDiscovery)} instead.
+     * Plugin discovery is now handled by {@link GrailsPluginDiscovery}. This 
constructor creates a default
+     * discovery instance. Will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public DefaultGrailsPluginManager(String[] pluginResources, 
GrailsApplication application) {
+        this(application, new DefaultGrailsPluginDiscovery());
+    }
+
+    /**
+     * @deprecated Use {@link #DefaultGrailsPluginManager(GrailsApplication, 
GrailsPluginDiscovery)} instead.
+     * Plugin discovery is now handled by {@link GrailsPluginDiscovery}. This 
constructor creates a default
+     * discovery instance. Will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public DefaultGrailsPluginManager(Class<?>[] plugins, GrailsApplication 
application) {
+        this(application, new DefaultGrailsPluginDiscovery());
+    }
+
     public GrailsPlugin[] getUserPlugins() {
         return Arrays.stream(pluginDiscovery.getDynamicPlugins())
                 .map(GrailsPluginInfo::name)
diff --git 
a/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java 
b/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java
index ad3f9e23d9..5443a73174 100644
--- a/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java
+++ b/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java
@@ -320,4 +320,24 @@ public interface GrailsPluginManager extends 
ApplicationContextAware {
      * @return True if it was shutdown
      */
     boolean isShutdown();
+
+    /**
+     * Set whether the core plugins should be loaded.
+     *
+     * @param shouldLoadCorePlugins True if they should
+     * @deprecated Core plugin loading is now handled by {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery}.
+     * This method is a no-op and will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    void setLoadCorePlugins(boolean shouldLoadCorePlugins);
+
+    /**
+     * Sets the filter to use to filter for plugins.
+     *
+     * @param pluginFilter The plugin filter
+     * @deprecated Plugin filtering is now handled by {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery}.
+     * This method is a no-op and will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    void setPluginFilter(PluginFilter pluginFilter);
 }
diff --git 
a/grails-core/src/main/groovy/org/grails/plugins/AbstractGrailsPluginManager.java
 
b/grails-core/src/main/groovy/org/grails/plugins/AbstractGrailsPluginManager.java
index 3124c734ba..b17e5520cd 100644
--- 
a/grails-core/src/main/groovy/org/grails/plugins/AbstractGrailsPluginManager.java
+++ 
b/grails-core/src/main/groovy/org/grails/plugins/AbstractGrailsPluginManager.java
@@ -54,6 +54,7 @@ import grails.core.ArtefactHandler;
 import grails.core.GrailsApplication;
 import grails.plugins.GrailsPlugin;
 import grails.plugins.GrailsPluginManager;
+import grails.plugins.PluginFilter;
 import grails.plugins.Plugin;
 import grails.plugins.exceptions.PluginException;
 import grails.util.Environment;
@@ -386,6 +387,24 @@ public abstract class AbstractGrailsPluginManager 
implements GrailsPluginManager
         return shutdown;
     }
 
+    /**
+     * @deprecated Core plugin loading is now handled by {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery}.
+     * This method is a no-op and will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    @Override
+    public void setLoadCorePlugins(boolean shouldLoadCorePlugins) {
+    }
+
+    /**
+     * @deprecated Plugin filtering is now handled by {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery}.
+     * This method is a no-op and will be removed in Grails 8.0.0.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    @Override
+    public void setPluginFilter(PluginFilter pluginFilter) {
+    }
+
     public void informOfClassChange(Class<?> aClass) {
         if (aClass == null || application == null) {
             return;
diff --git 
a/grails-core/src/main/groovy/org/grails/plugins/BinaryGrailsPluginDescriptor.java
 
b/grails-core/src/main/groovy/org/grails/plugins/BinaryGrailsPluginDescriptor.java
new file mode 100644
index 0000000000..7bd45821f2
--- /dev/null
+++ 
b/grails-core/src/main/groovy/org/grails/plugins/BinaryGrailsPluginDescriptor.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.plugins;
+
+import java.util.List;
+
+import org.springframework.core.io.Resource;
+
+import org.apache.grails.core.plugins.GrailsPluginDescriptor;
+
+/**
+ * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDescriptor} instead.
+ * This compatibility bridge will be removed in Grails 8.0.0.
+ */
+@Deprecated(forRemoval = true, since = "7.1")
+public class BinaryGrailsPluginDescriptor {
+
+    private final GrailsPluginDescriptor descriptor;
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDescriptor} instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public BinaryGrailsPluginDescriptor(Resource resource, List<String> 
classNames) {
+        this.descriptor = new GrailsPluginDescriptor(resource, List.of(), 
classNames);
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDescriptor#resource()} instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public Resource getResource() {
+        return descriptor.resource();
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDescriptor#providedClasses()} 
instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public List<String> getProvidedClassNames() {
+        return descriptor.providedClasses();
+    }
+}
diff --git 
a/grails-core/src/main/groovy/org/grails/plugins/CorePluginFinder.java 
b/grails-core/src/main/groovy/org/grails/plugins/CorePluginFinder.java
new file mode 100644
index 0000000000..0af1176e4b
--- /dev/null
+++ b/grails-core/src/main/groovy/org/grails/plugins/CorePluginFinder.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.plugins;
+
+import org.springframework.context.ApplicationContext;
+
+import grails.core.GrailsApplication;
+import grails.core.support.ParentApplicationContextAware;
+
+/**
+ * @deprecated Plugin discovery is now handled by {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery}.
+ * This compatibility stub will be removed in Grails 8.0.0.
+ */
+@Deprecated(forRemoval = true, since = "7.1")
+public class CorePluginFinder implements ParentApplicationContextAware {
+
+    public static final String CORE_PLUGIN_PATTERN = 
"META-INF/grails-plugin.xml";
+
+    private static final String UNSUPPORTED_MESSAGE = "CorePluginFinder is no 
longer supported. Use org.apache.grails.core.plugins.GrailsPluginDiscovery 
instead.";
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery} instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public CorePluginFinder(GrailsApplication application) {
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery} instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public Class<?>[] getPluginClasses() {
+        throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE);
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery} instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public BinaryGrailsPluginDescriptor getBinaryDescriptor(Class<?> 
pluginClass) {
+        throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE);
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.GrailsPluginDiscovery} instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    @Override
+    public void setParentApplicationContext(ApplicationContext parent) {
+        throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE);
+    }
+}
diff --git 
a/grails-core/src/main/groovy/org/grails/plugins/ExcludingPluginFilter.java 
b/grails-core/src/main/groovy/org/grails/plugins/ExcludingPluginFilter.java
new file mode 100644
index 0000000000..da107253b1
--- /dev/null
+++ b/grails-core/src/main/groovy/org/grails/plugins/ExcludingPluginFilter.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.plugins;
+
+import java.util.Set;
+
+/**
+ * @deprecated Use {@link 
org.apache.grails.core.plugins.filters.ExcludingPluginFilter} instead.
+ * This compatibility bridge will be removed in Grails 8.0.0.
+ */
+@Deprecated(forRemoval = true, since = "7.1")
+public class ExcludingPluginFilter extends 
org.apache.grails.core.plugins.filters.ExcludingPluginFilter {
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.filters.ExcludingPluginFilter#ExcludingPluginFilter(Set)}
 instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public ExcludingPluginFilter(Set<String> excluded) {
+        super(excluded);
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.filters.ExcludingPluginFilter#ExcludingPluginFilter(String[])}
 instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public ExcludingPluginFilter(String[] excluded) {
+        super(excluded);
+    }
+}
diff --git 
a/grails-core/src/main/groovy/org/grails/plugins/PluginFilterRetriever.java 
b/grails-core/src/main/groovy/org/grails/plugins/PluginFilterRetriever.java
new file mode 100644
index 0000000000..fb09be4f2b
--- /dev/null
+++ b/grails-core/src/main/groovy/org/grails/plugins/PluginFilterRetriever.java
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.plugins;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.springframework.core.env.Environment;
+import org.springframework.util.StringUtils;
+
+import grails.config.Config;
+import grails.config.Settings;
+import grails.plugins.PluginFilter;
+
+/**
+ * @deprecated Use {@link 
org.apache.grails.core.plugins.filters.PluginFilterRetriever} instead.
+ * This compatibility bridge will be removed in Grails 8.0.0.
+ */
+@Deprecated(forRemoval = true, since = "7.1")
+public class PluginFilterRetriever extends 
org.apache.grails.core.plugins.filters.PluginFilterRetriever {
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.filters.PluginFilterRetriever#getPluginFilter(Environment)}
 instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    public PluginFilter getPluginFilter(Config config) {
+        if (config == null) {
+            throw new IllegalArgumentException("Config should not be null");
+        }
+
+        if (config instanceof Environment environment) {
+            return super.getPluginFilter(environment);
+        }
+
+        Object includes = config.getProperty(Settings.PLUGIN_INCLUDES, 
Object.class, null);
+        Object excludes = config.getProperty(Settings.PLUGIN_EXCLUDES, 
Object.class, null);
+        return getPluginFilter(includes, excludes);
+    }
+
+    /**
+     * @deprecated Use {@link 
org.apache.grails.core.plugins.filters.PluginFilterRetriever#getPluginFilter(Environment)}
 instead.
+     */
+    @Deprecated(forRemoval = true, since = "7.1")
+    PluginFilter getPluginFilter(Object includes, Object excludes) {
+        if (includes != null) {
+            if (includes instanceof Collection<?> includesCollection) {
+                return new 
org.apache.grails.core.plugins.filters.IncludingPluginFilter(toSet(includesCollection));
+            }
+            return new 
org.apache.grails.core.plugins.filters.IncludingPluginFilter(StringUtils.commaDelimitedListToStringArray(includes.toString()));
+        }
+
+        if (excludes != null) {
+            if (excludes instanceof Collection<?> excludesCollection) {
+                return new 
org.apache.grails.core.plugins.filters.ExcludingPluginFilter(toSet(excludesCollection));
+            }
+            return new 
org.apache.grails.core.plugins.filters.ExcludingPluginFilter(StringUtils.commaDelimitedListToStringArray(excludes.toString()));
+        }
+
+        return new org.apache.grails.core.plugins.filters.NoOpPluginFilter();
+    }
+
+    private static Set<String> toSet(Collection<?> values) {
+        var set = new LinkedHashSet<String>();
+        for (Object v : values) {
+            if (v == null) {
+                continue;
+            }
+
+            String s = v.toString().trim();
+            if (!s.isEmpty()) {
+                set.add(s);
+            }
+        }
+        return set;
+    }
+}

Reply via email to