Skip to content

[JAVSCODE-253] enabling nb support for localisation #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ jobs:
path: netbeans
ref: 23-rc3

- name: Checkout NetBeans l10n
uses: actions/checkout@v4
with:
repository: apache/netbeans-l10n
path: netbeans-l10n
ref: ece00239dc7a208fba60703c2256ffd818da1646

- name: Apply NetBeans patches
run: ant apply-patches

Expand Down
9 changes: 9 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ $ git clone https://github.com/apache/netbeans.git
$ cd netbeans/
$ git checkout 23-rc3
$ cd ..
$ git clone https://github.com/apache/netbeans-l10n.git
$ cd netbeans-l10n
$ git checkout ece00239dc7a208fba60703c2256ffd818da1646 # head commit in master
$ cd ..
# the following target requires git executable to be on PATH:
$ ant apply-patches
$ ant build-netbeans

#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
$ ant no-l10n apply-patches
$ ant no-l10n build-netbeans
```


## Building VS Code extension

To build the VS Code extension invoke:
Expand Down
27 changes: 26 additions & 1 deletion THIRD_PARTY_LICENSES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10527,4 +10527,29 @@ balanced-match
brace-expansion

-------- License used by Dependencies
MIT License as above
MIT License as above

------------------ END OF DEPENDENCY LICENSE --------------------

Dependency: Apache Netbeans-l10n
================================

------------------ START OF DEPENDENCY LICENSE --------------------
Apache 2.0 License as above

-------- Copyrights
Apache NetBeans-l10n
Copyright 2017-2024 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

The code is based on NetBeans, that has been kindly donated to the Apache
Software Foundation by Oracle.

The code was Copyright 1997-2016 Oracle and/or its affiliates. The Initial
Developer of the Original Software was Sun Microsystems, Inc. Portions
Copyright 1997-2006 Sun Microsystems, Inc.


------------------ END OF DEPENDENCY LICENSE --------------------
131 changes: 118 additions & 13 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
<property name="nbplatform.default.harness.dir" location="${nbplatform.default.netbeans.dest.dir}/harness" />
<property name="nbantext.jar" location="netbeans/nbbuild/build/nbantext.jar" />
<property name="nb_all" location="netbeans" />
<loadresource property="patch-files-l10n">
<string>
patches/l10n/adding-ja-and-zh_CN.diff
</string>
<filterchain>
<tokenfilter delimoutput=" ">
<replaceregex pattern="\s+" replace=""/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="patch-files">
<string>
patches/6330.diff
Expand Down Expand Up @@ -60,6 +70,10 @@
<condition property="has-patches">
<length string="${patches}" trim="true" when="greater" length="0"/>
</condition>
<property name="patches-l10n" value="${patch-files-l10n}"/>
<condition property="has-l10n-patches">
<length string="${patches-l10n}" trim="true" when="greater" length="0"/>
</condition>

<condition property="cmd.suffix" value=".cmd" else="">
<os family="windows"/>
Expand Down Expand Up @@ -93,7 +107,7 @@
<chmod file="${lsp.build.dir}/platform/lib/nbexec.sh" perm="u+x"/>
<chmod file="${lsp.build.dir}/java/maven/bin/mvn.sh" perm="u+x" />
</target>
<target name="add-extra-modules" depends="build-lsp-server" if="extra.modules">
<target name="add-extra-modules" depends="build-lsp-server,build-l10n-bundles" if="extra.modules">
<ant dir="../../nbbuild" target="build-nbms" inheritall="false" inheritrefs="false">
<property name="cluster.config" value="basic"/>
</ant>
Expand All @@ -113,6 +127,57 @@
<delete dir="vscode/out" />
<ant dir="nbcode" target="clean" inheritall="false" inheritrefs="false"/>
</target>

<property name="netbeans.l10n.dir" location="netbeans-l10n"/>
<property name="javavscode.nbuild.nb.dir" location="netbeans/nbbuild/netbeans"/>
<property name="javavscode.nbcode.extra.dir" location="vscode/nbcode/extra"/>

<target name="build-l10n-ant-text-jar">
<ant dir="${netbeans.l10n.dir}/l10nantext" inheritall="false" inheritrefs="false">
<property name="file.reference.ant.jar" value="${ant.home}/lib/ant.jar"/>
</ant>
</target>

<target name="build-l10n">
<ant dir="${netbeans.l10n.dir}/locale_${locale}" target="build" inheritall="false" inheritrefs="false">
<property name="nbplatform.default.harness.dir" location="${javavscode.nbuild.nb.dir}/harness"/>
<property name="nbplatform.default.netbeans.dest.dir" location="${javavscode.nbuild.nb.dir}"/>
</ant>
<copy todir="${javavscode.nbcode.extra.dir}">
<fileset dir="${netbeans.l10n.dir}/locale_${locale}/build/cluster"/>
</copy>
</target>
<target name="clean-l10n">
<delete dir="${netbeans.l10n.dir}/locale_${locale}/build"/>
<delete dir="${netbeans.l10n.dir}/locale_${locale}/release"/>
</target>
<target name="clean-l10n-bundles">
<delete dir="${netbeans.l10n.dir}/l10nantext/build"/>
<delete dir="${netbeans.l10n.dir}/l10nantext/dist"/>
<ant target="clean-l10n">
<property name="locale" value="ja"/>
</ant>
<ant target="clean-l10n">
<property name="locale" value="zh_CN"/>
</ant>
</target>
<target name="no-l10n">
<property name="javavscode.disablel0n" value="true"/>
</target>
<target name="build-l10n-bundles" depends="clean-l10n-bundles,build-l10n-ant-text-jar" description="builds l10n language bundles for vs code extension"
unless="${javavscode.disablel0n}"
>
<ant target="build-l10n">
<property name="locale" value="ja" description="japanese"/>
</ant>
<ant target="build-l10n">
<property name="locale" value="zh_CN" description="simplified chinese"/>
</ant>
</target>




<target name="build-vscode-ext" depends="add-extra-modules" description="Build the Visual Studio Code extension.">
<taskdef name="gitbranchhash" classname="org.netbeans.nbbuild.GitBranchHash" classpath="${nbantext.jar}" />
<gitbranchhash file="." branchproperty="metabuild.branch" hashproperty="metabuild.hash" />
Expand Down Expand Up @@ -204,46 +269,86 @@
</exec>
</target>

<target name="apply-patches" if="has-patches">
<echo>${patches}</echo>

<target name = "git-patch" if="${has-git-patches}" >
<echo>${git-patches-list}</echo>
<exec executable="git" failonerror="true">
<arg value="apply"/>
<arg value="--directory=netbeans"/>
<arg value="--directory=${git-dir}"/>
<arg value="--whitespace=nowarn"/>
<arg line="${patches}"/>
<arg line="${git-patches-list}"/>
</exec>
</target>

<target name="unapply-patches" if="has-patches">
<target name="apply-patches">
<ant target="git-patch">
<property name="git-patches-list" value="${patches}"/>
<property name="has-git-patches" value="${has-patches}"/>
<property name="git-dir" value="netbeans"/>
</ant>

<condition value="true" property="should-apply">
<and>
<istrue value="${has-l10n-patches}"/>
<isfalse value="${javavscode.disablel0n}"/>
</and>
</condition>
<ant target="git-patch">
<property name="git-patches-list" value="${patches-l10n}"/>
<property name="has-git-patches" value="${should-apply}"/>
<property name="git-dir" value="netbeans-l10n"/>
</ant>
</target>

<target name = "git-un-patch" if="${has-git-patches}" >
<!--in the reverse order:-->
<echo file="${build.dir}/Reverse.java">
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class Reverse {
public static void main(String[] args) {
List&lt;String> patches = Arrays.asList(args[0].split(" "));
Collections.reverse(patches);
System.out.print(patches.stream().collect(Collectors.joining(" ")));
}
public static void main(String[] args) {
List&lt;String> patches = Arrays.asList(args[0].split(" "));
Collections.reverse(patches);
System.out.print(patches.stream().collect(Collectors.joining(" ")));
}
}
</echo>
<java sourcefile="${build.dir}/Reverse.java"
outputproperty="reverse.patches"
fork="true">
<arg value="${patches}" />
<arg value="${git-patches-list}" />
</java>
<echo>${reverse.patches}</echo>
<exec executable="git" failonerror="true">
<arg value="apply"/>
<arg value="--directory=netbeans"/>
<arg value="--directory=${git-dir}"/>
<arg value="--whitespace=nowarn"/>
<arg value="--reverse"/>
<arg line="${reverse.patches}"/>
</exec>
</target>

<target name="unapply-patches">
<ant target="git-un-patch">
<property name="git-patches-list" value="${patches}"/>
<property name="has-git-patches" value="${has-patches}"/>
<property name="git-dir" value="netbeans"/>
</ant>
<condition value="true" property="should-apply">
<and>
<istrue value="${has-l10n-patches}"/>
<isfalse value="${javavscode.disablel0n}"/>
</and>
</condition>
<ant target="git-un-patch">
<property name="git-patches-list" value="${patches-l10n}"/>
<property name="has-git-patches" value="${should-apply}"/>
<property name="git-dir" value="netbeans-l10n"/>
</ant>
</target>

<target name="build-netbeans">
<ant dir="netbeans" inheritAll="false" inheritRefs="false" useNativeBasedir="true"/>
</target>
Expand Down
Loading