-
Notifications
You must be signed in to change notification settings - Fork 23
/
makeDescriptor.pl
70 lines (57 loc) · 1.53 KB
/
makeDescriptor.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl -W
#Use this script to generate the archetype descriptor, as the format does not allow wildcards yet
# perl makeDescriptor.pl > META-INF/archetype.xml
use Data::Dumper;
#find all files
my @fileList=`find . -type d -name '.svn' -prune -o -type f -print` ;
my @sources;
my @resources;
my @testResources;
my @testSources;
foreach my $file (@fileList){
next unless $file=~/\.\/archetype-resources/ ;
#attempt to skip binary files alltogether as they make the archetype deployer barf sometimes
next if $file=~/\.ico$/;
next if $file=~/\.png$/;
next if $file=~/\.jpg$/;
next if $file=~/\.gif$/;
chomp ($file);
$file =~ s/\.\/archetype-resources\///;
if ($file=~/src\/main\/java/){
push(@sources, $file);
}
if ($file=~/src\/main\/webapp/){
push (@resources, $file);
}
if ($file=~/src\/test\/java/){
push (@testSources, $file);
}
if ($file=~/src\/\/test\/resources/){
push (@testResources, $file);
}
if ($file=~/src\/main\/resources/){
push (@resources, $file);
}
}
# ARCHETYPE
print "<archetype>\n";
print "<id>core-archetype</id>\n";
# SOURCES
print "<sources>\n";
foreach my $source (@sources) {
print "<source>$source</source>\n";
}
print "</sources>\n";
# TESTSOURCES
print "<testSources>\n";
foreach my $testSource (@testSources) {
print "<testSource>$testSource</testSource>\n";
}
print "</testSources>\n";
# RESOURCES
print "<resources>\n";
foreach my $resource (@resources) {
print "<resource>$resource</resource>\n";
}
print "</resources>\n";
print "</archetype>\n";