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 bugs in readme change #43618

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from all commits
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 @@ -128,7 +128,6 @@ public class ManifestBuilder {
private static final String TARGETMODULE = "targetModule";
private static final String OPTIONS = "options";
private static final String TOOL = "tool";

private static final String DESCRIPTION = "description";
private static final String README = "readme";

Expand Down Expand Up @@ -235,16 +234,25 @@ private PackageManifest parseAsPackageManifest() {
description = getStringValueFromTomlTableNode(pkgNode, DESCRIPTION, "");
moduleEntries = getModuleEntries(pkgNode, customReadmeVal, packageDescriptor.name());

if (!exported.isEmpty()) {
reportDiagnostic(pkgNode.entries().get(EXPORT),
"'export' under [package] is deprecated. " +
"Add the exports using the 'export' field under '[[package.modules]]'",
ProjectDiagnosticErrorCode.DEPRECATED_BALLERINA_TOML_ENTRY, DiagnosticSeverity.WARNING);
}
if (!isOldStructure) {
if (!exported.isEmpty()) {
reportDiagnostic(pkgNode.entries().get(EXPORT),
"'export' under [package] is deprecated. " +
"Add the exports using the 'export' field under '[[package.modules]]'",
ProjectDiagnosticErrorCode.DEPRECATED_BALLERINA_TOML_ENTRY, DiagnosticSeverity.WARNING);
if (!exported.contains(packageDescriptor.name().toString())) {
exported.add(packageDescriptor.name().toString()); // default module is always exported
}
for (PackageManifest.Module moduleEntry : moduleEntries) {
if (!moduleEntry.export()) {
continue;
}
String name = moduleEntry.name();
if (!exported.contains(name)) {
exported.add(name);
}
}
exported.add(packageDescriptor.name().toString()); // default module is always exported
exported.addAll(moduleEntries.stream().filter(
PackageManifest.Module::export).map(PackageManifest.Module::name).toList());
}
}
}
Expand Down Expand Up @@ -346,7 +354,8 @@ private List<PackageManifest.Module> getModuleEntries(
TomlTableArrayNode dependencyTableArray = (TomlTableArrayNode) dependencyEntries;
for (TomlTableNode modulesNode : dependencyTableArray.children()) {
String moduleName = getStringValueFromTomlTableNode(modulesNode, NAME, null);
if (moduleName == null) {
if (moduleName == null
|| !moduleName.contains(DOT)) { // The invalid module name is already handled
continue;
}

Expand Down
Loading