Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / setup / BuildFeatureFromProduct.groovy @ 499

History | View | Annotate | Download (2.2 kB)

1
package org.txm.setup;
2

    
3
import groovy.xml.*
4

    
5
String home = System.getProperty("user.home")
6
File rcpSrc = new File(home, "workspace43/org.txm.rcp")
7
File rcpFeatureSrc = new File(home, "workspace43/org.txm.rcp.feature")
8
File productFile = new File(rcpSrc, "rcpapplication.product")
9
File featureFile = new File(rcpFeatureSrc, "feature.xml")
10
//File featureFileBackUp = new File(rcpFeatureSrc, "feature_back.xml")
11

    
12

    
13
def slurper = new XmlParser();
14
def product = slurper.parse(productFile.toURI().toString())
15

    
16
def plugins = product.plugins.plugin
17
def toSend = []
18
for (def plugin : plugins) { // set @os @ws @arch and @nl
19
        boolean remove = false;
20
        String id = plugin.@id
21
        if (id.contains(".linux")) plugin.@os = "linux"
22
        else if (id.contains(".win32")) plugin.@os = "win32"
23
        else if (id.contains(".macosx")) plugin.@os = "macosx"
24
        else if (id.contains(".aix")) remove = true
25
        else if (id.contains(".hpux")) remove = true
26
        else if (id.contains(".qnx")) remove = true
27
        else if (id.contains(".solaris")) remove = true
28
        
29
        if (id.contains(".wpf")) plugin.@ws = "wpf"
30
        else if (id.contains(".win32")) plugin.@ws = "win32"
31
        else if (id.contains(".photon")) remove = true
32
        else if (id.contains(".motif")) remove = true
33
        else if (id.contains(".gtk")) plugin.@ws = "gtk"
34
        else if (id.contains(".cocoa")) plugin.@ws = "cocoa"
35
        else if (id.contains(".carbon")) plugin.@ws = "carbon"
36
        else if (id.contains(".s390")) remove = true
37
        else if (id.contains(".s390x")) remove = true
38
        
39
        if (id.contains(".x86_64")) plugin.@arch = "x86_64"
40
        else if (id.contains(".x86")) plugin.@arch = "x86"
41
        else if (id.contains(".ia64_32")) remove = true
42
        else if (id.contains(".ia64")) remove = true
43
        else if (id.contains(".spark")) remove = true
44
        else if (id.contains(".ppc")) remove = true
45
        else if (id.contains(".PA_RISC")) remove = true
46
        
47
//        def m = id =~ /.+\.nl_(..)/
48
//        if (m.size() > 0) {
49
//                if (m[0].size() > 1) {
50
//                        plugin.@nl = m[0][1]
51
//                }
52
//        }
53
        
54
        plugin."@download-size"="0"
55
        plugin."@install-size"="0"
56
        plugin.@version="0.0.0"
57
        plugin.@unpack="false"
58
        
59
        if (!remove) {
60
                toSend << plugin
61
        }
62
}
63

    
64
println "FEATURE"
65

    
66
def feature = slurper.parse(featureFile.toURI().toString())
67

    
68
for (def plugin : toSend) {
69
        feature.append(plugin)
70
}
71
//println XmlUtil.serialize(feature)
72
featureFile.write(XmlUtil.serialize(feature))