Skip to content

Commit

Permalink
Fix bugs in readme change
Browse files Browse the repository at this point in the history
  • Loading branch information
azinneera committed Nov 21, 2024
1 parent c4c87cb commit ea5460e
Showing 1 changed file with 19 additions and 10 deletions.
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

0 comments on commit ea5460e

Please sign in to comment.