diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 315fa26d26..9871c39e9e 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -238,7 +238,7 @@ jobs: project-api-tests: runs-on: ubuntu-latest - if: false + if: github.repository_owner == 'ballerina-platform' steps: - name: Checkout Repository diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java b/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java index 62ac077431..fbd17c45e9 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java @@ -1135,6 +1135,8 @@ private void updatePackageJsonBallerinaVersion(Path packagePath, String balVersi // Update the value for the given key jsonObject.addProperty("ballerina_version", balVersion); + jsonObject.addProperty("platform", "java17"); + jsonObject.remove("readme"); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String formattedJson = gson.toJson(jsonObject); Files.writeString(packageJsonPath, formattedJson); diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/HierarchicalPackagesTest.java b/project-api-tests/src/test/java/org/ballerina/projectapi/HierarchicalPackagesTest.java index e65d0b250f..5c3940187e 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/HierarchicalPackagesTest.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/HierarchicalPackagesTest.java @@ -49,6 +49,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static java.nio.file.StandardOpenOption.APPEND; import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_ARTIFACT_TYPE; import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_HOME_DIR; import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_TOML; @@ -227,9 +228,8 @@ public void testUpdatedPackage() throws IOException, InterruptedException { // Add a module to the package addNewModule(importedPackageName, "doc.api", "mod.api"); // Update version details in Ballerina.toml - updateBallerinaToml(importedPackageName, COMMON_VERSION, updatedVersion, - "\"" + importedPackageName + ".mod.api\"", - "\"" + importedPackageName + ".mod.api\", \"" + importedPackageName + ".doc.api\""); + updateBallerinaToml(importedPackageName, COMMON_VERSION, updatedVersion, "", ""); + addExports(importedPackageName, new String[]{importedPackageName + ".doc.api"}); // Build the bala for updated package buildPackageBala(tempWorkspaceDirectory, envVariables, importedPackageName, orgName, updatedVersion, Collections.emptyList()); @@ -422,6 +422,18 @@ private void updateBallerinaToml(String packageName, String previousVersion, Str lines.close(); } + private void addExports(String packageName, String[] moduleNames) throws IOException { + Path filePath = tempWorkspaceDirectory.resolve(packageName).resolve(BALLERINA_TOML); + List exports = new ArrayList<>(); + for (String mod : moduleNames) { + exports.add("\n"); + exports.add("[[package.modules]]"); + exports.add("name = \"" + mod + "\""); + exports.add("export = true"); + } + Files.write(filePath, exports, APPEND); + } + private void updateImports(String packageName, String s, String fileName) throws IOException { Path filePath = tempWorkspaceDirectory.resolve(packageName).resolve(fileName); Stream lines = Files.lines(filePath); diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml index b383ed560a..c7d76f2628 100644 --- a/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "disttestpackage" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/Ballerina.toml index f5230f5b6b..51b9dbc82b 100644 --- a/project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/Ballerina.toml +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "disttestpackage" version = "1.0.1" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml index e7fb04a437..ef8103f5be 100644 --- a/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "disttestpackage" version = "1.0.4" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml index 36b8931a27..f3036436d3 100644 --- a/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml +++ b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "disttestpackage" version = "1.1.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectA/Ballerina.toml b/project-api-tests/src/test/resources/central/projectA/Ballerina.toml index f4c220f2ad..c40b5af9d6 100644 --- a/project-api-tests/src/test/resources/central/projectA/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectA/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectB/Ballerina.toml b/project-api-tests/src/test/resources/central/projectB/Ballerina.toml index 07d2cb7e09..7a6f3c5ff9 100644 --- a/project-api-tests/src/test/resources/central/projectB/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectB/Ballerina.toml @@ -2,6 +2,7 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" [platform.java21] graalvmCompatible=true diff --git a/project-api-tests/src/test/resources/central/projectC/Ballerina.toml b/project-api-tests/src/test/resources/central/projectC/Ballerina.toml index f4c220f2ad..c40b5af9d6 100644 --- a/project-api-tests/src/test/resources/central/projectC/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectC/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectD/Ballerina.toml b/project-api-tests/src/test/resources/central/projectD/Ballerina.toml index f4c220f2ad..c40b5af9d6 100644 --- a/project-api-tests/src/test/resources/central/projectD/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectD/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectE/Ballerina.toml b/project-api-tests/src/test/resources/central/projectE/Ballerina.toml index f4c220f2ad..c40b5af9d6 100644 --- a/project-api-tests/src/test/resources/central/projectE/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectE/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectF/Ballerina.toml b/project-api-tests/src/test/resources/central/projectF/Ballerina.toml index f4c220f2ad..c40b5af9d6 100644 --- a/project-api-tests/src/test/resources/central/projectF/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectF/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectG/Ballerina.toml b/project-api-tests/src/test/resources/central/projectG/Ballerina.toml index f4c220f2ad..c40b5af9d6 100644 --- a/project-api-tests/src/test/resources/central/projectG/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectG/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/central/projectSnapshot/Ballerina.toml b/project-api-tests/src/test/resources/central/projectSnapshot/Ballerina.toml index 3a3bc52db9..e8caeb3156 100644 --- a/project-api-tests/src/test/resources/central/projectSnapshot/Ballerina.toml +++ b/project-api-tests/src/test/resources/central/projectSnapshot/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "my_package" version = "1.0.0-snapshot" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/distribution-tests/disttestmultiples/Ballerina.toml b/project-api-tests/src/test/resources/distribution-tests/disttestmultiples/Ballerina.toml index c950efb4c9..890d4fe618 100644 --- a/project-api-tests/src/test/resources/distribution-tests/disttestmultiples/Ballerina.toml +++ b/project-api-tests/src/test/resources/distribution-tests/disttestmultiples/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "disttestmultiples" version = "1.1.1" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/distribution-tests/disttestpack1/Ballerina.toml b/project-api-tests/src/test/resources/distribution-tests/disttestpack1/Ballerina.toml index 82d59a30db..15a006a1e9 100644 --- a/project-api-tests/src/test/resources/distribution-tests/disttestpack1/Ballerina.toml +++ b/project-api-tests/src/test/resources/distribution-tests/disttestpack1/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "disttestpack1" version = "1.1.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test.mod/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test.mod/Ballerina.toml index 50838b3e37..f4b9c3a81e 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test.mod/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test.mod/Ballerina.toml @@ -2,4 +2,12 @@ org = "bctestorg" name = "PackageH.test.mod" version = "1.0.1" -export = ["PackageH.test.mod.api", "PackageH.test.mod.api.doc"] +readme = "Package.md" + +[[package.modules]] +name = "PackageH.test.mod.api" +export = true + +[[package.modules]] +name = "PackageH.test.mod.api.doc" +export = true diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test/Ballerina.toml index 4bd7a43d49..2bab5caa16 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageH.test/Ballerina.toml @@ -2,4 +2,8 @@ org = "bctestorg" name = "PackageH.test" version = "1.0.0" -export = ["PackageH.test.mod.api"] +readme = "Package.md" + +[[package.modules]] +name = "PackageH.test.mod.api" +export = true diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageJ.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageJ.test/Ballerina.toml index 9e8f6c8ed6..5ce64ffa01 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageJ.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageJ.test/Ballerina.toml @@ -2,5 +2,4 @@ org = "bctestorg" name = "PackageJ.test" version = "1.0.0" - -export=["PackageJ.test"] \ No newline at end of file +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageL.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageL.test/Ballerina.toml index 409be0eb8e..f0e7466606 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageL.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageL.test/Ballerina.toml @@ -2,4 +2,8 @@ org = "bctestorg" name = "PackageL.test" version = "1.0.0" -export = ["PackageL.test.mod.api"] +readme = "Package.md" + +[[package.modules]] +name = "PackageL.test.mod.api" +export = true diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageO.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageO.test/Ballerina.toml index b0a026ad32..c67ec9fb42 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageO.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageO.test/Ballerina.toml @@ -2,4 +2,4 @@ org = "bctestorg" name = "PackageO.test" version = "1.0.0" -export = ["PackageO.test"] \ No newline at end of file +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageQ.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageQ.test/Ballerina.toml index 3d6c4024d7..bfe4d77968 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageQ.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageQ.test/Ballerina.toml @@ -2,4 +2,8 @@ org = "bctestorg" name = "PackageQ.test" version = "1.0.0" -export = ["PackageQ.test.mod.api"] +readme = "Package.md" + +[[package.modules]] +name = "PackageQ.test.mod.api" +export = true diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageR.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageR.test/Ballerina.toml index 01900164c6..5abb49ce7d 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageR.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageR.test/Ballerina.toml @@ -2,3 +2,4 @@ org = "bctestorg" name = "PackageR.test" version = "1.0.0" +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/hierarchical-packages/PackageT.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/PackageT.test/Ballerina.toml index 315bf8f45a..c2997a4e26 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/PackageT.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/PackageT.test/Ballerina.toml @@ -2,4 +2,4 @@ org = "bctestorg" name = "PackageT.test" version = "1.0.0-beta.1" -export = ["PackageT.test"] \ No newline at end of file +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/hierarchical-packages/Transitive.PackageH.test/Ballerina.toml b/project-api-tests/src/test/resources/hierarchical-packages/Transitive.PackageH.test/Ballerina.toml index 810a7735e9..89950f4290 100644 --- a/project-api-tests/src/test/resources/hierarchical-packages/Transitive.PackageH.test/Ballerina.toml +++ b/project-api-tests/src/test/resources/hierarchical-packages/Transitive.PackageH.test/Ballerina.toml @@ -2,4 +2,4 @@ org = "bctestorg" name = "Transitive.PackageH.test" version = "1.0.0" -export = ["Transitive.PackageH.test"] \ No newline at end of file +readme = "Package.md" diff --git a/project-api-tests/src/test/resources/maven-repos/pact/Ballerina.toml b/project-api-tests/src/test/resources/maven-repos/pact/Ballerina.toml index 7ca90e6d1b..7e22b99cfe 100644 --- a/project-api-tests/src/test/resources/maven-repos/pact/Ballerina.toml +++ b/project-api-tests/src/test/resources/maven-repos/pact/Ballerina.toml @@ -2,6 +2,7 @@ org = "bctestorg" name = "pact" version = "0.2.0" +readme = "Package.md" [build-options] observabilityIncluded = true