Subversion Repositories Projects

Rev

Rev 266 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
206 ligi 1
#!/usr/bin/env ruby
2
 
3
 
517 ligi 4
####################################
5
#                                  #
6
### build-script for DUBwise #######
7
#                                  #
8
# Author: Marcus -LiGi- Bueschleb  #
9
#                                  #
10
# see README for further Infos     #
11
#                                  #
12
####################################
13
 
14
 
15
def p_usage
16
 puts "./BUILD [options] <profile> [bin_dir]"
17
 puts "options:
18
      -z -> 7Zip bindir
19
      -l -> regenerate strings
20
      -i -> regenerate images
21
      -d -> debug output
22
      -o -> obfuscate"
23
end
24
 
25
 
26
@log_flag=false
27
def log str
28
  puts str if @log_flag
29
end
30
 
31
 
32
start_time=Time.now
33
 
206 ligi 34
resdir="res/"
35
 
517 ligi 36
version_split=File.read("version").delete("\n\r").split(".")
37
version_major=version_split[0]
38
version_minor=version_split[1]
39
version_patch=version_split[2]
40
 
41
 
42
advzip_flags="-4"
43
if ARGV.include?("-f")
44
  advzip_flags=""
45
  ARGV.delete("-f")
46
end
47
 
48
zip_bindir= ARGV.include?("-z")
49
obfuscate=  ARGV.include?("-o")
50
 
51
@log_flag= ARGV.include?("-d")
52
 
53
ARGV.delete("-d")
54
ARGV.delete("-z")
55
ARGV.delete("-o")
56
 
266 ligi 57
if ARGV.include?("-l")
58
  puts "regenerating language strings"
59
  p `cd res ; ruby lang_gen.rb ; cd ..`
60
  ARGV.delete("-l")
61
end
206 ligi 62
 
266 ligi 63
if ARGV.include?("-i")
64
  puts "regenerating images"
65
  p `cd res ; ruby image_gen.rb ; cd ..`
66
  ARGV.delete("-i")
67
end
68
 
69
 
517 ligi 70
bindir="bin"
71
set="test"
72
 
219 ligi 73
if ARGV.length==2
74
  bindir=ARGV[1]
242 ligi 75
  puts `rm -rf #{bindir}`
219 ligi 76
end
77
 
78
 
517 ligi 79
 
80
screensizes=["240x320"]
81
voice_modes=["en_speedy"]
82
bluetooth_modes=["on"]
83
fileapi_modes=["on"]
84
devicecontrol_modes=["on"]
85
cldc11_modes=["on"]
86
firmware_modes=["all_firmwares"]
87
location_modes=["no_location"]
88
#map_modes=["no_map","J2MEMap"]
89
map_modes=["no_map"]
90
 
91
#defaults={{:screensizes=>["240x320"],:voice_moes=>["en_speedy"] , :bluetooth_modes=>["on"] , :devicecontrol_modes=>["on"],:fileapi_modes=>"off"
92
#"loeti"=>[{:screensizes=>["176x220"],:voice_moes=>["en_speedy"] , :bluetooth_modes=>["on"] , :devicecontrol_modes=>["on"] }  ] ,
93
 
206 ligi 94
 ARGV<<"" if ARGV==[]
95
case ARGV[0]
264 ligi 96
 when "loeti"
517 ligi 97
 
98
 when "xda"
99
#  screensizes=["480x640"]
100
  screensizes=["240x320"]
101
#  screensizes=["128x128"]
102
  voice_modes=["no_voice"]
103
  bluetooth_modes=["on"]
104
  devicecontrol_modes=["off"]
105
  fileapi_modes=["on"]
106
  cldc11_modes=["on"]
107
  firmware_modes=["no_firmwares"]
108
  location_modes=["no_location"]
109
#  location_modes=["jsr179"]
110
  map_modes=["J2MEMap"]
111
#  map_modes=["J2MEMap","no_maps"]
112
 
113
 
114
 when "openlapi"
115
  screensizes=["240x320"]
116
#  screensizes=["128x128"]
117
  voice_modes=["de_64kbit_tts"]
118
  bluetooth_modes=["on"]
119
  devicecontrol_modes=["on"]
120
  fileapi_modes=["off"]
121
  cldc11_modes=["on"]
122
  firmware_modes=["no_firmwares"]
123
  location_modes=["openlapi"]
124
#  location_modes=["jsr179"]
125
  map_modes=["J2MEMap"]
126
 
127
 
128
 when "k750"
264 ligi 129
  screensizes=["176x220"]
517 ligi 130
#  screensizes=["128x128"]
131
  voice_modes=["de_tts"]
264 ligi 132
  bluetooth_modes=["on"]
133
  devicecontrol_modes=["on"]
134
  fileapi_modes=["off"]
517 ligi 135
  cldc11_modes=["on"]
136
  firmware_modes=["no_firmwares"]
137
  location_modes=["no_location"]
138
#  location_modes=["jsr179"]
139
  map_modes=["J2MEMap"]
264 ligi 140
 
517 ligi 141
 
142
 when "location_test"
143
  screensizes=["128x128"]
144
  voice_modes=["de_64kbit_tts"]
145
  bluetooth_modes=["on"]
146
  devicecontrol_modes=["on"]
147
  fileapi_modes=["off"]
148
  cldc11_modes=["on"]
149
  firmware_modes=["no_firmwares"]
150
  location_modes=["no_location","jsr179","openlapi"]
151
 
152
 when "sven"
153
  screensizes=["128x128"]
154
  voice_modes=["de_64kbit_tts"]
155
  bluetooth_modes=["on"]
156
  devicecontrol_modes=["on"]
157
  fileapi_modes=["off"]
158
  cldc11_modes=["on"]
159
  firmware_modes=["no_firmwares"]
160
 
206 ligi 161
 when "p910"
162
  screensizes=["200x300"]
163
  voice_modes=["en_speedy"]
164
  bluetooth_modes=["off"]
165
  devicecontrol_modes=["off"]
166
  fileapi_modes=["off"]
167
  cldc11_modes=["off"]
168
 
169
 when "test"
170
  screensizes=["240x320"]
171
  voice_modes=["en_speedy"]
172
  bluetooth_modes=["on"]
517 ligi 173
  devicecontrol_modes=["off","on"]
206 ligi 174
  fileapi_modes=["on"]
175
  cldc11_modes=["on"]
176
  #firmware_modes=["fc_mk3mag_firmwares"]
219 ligi 177
  #firmware_modes=["all_firmwares"]
264 ligi 178
 
219 ligi 179
  firmware_modes=["no_firmwares"]
206 ligi 180
 
245 ligi 181
 when "wtk"
182
  screensizes=["240x320"]
183
  voice_modes=["en_wav"]
184
  bluetooth_modes=["on"]
185
  devicecontrol_modes=["on"]
186
  fileapi_modes=["on"]
187
  cldc11_modes=["on"]
188
  #firmware_modes=["fc_mk3mag_firmwares"]
189
  #firmware_modes=["all_firmwares"]
190
  firmware_modes=["all_firmwares"]
191
 
517 ligi 192
 when "gpstest"
193
  screensizes=["240x320"]
194
  voice_modes=["en_speedy"]
195
  bluetooth_modes=["on"]
196
  devicecontrol_modes=["on"]
197
  fileapi_modes=["on"]
198
  cldc11_modes=["on"]
199
  firmware_modes=["no_firmwares"]
200
  location_modes=["jsr179"]
201
  map_modes=["J2MEMap"]
202
 
203
 when "gpstestola"
204
  screensizes=["240x320"]
205
  voice_modes=["en_speedy"]
206
  bluetooth_modes=["on"]
207
  devicecontrol_modes=["on"]
208
  fileapi_modes=["on"]
209
  cldc11_modes=["on"]
210
  firmware_modes=["no_firmwares"]
211
  location_modes=["openlapi"]
212
  map_modes=["J2MEMap"]
213
 
214
 when "gpstestall"
215
  screensizes=["240x320"]
216
  voice_modes=["en_speedy"]
217
  bluetooth_modes=["on"]
218
  devicecontrol_modes=["on"]
219
  fileapi_modes=["on"]
220
  cldc11_modes=["on"]
221
  firmware_modes=["no_firmwares"]
222
  location_modes=["jsr179","openlapi"]
223
  map_modes=["J2MEMap","no_map"]
224
 
225
 
219 ligi 226
 when "bltest"
227
  screensizes=["240x320"]
517 ligi 228
#  screensizes=["176x220"]
219 ligi 229
  voice_modes=["en_speedy"]
230
  bluetooth_modes=["on"]
231
  devicecontrol_modes=["on"]
232
  fileapi_modes=["on"]
233
  cldc11_modes=["on"]
234
  firmware_modes=["all_firmwares"]
517 ligi 235
#  location_modes=["jsr179"]
236
  location_modes=["no_location"]
237
#  map_modes=["J2MEMap"]
238
  map_modes=["no_map"]
219 ligi 239
 
517 ligi 240
 when "voicetest"
241
  screensizes=["240x320"]
242
#  screensizes=["176x220"]
243
  voice_modes=["new_en_speedy_tts"]
244
  bluetooth_modes=["on"]
245
  devicecontrol_modes=["on"]
246
  fileapi_modes=["on"]
247
  cldc11_modes=["on"]
248
  firmware_modes=["all_firmwares"]
249
#  location_modes=["jsr179"]
250
  location_modes=["no_location"]
251
#  map_modes=["J2MEMap"]
252
  map_modes=["no_map"]
253
 
254
 
255
 when "voiceall"
256
 
257
  screensizes=["176x220","200x300","240x320","340x400","480x640"]
258
#  screensizes=["176x220"]
259
  voice_modes=["new_en_speedy_tts"]
260
  bluetooth_modes=["on"]
261
  devicecontrol_modes=["on"]
262
  fileapi_modes=["on"]
263
  cldc11_modes=["on"]
264
  firmware_modes=["no_firmwares"]
265
  location_modes=["jsr179"]
266
#  location_modes=["no_location"]
267
  map_modes=["J2MEMap"]
268
#  map_modes=["no_map"]
269
 
270
 
271
 when "n95"
272
  screensizes=["240x320"]
273
#  screensizes=["176x220"]
274
  voice_modes=["en_speedy"]
275
  bluetooth_modes=["on"]
276
  devicecontrol_modes=["on"]
277
  fileapi_modes=["on"]
278
  cldc11_modes=["on"]
279
  firmware_modes=["no_firmwares"]
280
  location_modes=["jsr179"]
281
#  location_modes=["no_location"]
282
  map_modes=["J2MEMap"]
283
#  map_modes=["no_map"]
284
 
285
 
286
 
206 ligi 287
 when "test2"
288
  screensizes=["176x220"]
289
  voice_modes=["en_speedy"]
290
  bluetooth_modes=["on"]
291
  devicecontrol_modes=["on"]
292
  fileapi_modes=["on"]
293
  cldc11_modes=["on"]
294
  firmware_modes=["all_firmwares"]
295
 
296
 when "off"
297
  screensizes=["240x320"]
298
  voice_modes=["en_speedy"]
299
  bluetooth_modes=["off"]
300
  devicecontrol_modes=["off"]
301
  fileapi_modes=["off"]
302
  cldc11_modes=["off"]
303
 
304
 when "alloff"
305
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
245 ligi 306
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","en_wav","de_wav"]
206 ligi 307
  bluetooth_modes=["off"]
308
  devicecontrol_modes=["off"]
309
  fileapi_modes=["off"]
310
  cldc11_modes=["off"]
311
 
312
 when "n80"
313
  bluetooth_modes=["on"]
314
  screensizes=["340x400"]
315
  voice_modes=["en_speedy"]
316
  fileapi_modes=["on"]
317
  devicecontrol_modes=["on"]
318
  cldc11_modes=["on"]
319
  firmware_modes=["all_firmwares"]
320
 when "common"
321
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
245 ligi 322
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","en_wav","de_wav"]
517 ligi 323
  bluetooth_modes=["on","off"]
324
  fileapi_modes=["on","off"]
325
  devicecontrol_modes=["on","off"]
326
  cldc11_modes=["on","off"]
327
  firmware_modes=["all_firmwares"]
328
  location_modes=["no_location","jsr179"]
329
 
330
 when "all"
331
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
332
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","en_wav","de_wav"]
333
  bluetooth_modes=["on","off"]
334
  fileapi_modes=["on","off"]
335
  devicecontrol_modes=["on","off"]
336
  cldc11_modes=["on","off"]
337
  firmware_modes=["all_firmwares","no_firmwares","fc_mk3mag_firmwares"]
338
  location_modes=["no_location","jsr179","openlapi"]
339
 
340
 
341
 when "allinstaller"
342
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
343
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","en_wav","de_wav"]
344
  bluetooth_modes=["on","off"]
345
  fileapi_modes=["on","off"]
346
  devicecontrol_modes=["on","off"]
347
  cldc11_modes=["on","off"]
348
  firmware_modes=["all_firmwares","no_firmwares","fc_mk3mag_firmwares"]
349
  location_modes=["no_location","jsr179"]
350
#  map_modes=["no_map","J2MEMap"]
351
  map_modes=["no_map"]
352
 
353
 
354
 when "allwm"
355
  screensizes=["240x320","340x400","480x640"]
356
  voice_modes=["no_voice"]
206 ligi 357
  bluetooth_modes=["on"]
517 ligi 358
  fileapi_modes=["off"]
359
  devicecontrol_modes=["off"]
206 ligi 360
  cldc11_modes=["on"]
517 ligi 361
  firmware_modes=["no_firmwares"]
362
  location_modes=["no_location"]
363
  map_modes=["J2MEMap"]
206 ligi 364
 
517 ligi 365
 when "alloff"
366
  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
367
  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","en_wav","de_wav"]
368
  bluetooth_modes=["off"]
369
  fileapi_modes=["off"]
370
  devicecontrol_modes=["off"]
371
  cldc11_modes=["off"]
372
  firmware_modes=["all_firmwares","no_firmwares","fc_mk3mag_firmwares"]
373
  location_modes=["no_location"]
374
 
206 ligi 375
 else
242 ligi 376
#  screensizes=["128x128","176x220","200x300","240x320","340x400","480x640"]
245 ligi 377
#  voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","en_wav","de_wav"]
242 ligi 378
#  bluetooth_modes=["on","off"]
379
#  fileapi_modes=["on","off"]
380
# devicecontrol_modes=["on","off"]
381
#  cldc11_modes=["on","off"]
382
#  firmware_modes=["no_firmwares","fc_mk3mag_firmware","all_firmwares"]
383
  puts "no valid profile given"
384
  exit
206 ligi 385
end
386
 
387
 
219 ligi 388
puts `mv build.props build.props.bak`
389
puts `ant clean`
390
puts `mkdir #{bindir}`
206 ligi 391
 
392
propertys={}
517 ligi 393
 allthreads=[]
206 ligi 394
 
517 ligi 395
build_count= map_modes.length*location_modes.length*  firmware_modes.length*   cldc11_modes.length*      devicecontrol_modes.length*fileapi_modes.length* bluetooth_modes.length* screensizes.length* voice_modes.length
396
 
397
puts "build_count: " + build_count.to_s
398
sleep 1
399
 
400
 
401
build=0
402
last_time=Time.now
403
new_build=true
404
reprocess_lib=true
405
puts "cleaning ressources"
406
p `rm -rf tmp/res `
407
p `mkdir tmp/res `
408
p `cp -v res/langpacks/* tmp/res/`
409
 
206 ligi 410
cldc11_modes.each { |cldc11|
517 ligi 411
  reprocess_lib=true
412
 
413
  ### modifiers from here wont affect the communicator-lib
414
  map_modes.each { |map_mode|
415
  location_modes.each {|location_mode|
416
    devicecontrol_modes.each { |devicecontrol|
417
      fileapi_modes.each { |fileapi|
418
        bluetooth_modes.each { |bluetooth|
419
 
420
          new_build=true
421
          ### modifiers from here wont affect source - just ressources
206 ligi 422
          voice_modes.each { |voice_mode|
517 ligi 423
            new_voice=true
424
 
206 ligi 425
 
517 ligi 426
           screensizes.each { |screensize|
427
              new_screensize=true
428
 
429
              firmware_modes.each {|firmware|
430
                #                new_firmwares=true
431
                build=build+1
432
                last_time=Time.now
433
 
434
                propertys["screensize"]=screensize
206 ligi 435
 
436
 
517 ligi 437
#                if allthreads.length>7
206 ligi 438
 
517 ligi 439
#                  allthreads.each { |t|
440
#                  p "waiting for thread" + t.inspect
441
#                    t.join
442
#                  }
443
#                  allthreads=[]
444
#                end
445
 
446
                propertys["voice_mode"]=voice_mode
447
                propertys["bluetooth"]=bluetooth
448
                propertys["fileapi"]=fileapi
449
                propertys["devicecontrol"]=devicecontrol
450
                propertys["cldc11"]=cldc11
451
                propertys["version_major"]=version_major
452
                propertys["version_minor"]=version_minor
453
                propertys["version_patch"]=version_patch
454
 
455
 
456
                propertys["basename"]="DUBwise-#{screensize}-#{voice_mode}-#{firmware}"
457
 
458
                if  location_mode=="jsr179"
459
                  propertys["basename"]+="-LocationAPI"
460
                end
206 ligi 461
 
517 ligi 462
                if  location_mode=="openlapi"
463
                  propertys["basename"]+="-OpenLAPI"
464
                end
465
 
466
                if location_mode=="jsr179"
467
                  propertys["jsr179"]="on"
468
                else
469
                  propertys["jsr179"]="off"
470
                end
206 ligi 471
 
472
 
517 ligi 473
                if location_mode=="openlapi"
474
                  propertys["openlapi"]="on"
475
                else
476
                  propertys["openlapi"]="off"
477
                end
206 ligi 478
 
517 ligi 479
                if ((location_mode=="jsr179" ) || (location_mode=="openlapi" ))
480
                  propertys["location"]="on"
481
                else
482
                  propertys["location"]="off"
483
                end
206 ligi 484
 
485
 
517 ligi 486
 
487
 
488
                propertys["basename"]+="-CLDC11"    if  cldc11=="on"
489
                propertys["basename"]+="-FileAPI"    if  fileapi=="on"
490
                propertys["basename"]+="-BluetoothAPI"    if  bluetooth=="on"
491
                propertys["basename"]+="-DeviceControl"    if  devicecontrol=="on"
492
                propertys["basename"]+="-J2MEMap"   if map_mode=="J2MEMap"
206 ligi 493
 
517 ligi 494
                propertys["bin_path"]="#{screensize}/#{cldc11=="on"?"cldc11":"cldc10"}/#{voice_mode}/bluetooth_#{bluetooth}/fileapi_#{fileapi}/devicecontrol_#{devicecontrol}/#{location_mode}"
495
 
206 ligi 496
 
497
 
517 ligi 498
                if new_build
206 ligi 499
 
517 ligi 500
                  puts "compiling"
501
                  prefs_file= File.new("build.props","w")
502
                  propertys.each_pair {|name,value|
503
                    prefs_file <<	name+"="+value+"\n"
504
                  }
505
#                  prefs_file <<	"libs=lib/J2meMap_lib_cldc11.jar:lib/openlapi-jsr179-0.9.11.jar:lib/openlapi-0.9.11.jar\n"
506
#                  prefs_file << "classes=lib/classes_with_fileapi_and_jsr179.zip\n"
507
#                  prefs_file << "classes=lib/classes_with_fileapi.zip\n"
206 ligi 508
 
517 ligi 509
                  prefs_file.close
206 ligi 510
 
517 ligi 511
                  if reprocess_lib
512
                    puts `ant preprocess_lib`
513
                    reprocess_lib=false
514
                  end
515
 
516
                  build_params=""
517
                  build_params+=" -Dobfuscate=true" if obfuscate
518
                  build_params+=" -Dobfuscate=false" if !obfuscate
519
 
520
 
521
                  build_params+=" -Dlibs="
522
                  build_params+="lib/J2meMap_lib_cldc11.jar" if map_mode=="J2MEMap"
523
#                  build_params+=":lib/openlapi-jsr179-0.9.11.jar:lib/openlapi-0.9.11.jar"  if  location_mode=="openlapi"
524
 
525
             build_params+=":lib/openlapi-0.9.11.jar"  if  location_mode=="openlapi"
526
 
527
 
528
                  if  location_mode=="jsr179"
529
                    build_params+=" -Djsr179=on"
530
                    build_params+=" -Dclasses=lib/classes_with_fileapi_and_jsr179.zip"
531
                  else
532
                    build_params+=" -Dclasses=lib/classes_with_fileapi.zip"
533
                    build_params+=" -Djsr179=off"
534
                  end
535
 
536
                  if map_mode=="J2MEMap"
537
                     build_params+=" -Dj2memap=on"
538
                  else
539
                     build_params+=" -Dj2memap=off"
540
                  end
541
 
542
 
543
                  p propertys.inspect
544
                  `ant #{build_params} build`.each_line {
545
                    |l| puts l
546
                    exit if  (l =~ /\[wtkbuild\].*error/)
547
 
548
 
549
                  }
550
                  new_build=false
551
 
552
                  `rm -rf tmp/bin`
553
                  `mkdir -p tmp/bin`
554
 
555
 
556
#                  `mv build/bin/#{propertys["basename"]}.jar tmp/bin`
557
                  `mv build/bin/#{propertys["basename"]}.jar tmp/bin/tmp.jar`
558
#                  `advzip -z -4 #{advzip_flags} tmp/bin/tmp.jar`
559
 
560
                  `rm build/bin/#{propertys["basename"]}.jad`
561
 
562
#                  `cd tmp/bin ; unzip #{propertys["basename"]}.jar ; rm #{propertys["basename"]}.jar ; cd ../..`
563
 
564
                  #                else
565
                  #                  `ant only_jar`.each_line {
566
                  #                    |l| puts l
567
                  #                    exit if  (l =~ /\[wtkbuild\].*error/)
568
 
569
                  #                  }
570
 
571
                end # new build
572
 
573
 
574
 
575
                #                if new_firmwares
576
###                p `rm -rf tmp/bin/*.bin `
577
###                p `cp -v res/firmwares/#{firmware}/* tmp/bin`
578
 
579
                p `cp -v tmp/bin/tmp.jar #{bindir}/#{propertys["basename"]}.jar`
580
#exit
581
#                p `advzip #{advzip_flags} -a  #{bindir}/#{propertys["basename"]}.jar  res/images_by_screensize/#{screensize}/*`
582
 
583
#                p `advzip  #{advzip_flags} -a  #{bindir}/#{propertys["basename"]}.jar   res/voice_samples_by_name/#{voice_mode}/*`
584
 
585
#                p `advzip  #{advzip_flags} -a  #{bindir}/#{propertys["basename"]}.jar    res/firmwares/#{firmware}/*`
586
 
587
#                p `advzip #{advzip_flags} -u  #{bindir}/#{propertys["basename"]}.jar  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`
588
 
589
 
590
#                p `advzip #{advzip_flags} -u  #{bindir}/#{propertys["basename"]}.jar  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`
591
 
592
#
593
 
594
 #               p `7z #{advzip_flags} a  -x.svn* #{bindir}/#{propertys["basename"]}.jar  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`
595
 
596
 
597
#                p `7z #{advzip_flags} a  -x.svn* #{bindir}/#{propertys["basename"]}.jar  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`
598
 
599
#               allthreads<< Thread.new
600
                #{
601
 
602
 
603
 
604
                  @basename=propertys["basename"]
605
#                  ` mkdir tmp/#{@basename} `
606
                  @screensize=screensize
607
                  @firmware=firmware
608
                  @voice_mode=voice_mode
609
 
610
 
611
 
612
              log "compressing images"
613
                  log `cd res/images_by_screensize/#{@screensize} ; 7z a -x\!.svn* -w../../../tmp/ ../../../#{bindir}/#{@basename}.jar * ; cd ../../.. ` #  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`
614
 
615
 
616
                log "compressing firmwares"
617
                  log `cd res/firmwares/#{@firmware} && 7z a  -x\!.svn* -w../../../tmp/ ../../../#{bindir}/#{@basename}.jar * && cd -`
618
 
619
                log "compressing sounds"
620
                  log `cd res/voice_samples_by_name/#{@voice_mode} ; 7z a -x\!.svn* -w../../../tmp/ ../../../#{bindir}/#{@basename}.jar * ; cd ../../..`
621
 
622
 
623
  #              log "compressing images"
624
#                  log `cd res/images_by_screensize/#{@screensize} ; 7z a -w../../../tmp/#{@basename} -x\!.svn* ../../../#{bindir}/#{@basename}.jar * ; cd ../../.. ` #  res/images_by_screensize/#{screensize}/* res/voice_samples_by_name/#{voice_mode}/*  res/firmwares/#{firmware}/*`
625
 
626
 
627
 #               log "compressing firmwares"
628
  #                log `cd res/firmwares/#{@firmware} ; 7z a  -x\!.svn*  -w../../../tmp/#{@basename} ../../../#{bindir}/#{@basename}.jar * ; cd ../../..`
629
 
630
   #             log "compressing sounds"
631
  #                log `cd res/voice_samples_by_name/#{@voice_mode} ; 7z a -x\!.svn* -w../../../tmp/#{@basename}/ ../../../#{bindir}/#{@basename}.jar * ; cd ../../..`
632
 
633
 
634
                #                end
635
#                   new_screensize
636
###                if new_screensize
637
###                  p `rm -rf tmp/bin/*.png  `
638
###                  p `rm -rf tmp/bin/*.jpg  `
639
###                  p `cp -v res/images_by_screensize/#{screensize}/* tmp/bin/`
640
###                  new_screensize=false
641
###                end
642
###                if new_voice
643
###                  p `rm tmp/bin/*.wav `
644
###                  p `rm  tmp/bin/*.mp3 `
645
###                  p `cp -v res/voice_samples_by_name/#{voice_mode}/* tmp/bin/`
646
###                  new_voice=false
647
###                end
648
#                p `advzip -4 -a #{bindir}/#{propertys["basename"]}.jar  tmp/bin/`
649
                p "---------------"
650
# normal zip is larger than advzip and not working on e.g. N80 ( took me som time to figure out)       p `cd tmp/bin ; zip  ../../#{bindir}/#{propertys["basename"]}.jar  -r . ; cd ../..`
651
 
652
   #             p `cd tmp ; advzip -4 -a  ../#{bindir}/#{propertys["basename"]}.jar   bin/* ; cd ..`
653
                p "---------------"
654
                #                `cp tmp/jad/*.jad #{bindir}/#{propertys["basename"]}.jad`
655
 
656
 #                 puts "#{bindir} ----+ " + Dir.pwd
657
                jarsize=File.size("#{bindir}/#{@basename}.jar").to_s
658
                jad_file=File.new("#{bindir}/#{@basename}.jad","w+")
659
 
660
                jad_file << "MIDlet-Jar-URL: #{@basename}.jar\n"
661
                jad_file << "MIDlet-Jar-Size: #{jarsize}\n"
662
                jad_file << "MIDlet-Name: DUBwise\n"
663
                jad_file << "MIDlet-Vendor: LiGi\n"
664
                jad_file << "MIDlet-Version: " + version_split[0..1].join(".") + "\n"
665
                jad_file << "MIDlet-1: DUBwise, i.png, DUBwise\n"
666
                jad_file << "MIDletX-No-Command: true\n"
667
                jad_file << "MIDlet-Icon: i.png\n"
668
                jad_file << "MIDlet-Install-Notify: http://ligi.selfip.org/ligi/mail?subject=DUBWiseInstallNotify&text=jarname_#{@basename}\n"
669
                jad_file << "MIDlet-Delete-Notify: http://ligi.selfip.org/ligi/mail?subject=DUBWiseDeleteNotify&text=jarname_#{@basename}\n"
670
 
671
                jad_file.close
672
 
673
 
674
                puts "done build # " + build.to_s  + "/" + build_count.to_s + " Time:" + (Time.now-last_time ).to_s + " overall: #{((Time.now-start_time)/60).to_i.to_s}:#{((Time.now-start_time)%60).to_i.to_s}"
675
                p    "voice_mode" + voice_mode
676
                p    "Screensize " + screensize
677
                p    "size" + jarsize.to_s
678
#                }
679
                #                `mkdir -p #{bindir}/#{propertys["bin_path"]}`
680
 
681
                #          `mv build/bin/#{propertys["basename"]}* #{bindir}/#{propertys["bin_path"]}`
682
 
683
                ##`mkdir -p #{bindir}/#{propertys["bin_path"]}`
684
 
685
                ##`mv build/bin/#{propertys["basename"]}* #{bindir}/#{propertys["bin_path"]}`
686
 
687
 
688
                ###`mkdir -p #{bindir}/`
689
 
690
                ###`mv build/bin/#{propertys["basename"]}* #{bindir}/`
691
 
692
 
693
#                `mkdir -p #{bindir}/`
694
 
695
#                `mv build/bin/#{propertys["basename"]}* #{bindir}/`
696
 
697
              }
698
 
699
              build_new=true if voice_mode!="no_voice"
700
 
701
            }
702
          }
703
        }
206 ligi 704
      }
705
    }
706
  }
707
}
708
}
517 ligi 709
 
710
sleep 3
711
puts "Joining all open threads (" + allthreads.length.to_s + "open)" + `pwd`
712
#sleep allthreads.length
713
allthreads.each { |t|
714
  t.join
206 ligi 715
}
517 ligi 716
allthreads=[]
206 ligi 717
 
517 ligi 718
puts `mv -v  build.props.bak build.props`
719
 
720
puts "Finished in #{((Time.now-start_time)/60).to_i.to_s}:#{((Time.now-start_time)%60).to_i.to_s}"
721
 
722
 
723
 
724
if zip_bindir
725
 puts "Zipping bindir"
726
  if File.exist?( "#{bindir}.7z")
727
    puts "Zip allready there"
728
  else
729
    `7z a #{bindir}.7z #{bindir}`
730
  end
731
end
732
 
733