Commits

Dhananjay Nene  committed 24c2d68

Superior exclusion handling through exclusions dependencies

  • Participants
  • Parent commits 063041a

Comments (0)

Files changed (1)

File src/main/groovy/in/vayana/gradle_plugins/GradleBndPlugin.groovy

             // file trees .. but leaving it for now as is.
             doLast() {
                 classpathJars = [] // to be used eventually
+                /*
                 if (project.bnd.exclusions == null || project.bnd.exclusions.trim() == "") {
                     excludedDeps = []
                 } else {
                     }
                     log.debug("Excluded dependencies are :" + excludedDeps)
                 }
+                */
 
                 oldJar = project.jar.archivePath
                 excludedJars = []
                     if (project.bnd.includeTestDependencies)
                         depJars = depJars + (project.configurations.testCompile 
 as List)
-                    excludedDepNames = excludedDeps.collect { nv -> nv.name }
+                    excluded = (project.configurations.exclusions as List).collect {it.name} 
                     depJars.each { file -> 
-                        matcher = (file.name =~ pattern)
-                        if (matcher.matches()) jarBaseName = matcher[0][1] else jarBaseName = null
-                        if ((jarBaseName != null) && !(jarBaseName in excludedDepNames)) {
-                            log.debug(file.name + ":" + jarBaseName + " included")
+                        if (!(file.name in excluded)) {
+                            log.debug(file.name + " included")
                             includedJars.add(file.name)
                             // extract each entry from the jar file
                             jarFile = new JarFile(file.absolutePath)
                                 }
                             }
                         } else {
-                            log.debug(file.name + ":" + jarBaseName + " excluded")
+                            log.debug(file.name + " excluded")
                             excludedJars.add(file.toString())
                         }
                     }