Skip to content

Commit

Permalink
feat: generate new package overviews (#209)
Browse files Browse the repository at this point in the history
* feat: generate new package overviews

* fix lint

* update to package summary and use optional for repoMetadata

* update repometadata test

* update method to get filepath

* move extractPackageBaseURIBeforeVersion to package overview

* refactor packagechildrensummary method, update prerelease implication, add new tables
  • Loading branch information
alicejli authored Oct 9, 2023
1 parent 7f9c42f commit 270775c
Show file tree
Hide file tree
Showing 38 changed files with 1,276 additions and 429 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
import java.util.Optional;

public class RepoMetadata {

Expand All @@ -27,6 +28,12 @@ public class RepoMetadata {
@SerializedName("client_documentation")
private String clientDocumentationUri;

@SerializedName("rest_documentation")
private String restDocumentationUri;

@SerializedName("rpc_documentation")
private String rpcDocumentationUri;

@SerializedName("repo")
private String repo;

Expand Down Expand Up @@ -61,6 +68,14 @@ public String getProductDocumentationUri() {
return this.productDocumentationUri;
}

public Optional<String> getRestDocumentationUri() {
return Optional.ofNullable(this.restDocumentationUri);
}

public Optional<String> getRpcDocumentationUri() {
return Optional.ofNullable(this.rpcDocumentationUri);
}

public void setProductDocumentationUri(String productDocumentationUri) {
this.productDocumentationUri = productDocumentationUri;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ private void consume(List<MetadataFile> metadataFiles) {
.forEach(
item -> {
String uid = item.getUid();
String href = item.getHref();
String nameWithType = item.getNameWithType();
String nameWithTypeWithoutGenerics = removeAll(nameWithType, "<.*?>");

map.put(nameWithTypeWithoutGenerics, uid); // This item should go first
map.put(uid, uid);
map.put(href, href);
map.put(removeAll(uid, PARAM_PACKAGE_NAME_REGEXP), uid);
map.put(removeAll(uid, UID_PACKAGE_NAME_REGEXP), uid);
map.put(removeAll(nameWithTypeWithoutGenerics, METHOD_PARAMS_REGEXP), uid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
*/
package com.microsoft.build;

import static com.microsoft.build.BuilderUtil.LANGS;
import static com.microsoft.build.BuilderUtil.populateItemFields;

import com.google.docfx.doclet.RepoMetadata;
import com.microsoft.lookup.PackageLookup;
import com.microsoft.model.MetadataFile;
import com.microsoft.model.MetadataFileItem;
import javax.lang.model.element.PackageElement;

class PackageBuilder {
Expand All @@ -35,16 +31,24 @@ class PackageBuilder {
this.referenceBuilder = referenceBuilder;
}

MetadataFile buildPackageMetadataFile(PackageElement packageElement) {
String fileName = packageLookup.extractHref(packageElement);
MetadataFile packageMetadataFile = new MetadataFile(outputPath, fileName);
MetadataFileItem packageItem =
new MetadataFileItem(LANGS, packageLookup.extractUid(packageElement));
packageItem.setId(packageLookup.extractId(packageElement));
referenceBuilder.addChildrenReferences(
packageElement, packageItem.getChildren(), packageMetadataFile.getReferences());
populateItemFields(packageItem, packageLookup, packageElement);
packageMetadataFile.getItems().add(packageItem);
return packageMetadataFile;
PackageOverviewFile buildPackageOverviewFile(
PackageElement packageElement,
RepoMetadata repoMetadata,
String artifactVersion,
String recommendedApiVersion) {
String status = packageLookup.extractStatus(packageElement);
String fileName = packageElement.getQualifiedName() + ".md";
PackageOverviewFile packageOverviewFile =
new PackageOverviewFile(
outputPath,
fileName,
repoMetadata,
packageElement,
status,
packageLookup,
referenceBuilder,
artifactVersion,
recommendedApiVersion);
return packageOverviewFile;
}
}
Loading

0 comments on commit 270775c

Please sign in to comment.