Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(descriptions-javadoc): put descriptions in META-INF folder #971

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.qameta.allure.description;

import io.qameta.allure.Description;
import io.qameta.allure.util.ResultsUtils;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
Expand Down Expand Up @@ -85,8 +86,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, "",
ResultsUtils.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 @@ -18,6 +18,7 @@
import com.google.testing.compile.Compilation;
import com.google.testing.compile.Compiler;
import com.google.testing.compile.JavaFileObjects;
import io.qameta.allure.util.ResultsUtils;
import org.junit.jupiter.api.Test;

import javax.tools.JavaFileObject;
Expand All @@ -30,9 +31,6 @@
* @author Egor Borisov [email protected]
*/
class ProcessDescriptionsTest {

private static final String ALLURE_PACKAGE_NAME = "allureDescriptions";

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

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

Expand Down Expand Up @@ -154,8 +152,8 @@ void captureDescriptionParametrizedTestWithPrimitivesParameterTest() {
Compilation compilation = compiler.compile(source);
assertThat(compilation).generatedFile(
StandardLocation.CLASS_OUTPUT,
ALLURE_PACKAGE_NAME,
expectedMethodSignatureHash
"",
ResultsUtils.ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public final class ResultsUtils {
public static final String PACKAGE_LABEL_NAME = "package";
public static final String FRAMEWORK_LABEL_NAME = "framework";
public static final String LANGUAGE_LABEL_NAME = "language";
public static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/";
baev marked this conversation as resolved.
Show resolved Hide resolved

private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtils.class);
private static final String ALLURE_DESCRIPTIONS_PACKAGE = "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
Loading