Commits

Dhananjay Nene committed f4da143

Added log messages

Comments (0)

Files changed (1)

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

 import aQute.lib.osgi.Analyzer
 import org.gradle.api.*
 
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+
 class GradleBndPluginExtension {
    def Map<String,String> instructions = new HashMap<String,String>() 
    def Set<String> exclusions = new HashSet<String>()
 
 class GradleBndPlugin implements Plugin<Project> {
     def void apply(Project project) {
+	Logger log = LoggerFactory.getLogger('gradle-bnd-plugin')
+	log.debug('test debug message')
+
         project.extensions.bnd = new GradleBndPluginExtension()
         project.tasks.jar {
             // having a lot of issues with the construct below. Need to see if it could be
                     pattern = /(.*)-[^-]*$/
                     // move old jar away
                     newJarName = oldJar.toString().replaceFirst('.jar$',".standalone.jar")
+		    log.debug("Moving " + oldJar.toString() + " to " + newJarName)
                     oldJar.renameTo(new File(newJarName))
 
                     // create the new jar with same name as the output of the jar task
                 java.util.jar.Manifest manifest = analyzer.calcManifest()
                 jarFile = new File(oldJar.toString())
                 tmpFileName = oldJar.toString() + ".tmp"
+		log.debug("Renaming " + oldJar.toString() + " to " + tmpFileName)
                 jarFile.renameTo(tmpFileName)
                 outputJar = new JarOutputStream(
                                 new FileOutputStream(oldJar.toString()))
+		log.debug("Creating a new jar file " + oldJar.toString())
                 jarFileHandle = new File(tmpFileName)
                 jarFile = new JarFile(jarFileHandle) // , false, java.util.zip.ZipFile.OPEN_DELETE)
                 jarFile.entries().each { entry ->
                 }
                 
                 jarFile.close();
+		log.debug("Deleting file " + tmpFileName)
                 new File(tmpFileName).delete();
                 jarEntry = new JarEntry("META-INF/MANIFEST.MF")
                 outputJar.putNextEntry(jarEntry)