Skip to content

Commit

Permalink
Merge pull request dita-ot#4329 from dita-ot/feature/java-uninstall
Browse files Browse the repository at this point in the history
Refactor to remove Ant from install and uninstall process
  • Loading branch information
jelovirt authored Dec 10, 2023
2 parents 8c8dc4b + 2391482 commit 7eeb971
Show file tree
Hide file tree
Showing 66 changed files with 1,576 additions and 876 deletions.
2 changes: 1 addition & 1 deletion src/main/bin/dita
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,5 @@ ant_sys_opts=
if [ -n "$CYGHOME" ]; then
ant_sys_opts="-Dcygwin.user.home=\"$CYGHOME\""
fi
ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -Djava.awt.headless=true -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$DITA_HOME\" -Ddita.dir=\"$DITA_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\""
ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -Djava.awt.headless=true -Dcli.log-format=fancy -Dcli.color=true -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$DITA_HOME\" -Ddita.dir=\"$DITA_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\""
eval $ant_exec_command "$ant_exec_args"
2 changes: 1 addition & 1 deletion src/main/bin/dita.bat
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if "%_JAVACMD%" == "" set _JAVACMD=java.exe

:runAnt
rem sun.io.useCanonCaches improves performance in Java 12+ (see https://bugs.openjdk.java.net/browse/JDK-8207005)
"%_JAVACMD%" %ANT_OPTS% -Djava.awt.headless=true -Dsun.io.useCanonCaches=true -classpath "%DITA_HOME%\lib\ant-launcher.jar;%DITA_HOME%\config" "-Dant.home=%DITA_HOME%" "-Ddita.dir=%DITA_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %DITA_CMD_LINE_ARGS% -buildfile "%DITA_HOME%\build.xml" -main "org.dita.dost.invoker.Main"
"%_JAVACMD%" %ANT_OPTS% -Djava.awt.headless=true -Dcli.log-format=fancy -Dcli.color=true -Dsun.io.useCanonCaches=true -classpath "%DITA_HOME%\lib\ant-launcher.jar;%DITA_HOME%\config" "-Dant.home=%DITA_HOME%" "-Ddita.dir=%DITA_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %DITA_CMD_LINE_ARGS% -buildfile "%DITA_HOME%\build.xml" -main "org.dita.dost.invoker.Main"
rem Check the error code of the Ant build
if not "%OS%"=="Windows_NT" goto onError
set ANT_ERROR=%ERRORLEVEL%
Expand Down
3 changes: 2 additions & 1 deletion src/main/config/configuration.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ default.cascade = merge
temp-file-name-scheme = org.dita.dost.module.reader.DefaultTempFileScheme
#filter-attributes =
#flag-attributes =
cli.color = true
cli.color = false
cli.log-format = legacy
default.coderef-charset=UTF-8

# Integration
Expand Down
64 changes: 8 additions & 56 deletions src/main/integrator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Copyright 2006 IBM Corporation
See the accompanying LICENSE file for applicable license.
-->
<project name="dita.integrator" default="integrate">

<echo level="warn">WARN: The Ant integration process is deprecated. Use the 'dita install' command instead.</echo>

<dirname property="ant.file.dita.integrator.dir" file="${ant.file.dita.integrator}"/>

Expand All @@ -20,71 +22,21 @@ See the accompanying LICENSE file for applicable license.
</not>
</and>
</condition>

<!-- Try to initialize ${dita.dir} again if it was not set. -->
<!-- Deprecated since 1.8 -->
<condition property="dita.dir" value="${basedir}">
<not>
<isset property="dita.dir"/>
</not>
</condition>

<!-- Deprecated since 3.1 -->
<path id="dost.class.path">
<pathelement location="${dita.dir}/lib/dost.jar"/>
<pathelement location="${dita.dir}/lib/dost-configuration.jar"/>
<pathelement location="${dita.dir}/lib/commons-io-2.4.jar"/>
</path>

<taskdef name="integrate" classname="org.dita.dost.ant.IntegratorTask">
<classpath refid="dost.class.path"/>
</taskdef>
<taskdef name="install" classname="org.dita.dost.ant.PluginInstallTask"/>

<target name="integrate">
<taskdef name="integrate" classname="org.dita.dost.ant.IntegratorTask"/>
<integrate ditadir="${dita.dir}" />
<antcall target="configuration-jar"/>
</target>

<!-- Deprecated since 3.2 -->
<target name="configuration-jar">
<!-- place property files into a JAR so Ant will find them -->
<jar destfile="${basedir}/lib/dost-configuration.jar">
<fileset dir="${basedir}/config">
<include name="messages.xml"/>
<include name="messages_*.properties"/>
<include name="plugins.xml"/>
<include name="configuration.properties"/>
<include name="CatalogManager.properties"/>
<include name="org.dita.dost.platform/plugin.properties"/>
</fileset>
</jar>
</target>

<target name="lax" description="Run integration in lax mode">
<echo>WARN: The lax integration mode has been removed, using strict mode</echo>
<antcall target="integrate"/>
</target>

<target name="strict" description="Run integration in strict mode">
<antcall target="integrate"/>
</target>

<target name="install" description="Install plug-in" >
<property name="force" value="false"/>
<taskdef name="install" classname="org.dita.dost.ant.PluginInstallTask"/>
<install pluginFile="${plugin.file}" force="${force}"/>
<antcall target="configuration-jar"/>
</target>

<target name="uninstall" description="Uninstall plug-in">
<fail unless="plugin.id"/>
<available property="plugin.exists" file="${dita.dir}/plugins/${plugin.id}"/>
<fail unless="plugin.exists">Plug-in ${dita.dir}/plugins/${plugin.id} doesn't exist.</fail>
<antcall target="uninstall.delete"/>
</target>
<target name="uninstall.delete" if="plugin.exists">
<delete dir="${dita.dir}/plugins/${plugin.id}"/>
<antcall target="integrate"/>
<taskdef name="uninstall" classname="org.dita.dost.ant.PluginUninstallTask"/>
<uninstall id="${plugin.id}"/>
</target>

</project>
2 changes: 1 addition & 1 deletion src/main/java/org/dita/dost/ant/ExtensibleAntInvoker.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void execute() throws BuildException {
logger.debug("{0} processing took {1} ms", mod.getClass().getSimpleName(), end - start);
}
} catch (final DITAOTException e) {
throw new BuildException("Failed to run pipeline: " + e.getMessage(), e);
throw new BuildException(e.getMessage(), e);
}
}

Expand Down
Loading

0 comments on commit 7eeb971

Please sign in to comment.