Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

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

Open
michael-barth-elco opened this issue Mar 9, 2017 · 0 comments
Projects

Comments

@michael-barth-elco
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

No branches or pull requests

1 participant