Skip to content

Commit

Permalink
Fix javadoc when enable preview flag is added (#2338)
Browse files Browse the repository at this point in the history
javadoc tasks are now properly configured when `--enable-preview` is used
  • Loading branch information
iamdanfox authored Jul 29, 2022
1 parent c25e807 commit c6b3790
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-2338.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: fix
fix:
description: javadoc tasks are now properly configured when `--enable-preview` is
used
links:
- https://github.com/palantir/gradle-baseline/pull/2338
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public void execute(Task task) {
if (target.get().enablePreview()) {
// yes, javadoc truly takes a single-dash where everyone else takes a double dash
options.addBooleanOption("-enable-preview", true);
options.setSource(target.get().javaLanguageVersion().toString());
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ class BaselineJavaVersionIntegrationTest extends IntegrationSpec {
assertBytecodeVersion(compiledClass, JAVA_17_BYTECODE, ENABLE_PREVIEW_BYTECODE)
}

def 'java 17 preview javadoc works'() {
when:
buildFile << '''
javaVersions {
libraryTarget = 11
distributionTarget = '17_PREVIEW'
}
'''.stripIndent(true)
file('src/main/java/Main.java') << java17PreviewCode

then:
runTasksSuccessfully('javadoc', '-i')
}

def 'library target is used when no artifacts are published but project is overridden as a library'() {
when:
buildFile << '''
Expand Down

0 comments on commit c6b3790

Please sign in to comment.