From 3bd6077ca9d24d4980bec0eecaf7d01d8bd96205 Mon Sep 17 00:00:00 2001 From: sameerajayasoma Date: Mon, 30 Oct 2023 12:03:00 -0700 Subject: [PATCH 1/3] Update .gitignore template with comments --- .../src/main/resources/new_cmd_defaults/gitignore | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore b/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore index 7512ebe2325f..36d305439a3a 100644 --- a/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore +++ b/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore @@ -1,3 +1,11 @@ -target -generated -Config.toml +# Ballerina generates this directory during the compilation of a package. +# It contains compiler-generated artifacts and the final executable if this is an application package. +target/ + +# Ballerina maintains the compiler-generated source code here. +# Remove this if you want to commit generated sources. +generated/ + +# Contains configuration values used during development time. +# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details. +Config.toml \ No newline at end of file From 06378e673ca2fbaa0166cea0580d12f0d16ec73a Mon Sep 17 00:00:00 2001 From: Sameera Jayasoma Date: Mon, 30 Oct 2023 12:06:47 -0700 Subject: [PATCH 2/3] Update gitignore --- cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore b/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore index 36d305439a3a..d5fc29aba3c3 100644 --- a/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore +++ b/cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore @@ -8,4 +8,4 @@ generated/ # Contains configuration values used during development time. # See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details. -Config.toml \ No newline at end of file +Config.toml From 44d89bdf8808fac70c9d4850a6623ea5197bf0c5 Mon Sep 17 00:00:00 2001 From: Thevakumar-Luheerathan Date: Tue, 7 Nov 2023 11:09:41 +0530 Subject: [PATCH 3/3] Fix build failures --- .../io/ballerina/cli/cmd/NewCommandTest.java | 55 +++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java index dd7d70bc99a3..4d27b4ef5806 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/NewCommandTest.java @@ -115,7 +115,16 @@ public void testNewCommand() throws IOException { Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME))); String gitignoreContent = Files.readString( packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8); - String expectedGitignoreContent = "target\ngenerated\n" + + String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " + + "\n# It contains compiler-generated artifacts and the final executable if this is an application " + + "package.\ntarget/\n" + + "\n" + + "# Ballerina maintains the compiler-generated source code here.\n" + + "# Remove this if you want to commit generated sources.\n" + + "generated/\n" + + "\n" + + "# Contains configuration values used during development time.\n" + + "# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" + "Config.toml\n"; Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim()); Assert.assertTrue(readOutput().contains("Created new package")); @@ -158,7 +167,16 @@ public void testNewCommandInExistingDirectory() throws IOException { Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME))); String gitignoreContent = Files.readString( packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8); - String expectedGitignoreContent = "target\ngenerated\n" + + String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " + + "\n# It contains compiler-generated artifacts and the final executable if this is an application " + + "package.\ntarget/\n" + + "\n" + + "# Ballerina maintains the compiler-generated source code here.\n" + + "# Remove this if you want to commit generated sources.\n" + + "generated/\n" + + "\n" + + "# Contains configuration values used during development time.\n" + + "# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" + "Config.toml\n"; Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim()); Assert.assertTrue(readOutput().contains("Created new package")); @@ -201,7 +219,16 @@ public void testNewCommandInExistingDirectoryWithExistingBalFilesForDefaultTempl Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME))); String gitignoreContent = Files.readString( packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8); - String expectedGitignoreContent = "target\ngenerated\n" + + String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " + + "\n# It contains compiler-generated artifacts and the final executable if this is an application " + + "package.\ntarget/\n" + + "\n" + + "# Ballerina maintains the compiler-generated source code here.\n" + + "# Remove this if you want to commit generated sources.\n" + + "generated/\n" + + "\n" + + "# Contains configuration values used during development time.\n" + + "# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" + "Config.toml\n"; Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim()); Assert.assertTrue(readOutput().contains("Created new package")); @@ -332,7 +359,16 @@ public void testNewCommandInExistingDirectoryWithInvalidName() throws IOExceptio Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME))); String gitignoreContent = Files.readString( packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8); - String expectedGitignoreContent = "target\ngenerated\n" + + String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " + + "\n# It contains compiler-generated artifacts and the final executable if this is an application " + + "package.\ntarget/\n" + + "\n" + + "# Ballerina maintains the compiler-generated source code here.\n" + + "# Remove this if you want to commit generated sources.\n" + + "generated/\n" + + "\n" + + "# Contains configuration values used during development time.\n" + + "# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" + "Config.toml\n"; Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim()); Assert.assertTrue(readOutput().contains("Created new package")); @@ -382,7 +418,16 @@ public void testNewCommandWithRelativePath() throws IOException { Assert.assertTrue(Files.exists(relativeToCurrentDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME))); String gitignoreContent = Files.readString( relativeToCurrentDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8); - String expectedGitignoreContent = "target\ngenerated\n" + + String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " + + "\n# It contains compiler-generated artifacts and the final executable if this is an application " + + "package.\ntarget/\n" + + "\n" + + "# Ballerina maintains the compiler-generated source code here.\n" + + "# Remove this if you want to commit generated sources.\n" + + "generated/\n" + + "\n" + + "# Contains configuration values used during development time.\n" + + "# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" + "Config.toml\n"; Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim()); Assert.assertTrue(readOutput().contains("Created new package"));