Lines 43-48
Link Here
|
43 |
import java.util.zip.ZipFile; |
43 |
import java.util.zip.ZipFile; |
44 |
import org.apache.tools.ant.BuildException; |
44 |
import org.apache.tools.ant.BuildException; |
45 |
import org.apache.tools.ant.Project; |
45 |
import org.apache.tools.ant.Project; |
|
|
46 |
import org.apache.tools.ant.taskdefs.spi.Service; |
46 |
import org.apache.tools.ant.types.EnumeratedAttribute; |
47 |
import org.apache.tools.ant.types.EnumeratedAttribute; |
47 |
import org.apache.tools.ant.types.FileSet; |
48 |
import org.apache.tools.ant.types.FileSet; |
48 |
import org.apache.tools.ant.types.Path; |
49 |
import org.apache.tools.ant.types.Path; |
Lines 335-340
Link Here
|
335 |
if (!skipWriting) { |
336 |
if (!skipWriting) { |
336 |
Manifest jarManifest = createManifest(); |
337 |
Manifest jarManifest = createManifest(); |
337 |
writeManifest(zOut, jarManifest); |
338 |
writeManifest(zOut, jarManifest); |
|
|
339 |
writeService(zOut); |
338 |
} |
340 |
} |
339 |
} |
341 |
} |
340 |
|
342 |
|
Lines 846-849
Link Here
|
846 |
} |
848 |
} |
847 |
} |
849 |
} |
848 |
} |
850 |
} |
849 |
} |
851 |
|
|
|
852 |
/** |
853 |
* ANT Jar-Task SPI extension |
854 |
* |
855 |
* List of all known Services |
856 |
* |
857 |
* @author Bernd 'Nexos' Dutkowski <bernd@dutkowski.net> |
858 |
* @see http://issues.apache.org/bugzilla/show_bug.cgi?id=31520 |
859 |
*/ |
860 |
private List serviceList = new ArrayList(); |
861 |
|
862 |
/** |
863 |
* ANT Jar-Task SPI extension |
864 |
* |
865 |
* @author Bernd 'Nexos' Dutkowski <bernd@dutkowski.net> |
866 |
* @see http://issues.apache.org/bugzilla/show_bug.cgi?id=31520 |
867 |
*/ |
868 |
public void addConfiguredService(Service service){ |
869 |
serviceList.add(service); |
870 |
} |
871 |
|
872 |
/** |
873 |
* ANT Jar-Task SPI extension |
874 |
* |
875 |
* Write SPI Information to JAR |
876 |
* |
877 |
* @author Bernd 'Nexos' Dutkowski <bernd@dutkowski.net> |
878 |
* @see http://issues.apache.org/bugzilla/show_bug.cgi?id=31520 |
879 |
*/ |
880 |
private void writeService(ZipOutputStream zOut) throws IOException{ |
881 |
Iterator serviceIterator; |
882 |
Service service; |
883 |
|
884 |
serviceIterator = serviceList.iterator(); |
885 |
while(serviceIterator.hasNext()){ |
886 |
service = (Service) serviceIterator.next(); |
887 |
//stolen from writeManifest |
888 |
super.zipFile(service.getAsStream(), zOut, |
889 |
"META-INF/service/" + service.getType(), |
890 |
System.currentTimeMillis(), null, |
891 |
ZipFileSet.DEFAULT_FILE_MODE); |
892 |
} |
893 |
} |
894 |
} |