File: template.xml

package info (click to toggle)
libnb-platform18-java 7.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 81,288 kB
  • ctags: 101,418
  • sloc: java: 682,018; xml: 117,409; ansic: 6,281; sh: 3,982; cpp: 2,458; objc: 288; perl: 276; makefile: 252
file content (197 lines) | stat: -rw-r--r-- 9,624 bytes parent folder | download
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
<project name="build installers" default="build" basedir=".">
    <!--<property file="${basedir}/template.properties"/>-->
    
    <target name="build" depends="init,prepare-sources,prepare-zip,-build,post-build,run-build"/>

    <target name="-init-props">
        <available file="${suite.location}/nbproject/project.properties" property="do.load.ant.props"/>    
        <available file="${suite.location}/pom.xml" property="do.load.maven.props"/>    
    </target>

    <target name="-init-ant-props" if="do.load.ant.props" depends="-init-props">
        <property file="${suite.location}/nbproject/platform.properties" prefix="suite.platform."/>    
        <condition property="branding.token" value="${suite.platform.branding.token}">
            <isset property="suite.platform.branding.token"/>
        </condition>
        <property file="${suite.location}/nbproject/project.properties" prefix="suite.props."/>    
    </target>
    <target name="-init-maven-props" if="do.load.maven.props" depends="-init-props">
        <!-- There is no need to read any property from pom.xml - the properties are solved by maven plug-in. -->
        <!-- xmlproperty file="${suite.location}/pom.xml" prefix="pom.props"/>
        <property name="suite.props.app.name"  value="${pom.props.project.properties.brandingToken}"/>
        <property name="suite.props.app.title" value="${pom.props.project.artifactId}"/ -->
    </target>
    
    <target name="init" depends="-clean,-init-ant-props,-init-maven-props">
        <property name="installer.build.dir" value="${suite.location}/build/installer"/>
        <property name="suite.dist.directory" value="${suite.location}/dist"/>
        <property name="suite.dist.zip"       value="${suite.dist.directory}/${suite.props.app.name}.zip"/>
        <property name="installers.file.prefix" value="${suite.props.app.name}"/>
        <delete dir="${installer.build.dir}" includeemptydirs="yes" failonerror="false"/>

        <mkdir dir="${installer.build.dir}"/>
    </target>

    
    <target name="-clean">
    </target>

    <target name="post-build">
    </target>
    
    <target name="-build">
    </target>

    <target name="run-build">
        <ant dir="${installer.build.dir}" inheritAll="false"/>
    </target>

    <target name="-init-zip">
        <condition property="do.build.zip">
            <available file="${suite.dist.zip}"/>
        </condition>
    </target>
    <target name="-build-zip" depends="-init-zip" unless="do.build.zip">
        <antcall target="-build-zip-ant"/>
        <antcall target="-build-zip-maven"/>
    </target>

    <target name="-build-zip-ant" depends="-init-zip"  if="do.load.ant.props">
        <subant buildpath="${suite.location}" inheritAll="false" target="build-zip"/>
    </target>

    <target name="-build-zip-maven" depends="-init-zip" if="do.load.maven.props">
        <condition property="mvn.executable" value="mvn.bat" else="mvn">
            <os family="windows"/>
        </condition>

        <exec executable="${mvn.executable}" dir="${suite.location}">
           <arg value="install"/>
           <env key="JAVA_HOME" value="${java.home}"/>
        </exec>
    </target>

    <target name="prepare-zip" depends="-init-zip,-build-zip"/>

    <target name="prepare-sources">
        <copy todir="${installer.build.dir}">
           <fileset dir="${nbi.stub.location}"/>
        </copy>
        <copy todir="${installer.build.dir}/.common">
           <fileset dir="${nbi.stub.common.location}"/>
        </copy>

        <property name="product-uid"  value="${suite.nbi.product.uid}"/>

        <condition property="icon.path" value="${nbi.icon.file}" else="${installer.build.dir}/ext/components/products/helloworld/data/icon48.png">
             <and>
                 <isset property="nbi.icon.file"/>
                 <available file="${nbi.icon.file}"/>
             </and>
        </condition>

        <basename property="icon.file.name" file="${icon.path}"/>
        <condition property="icon.extension" value=".gif">
             <or>
                 <matches string="${icon.file.name}" pattern="^.*\.gif$"/>
                 <matches string="${icon.file.name}" pattern="^.*\.gif$"/>
             </or>
        </condition>
        <condition property="icon.extension" value=".png">
             <or>
                 <matches string="${icon.file.name}" pattern="^.*\.png$"/>
                 <matches string="${icon.file.name}" pattern="^.*\.PNG$"/>
             </or>
        </condition>

        <property name="icon.name" value="${suite.props.app.name}${icon.extension}"/>

        <copy file="${icon.path}" tofile="${installer.build.dir}/ext/components/products/helloworld/src/org/mycompany/${icon.name}"/>



        <replace file="${installer.build.dir}/build.properties" encoding="utf-8">
            <replacefilter token="{nbi.ant.tasks.jar}"             value="${nbi.ant.tasks.jar}"/>
            <replacefilter token="{nbi.registries.management.jar}" value="${nbi.registries.management.jar}"/>
            <replacefilter token="{nbi.engine.jar}"                value="${nbi.engine.jar}"/>
            <replacefilter token="{product-platforms}"             value="${generate.installer.for.platforms}"/>
            <replacefilter token="{generator-jdk-location-forward-slashes}"         value="${generator-jdk-location-forward-slashes}"/>
            <replacefilter token="{generated-installers-location-forward-slashes}"  value="${suite.dist.directory}"/>
            <replacefilter token="{pack200.enabled}"               value="${pack200.enabled}"/>
            <replacefilter token="{generated-installers-prefix}"   value="${installers.file.prefix}"/>
            <replacefilter token="{product-uid}"                   value="${product-uid}"/>
        </replace>

        <replace dir="${installer.build.dir}/ext" encoding="utf-8">
            <replacefilter token="{product-name}" value="${suite.props.app.title}"/>
            <replacefilter token="{product-simple-name}" value="${suite.props.app.name}"/>
            <replacefilter token="{product-description}" value=""/>
            <replacefilter token="{product-uid}"         value="${product-uid}"/>
            <replacefilter token="{product-icon-name}"   value="${icon.name}"/>
        </replace>

        <replace dir="${installer.build.dir}/ext/infra/build/products" encoding="utf-8">
            <replacefilter token="{product.platforms}"        value="${generate.installer.for.platforms}"/>
            <replacefilter token="{product-data-path}"        value="${suite.dist.zip}"/>
            <replacefilter token="{product-data-sub-dir}"     value="${suite.props.app.name}"/>
            <replacefilter token="{product-uid}"              value="${product-uid}"/>
            <replacefilter token="{product-install-directory-name}"         value="${suite.props.app.name}"/>
            <replacefilter token="{product-install-directory-name-windows}" value="${suite.props.app.name}"/>
            <replacefilter token="{product-install-directory-name-macosx}"  value="${suite.props.app.name}"/>
        </replace>       
        <property name="dir.dir" value="${installer.build.dir}/tmpdirfornac"/>
        <mkdir dir="${dir.dir}"/>

        <native2ascii encoding="utf-8" src="${installer.build.dir}" dest="${dir.dir}" includes="build.properties ext/**/*.properties"/>

        <copy todir="${installer.build.dir}" overwrite="true" includeEmptyDirs="true">
             <fileset dir="${dir.dir}"/>
        </copy> 
        <condition property="license.defined">
             <and>
                 <isset property="nbi.license.file"/>
                 <available file="${nbi.license.file}"/>
             </and>
        </condition> 
        <antcall target="-prepare-license"/>

        <condition property="icon.defined">
             <and>
                 <isset property="nbi.icon.file"/>
                 <available file="${nbi.icon.file}"/>
             </and>
        </condition> 
        <antcall target="-prepare-icon"/>

        <condition property="dock.icon.defined">
             <and>
                 <isset property="nbi.dock.icon.file"/>
                 <available file="${nbi.dock.icon.file}"/>
             </and>
        </condition> 
        <antcall target="-prepare-dock-icon"/>

        <delete dir="${dir.dir}" includeEmptyDirs="true"/>
    </target>
    
    <target name="-prepare-license" if="license.defined">
        <copy file="${nbi.license.file}" tofile="${installer.build.dir}/ext/components/products/helloworld/src/org/mycompany/license.txt" overwrite="true"/>
    </target>
    <target name="-prepare-icon" if="icon.defined">
        <copy file="${nbi.icon.file}" tofile="${installer.build.dir}/ext/engine/src/org/mycompany/installer/wizard/wizard-icon.png" overwrite="true"/>
    </target>

    <target name="-prepare-dock-icon" if="dock.icon.defined">
        <mkdir dir="${installer.build.dir}/ext/engine/src/org/netbeans/installer/utils/system/launchers/impl"/>
        <copy file="${nbi.dock.icon.file}" tofile="${installer.build.dir}/ext/engine/src/org/netbeans/installer/utils/system/launchers/impl/dockicon.icns"/>
        <copy file="${nbi.dock.icon.file}" tofile="${installer.build.dir}/ext/components/products/helloworld/src/org/mycompany/${suite.props.app.name}.icns"/>
    </target>

    <target name="replace">
        <property file="${token.file}"/>
        <replaceregexp file="${file.to.replace}" flags="mg">
            <regexp pattern="${regexp.token}"/>
            <substitution expression="${regexp.replacement}"/>
        </replaceregexp>
    </target>
</project>