Skip to content

Commit b1bac24

Browse files
committed
[JVSC-253] Refactor Netbeans localisation build
1. Moved the addition of the build project dirs locale_ja and locale_zh_CN to nbcode/l10n/ from inside netbeans-l10n/. - This is because the netbeans-l10n repo provides the build projects locale_de/ and locale_cs/ only as samples. - Thus the repo would not need to accept more such samples causing bloat. - Only the addition of localised messages for the java.lsp.server module is included in the patch. - This slimmed and renamed patch maybe submitted to the repo as a PR. 2. Enhanced the Package ant task definition in netbeans-l10n to: - Support accepting "disabledModules" and "enabledClusterPath" as input. - These are used to filter unneeded clusters and modules from being built. - The platform properties "disabled.modules" and "cluster.path" can be used to set these parameters. - The former is expected to contain comma-separated module names. - The latter is expected to contain path-delimiter separated cluster paths. - This is stored in patches/l10n/filter-enabled-clusters-disabled-modules-code-cleanup.diff 3. Fixed nbcode/nbproject/platform.properties to specify ${path.separator} instead of ':' for the cluster.path value separator. - This is needed for build support on windows. 4. Loaded the platform.properties in the locale build scripts and pass the values for "disabled.modules" and "cluster.path" to the buildPackage task. 5. Updated the build.xml scripts to pass the appropriate property values for the netbeans/ and netbeans-l10n/ dirs. 6. Fixed the clean-l10n target to clean out the copied artifacts from vscode/nbcode/extras/ 7. Fixed minor typos. Signed-off-by: Siddharth Srinivasan <[email protected]>
1 parent 54d10fc commit b1bac24

19 files changed

+932
-596
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
build/
22
netbeans/
3+
netbeans-l10n/
34
.DS_STORE
45
.idea/
6+
*.iml

build.xml

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
<property name="nb_all" location="netbeans" />
3434
<loadresource property="patch-files-l10n">
3535
<string>
36-
patches/l10n/adding-ja-and-zh_CN.diff
36+
patches/l10n/filter-enabled-clusters-disabled-modules-code-cleanup.diff
37+
patches/l10n/adding-java.lsp.server-ja-and-zh_CN.diff
3738
</string>
3839
<filterchain>
3940
<tokenfilter delimoutput=" ">
@@ -58,7 +59,7 @@
5859
patches/rename-debugger.diff
5960
patches/remove-db.diff
6061
patches/nbjavac-not-required.diff
61-
patches/l10n-liscence.diff
62+
patches/l10n-licence.diff
6263
</string>
6364
<filterchain>
6465
<tokenfilter delimoutput=" ">
@@ -129,27 +130,36 @@
129130
</target>
130131

131132
<property name="netbeans.l10n.dir" location="netbeans-l10n"/>
132-
<property name="javavscode.nbuild.nb.dir" location="netbeans/nbbuild/netbeans"/>
133-
<property name="javavscode.nbcode.extra.dir" location="vscode/nbcode/extra"/>
133+
<property name="nbcode.l10n.dir" location="nbcode/l10n"/>
134+
<property name="vscode.nbcode.extra.dir" location="vscode/nbcode/extra"/>
134135

135-
<target name="build-l10n-ant-text-jar">
136+
<target name="build-l10n-ant-ext-jar">
136137
<ant dir="${netbeans.l10n.dir}/l10nantext" inheritall="false" inheritrefs="false">
137138
<property name="file.reference.ant.jar" value="${ant.home}/lib/ant.jar"/>
138139
</ant>
139140
</target>
140141

141142
<target name="build-l10n">
142-
<ant dir="${netbeans.l10n.dir}/locale_${locale}" target="build" inheritall="false" inheritrefs="false">
143-
<property name="nbplatform.default.harness.dir" location="${javavscode.nbuild.nb.dir}/harness"/>
144-
<property name="nbplatform.default.netbeans.dest.dir" location="${javavscode.nbuild.nb.dir}"/>
143+
<ant dir="${nbcode.l10n.dir}/locale_${locale}" target="build" inheritall="false" inheritrefs="false">
144+
<property name="nbplatform.default.harness.dir" location="${nbplatform.default.harness.dir}"/>
145+
<property name="nbplatform.default.netbeans.dest.dir" location="${nbplatform.default.netbeans.dest.dir}"/>
146+
<property name="netbeans.l10n.dir" location="${netbeans.l10n.dir}"/>
147+
<property name="nbantext.jar" location="${nbantext.jar}"/>
145148
</ant>
146-
<copy todir="${javavscode.nbcode.extra.dir}">
147-
<fileset dir="${netbeans.l10n.dir}/locale_${locale}/build/cluster"/>
149+
<copy todir="${vscode.nbcode.extra.dir}">
150+
<fileset dir="${nbcode.l10n.dir}/locale_${locale}/build/cluster"/>
148151
</copy>
149152
</target>
150153
<target name="clean-l10n">
151-
<delete dir="${netbeans.l10n.dir}/locale_${locale}/build"/>
152-
<delete dir="${netbeans.l10n.dir}/locale_${locale}/release"/>
154+
<delete dir="${nbcode.l10n.dir}/locale_${locale}/build" includeemptydirs="true" quiet="true"/>
155+
<delete dir="${nbcode.l10n.dir}/locale_${locale}/release" includeemptydirs="true" quiet="true"/>
156+
<delete includeemptydirs="true" quiet="true">
157+
<fileset dir="${vscode.nbcode.extra.dir}">
158+
<include name="**/*${locale}.jar"/>
159+
<include name="**/*${locale}.xml"/>
160+
<include name="**/*${locale}.html"/>
161+
</fileset>
162+
</delete>
153163
</target>
154164
<target name="clean-l10n-bundles">
155165
<delete dir="${netbeans.l10n.dir}/l10nantext/build"/>
@@ -162,11 +172,10 @@
162172
</ant>
163173
</target>
164174
<target name="no-l10n">
165-
<property name="javavscode.disablel0n" value="true"/>
175+
<property name="disable.netbeans.l10n" value="true"/>
166176
</target>
167-
<target name="build-l10n-bundles" depends="clean-l10n-bundles,build-l10n-ant-text-jar" description="builds l10n language bundles for vs code extension"
168-
unless="${javavscode.disablel0n}"
169-
>
177+
<target name="build-l10n-bundles" depends="clean-l10n-bundles,build-l10n-ant-ext-jar" description="builds l10n language bundles for vs code extension"
178+
unless="${disable.netbeans.l10n}">
170179
<ant target="build-l10n">
171180
<property name="locale" value="ja" description="japanese"/>
172181
</ant>
@@ -221,10 +230,10 @@
221230
<arg value="--save" />
222231
<arg value="@vscode/[email protected]" />
223232
</exec>
224-
225-
<copy file="${basedir}/LICENSE.txt" todir="${basedir}/vscode" />
226-
<copy file="${basedir}/THIRD_PARTY_LICENSES.txt" todir="${basedir}/vscode" />
227-
233+
234+
<copy file="${basedir}/LICENSE.txt" todir="${basedir}/vscode" />
235+
<copy file="${basedir}/THIRD_PARTY_LICENSES.txt" todir="${basedir}/vscode" />
236+
228237
<exec executable="${build.dir}/vsce/node_modules/.bin/vsce${cmd.suffix}" failonerror="true" dir="${basedir}/vscode">
229238
<arg value="package" />
230239
<arg line="${vsce.extra.args}" />
@@ -234,9 +243,9 @@
234243
<arg value="https://github.com/oracle/javavscode/raw/${metabuild.hash}/vscode" />
235244
<arg value="--out" />
236245
<arg value="${build.dir}/oracle-java-${vsix.version}.vsix" />
237-
</exec>
238-
<delete file="${basedir}/vscode/LICENSE.txt"/>
239-
<delete file="${basedir}/vscode/THIRD_PARTY_LICENSES.txt"/>
246+
</exec>
247+
<delete file="${basedir}/vscode/LICENSE.txt"/>
248+
<delete file="${basedir}/vscode/THIRD_PARTY_LICENSES.txt"/>
240249
</target>
241250
<target name="test-lsp-server" description="Tests the LSP server behavior">
242251
<ant dir="nbcode" target="test" inheritall="false" inheritrefs="false">
@@ -290,7 +299,7 @@
290299
<condition value="true" property="should-apply">
291300
<and>
292301
<istrue value="${has-l10n-patches}"/>
293-
<isfalse value="${javavscode.disablel0n}"/>
302+
<isfalse value="${disable.netbeans.l10n}"/>
294303
</and>
295304
</condition>
296305
<ant target="git-patch">
@@ -308,11 +317,11 @@
308317
import java.util.List;
309318
import java.util.stream.Collectors;
310319
public class Reverse {
311-
public static void main(String[] args) {
312-
List&lt;String> patches = Arrays.asList(args[0].split(" "));
313-
Collections.reverse(patches);
314-
System.out.print(patches.stream().collect(Collectors.joining(" ")));
315-
}
320+
public static void main(String[] args) {
321+
List&lt;String> patches = Arrays.asList(args[0].split(" "));
322+
Collections.reverse(patches);
323+
System.out.print(patches.stream().collect(Collectors.joining(" ")));
324+
}
316325
}
317326
</echo>
318327
<java sourcefile="${build.dir}/Reverse.java"
@@ -339,7 +348,7 @@
339348
<condition value="true" property="should-apply">
340349
<and>
341350
<istrue value="${has-l10n-patches}"/>
342-
<isfalse value="${javavscode.disablel0n}"/>
351+
<isfalse value="${disable.netbeans.l10n}"/>
343352
</and>
344353
</condition>
345354
<ant target="git-un-patch">

nbcode/l10n/locale_ja/build.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<project name="org.apache.netbeans.l10n.ja" default="netbeans" basedir=".">
23+
<description>Builds, tests, and runs the project org.apache.netbeans.l10n.ja.</description>
24+
<property name="nbplatform.active" value="default"/>
25+
<property name="netbeans.l10n.dir" location="${nbplatform.default.netbeans.dest.dir}/../../../netbeans-l10n"/>
26+
<property file="../../nbproject/platform.properties"/>
27+
<property name="src.dir" location="src"/>
28+
<import file="nbproject/build-impl.xml"/>
29+
30+
<target name="build" depends="build-language-jars,projectized-common.build"/>
31+
32+
<target name="build-language-jars">
33+
<property name="locale" value="ja"/>
34+
<property name="dist.dir" location="${netbeans.l10n.dir}/netbeans-l10n-zip/src/${locale}"/>
35+
<property name="nbms.dist.dir" location="nbms"/>
36+
<property name="nbms.dir" location="${netbeans.l10n.dir}/nbbuild/${nbms.dist.dir}"/>
37+
<property name="keystore" location=""/>
38+
<property name="storepass" value=""/>
39+
<property name="nbm_alias" value="nb_ide"/>
40+
41+
<taskdef name="packageBuild" classname="org.netbeans.l10n.Package">
42+
<classpath>
43+
<pathelement path="${netbeans.l10n.dir}/l10nantext/dist/l10nantext.jar"/>
44+
</classpath>
45+
</taskdef>
46+
<packageBuild src="${dist.dir}" locales="${locale}" dist="release/modules/locale" nbms="${nbms.dir}" nbmsDist="${nbms.dist.dir}"
47+
enabledClusterPath="${cluster.path}" disabledModules="${disabled.modules}"
48+
keystore="${keystore}" storepass="${storepass}" alias="${nbm_alias}">
49+
<classpath>
50+
<pathelement location="${nbantext.jar}"/>
51+
<fileset dir="${main.dir}">
52+
<include name="apisupport.harness/external/jsearch*.jar"/>
53+
</fileset>
54+
<fileset dir="${nbplatform.default.netbeans.dest.dir}">
55+
<include name="harness/jsearch*.jar"/>
56+
</fileset>
57+
</classpath>
58+
</packageBuild>
59+
<!--<repeat target="copy-docs-for-locale" name="one.locale" values="${locales}"/>-->
60+
</target>
61+
62+
</project>

nbcode/l10n/locale_ja/manifest.mf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Manifest-Version: 1.0
2+
AutoUpdate-Show-In-Client: true
3+
OpenIDE-Module: org.apache.netbeans.l10n.ja
4+
OpenIDE-Module-Localizing-Bundle: org/apache/netbeans/l10n/ja/Bundle.properties
5+
OpenIDE-Module-Specification-Version: 0.0.1
6+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
*** GENERATED FROM project.xml - DO NOT EDIT ***
4+
*** EDIT ../build.xml INSTEAD ***
5+
-->
6+
<project name="org.apache.netbeans.l10n.ja-impl" basedir="..">
7+
<fail message="Please build using Ant 1.7.1 or higher.">
8+
<condition>
9+
<not>
10+
<antversion atleast="1.7.1"/>
11+
</not>
12+
</condition>
13+
</fail>
14+
<property file="nbproject/platform.properties"/>
15+
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
16+
<attribute name="name"/>
17+
<attribute name="value"/>
18+
<sequential>
19+
<property name="@{name}" value="${@{value}}"/>
20+
</sequential>
21+
</macrodef>
22+
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
23+
<attribute name="property"/>
24+
<attribute name="value"/>
25+
<sequential>
26+
<property name="@{property}" value="@{value}"/>
27+
</sequential>
28+
</macrodef>
29+
<property file="${user.properties.file}"/>
30+
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
31+
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
32+
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
33+
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
34+
<condition>
35+
<not>
36+
<contains string="${cluster.path.evaluated}" substring="platform"/>
37+
</not>
38+
</condition>
39+
</fail>
40+
<import file="${harness.dir}/build.xml"/>
41+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
nbplatform.active=default
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
javac.source=1.8
18+
javac.compilerargs=-Xlint -Xlint:-serial
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<project xmlns="http://www.netbeans.org/ns/project/1">
23+
<type>org.netbeans.modules.apisupport.project</type>
24+
<configuration>
25+
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
26+
<code-name-base>org.apache.netbeans.l10n.ja</code-name-base>
27+
<standalone/>
28+
<module-dependencies/>
29+
<public-packages/>
30+
</data>
31+
</configuration>
32+
</project>

nbcode/l10n/locale_zh_CN/build.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<project name="org.apache.netbeans.l10n.zh_CN" default="netbeans" basedir=".">
23+
<description>Builds, tests, and runs the project org.apache.netbeans.l10n.zh_CN.</description>
24+
<property name="nbplatform.active" value="default"/>
25+
<property name="netbeans.l10n.dir" location="${nbplatform.default.netbeans.dest.dir}/../../../netbeans-l10n"/>
26+
<property file="../../nbproject/platform.properties"/>
27+
<property name="src.dir" location="src"/>
28+
<import file="nbproject/build-impl.xml"/>
29+
30+
<target name="build" depends="build-language-jars,projectized-common.build"/>
31+
32+
<target name="build-language-jars">
33+
<property name="locale" value="zh_CN"/>
34+
<property name="dist.dir" location="${netbeans.l10n.dir}/netbeans-l10n-zip/src/${locale}"/>
35+
<property name="nbms.dist.dir" location="nbms"/>
36+
<property name="nbms.dir" location="${netbeans.l10n.dir}/nbbuild/${nbms.dist.dir}"/>
37+
<property name="keystore" location=""/>
38+
<property name="storepass" value=""/>
39+
<property name="nbm_alias" value="nb_ide"/>
40+
41+
<taskdef name="packageBuild" classname="org.netbeans.l10n.Package">
42+
<classpath>
43+
<pathelement path="${netbeans.l10n.dir}/l10nantext/dist/l10nantext.jar"/>
44+
</classpath>
45+
</taskdef>
46+
<packageBuild src="${dist.dir}" locales="${locale}" dist="release/modules/locale" nbms="${nbms.dir}" nbmsDist="${nbms.dist.dir}"
47+
enabledClusterPath="${cluster.path}" disabledModules="${disabled.modules}"
48+
keystore="${keystore}" storepass="${storepass}" alias="${nbm_alias}">
49+
<classpath>
50+
<pathelement location="${nbantext.jar}"/>
51+
<fileset dir="${main.dir}">
52+
<include name="apisupport.harness/external/jsearch*.jar"/>
53+
</fileset>
54+
<fileset dir="${nbplatform.default.netbeans.dest.dir}">
55+
<include name="harness/jsearch*.jar"/>
56+
</fileset>
57+
</classpath>
58+
</packageBuild>
59+
<!--<repeat target="copy-docs-for-locale" name="one.locale" values="${locales}"/>-->
60+
</target>
61+
62+
</project>

0 commit comments

Comments
 (0)