Skip to content

Commit

Permalink
fix(descriptions-javadoc): put descriptions in META-INF folder (via #971
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rPraml authored Oct 19, 2023
1 parent 2c3ed8b commit 3add1c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
@SupportedAnnotationTypes("io.qameta.allure.Description")
public class JavaDocDescriptionsProcessor extends AbstractProcessor {

private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/";

private Filer filer;
private Elements elementUtils;
private Messager messager;
Expand Down Expand Up @@ -85,8 +87,8 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round

final String hash = generateMethodSignatureHash(el.getEnclosingElement().toString(), name, typeParams);
try {
final FileObject file = filer.createResource(StandardLocation.CLASS_OUTPUT,
"allureDescriptions", hash);
final FileObject file = filer.createResource(StandardLocation.CLASS_OUTPUT, "",
ALLURE_DESCRIPTIONS_FOLDER + hash);
try (Writer writer = file.openWriter()) {
writer.write(docs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class ProcessDescriptionsTest {

private static final String ALLURE_PACKAGE_NAME = "allureDescriptions";
private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/";

@Test
void captureDescriptionTest() {
Expand All @@ -58,8 +58,8 @@ void captureDescriptionTest() {
Compilation compilation = compiler.compile(source);
assertThat(compilation).generatedFile(
StandardLocation.CLASS_OUTPUT,
ALLURE_PACKAGE_NAME,
expectedMethodSignatureHash
"",
ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash
);
}

Expand Down Expand Up @@ -121,8 +121,8 @@ void captureDescriptionParametrizedTestWithGenericParameterTest() {
Compilation compilation = compiler.compile(source);
assertThat(compilation).generatedFile(
StandardLocation.CLASS_OUTPUT,
ALLURE_PACKAGE_NAME,
expectedMethodSignatureHash
"",
ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash
);
}

Expand Down Expand Up @@ -154,8 +154,8 @@ void captureDescriptionParametrizedTestWithPrimitivesParameterTest() {
Compilation compilation = compiler.compile(source);
assertThat(compilation).generatedFile(
StandardLocation.CLASS_OUTPUT,
ALLURE_PACKAGE_NAME,
expectedMethodSignatureHash
"",
ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public final class ResultsUtils {
public static final String LANGUAGE_LABEL_NAME = "language";

private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtils.class);
private static final String ALLURE_DESCRIPTIONS_PACKAGE = "allureDescriptions/";
private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/";
private static final String MD_5 = "MD5";

private static String cachedHost;
Expand Down Expand Up @@ -305,7 +305,7 @@ public static Optional<String> getJavadocDescription(final ClassLoader classLoad
name,
parameterTypes);

return readResource(classLoader, ALLURE_DESCRIPTIONS_PACKAGE + signatureHash)
return readResource(classLoader, ALLURE_DESCRIPTIONS_FOLDER + signatureHash)
.map(desc -> separateLines() ? desc.replace("\n", "<br />") : desc);
}

Expand Down

0 comments on commit 3add1c9

Please sign in to comment.