Skip to content

Commit 12c4ba3

Browse files
authored
Use New Javadoc Codesnippet Tooling to Support Java 17 (Azure#24475)
Use New Javadoc Snippet Tooling to Support Java 17
1 parent 7f37198 commit 12c4ba3

File tree

107 files changed

+2713
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2713
-240
lines changed

eng/pipelines/scripts/generate_overview_from_readme.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
import argparse
1818
from bs4 import BeautifulSoup
19+
import pdb
1920
import markdown2
2021
import os.path
2122
from io import open
2223
import re
23-
import sys
2424

25-
def generate_overview(readme_file, version):
25+
def generate_overview(readme_file, version, overview_file_path):
2626

2727
readme_exists = False
2828
if os.path.exists(readme_file) and os.path.isfile(readme_file):
@@ -33,7 +33,10 @@ def generate_overview(readme_file, version):
3333
# allow processing to continue without failing the build the way a raise would.
3434
print('{} does not exist'.format(readme_file))
3535

36-
html_overview_file = str(readme_file).lower().replace('readme.md', 'readme_overview.html')
36+
if overview_file_path:
37+
html_overview_file = overview_file_path + 'readme_overview.html'
38+
else:
39+
html_overview_file = str(readme_file).lower().replace('readme.md', 'readme_overview.html')
3740

3841
if (readme_exists):
3942
with open(readme_file, 'r', encoding='utf-8') as f:
@@ -45,27 +48,36 @@ def generate_overview(readme_file, version):
4548
# The toc helps the anchor link to jump to the right place.
4649
html_readme_content = markdown2.markdown(re.sub(pattern='@', repl='{@literal @}', string=readme_content, flags=re.MULTILINE), extras=["fenced-code-blocks", "target-blank-links", "toc"])
4750

51+
# Now use BeautifulSoup to cleanup the generated HTML so that it conforms to Javadoc compliance.
52+
soup = BeautifulSoup(html_readme_content, features="html.parser")
53+
54+
# Find all anchor tags with the rel attribute and remove the attribute.
55+
anchors_with_rel = soup.find_all(name='a', attrs={'rel':'noopener'})
56+
for anchor in anchors_with_rel:
57+
del anchor['rel']
58+
4859
# The html_readme_content needs to be encapsulated inside of <body> tags in order
4960
# for the content to correctly be added to the landing page
5061
with open(html_overview_file, 'w', encoding='utf-8') as f:
5162
# The literal strings have to be unicode otherwise the write will fail.
5263
# This will allow this code to work for python 2 and 3
5364
f.write('<body>')
5465
f.write('Current version is {}, click <a href="https://azure.github.io/azure-sdk-for-java" target="new">here</a> for the index'.format(version))
55-
f.write('<br/>')
66+
f.write('<br>')
5667
if (readme_exists):
57-
f.write(str(html_readme_content))
68+
f.write(str(soup.encode(formatter="html5").decode('utf-8')))
5869
f.write('</body>')
5970

6071

6172
def main():
6273
parser = argparse.ArgumentParser(description='Generate a readme_overview.html from a README.md.')
6374
parser.add_argument('--readme-file', '--rf', help='path to the README.md file to readme_generate the overview.html file from.', required=True)
75+
parser.add_argument('--overview-file-path', '--ofp', help='path to the overview.html file.')
6476
parser.add_argument('--version', '--v', help='Version, used on the landing page to identify the version.', required=True)
6577
args = parser.parse_args()
6678
# verify the argument is a readme.md file
6779
if str(args.readme_file).lower().endswith('readme.md'):
68-
generate_overview(args.readme_file, args.version)
80+
generate_overview(args.readme_file, args.version, args.overview_file_path)
6981
else:
7082
raise ValueError('{} is not a readmefile. The --readme-file argument must be a readme.md file.'.format(args.readme_file))
7183

eng/spotbugs-aggregate-report/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<plugin>
5757
<groupId>org.apache.maven.plugins</groupId>
5858
<artifactId>maven-javadoc-plugin</artifactId>
59-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
59+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
6060
<configuration>
6161
<!-- Added to override the -snippetpath arg which is not applicable here-->
6262
<additionalOptions>-maxLineLength 120</additionalOptions>

eng/versioning/external_dependencies.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ org.apache.maven.plugins:maven-enforcer-plugin;3.0.0-M3
242242
org.apache.maven.plugins:maven-failsafe-plugin;2.22.0
243243
org.apache.maven.plugins:maven-help-plugin;2.1.1
244244
org.apache.maven.plugins:maven-jar-plugin;3.1.2
245-
org.apache.maven.plugins:maven-javadoc-plugin;3.1.1
245+
org.apache.maven.plugins:maven-javadoc-plugin;3.3.1
246246
org.apache.maven.plugins:maven-jxr-plugin;3.0.0
247247
org.apache.maven.plugins:maven-project-info-reports-plugin;3.0.0
248248
org.apache.maven.plugins:maven-release-plugin;2.5.3
@@ -269,6 +269,7 @@ org.revapi:revapi-java;0.20.0
269269
org.revapi:revapi-maven-plugin;0.11.2
270270
org.moditect:moditect-maven-plugin;1.0.0.RC1
271271
org.ow2.asm:asm;9.1
272+
com.azure.tools:codesnippet-maven-plugin;1.0.0-beta.1
272273

273274
# External Dependency Exceptions
274275
# This section is for external dependencies whose versions were different than

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
<plugin>
161161
<groupId>org.apache.maven.plugins</groupId>
162162
<artifactId>maven-javadoc-plugin</artifactId>
163-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
163+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
164164
<configuration>
165165
<source>1.8</source>
166166
<doctitle>Azure SDK for Java Reference Documentation</doctitle>
@@ -586,7 +586,7 @@
586586
<plugin>
587587
<groupId>org.apache.maven.plugins</groupId>
588588
<artifactId>maven-javadoc-plugin</artifactId>
589-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
589+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
590590
<reportSets>
591591
<reportSet>
592592
<id>non-aggregate</id>

sdk/authorization/microsoft-azure-authentication-msi-token-provider/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<plugin>
113113
<groupId>org.apache.maven.plugins</groupId>
114114
<artifactId>maven-javadoc-plugin</artifactId>
115-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
115+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
116116
<configuration>
117117
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
118118
<bottom>

sdk/cognitiveservices/ms-azure-cs-autosuggest/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<plugin>
7575
<groupId>org.apache.maven.plugins</groupId>
7676
<artifactId>maven-javadoc-plugin</artifactId>
77-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
77+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
7878
<configuration>
7979
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
8080
<bottom>

sdk/cognitiveservices/ms-azure-cs-computervision/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<plugin>
7777
<groupId>org.apache.maven.plugins</groupId>
7878
<artifactId>maven-javadoc-plugin</artifactId>
79-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
79+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
8080
<configuration>
8181
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
8282
<bottom>

sdk/cognitiveservices/ms-azure-cs-contentmoderator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<plugin>
7777
<groupId>org.apache.maven.plugins</groupId>
7878
<artifactId>maven-javadoc-plugin</artifactId>
79-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
79+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
8080
<configuration>
8181
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
8282
<bottom>

sdk/cognitiveservices/ms-azure-cs-customimagesearch/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<plugin>
7575
<groupId>org.apache.maven.plugins</groupId>
7676
<artifactId>maven-javadoc-plugin</artifactId>
77-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
77+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
7878
<configuration>
7979
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
8080
<bottom>

sdk/cognitiveservices/ms-azure-cs-customsearch/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<plugin>
7575
<groupId>org.apache.maven.plugins</groupId>
7676
<artifactId>maven-javadoc-plugin</artifactId>
77-
<version>3.1.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
77+
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
7878
<configuration>
7979
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
8080
<bottom>

0 commit comments

Comments
 (0)