MONKEY-WORKS/BuildMonkey

Task for manipulating Jar file make it an OSGi bundle with Eclipse nature

michael-barth-elco opened this issue · 0 comments

A simply to apply task (modifyBundle) with the follwong (script) code has to been provided:

    // Make the crated jar file matching OSGi bundle and Eclipse plugin nature
    jar {
        if (project.file("${resourcesPath}").exists()) {
                with copySpec {
                    from "${projectDir}/${resourcesPath}"
                    into "${resourcesPath}"
                }  
        }
        if (project.file('OSGI-INF').exists()) {
            with copySpec {
                from "${projectDir}/OSGI-INF"
                into 'OSGI-INF'
            }       
        }
    
        manifest {
            // benutze das im Projekt vorliegende File, falls vorhanden:
            def manif = "${projectDir}/META-INF/MANIFEST.MF"
            if (new File(manif).exists()) {
                from (manif) { 
                    eachEntry { details ->
                        if (details.key == 'Bundle-Version') {
                            details.value = "1.0.0"
                        }
                    }
                }
            }
        }
        from file ('plugin.xml')
    }

The resourcePath and some other value have configurable