Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c90d483026e642e087fad4ca8161c9b2cae43e01 (plain) (blame)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
<project
    name="runTests2"
    default="runTests2"
    basedir=".">

    <!-- hurestic to check if we are running on hudson variable, if so -->
    <target name="checkHudson">
        <!-- HUDSON_USER should just be "anonyous" for most of our cases (currently)
             but seems a safe variable to check ... if set, assume we are on hudson,
             if not set, assume we are not and leave "hudson" unset (not false)
             Hmm, seems HUDSON_USER is not reliably set. The only 4 I saw reliably
             set were
             [echoproperties] env.HUDSON_COOKIE
             [echoproperties] env.HUDSON_HOME
             [echoproperties] env.HUDSON_SERVER_COOKIE
             [echoproperties] env.HUDSON_URL
             Not sure which would be best/safest to use in huristic, but
             I'll go with URL for now.
             -->
        <property environment="env" />
        <condition property="hudson">
            <isset property="env.HUDSON_URL" />
        </condition>

    </target>

    <target
        name="hudson-init"
        if="hudson"
        depends="checkHudson">
        <!-- as of this writing, 04/22/2012, this was current list of
             hudson provided variables. We take advantage of a number
             of them, but "translate" them into our own variable names,
             for a little loser build-system seperattion
        BUILD_NUMBER
            The current build number, such as "153"
        BUILD_ID
            The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
        JOB_NAME
            Name of the project of this build, such as "foo"
        BUILD_TAG
            String of "hudson-${JOB_NAME}-${BUILD_NUMBER}". Convenient to put into a resource file, a jar file, etc for easier identification.
        EXECUTOR_NUMBER
            The unique number that identifies the current executor (among executors of the same machine) that's carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1.
        NODE_NAME
            Name of the slave if the build is on a slave, or "" if run on master
        NODE_LABELS
            Whitespace-separated list of labels that the node is assigned.
        JAVA_HOME
            If your job is configured to use a specific JDK, this variable is set to the JAVA_HOME of the specified JDK. When this variable is set, PATH is also updated to have $JAVA_HOME/bin.
        WORKSPACE
            The absolute path of the workspace.
        HUDSON_URL
            Full URL of Hudson, like http://server:port/hudson/
        BUILD_URL
            Full URL of this build, like http://server:port/hudson/job/foo/15/
        JOB_URL
            Full URL of this job, like http://server:port/hudson/job/foo/
        SVN_REVISION
            For Subversion-based projects, this variable contains the revision number of the module.
        CVS_BRANCH
            For CVS-based projects, this variable contains the branch of the module. If CVS is configured to check out the trunk, this environment variable will not be set.
        HUDSON_USER
            Currently logged in user
            -->
        <property environment="hudson" />
        <property
            name="WORKSPACE"
            value="${hudson.WORKSPACE}" />
        <echo message="Found we are running in hudson and set workspace to ${WORKSPACE}" />

    </target>
    <target
        name="init"
        depends="hudson-init, streamSpecificInit">

        <!-- if not specified on command line, assume files come from 'download.eclipse.org' -->
        <property name="DOWNLOAD_HOST" value="download.eclipse.org"/>
        <property name="ARCHIVE_HOST" value="archive.eclipse.org"/>
        
        <condition
            property="dropsSuffix"
            value=""
            else="pdebased">
            <equals
                arg1="${BUILD_TECH}"
                arg2="CBI" />
        </condition>
        
        <!-- if not otherwise set, such as by hudson-init,
             assume "current directory" for WORKSPACE -->
        <property
            name="WORKSPACE"
            value="${basedir}" />


        <property
            name="relengBaseBuilderDir"
            value="${WORKSPACE}/org.eclipse.releng.basebuilder" />
        <property
            name="eclipseBuilderDir"
            value="${WORKSPACE}/eclipse.platform.releng.aggregator/production/testScripts/configuration" />

        <fail
            unless="buildId"
            message="buildId value must be provided by caller (such as 'I20120717-0800'" />

        <!--
             this "buildId check" may be overly strict, but best to start off strict for now,
             loosen in future if we start to find/have variety
        -->

        <condition property="buildIdOK">
            <matches
                pattern="^[IMNSR]\d{8}-\d{4}$"
                string="${buildId}" />
        </condition>
        <fail
            message="buildId variable had unexpected format. Should be of the form  [IMNSR] 8 digits '-' 4 digits, but was ${buildId}"
            unless="buildIdOK" />

        <script language="javascript">
            var buildId = project.getProperty("buildId");
            var pattern = new RegExp(/^([IMNSR])(\d{8})-(\d{4})$/);

            var sArray = pattern.exec(buildId);
            // sArray 0 is "whole match"
            project.setProperty("buildType", sArray[1]);
        </script>


        <fail unless="buildType" />


        <echo message="hudson: ${hudson}" />
        <echo message="WORKSPACE: ${WORKSPACE}" />
        <echo message="buildId: ${buildId}" />
        <echo message="relengBaseBuilderDir: ${relengBaseBuilderDir}" />
        <echo message="eclipseBuilderDir: ${eclipseBuilderDir}" />
        <echo message="java.home: ${java.home}" />
        <echo message="eclipseStream: ${eclipseStream}" />
        <echo message="buildType: ${buildType}" />

        <property
            name="testDir"
            value="${WORKSPACE}/workarea/${buildId}" />
        <echo message="DEBUG: testDir ${testDir}" />
        <property
            name="executionDir"
            value="${testDir}/eclipse-testing" />
        <mkdir dir="${executionDir}" />
        <echo message="executionDir ${executionDir}" />

        <!-- what's intended/needed? specific, simple repo? Or composite? -->
        <property
            name="currentbuildrepo"
            value="http://${DOWNLOAD_HOST}/eclipse/updates/${updateSiteSegment}-${buildType}-builds/${buildId}" />
        <echo message="currentbuildrepo: ${currentbuildrepo}" />

        <property
            name="buildURL"
            value="http://${DOWNLOAD_HOST}/eclipse/downloads/${dropsDirSegment}${dropsSuffix}/${buildId}" />

        <!--
             there's nothing "automatic" about the local cache (so far).
             If specified (such as on hudson command line that executes this
             file, as, say,
             -DlocalCache=file:///shared/eclipse/localCache
             then all the downloads required must be already available there.
             It is intended to speed up local testing to avoid re-downloading
             files.
             -->
        <condition
            property="archiveLocation"
            value="${localCache}"
            else="${buildURL}">
            <isset property="localCache" />
        </condition>

        <echo message="buildURL ${buildURL}" />
        <echo message="archiveLocation ${archiveLocation}" />
    </target>

    <target
        name="platformIndependentZips"
        unless="skipInstall">

        <get
            retries="5"
            verbose="true"
            src="${archiveLocation}/eclipse-Automated-Tests-${buildId}.zip"
            dest="${testDir}/eclipse-Automated-Tests-${buildId}.zip" />
        <get
            retries="5"
            verbose="true"
            src="${archiveLocation}/eclipse-${buildId}-delta-pack.zip"
            dest="${executionDir}/eclipse-${buildId}-delta-pack.zip" />
        <!--
        <get
            retries="5"
            verbose="true"
            src="${archiveLocation}/eclipse-Automated-Tests-${buildId}.zip"
            dest="${executionDir}/eclipse-Automated-Tests-${buildId}.zip" />
         -->
    </target>

    <target
        name="getwinzips"
        depends="platformIndependentZips"
        unless="skipInstall">
        <get
            src="${archiveLocation}/eclipse-SDK-${buildId}-win32.zip"
            dest="${executionDir}/eclipse-SDK-${buildId}-win32.zip" />
        <get
            src="${archiveLocation}/eclipse-platform-${buildId}-win32.zip"
            dest="${executionDir}/eclipse-platform-${buildId}-win32.zip" />
        <get
            src="http://${ARCHIVE_HOST}/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-platform-3.7.2-win32.zip"
            dest="${executionDir}/eclipse-platform-3.7.2-win32.zip" />
    </target>
    <target
        name="getwinzips64"
        depends="platformIndependentZips"
        unless="skipInstall">
        <get
            src="${archiveLocation}/eclipse-SDK-${buildId}-win32-x86_64.zip"
            dest="${executionDir}/eclipse-SDK-${buildId}-win32-x86_64.zip" />
        <get
            src="${archiveLocation}/eclipse-platform-${buildId}-win32-x86_64.zip"
            dest="${executionDir}/eclipse-platform-${buildId}-win32-x86_64.zip" />
        <get
            src="http://${ARCHIVE_HOST}/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-platform-3.7.2-win32-x86_64.zip"
            dest="${executionDir}/eclipse-platform-3.7.2-win32.zip-x86_64" />
    </target>
    <target
        name="getlinzips"
        depends="platformIndependentZips"
        unless="skipInstall">
        <get
            src="${archiveLocation}/eclipse-SDK-${buildId}-linux-gtk-x86_64.tar.gz"
            dest="${executionDir}/eclipse-SDK-${buildId}-linux-gtk-x86_64.tar.gz" />
        <get
            src="${archiveLocation}/eclipse-platform-${buildId}-linux-gtk-x86_64.tar.gz"
            dest="${executionDir}/eclipse-platform-${buildId}-linux-gtk-x86_64.tar.gz" />
        <get
            src="http://${ARCHIVE_HOST}/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-platform-3.7.2-linux-gtk-x86_64.tar.gz"
            dest="${executionDir}/eclipse-platform-3.7.2-linux-gtk-x86_64.tar.gz" />
    </target>

    <target
        name="getlinzips32"
        depends="platformIndependentZips"
        unless="skipInstall">
        <get
            src="${archiveLocation}/eclipse-SDK-${buildId}-linux-gtk.tar.gz"
            dest="${executionDir}/eclipse-SDK-${buildId}-linux-gtk.tar.gz" />
        <get
            src="${archiveLocation}/eclipse-platform-${buildId}-linux-gtk.tar.gz"
            dest="${executionDir}/eclipse-platform-${buildId}-linux-gtk.tar.gz" />
        <get
            src="http://${ARCHIVE_HOST}/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-platform-3.7.2-linux-gtk.tar.gz"
            dest="${executionDir}/eclipse-platform-3.7.2-linux-gtk.tar.gz" />
    </target>

    <target
        name="getmaczips"
        depends="platformIndependentZips"
        unless="skipInstall">
        <get
            src="${archiveLocation}/eclipse-SDK-${buildId}-macosx-cocoa.tar.gz"
            dest="${executionDir}/eclipse-SDK-${buildId}-macosx-cocoa.tar.gz" />
        <get
            src="${archiveLocation}/eclipse-platform-${buildId}-macosx-cocoa.tar.gz"
            dest="${executionDir}/eclipse-platform-${buildId}-macosx-cocoa.tar.gz" />
        <get
            src="http://${ARCHIVE_HOST}/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-platform-3.7.2-macosx-cocoa.tar.gz"
            dest="${executionDir}/eclipse-platform-3.7.2-macosx-cocoa.tar.gz" />
    </target>

    <target
        name="getmacosx"
        depends="platformIndependentZips"
        unless="skipInstall">
        <get
            src="${archiveLocation}/eclipse-SDK-${buildId}-macosx-cocoa-x86_64.tar.gz"
            dest="${executionDir}/eclipse-SDK-${buildId}-macosx-cocoa-x86_64.tar.gz" />
        <get
            src="${archiveLocation}/eclipse-platform-${buildId}-macosx-cocoa-x86_64.tar.gz"
            dest="${executionDir}/eclipse-platform-${buildId}-macosx-cocoa-x86_64.tar.gz" />
        <get
            src="http://${ARCHIVE_HOST}/eclipse/downloads/drops/R-3.7.2-201202080800/eclipse-platform-3.7.2-macosx-cocoa-x86_64.tar.gz"
            dest="${executionDir}/eclipse-platform-3.7.2-macosx-cocoa-x86_64.tar.gz" />
    </target>

    <target
        name="configure.team.cvs.test"
        depends="computeExpectedLocation,getcvstestProperties" />

    <target name="computeExpectedLocation">
        <condition
            property="cvstest.properties"
            value="/shared/eclipse/buildtests/cvstest.properties">
            <and>
                <os family="unix" />
                <not>
                    <os family="mac" />
                </not>
            </and>
        </condition>
        <condition
            property="cvstest.properties"
            value="c:\users\hudsonbuild\cvstest.properties">
            <os family="windows" />
        </condition>
        <condition
            property="cvstest.properties"
            value="/Users/hudsonbuild/cvstest.properties">
            <os family="mac" />
        </condition>
    </target>

    <target
        name="getcvstestProperties"
        if="cvsPropertiesAvailable"
        depends="computeExpectedLocation,checkCVSPropExists,logNoExistence">

        <echo message="cvstest.properties file: ${cvstest.properties}" />
        <replace
            file="${executionDir}/test.xml"
            propertyFile="${cvstest.properties}">
            <replacefilter
                token="${cvs_user}"
                property="cvs_user" />
            <replacefilter
                token="${cvs_password}"
                property="cvs_password" />
            <replacefilter
                token="${cvs_host}"
                property="cvs_host" />
            <replacefilter
                token="${cvs_root}"
                property="cvs_root" />
        </replace>

    </target>

    <target
        name="checkCVSPropExists"
        depends="computeExpectedLocation">
        <condition property="cvsPropertiesAvailable">
            <available file="${cvstest.properties}" />
        </condition>
    </target>
    <target
        name="logNoExistence"
        depends="checkCVSPropExists"
        unless="cvsPropertiesAvailable">
        <echo message="cvs properties file was not found in this environment. " />
        <echo message="   expected file: ${cvstest.properties} " />
    </target>
    <target
        name="runTests2"
        depends="init">

        <echo message="DEBUG: echoproperties at start of main runTests2.xml (after inits)" />
        <echoproperties />
        <property
            name="test.xml"
            value="${WORKSPACE}/sdk.tests/testScripts/runTests.xml" />
         <!--   value="${relengBaseBuilderDir}/plugins/org.eclipse.build.tools/scripts/test.xml" /> -->
        <condition
            property="testPlatform"
            value="win7-64">
            <and>
                <equals
                    arg1="${osgi.os}"
                    arg2="win32" />
                <equals
                    arg1="${osgi.ws}"
                    arg2="win32" />
                <equals
                    arg1="${osgi.arch}"
                    arg2="x86_64" />
            </and>
        </condition>
        <condition
            property="testPlatform"
            value="win7">
            <and>
                <equals
                    arg1="${osgi.os}"
                    arg2="win32" />
                <equals
                    arg1="${osgi.ws}"
                    arg2="win32" />
                <equals
                    arg1="${osgi.arch}"
                    arg2="x86" />
            </and>
        </condition>
        <echo message="os ws arch ${osgi.os} ${osgi.ws} ${osgi.arch}" />
        <condition
            property="testPlatform"
            value="linux">
            <and>
                <equals
                    arg1="${osgi.os}"
                    arg2="linux" />
                <equals
                    arg1="${osgi.ws}"
                    arg2="gtk" />
                <equals
                    arg1="${osgi.arch}"
                    arg2="x86_64" />
            </and>
        </condition>
        <condition
            property="testPlatform"
            value="linux32">
            <and>
                <equals
                    arg1="${osgi.os}"
                    arg2="linux" />
                <equals
                    arg1="${osgi.ws}"
                    arg2="gtk" />
                <equals
                    arg1="${osgi.arch}"
                    arg2="x86" />
            </and>
        </condition>
        <condition
            property="testPlatform"
            value="macosx">
            <and>
                <equals
                    arg1="${osgi.os}"
                    arg2="macosx" />
                <equals
                    arg1="${osgi.ws}"
                    arg2="cocoa" />
                <equals
                    arg1="${osgi.arch}"
                    arg2="x86_64" />
            </and>
        </condition>
        <condition
            property="testPlatform"
            value="macmini">
            <and>
                <equals
                    arg1="${osgi.os}"
                    arg2="macosx" />
                <equals
                    arg1="${osgi.ws}"
                    arg2="cocoa" />
                <equals
                    arg1="${osgi.arch}"
                    arg2="x86" />
            </and>
        </condition>
        <echo message="testPlatform  ${testPlatform}" />
        <fail
            unless="testPlatform"
            message="testPlatform did not match any of the supported combinations of osgi.os, osgi.ws, osgi.arch" />
        <condition
            property="getArtifacts"
            value="getwinzips">
            <equals
                arg1="${testPlatform}"
                arg2="win7" />
        </condition>
        <condition
            property="getArtifacts"
            value="getwinzips64">
            <equals
                arg1="${testPlatform}"
                arg2="win7-64" />
        </condition>
        <condition
            property="getArtifacts"
            value="getlinzips">
            <equals
                arg1="${testPlatform}"
                arg2="linux" />
        </condition>
        <condition
            property="getArtifacts"
            value="getlinzips32">
            <equals
                arg1="${testPlatform}"
                arg2="linux32" />
        </condition>
        <condition
            property="getArtifacts"
            value="getmaczips">
            <equals
                arg1="${testPlatform}"
                arg2="macmini" />
        </condition>
        <condition
            property="getArtifacts"
            value="getmacosx">
            <equals
                arg1="${testPlatform}"
                arg2="macosx" />
        </condition>
        <echo message="getArtifacts ${getArtifacts}" />
        <antcall target="${getArtifacts}" />

        <!--
            Try using "loadproperties", insstead of "properties file=" to see if
            that will "evaluate" variables as loaded. Otherwise, the <properties form
            has to move to "top of file" ... outer scope?
           <property file="${eclipseBuilderDir}/eclipse/buildConfigs/sdk.tests/testConfigs/${testPlatform}/testing.properties" />
        -->
        <property
            name="testingPropertiesfile"
            value="${eclipseBuilderDir}/sdk.tests/testConfigs/${testPlatform}/testing.properties" />
        <loadproperties>
            <file file="${testingPropertiesfile}" />
        </loadproperties>

        <echo message="DEBUG: testingPropertiesfile: ${testingPropertiesfile}" />
        <echo message="buildId: ${buildId}" />
        
        <echo message="DEBUG: org.eclipse.core.net.prefs: ${org.eclipse.core.net.prefs}" />

        <property
            name="tester"
            value="${executionDir}" />

        <echo message="DEBUG: testDir: ${testDir}" />
        <echo message="DEBUG: executionDir: ${executionDir}" />

		<!--if executiondir starts with c:\ you'll need to escape it so it can load the filename properly with java -->
        <pathconvert
            targetos="unix"
            property="windowsfile">
            <path location="${executionDir}" />
        </pathconvert>
        <echo message="windowsfile ${windowsfile}" />
        <property
            name="p2executionDir"
            value="${windowsfile}" />
        <replace
            file="${eclipseBuilderDir}/sdk.tests/testConfigs/${testPlatform}/equinoxp2tests.properties"
            token="@executionDir@"
            value="${p2executionDir}" />
        <replace
            file="${eclipseBuilderDir}/sdk.tests/testConfigs/${testPlatform}/equinoxp2tests.properties"
            token="@buildId@"
            value="${buildId}" />
        <replace
            file="${eclipseBuilderDir}/sdk.tests/testConfigs/${testPlatform}/equinoxp2tests.properties"
            token="@org.eclipse.equinox.p2.tests.current.build.repo@"
            value="${currentbuildrepo}" />
        <property file="${eclipseBuilderDir}/sdk.tests/testConfigs/${testPlatform}/equinoxp2tests.properties" />

        <echo message="executionDir ${executionDir}" />

        <copy
            todir="${executionDir}"
            verbose="true">
            <fileset dir="${eclipseBuilderDir}/sdk.tests/testConfigs/${testPlatform}" />
        </copy>
        <copy
            verbose="true"
            todir="${executionDir}"
            overwrite="true">
            <fileset dir="${eclipseBuilderDir}/sdk.tests/testScripts" />
        </copy>

        <antcall target="configure.team.cvs.test" />
        <echo message="test.xml: ${test.xml}" />
        <echoproperties />
        <ant antfile="${test.xml}">
        </ant>


    </target>

            <!--
                 This streamSpecificInit target was copied from buildAll.xml and does about exactly the same thing,
                 purposely left close to original, though not as much is actually required.
                 TODO: in future, pull out into one file, and reuse

                 Its purpose, here, is entirely to pick up "stream specific" stings from the releng maps
                 project, 'configuration' folder.

                 Important note: here, unlike the one in buildAll.xml, we assume the maps have already
                 been checked out, say by hudson, as a peer of eclipseBuilder, rather then us doing
                 the checkout here, ourselves. Not sure which is easier, but current means hudson job
                 has to be set up with two git checkout steps, right version for maps (for 3.8 vs 4.2).

             -->
    <target
        name="streamSpecificInit"
        unless="streamSpecificInitComplete"
        depends="initStreamVariables,hudson-init">
        <echo message="DEBUG: executing streamSpecificInit" />

        <!-- if not specified on command line, assume files come from 'download.eclipse.org' -->
        <property name="DOWNLOAD_HOST" value="download.eclipse.org"/>
        <property name="ARCHIVE_HOST" value="archive.eclipse.org"/>
        
        <property
            name="configurationLocation"
            value="${WORKSPACE}/eclipse.platform.releng.aggregator/production/testScripts/configuration" />

                <!-- TODO: I moved (copied) this from init, probably only needs to
                    be set once, but, needs to be set before loading the repo properties -->
                <!--set local mirror location depending if hudson is running -->
        <condition
            property="localmirror"
            value="${DOWNLOAD_HOST}">
            <equals
                arg1="${hudson}"
                arg2="true" />
        </condition>




        <!--
             these condidtions used to be in "init". Conceptually seems right to be in "stream
             specific" init (since their value depends on stream) but may have side effects?)
         -->
        <condition
            property="dropsDirSegment"
            value="drops4"
            else="drops">
            <equals
                arg1="${eclipseStreamMajor}"
                arg2="4" />
        </condition>

        <copy
            verbose="true"
            failonerror="true"
            todir="${WORKSPACE}"
            overwrite="true">
            <fileset dir="${configurationLocation}/">
                <include name="**" />
            </fileset>
        </copy>
        
                <!-- bug 376217: repos.properties is one of the files moved from
                    Eclipsebuild to maps project and into a common file, streamSpecific-build.properties -->
        <replace
            token="@localmirror@"
            file="${WORKSPACE}/streamSpecific-build.properties"
            value="${localmirror}" />
                <!-- The reading/loading of the these streamSpecific-build.properties
                    is critical to several stream specific areas of code, so may have to be moved
                    "earlier"? Made it own task for depends on clauses? -->
        <loadproperties srcFile="${WORKSPACE}/streamSpecific-build.properties" />

        <!-- echo a few typically expected properties, to make sure getting right file -->

        <echo message="streamSpecificPropertiesTitle: ${streamSpecificPropertiesTitle}" />
        <echo message="p2repopreviousR: ${p2repopreviousR}" />
        <echo message="apiTestsPreviousBaseDLBaseURL: ${apiTestsPreviousBaseDLBaseURL}" />
        <echo message="apiTestsPreviousBaseWin32Filename: ${apiTestsPreviousBaseWin32Filename}" />

                <!-- now that we have maps (and we already have eclipseBuider from
                    masterBuild.sh, before calling buildAll.xml, then now its time to "overlay"
                    the stream specific files of eclipseBuild that are in the maps project, in
                    the folder named /org.eclipse.releng/configuration/eclipseBuilderOverlays -->
                <!-- TODO: semi hard code for now, figure out variables later maybe
                    do away with "supportDir" segment? maybe call 'base' and other variables
                    'eclipsebulder.base'? -->

        <property
            name="eclipseBuilderDir"
            value="${WORKSPACE}/eclipse.platform.releng.aggregator/production/testScripts/configuration" />



                <!-- now that we've done that little merge, let's "fix up" eclipseBuild
                    stuff that depends on exact version numbers -->
        <replace
            dir="${eclipseBuilderDir}"
            token="@eclipseStream@"
            value="${eclipseStream}" />
        <replace
            dir="${eclipseBuilderDir}"
            token="@eclipseStreamMajor@"
            value="${eclipseStreamMajor}" />
        <replace
            dir="${eclipseBuilderDir}"
            token="@eclipseStreamMinor@"
            value="${eclipseStreamMinor}" />
                <!-- seems unlikely we'd ever need this all by itself, and not just
                    use eclipseStream, which should be all three fields
                    <replace summary="true"
                      dir="${eclipseBuilderDir}" token="@eclipseStreamService@"
                      value="${eclipseStreamService}" />
                    -->

                <!-- no need to re-init the properties, once done (in this scope)
                    so no one else can ever set streamSpecificInitComplete properties. It is
                    our control property -->
        <property
            name="streamSpecificInitComplete"
            value="true" />
    </target>
        <!--
            note: no check for "if maps local". Here we want to be sure to get
            a fresh copy, but only once
        -->

    <!--
       main purpose of initStreamVariables, it to be sure we have eclipseStreamMajor and eclipseStreamMinor
       Uses script, which requires Java 1.6 (or ... else gets complicated to setup)
     -->
    <target name="initStreamVariables">
        <fail
            unless="eclipseStream"
            message="eclipseStream value must be provided by caller, such as '4.3.0'." />
        <condition property="streamOK">
            <matches
                pattern="\d\.\d\.\d"
                string="${eclipseStream}" />
        </condition>
        <fail
            message="eclipseStream variable had unexpected format. Should be of form digit.digit.digit, but was ${eclipseStream}"
            unless="streamOK" />

        <script language="javascript">
            var eclipseStream = project.getProperty("eclipseStream");
            var pattern = new
            RegExp(/(\d+)\.(\d+)\.(\d+)/);

            var sArray = pattern.exec(eclipseStream);
            // sArray[0] is "whole match"
            project.setProperty("eclipseStreamMajor", sArray[1]);
            project.setProperty("eclipseStreamMinor", sArray[2]);
            project.setProperty("eclipseStreamService", sArray[3]);
            project.setProperty("updateSiteSegment", sArray[1] + "." +
            sArray[2]);
        </script>

        <fail
            unless="eclipseStreamMajor"
            message="eclipseStreamMajor not defined or computed" />
        <fail
            unless="eclipseStreamMinor"
            message="eclipseStreamMinor not defined or computed" />
        <fail
            unless="eclipseStreamService"
            message="eclipseStreamService not defined or computed" />
        <fail
            unless="updateSiteSegment"
            message="updateSiteSegment not defined or computed" />

    </target>

</project>

Back to the top