Skip to content

Commit 1d8d2bd

Browse files
committed
[JAVSCODE-253] enabling nb support for localisation
[JAVSCODE-253] enabling nb support for localisation
1 parent 5558cdb commit 1d8d2bd

File tree

11 files changed

+799
-24
lines changed

11 files changed

+799
-24
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ jobs:
6464
path: netbeans
6565
ref: 23-rc3
6666

67+
- name: Checkout NetBeans l10n
68+
uses: actions/checkout@v4
69+
with:
70+
repository: apache/netbeans-l10n
71+
path: netbeans-l10n
72+
ref: ece00239dc7a208fba60703c2256ffd818da1646
73+
6774
- name: Apply NetBeans patches
6875
run: ant apply-patches
6976

BUILD.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,20 @@ $ git clone https://github.com/apache/netbeans.git
4141
$ cd netbeans/
4242
$ git checkout 23-rc3
4343
$ cd ..
44+
$ git clone https://github.com/apache/netbeans-l10n.git
45+
$ cd netbeans-l10n
46+
$ git checkout ece00239dc7a208fba60703c2256ffd818da1646 # head commit in master
47+
$ cd ..
4448
# the following target requires git executable to be on PATH:
4549
$ ant apply-patches
4650
$ ant build-netbeans
51+
52+
#Note if you do not wish to have l10n in scope then add no-l10n before any ant invocation target at beginning as below, by default l10n is enabled
53+
$ ant no-l10n apply-patches
54+
$ ant no-l10n build-netbeans
4755
```
4856

57+
4958
## Building VS Code extension
5059

5160
To build the VS Code extension invoke:

THIRD_PARTY_LICENSES.txt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10527,4 +10527,29 @@ balanced-match
1052710527
brace-expansion
1052810528

1052910529
-------- License used by Dependencies
10530-
MIT License as above
10530+
MIT License as above
10531+
10532+
------------------ END OF DEPENDENCY LICENSE --------------------
10533+
10534+
Dependency: Apache Netbeans-l10n
10535+
================================
10536+
10537+
------------------ START OF DEPENDENCY LICENSE --------------------
10538+
Apache 2.0 License as above
10539+
10540+
-------- Copyrights
10541+
Apache NetBeans-l10n
10542+
Copyright 2017-2024 The Apache Software Foundation
10543+
10544+
This product includes software developed at
10545+
The Apache Software Foundation (http://www.apache.org/).
10546+
10547+
The code is based on NetBeans, that has been kindly donated to the Apache
10548+
Software Foundation by Oracle.
10549+
10550+
The code was Copyright 1997-2016 Oracle and/or its affiliates. The Initial
10551+
Developer of the Original Software was Sun Microsystems, Inc. Portions
10552+
Copyright 1997-2006 Sun Microsystems, Inc.
10553+
10554+
10555+
------------------ END OF DEPENDENCY LICENSE --------------------

build.xml

Lines changed: 118 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
<property name="nbplatform.default.harness.dir" location="${nbplatform.default.netbeans.dest.dir}/harness" />
3232
<property name="nbantext.jar" location="netbeans/nbbuild/build/nbantext.jar" />
3333
<property name="nb_all" location="netbeans" />
34+
<loadresource property="patch-files-l10n">
35+
<string>
36+
patches/l10n/adding-ja-and-zh_CN.diff
37+
</string>
38+
<filterchain>
39+
<tokenfilter delimoutput=" ">
40+
<replaceregex pattern="\s+" replace=""/>
41+
</tokenfilter>
42+
</filterchain>
43+
</loadresource>
3444
<loadresource property="patch-files">
3545
<string>
3646
patches/6330.diff
@@ -60,6 +70,10 @@
6070
<condition property="has-patches">
6171
<length string="${patches}" trim="true" when="greater" length="0"/>
6272
</condition>
73+
<property name="patches-l10n" value="${patch-files-l10n}"/>
74+
<condition property="has-l10n-patches">
75+
<length string="${patches-l10n}" trim="true" when="greater" length="0"/>
76+
</condition>
6377

6478
<condition property="cmd.suffix" value=".cmd" else="">
6579
<os family="windows"/>
@@ -93,7 +107,7 @@
93107
<chmod file="${lsp.build.dir}/platform/lib/nbexec.sh" perm="u+x"/>
94108
<chmod file="${lsp.build.dir}/java/maven/bin/mvn.sh" perm="u+x" />
95109
</target>
96-
<target name="add-extra-modules" depends="build-lsp-server" if="extra.modules">
110+
<target name="add-extra-modules" depends="build-lsp-server,build-l10n-bundles" if="extra.modules">
97111
<ant dir="../../nbbuild" target="build-nbms" inheritall="false" inheritrefs="false">
98112
<property name="cluster.config" value="basic"/>
99113
</ant>
@@ -113,6 +127,57 @@
113127
<delete dir="vscode/out" />
114128
<ant dir="nbcode" target="clean" inheritall="false" inheritrefs="false"/>
115129
</target>
130+
131+
<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"/>
134+
135+
<target name="build-l10n-ant-text-jar">
136+
<ant dir="${netbeans.l10n.dir}/l10nantext" inheritall="false" inheritrefs="false">
137+
<property name="file.reference.ant.jar" value="${ant.home}/lib/ant.jar"/>
138+
</ant>
139+
</target>
140+
141+
<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}"/>
145+
</ant>
146+
<copy todir="${javavscode.nbcode.extra.dir}">
147+
<fileset dir="${netbeans.l10n.dir}/locale_${locale}/build/cluster"/>
148+
</copy>
149+
</target>
150+
<target name="clean-l10n">
151+
<delete dir="${netbeans.l10n.dir}/locale_${locale}/build"/>
152+
<delete dir="${netbeans.l10n.dir}/locale_${locale}/release"/>
153+
</target>
154+
<target name="clean-l10n-bundles">
155+
<delete dir="${netbeans.l10n.dir}/l10nantext/build"/>
156+
<delete dir="${netbeans.l10n.dir}/l10nantext/dist"/>
157+
<ant target="clean-l10n">
158+
<property name="locale" value="ja"/>
159+
</ant>
160+
<ant target="clean-l10n">
161+
<property name="locale" value="zh_CN"/>
162+
</ant>
163+
</target>
164+
<target name="no-l10n">
165+
<property name="javavscode.disablel0n" value="true"/>
166+
</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+
>
170+
<ant target="build-l10n">
171+
<property name="locale" value="ja" description="japanese"/>
172+
</ant>
173+
<ant target="build-l10n">
174+
<property name="locale" value="zh_CN" description="simplified chinese"/>
175+
</ant>
176+
</target>
177+
178+
179+
180+
116181
<target name="build-vscode-ext" depends="add-extra-modules" description="Build the Visual Studio Code extension.">
117182
<taskdef name="gitbranchhash" classname="org.netbeans.nbbuild.GitBranchHash" classpath="${nbantext.jar}" />
118183
<gitbranchhash file="." branchproperty="metabuild.branch" hashproperty="metabuild.hash" />
@@ -204,46 +269,86 @@
204269
</exec>
205270
</target>
206271

207-
<target name="apply-patches" if="has-patches">
208-
<echo>${patches}</echo>
272+
273+
<target name = "git-patch" if="${has-git-patches}" >
274+
<echo>${git-patches-list}</echo>
209275
<exec executable="git" failonerror="true">
210276
<arg value="apply"/>
211-
<arg value="--directory=netbeans"/>
277+
<arg value="--directory=${git-dir}"/>
212278
<arg value="--whitespace=nowarn"/>
213-
<arg line="${patches}"/>
279+
<arg line="${git-patches-list}"/>
214280
</exec>
215281
</target>
216282

217-
<target name="unapply-patches" if="has-patches">
283+
<target name="apply-patches">
284+
<ant target="git-patch">
285+
<property name="git-patches-list" value="${patches}"/>
286+
<property name="has-git-patches" value="${has-patches}"/>
287+
<property name="git-dir" value="netbeans"/>
288+
</ant>
289+
290+
<condition value="true" property="should-apply">
291+
<and>
292+
<istrue value="${has-l10n-patches}"/>
293+
<isfalse value="${javavscode.disablel0n}"/>
294+
</and>
295+
</condition>
296+
<ant target="git-patch">
297+
<property name="git-patches-list" value="${patches-l10n}"/>
298+
<property name="has-git-patches" value="${should-apply}"/>
299+
<property name="git-dir" value="netbeans-l10n"/>
300+
</ant>
301+
</target>
302+
303+
<target name = "git-un-patch" if="${has-git-patches}" >
218304
<!--in the reverse order:-->
219305
<echo file="${build.dir}/Reverse.java">
220306
import java.util.Arrays;
221307
import java.util.Collections;
222308
import java.util.List;
223309
import java.util.stream.Collectors;
224310
public class Reverse {
225-
public static void main(String[] args) {
226-
List&lt;String> patches = Arrays.asList(args[0].split(" "));
227-
Collections.reverse(patches);
228-
System.out.print(patches.stream().collect(Collectors.joining(" ")));
229-
}
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+
}
230316
}
231317
</echo>
232318
<java sourcefile="${build.dir}/Reverse.java"
233319
outputproperty="reverse.patches"
234320
fork="true">
235-
<arg value="${patches}" />
321+
<arg value="${git-patches-list}" />
236322
</java>
237323
<echo>${reverse.patches}</echo>
238324
<exec executable="git" failonerror="true">
239325
<arg value="apply"/>
240-
<arg value="--directory=netbeans"/>
326+
<arg value="--directory=${git-dir}"/>
241327
<arg value="--whitespace=nowarn"/>
242328
<arg value="--reverse"/>
243329
<arg line="${reverse.patches}"/>
244330
</exec>
245331
</target>
246332

333+
<target name="unapply-patches">
334+
<ant target="git-un-patch">
335+
<property name="git-patches-list" value="${patches}"/>
336+
<property name="has-git-patches" value="${has-patches}"/>
337+
<property name="git-dir" value="netbeans"/>
338+
</ant>
339+
<condition value="true" property="should-apply">
340+
<and>
341+
<istrue value="${has-l10n-patches}"/>
342+
<isfalse value="${javavscode.disablel0n}"/>
343+
</and>
344+
</condition>
345+
<ant target="git-un-patch">
346+
<property name="git-patches-list" value="${patches-l10n}"/>
347+
<property name="has-git-patches" value="${should-apply}"/>
348+
<property name="git-dir" value="netbeans-l10n"/>
349+
</ant>
350+
</target>
351+
247352
<target name="build-netbeans">
248353
<ant dir="netbeans" inheritAll="false" inheritRefs="false" useNativeBasedir="true"/>
249354
</target>

0 commit comments

Comments
 (0)