Skip to content
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
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ jobs:
- name: Build javadoc
if: env.test_javadoc == 'true' && success()
run: |
export ANT_OPTS=-Djdk.xml.totalEntitySizeLimit=200000
ant $OPTS -Djavadoc.fail.broken.links=true build-javadoc

- name: Create Test Summary
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $ ant javadoc
```

#### Notes:
* On JDK 24 or later, building javadoc may require to raise the jaxp entity limit by setting `export ANT_OPTS=-Djdk.xml.totalEntitySizeLimit=200000`

* Run `javadoc-nb` task in Netbeans to run the javadoc build and display it in a web browser.

### Running NetBeans
Expand Down
50 changes: 50 additions & 0 deletions nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.nbbuild;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;

/** Sets a system property in the running JVM. Use with care. Needed to
* increase XML entities parsing limit before processing out Javadoc with
* {@code <ant file="template.xml" .../>}.
*/
public final class SysProperty extends Task {
private String name;
private String value;

public void setProperty(String name) {
this.name = name;
}

public void setValue(String value) {
this.value = value;
}

@Override
public void execute() throws BuildException {
String current = System.getProperty(name);
if (current == null) {
System.setProperty(name, value);
} else {
getProject().log(this, "Not setting property " + name + " as it already has a value " + current, Project.MSG_WARN);
}
}
}
3 changes: 3 additions & 0 deletions nbbuild/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
<taskdef name="subant-junit" classname="org.netbeans.nbbuild.SubAntJUnitReport" classpath="${nbantext.jar}"/>
<taskdef name="resolvelist" classname="org.netbeans.nbbuild.ResolveList" classpath="${nbantext.jar}"/>
<taskdef name="checkmoduleconfigs" classname="org.netbeans.nbbuild.CheckModuleConfigs" classpath="${nbantext.jar}"/>
<taskdef name="sysproperty"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I think it would be good to follow the formatting convention of the surrounding code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is

    <taskdef name="hgid"
         classname="org.netbeans.nbbuild.HgId"
         classpath="${nbantext.jar}"/>

just few lines above. E.g. there doesn't seem to be a single formatting of these statements.

classname="org.netbeans.nbbuild.SysProperty"
classpath="${nbantext.jar}"/>
<property name="tasks-already-set" value="true"/>
</target>

Expand Down
1 change: 1 addition & 0 deletions nbbuild/templates/projectized.xml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@

<target name="javadoc" depends="build-init,-javadoc-init">
<path id="javadoc.classpath" refid="processor.cp"/> <!-- #157320 -->
<sysproperty property="jdk.xml.totalEntitySizeLimit" value="200000"/>
<!-- This should become an import at some point, perhaps: -->
<ant dir="${nb_all}/nbbuild/javadoctools" antfile="template.xml" target="javadoc">
<property name="javadoc.base" location="."/>
Expand Down
Loading