Skip to content

fix: Ensure parser directory is created correctly, not as a file - #4

Open
tomoya0318 wants to merge 1 commit into
zhuwq585:mainfrom
tomoya0318:fix/ensure-build-directory
Open

fix: Ensure parser directory is created correctly, not as a file#4
tomoya0318 wants to merge 1 commit into
zhuwq585:mainfrom
tomoya0318:fix/ensure-build-directory

Conversation

@tomoya0318

Copy link
Copy Markdown

Overview

This PR fixes a critical build failure where the build script incorrectly created the parser build directory as a file instead of a directory.

This change ensures the directory is proactively created correctly, making the build process robust. It also includes minor code style improvements by removing unnecessary whitespace.

Background/Problem

The core issue was not simply that the parser directory was missing, but that the build script incorrectly created it as a file.

Here's the sequence of events that caused the failure:

  1. The cp command within the cpResources.sh script was executed with a non-existent destination path (MSCCD/modules/msccd_tokenizer/src/main/java/org/nagoya_u/ertl/sa/parser).
  2. Instead of creating a directory, the cp command's default behavior created a file named parser containing the contents of the first source file.
  3. All subsequent attempts to copy other files into what should have been a directory immediately failed with a target is not a directory error.

Changes

To resolve this, the following changes were made:

  • Proactive Directory Creation: In tokenizerGeneration.py, added a call to os.makedirs() right before the resource copy script is executed. This proactively creates parser as a directory, ensuring that the cp command correctly copies files into it, rather than creating an incorrect file.
  • Code Style: Removed unnecessary trailing whitespace from the script for better readability and consistency.

How to Test

I have confirmed that this change fixes the issue by following these steps:

  1. Checked out this branch.
  2. Manually removed the parser directory to simulate the failure condition.
  3. Executed the generation script
python3 tokenizerGeneration.py
  1. Result: The script now completes successfully without any errors, and the tokenizer .jar file is generated as expected.

Related Issues

  • N/A

The tokenizer generation script failed when the build directory did not exist.

- In step 2, added logic to create the `parser` directory inside `/MSCCD/modules/msccd_tokenizer/src/main/java/org/nagoya_u/ertl/sa/` before copying resources. This prevents build failures caused by the missing directory.
- Removed unnecessary trailing whitespace for better code style and readability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant