Skip to content

Commit

Permalink
Enable Spotless in POMs generated (#4484)
Browse files Browse the repository at this point in the history
Co-authored-by: Weidong Xu <weidxu@microsoft.com>
  • Loading branch information
alzimmermsft and weidongxu-microsoft authored Sep 26, 2024
1 parent bcee728 commit ea724f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ public final void block(String text, Consumer<XmlBlock> bodyAction) {
}

public final void tagWithInlineComment(String tag, String value, String comment) {
contents.line("<%1$s>%2$s</%1$s> <!-- %3$s -->", tag, CodeNamer.escapeXmlComment(value),
CodeNamer.escapeXmlComment(comment));
String escapedValue = CodeNamer.escapeXmlComment(value);
String escapedComment = CodeNamer.escapeXmlComment(comment);
contents.line("<" + tag + ">" + escapedValue + "</" + tag + "> <!-- " + escapedComment + " -->");
}

public final void tagCData(String tag, String value) {
contents.line("<%1$s><![CDATA[%2$s]]></%1$s>", tag, value);
contents.line("<" + tag + "><![CDATA[" + value + "]]></" + tag + ">");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public final void write(Pom pom, XmlFile xmlFile) {
propertiesBlock.tag("project.build.sourceEncoding", "UTF-8");
writeJacoco(propertiesBlock);
writeRevapi(propertiesBlock, pom);
writeSpotless(propertiesBlock);
});

if (!CoreUtils.isNullOrEmpty(pom.getDependencyIdentifiers())) {
Expand Down Expand Up @@ -179,6 +180,16 @@ protected void writeRevapi(XmlBlock propertiesBlock, Pom pom) {
// NOOP for data-plane
}

/**
* Extension for writing Spotless configuration.
*
* @param propertiesBlock The {@code <properties></properties>} XML block within the {@code pom.xml}.
*/
protected void writeSpotless(XmlBlock propertiesBlock) {
// For now all generation will enable Spotless running.
propertiesBlock.tag("spotless.skip", "false");
}

/**
* Extension for writing a "build" block, with array of "plugin" within.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ProtocolTestWriter(TestContext testContext) {
HttpLogOptions.class.getName(), Configuration.class.getName(),
"com.azure.core.test.utils.MockTokenCredential", "com.azure.identity.DefaultAzureCredentialBuilder",
"com.azure.core.test.TestProxyTestBase", "com.azure.core.test.TestMode",
// "com.azure.core.test.annotation.DoNotRecord",
// "com.azure.core.test.annotation.DoNotRecord",
"org.junit.jupiter.api.Disabled", "org.junit.jupiter.api.Test"));
// client and builder
syncClients.forEach(c -> {
Expand Down

0 comments on commit ea724f5

Please sign in to comment.