Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.installer / pom.xml @ 41271

History | View | Annotate | Download (10.3 KB)

1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0          http://maven.apache.org/xsd/maven-4.0.0.xsd">
3

    
4
        <modelVersion>4.0.0</modelVersion>
5
        <groupId>org.gvsig</groupId>
6
        <artifactId>org.gvsig.desktop.installer</artifactId>
7
        <version>1.0.0</version>
8
        <packaging>pom</packaging>
9
        <name>${project.artifactId}</name>
10

    
11
  <build>
12
  
13
     <pluginManagement>
14
        <plugins>
15
        
16
          <plugin>
17
            <groupId>org.codehaus.gmaven</groupId>
18
            <artifactId>gmaven-plugin</artifactId>
19
            <version>1.4</version>
20
          </plugin>
21
          
22
          <plugin>
23
            <groupId>org.codehaus.mojo</groupId>
24
            <artifactId>properties-maven-plugin</artifactId>
25
            <version>1.0-alpha-2</version>
26
          </plugin>
27
                            
28
        </plugins>
29
     </pluginManagement>
30
  
31
      <plugins>
32
          <plugin>
33
              <groupId>org.codehaus.mojo</groupId>
34
              <artifactId>properties-maven-plugin</artifactId>
35
              <executions>
36
                  <execution>
37
                      <phase>install</phase>
38
                      <goals>
39
                          <goal>read-project-properties</goal>
40
                      </goals>
41
                      <configuration>
42
                          <files>
43
                                        <!-- Define gvsig.product.folder.path in this property -->
44
                                        <file>${env.HOME}/.gvsig-devel.properties</file>
45
                                        <file>${project.basedir}/gvsig-devel.properties</file>
46
                          </files>
47
                          <quiet>true</quiet>
48
                      </configuration>
49
                  </execution>
50
              </executions>
51
          </plugin>
52
          
53
          <plugin>
54
              <groupId>org.codehaus.gmaven</groupId>
55
              <artifactId>gmaven-plugin</artifactId>
56
                                <inherited>false</inherited>
57
              <executions>
58
                <execution>
59
                  <id>release</id>
60
                  <phase>install</phase>
61
                  <goals>
62
                    <goal>execute</goal>
63
                  </goals>
64
                  <configuration>
65
                    <source><![CDATA[
66
  def getVersionWithBuildNumber(pakageinfo) {
67
      return pakageinfo.getProperty("version")+"-"+pakageinfo.getProperty("buildNumber")
68
  }
69

    
70
  def getVersionWithoutBuildNumber(pakageinfo) {
71
      return pakageinfo.getProperty("version") // .replaceFirst("-[0-9]*\$","")
72
  }
73
                        
74
                        
75
  ant = new AntBuilder()
76
  log.info("For create windows launchers launch4j is requiered in the PATH. In linux link launch4j to launch4jc.")
77
  log.info("For create installer InstallJammer is required in the PATH.")
78

    
79
  installation_folder = project.basedir.getAbsolutePath()+"/target/product/gvsig-desktop"
80
  pool_folder = project.basedir.getAbsolutePath()+"/target/pool.d"
81
  new File(installation_folder).mkdirs()
82
  new File(pool_folder,"pool").mkdirs()
83

    
84
  gvsig_product_folder_path = project.properties["gvsig.product.folder.path"]
85

    
86

    
87
  log.info("Getting a local copy of product folder...")
88
  ant.copy( todir: installation_folder ) {
89
    fileset( dir: gvsig_product_folder_path )
90
  }
91
  gvsig_product_folder_path = installation_folder 
92

    
93

    
94
  log.info("Populate the pool folder...")
95
  ant.move( todir: pool_folder + "/pool" ) {
96
  fileset( dir: installation_folder + "/install/" )
97
  }
98
  new File(installation_folder,"install").mkdirs()
99

    
100
  log.info("Preparing basic package set (gvspks)...")
101
  gvspks_folder = new File(project.basedir,"target/gvspks")
102
  gvspks_folder.mkdirs()                    
103
  filenames = new FileNameFinder().getFileNames(pool_folder,"**/*.gvspkg")
104
  for( filename in filenames ) {
105
    file = new File(filename)
106
    ant.copy(file:filename, todir:gvspks_folder.getAbsolutePath())
107
  }            
108
  ant.copy(file:"src/main/config/defaultPackages", todir:gvspks_folder.getAbsolutePath())
109

    
110
  log.info("Finding andami updater jar...")
111
  org_gvsig_andami_updater_jar = new FileNameFinder().getFileNames(
112
    gvsig_product_folder_path+"/lib",
113
    'org.gvsig.andami.updater-*.jar'
114
  )[0]
115
  if( org_gvsig_andami_updater_jar == null ) {
116
    log.error("Can't find andami updater jar")
117
    assert false
118
  }
119
  org_gvsig_andami_updater_jar = new File(org_gvsig_andami_updater_jar).getName()
120
  log.info("Found andami updater :"+org_gvsig_andami_updater_jar)
121

    
122
  File file = new File(gvsig_product_folder_path + "/gvSIG/extensiones/org.gvsig.app.mainplugin/package.info")
123
  log.info("Loading package.info - " + file.getAbsolutePath())
124
  pakageinfo = new Properties()
125
  pakageinfo.load(file.newDataInputStream())
126

    
127
  log.info("Creating gvsig-desktop.exe windows launcher...")
128
  source = project.basedir.getAbsolutePath()+"/src/main/launch4j/gvsig-desktop.xml"
129
  target = project.basedir.getAbsolutePath()+"/target/product/gvsig-desktop/gvsig-desktop.xml"
130
  s = new File(source).text
131
  s = s.replaceAll("@@gvsig.product.folder.path@@", gvsig_product_folder_path)
132
  s = s.replaceAll("@@org.gvsig.andami.updater.jar@@", org_gvsig_andami_updater_jar)
133
  s = s.replaceAll("@@version@@", getVersionWithBuildNumber(pakageinfo).replace("-","."))
134
  new File(target).write(s)
135
  log.info("Created "+target)
136
  ant.exec( command:"launch4jc "+ target )
137
  log.info("Created gvsig-desktop.exe windows launcher.")
138

    
139
  log.info("Creating gvsig-desktop-devel.exe windows launcher...")
140
  source = project.basedir.getAbsolutePath()+"/src/main/launch4j/gvsig-desktop-devel.xml"
141
  target = project.basedir.getAbsolutePath()+"/target/product/gvsig-desktop/gvsig-desktop-devel.xml"
142
  s = new File(source).text
143
  s = s.replaceAll("@@gvsig.product.folder.path@@", gvsig_product_folder_path)
144
  s = s.replaceAll("@@org.gvsig.andami.updater.jar@@", org_gvsig_andami_updater_jar)
145
  s = s.replaceAll("@@version@@", getVersionWithBuildNumber(pakageinfo).replace("-","."))
146
  new File(target).write(s)
147
  log.info("Created "+target)
148
  ant.exec( command:"launch4jc "+ target )
149
  log.info("Created gvsig-desktop-devel.exe windows launcher")
150

    
151
  log.info("Creating gvsig-package-installer.exe windows launcher...")
152
  source = project.basedir.getAbsolutePath()+"/src/main/launch4j/gvsig-package-installer.xml"
153
  target = project.basedir.getAbsolutePath()+"/target/product/gvsig-desktop/gvsig-package-installer.xml"
154
  s = new File(source).text
155
  s = s.replaceAll("@@gvsig.product.folder.path@@", gvsig_product_folder_path)
156
  s = s.replaceAll("@@org.gvsig.andami.updater.jar@@", org_gvsig_andami_updater_jar)
157
  s = s.replaceAll("@@version@@", getVersionWithBuildNumber(pakageinfo).replace("-","."))
158
  new File(target).write(s)
159
  log.info("Created "+target)
160
  ant.exec( command:"launch4jc "+ target )
161
  log.info("Created gvsig-package-installer.exe windows launcher")
162

    
163
  jre_pkg_name = "gvSIG-desktop-2.0.0-jre_6_windows_i586-1.6.26-0-devel-win-x86-j1_6.gvspkg"
164
  url = "http://downloads.gvsig.org/download/gvsig-desktop/pool/jre_6_windows_i586/" + jre_pkg_name
165
  target = project.basedir.getAbsolutePath() + "/target/" + jre_pkg_name
166
  if(! new File(target).exists() ) {
167
          if( project.properties["jre.path"]!=null ) {
168
                  if( project.properties["jre.path"].endsWith(".gvspkg") ) {
169
                          source = project.properties["jre.path"]
170
                  } else {
171
                          source = project.properties["jre.path"] + "/" + jre_pkg_name
172
                  }
173
                if (source.startsWith("~" + File.separator)) {
174
                    source = System.getenv().get("HOME") + source.substring(1);
175
                }
176
                  if( ! new File(source).exists() ) {
177
                        log.info("jre specified in jre.path variable not found - "+source)
178
                    log.info("Downloading windows jre plugin")
179
                    ant.get(src: url, dest: target)
180
                } else {
181
                    log.info("Copy windows jre plugin")
182
                    ant.copy(file:source, todir:project.basedir.getAbsolutePath() + "/target/")
183
                }                  
184
          } else {
185
            log.info("Downloading windows jre plugin")
186
            ant.get(src: url, dest: target)
187
          }                                   
188
  } else {
189
    log.info("Skip download of jre, it exist in local filesystem.")
190
  }
191
  
192
  log.info("Download busybox.exe.")
193
  ant.get(src: "http://downloads.gvsig.org/download/gvsig-desktop/runtimes/winutils/busybox.exe", dest: gvsig_product_folder_path+"/busybox.exe")
194

    
195
  source = project.basedir.getAbsolutePath() + "/target/" + jre_pkg_name
196
  target = gvsig_product_folder_path + "/gvSIG/extensiones/"
197
  log.info("Installing plugin windows jre plugin to " + target + "...")
198
  ant.unzip(src: source, dest: target)
199
  log.info("jre installed.")
200

    
201
  log.info("Building zip installer...")
202
  source  = project.basedir.getAbsolutePath()+"/target/product"
203
  target  = project.basedir.getAbsolutePath() + 
204
    "/target/gvSIG-desktop-" + 
205
    getVersionWithBuildNumber(pakageinfo) + "-" + 
206
    pakageinfo.getProperty("state") + "-all-x86-online.zip"
207
  ant.zip(destfile: target, basedir: source)
208

    
209
  log.info("Building pool zip...")
210
  source  = project.basedir.getAbsolutePath()+"/target/pool.d"
211
  target  = project.basedir.getAbsolutePath() + 
212
    "/target/gvSIG-desktop-" + 
213
    getVersionWithBuildNumber(pakageinfo) + "-" + 
214
    pakageinfo.getProperty("state") + "-all-all-pool.zip"
215
  ant.zip(destfile: target, basedir: source)
216

    
217
  log.info("Building basic package-set (gvspks)...")
218
  source  = project.basedir.getAbsolutePath()+"/target/gvspks"
219
  target  = project.basedir.getAbsolutePath() + 
220
    "/target/gvSIG-desktop-" + 
221
    getVersionWithBuildNumber(pakageinfo) + "-" + 
222
    pakageinfo.getProperty("state") + "-all-all.gvspks"
223
  ant.zip(destfile: target, basedir: source)
224

    
225

    
226
  cmd = [ "installjammer" , 
227
    "--output-dir", project.basedir.getAbsolutePath() + "/target",
228
    "-DBaseDir", gvsig_product_folder_path,
229
    "-DVersion",        getVersionWithoutBuildNumber(pakageinfo),
230
    "-DInstallVersion", getVersionWithoutBuildNumber(pakageinfo),
231
    "-DDevelState", pakageinfo.getProperty("state"),
232
    "-DBuildVersion", pakageinfo.getProperty("buildNumber"), 
233
    "--build-for-release",
234
    "--build-dir", project.basedir.getAbsolutePath() + "/target/installjammer", 
235
    "--build-log-file", project.basedir.getAbsolutePath() + "/target/installjammer.log",
236
    "--verbose",
237
    "--build",
238
    project.basedir.getAbsolutePath() + "/src/main/installjammer/gvsig-standard-installer.mpi"
239
  ]
240
  log.info("Launching InstallJammer - " + cmd.join(" ") )
241
  ant.exec( command: cmd.join(" ") )
242

    
243
                    ]]></source>
244
                  </configuration>
245
                </execution>
246
              </executions>
247
          </plugin>
248
      </plugins>
249
  </build>
250

    
251
</project>