@@ -8,10 +8,10 @@ import org.gradle.api.Task
88import org.gradle.api.execution.TaskExecutionListener
99import org.gradle.api.tasks.TaskState
1010
11- Set<String > projectNameExcludeFilter = convertStringToSet('${excludedProjectNames} ')
12- Set<String > projectNameIncludeFilter = convertStringToSet('${includedProjectNames} ')
13- Set<String > projectPathExcludeFilter = convertStringToSet('${excludedProjectPaths} ')
14- Set<String > projectPathIncludeFilter = convertStringToSet('${includedProjectPaths} ')
11+ Set<String > projectNameExcludeFilter = convertStringToSet('${excludedProjectNames?replace("\\", "\\\\")?replace("\'", "\\\'") } ')
12+ Set<String > projectNameIncludeFilter = convertStringToSet('${includedProjectNames?replace("\\", "\\\\")?replace("\'", "\\\'") } ')
13+ Set<String > projectPathExcludeFilter = convertStringToSet('${excludedProjectPaths?replace("\\", "\\\\")?replace("\'", "\\\'") } ')
14+ Set<String > projectPathIncludeFilter = convertStringToSet('${includedProjectPaths?replace("\\", "\\\\")?replace("\'", "\\\'") } ')
1515Boolean rootOnly = Boolean.parseBoolean("${rootOnlyOption} ")
1616
1717gradle.allprojects {
@@ -47,9 +47,11 @@ gradle.allprojects {
4747 def projectVersion = currentProject.version.toString()
4848 def projectParent = currentProject.parent ? currentProject.parent.toString() : "none"
4949
50- // Prepare configuration names
50+ // Prepare configuration names (handles single quotes issues )
5151 def configurationNames = getFilteredConfigurationNames(currentProject,
52- '${excludedConfigurationNames} ', '${includedConfigurationNames} ')
52+ '${excludedConfigurationNames?replace("\\", "\\\\")?replace("\'", "\\\'") } ',
53+ '${includedConfigurationNames?replace("\\", "\\\\")?replace("\'", "\\\'") } '
54+ )
5355
5456 def selectedConfigs = []
5557 configurationNames.each { name ->
@@ -64,11 +66,14 @@ gradle.allprojects {
6466 }
6567 }
6668
67- // Check if the project should be included in results
68- def shouldIncludeProject = (rootOnly && isRootProject) ||
69+ // Check if the project should be included based on project-level filters
70+ def projectMatchesFilters = (rootOnly && isRootProject) ||
6971 (!rootOnly && shouldInclude(projectNameExcludeFilter, projectNameIncludeFilter, projectName) &&
7072 shouldInclude(projectPathExcludeFilter, projectPathIncludeFilter, projectPath))
7173
74+ // A project is only included if it matches project filters AND has configurations that match config filters.
75+ def shouldIncludeProject = projectMatchesFilters && !selectedConfigs.isEmpty()
76+
7277 // Capture output file path during configuration
7378 def projectFilePathConfig = computeProjectFilePath(projectPath, extractionDir, rootProject)
7479
0 commit comments