-
-
Save rodolfodpk/8662174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "osgi" | |
apply plugin: "java" | |
apply plugin: "maven" | |
version = "0.0.1" | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath "org.apache.felix:org.apache.felix.ipojo.manipulator:1.6.0" | |
} | |
} | |
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile "org.apache.felix:org.apache.felix.main:4.2.0", "org.apache.felix:org.apache.felix.ipojo.annotations:1.6.0" | |
} | |
jar { | |
manifest { | |
instruction 'Export-Package','*' | |
} | |
} | |
jar.doLast { | |
org.apache.felix.ipojo.manipulator.Pojoization pojo = new org.apache.felix.ipojo.manipulator.Pojoization() | |
File jarfile = file(jar.archivePath) | |
File targetJarFile = file(jar.destinationDir.absolutePath +"/" + jar.baseName + "_out.jar") | |
if (!jarfile.exists()) throw new InvalidUserDataException("The specified bundle file does not exist: " + jarfile.absolutePath) | |
pojo.pojoization(jarfile, targetJarFile, (File) null) | |
pojo.getWarnings().each { s -> | |
println s | |
} | |
if (jarfile.delete()) { | |
if ( !targetJarFile.renameTo(jarfile) ) { | |
throw new InvalidUserDataException("Cannot rename the manipulated jar file"); | |
} | |
}else { | |
throw new InvalidUserDataException("Cannot delete the input jar file") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment