Skip to content

Commit

Permalink
Deprecate destinationDir option in API
Browse files Browse the repository at this point in the history
Fix option to set ToDir internally.
Deprecate destinationDir in Options and OptionsBuilder.
Add JavaDoc pointing users to use toDir.

Fixes asciidoctor#853
Fixes asciidoctor#941
  • Loading branch information
abelsromero committed Mar 30, 2023
1 parent fa43680 commit f8448fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Improvement::
* Upgrade to asciidoctorj-diagram 2.2.4 (#1140)
* Upgrade to jruby 9.3.10.0 (#1138) (@alexlevinfr)

Bug Fixes::
* Fix destinationDir not having effect. Deprecate destinationDir in favour of toDir (@abelsromero) (#853, #941)

Build / Infrastructure::

* Replace use of deprecated 'numbered' attribute by 'sectnums' (#1127) (@abelsromero)
Expand Down
9 changes: 9 additions & 0 deletions asciidoctorj-api/src/main/java/org/asciidoctor/Options.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.asciidoctor;

import java.io.File;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -171,6 +172,14 @@ public void setCompact(boolean compact) {
this.options.put(COMPACT, compact);
}

/**
* Destination output directory.
*
* @param destinationDir
* destination directory.
* @deprecated Use {@link #setToDir(String)} instead.
*/
@Deprecated
public void setDestinationDir(String destinationDir) {
this.options.put(DESTINATION_DIR, destinationDir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,15 @@ public OptionsBuilder parseHeaderOnly(boolean parseHeaderOnly) {

/**
* Destination output directory.
*
*
* @param destinationDir
* destination directory.
* destination directory.
* @return this instance.
* @deprecated Use {@link #toDir(File)} instead.
*/
@Deprecated
public OptionsBuilder destinationDir(File destinationDir) {
this.options.setDestinationDir(destinationDir.getAbsolutePath());
this.options.setToDir(destinationDir.getAbsolutePath());
return this;
}

Expand Down

0 comments on commit f8448fe

Please sign in to comment.