ebuild

website·Indexed 29 days ago

https://salheli.com/ebuild/

A configuration-based build tool for E-language (易语言) that automates the conversion of source files to text format using e2txt and facilitates compilation via ecl.

Tokens
3.4K
Snippets
22
Records
32
Agent score
50%

What's inside ebuild

  1. Overview of EBuild for E-language

    EBuild is a configuration-driven build tool for the E-language (易语言). It automates the process of converting binary E-language source files into text-based descriptions using e2txt and performs source file compilation using ecl. Key features include:

    • Selective automation and exclusion of specific source files.
    • Batch processing for e2txt (binary to text) and txt2e (text to binary) conversions.
    • Automatic detection of source file changes to trigger text conversion.
    • Batch building of targets (full build or specific targets).
    • Support for pre-build and post-build actions.
    • Ability to immediately compile and execute source files.
    • Support for using E-language programs as plugins within the build process.
    • Automatic cleanup of temporary files such as .recover.e, .ecode, and files in the ebuild-out directory.
  2. Overview of EBuild for E-Language

    EBuild is a configuration-based build tool for E-Language (易语言). It automates the process of converting binary E-Language source files into text-based descriptions using e2txt and performs source file compilation using ecl. The tool is developed using C# on the .NET 6 framework.
  3. Use build lifecycle hooks in ebuild

    ebuild provides lifecycle hooks that allow you to execute scripts at specific stages of the build process. These scripts receive additional environment variables containing information about the current build target. Use these for tasks such as copying output files or creating backups.

    Available hooks:

    • pre-build: Executes before the target is compiled.
    • post-build: Executes after the target is compiled.
  4. Configure project metadata in ebuild.yaml

    The project section in ebuild.yaml is used to provide descriptive information about the project. These fields are for documentation purposes and do not affect the functional behavior of the build process.
    project:
      name: ebuild-example                          # Project name
      version: "1.0"                                # Project version
      description: This is an example project.       # Project description
      author: SalHe                                 # Project author
      repository: https://github.com/SalHe/ebuild   # Source repository URL
      homepage: https://github.com/SalHe            # Project homepage
  5. Use e2txt for E-language source code version control

    Use the e2txt tool to convert E-language (易语言) source code from project files into a text-based format (and vice versa). This process enables the use of standard version control systems and facilitates collaborative development among multiple developers by making the code human-readable and diff-able.
  6. Configure the ebuild toolchain (e2txt and ecl)

    ebuild requires a .toolchain folder in its installation directory to manage external tools.

    1. Create a folder named .toolchain inside the ebuild installation directory.
    2. Install e2txt: Download e2txt 1.2 from E2EE and extract it to <ebuild installation directory>\.toolchain\e2txt.
    3. Install ecl: Download the ecl command-line compiler and extract it to <ebuild installation directory>\.toolchain\ecl.

    Your final directory structure should look like this:

    • ebuild.exe
    • .toolchain/
      • e2txt/ (containing e2txt.exe, etc.)
      • ecl/ (containing ecl.exe, etc.)
    ebuild-v1.0
     ├── .toolchain
     │   ├── e2txt
     │   │   ├── e2txt.exe
     │   │   └── ...
     │   └── ecl
     │       ├── ecl.exe
     │       └── ...
     └── ebuild.exe
  7. Access ebuild CLI help documentation

    Because the current version of ebuild (rewritten in C#/.NET 6) uses a command-line parsing library that does not support automatic documentation generation, the most up-to-date way to view available commands and options is by using the built-in help flag directly in the terminal.
    ebuild --help
  8. Initialize a new ebuild project

    To start a new project, create a directory for your project, open a command line interface within that directory, and run the initialization command. This will generate the necessary project structure and configuration files.
    ebuild init
  9. Manage E-Language source files with EBuild

    EBuild provides several automation features for managing E-Language source files:

    • Selective Management: Choose specific source files for automation or exclude certain files.
    • Batch Conversion: Perform full or targeted conversions between binary and text formats using e2txt and txt2e.
    • Change Detection: Automatically converts source files to text format when changes are detected.
    • File Cleanup: Manages and cleans up temporary files, including .recover.e (binary files recovered via txt2e), .ecode (text files generated via e2txt), and files within the ebuild-out directory.
    • Build Automation: Supports full builds or targeted builds of specific objectives, with support for pre- and post-build actions.
    • Execution: Ability to immediately compile and execute E-Language source files.
    • Extensibility: Supports using E-Language programs as plugins to participate in the compilation process.
  10. Install ebuild and configure environment variables

    To use ebuild, download the latest version from GitHub and extract it to a folder. To use the ebuild command globally from any command prompt, add the ebuild installation directory to the system Path environment variable. For example, if installed at E:\Users\SalHe\Downloads\ebuild-v1.0.0-windows-386, append ;E:\Users\SalHe\Downloads\ebuild-v1.0.0-windows-386 to the end of your Path variable.
  11. Use E-language source files as scripts

    Instead of batch files, you can use E-language (.e) source files as scripts. When you run an .e file via ebuild run, ebuild automatically uses ecl to compile the source into an executable before running it. Because compilation occurs during execution, it is recommended to keep these source files small. You can access project environment variables (like EBUILD_PROJECT_ROOT_DIR and EBUILD_PROJECT_OUTPUT_DIR) using the 读环境变量 (Read Environment Variable) function in E-language.
    ebuild run ./scripts/my_script.e -- arg1 arg2
  12. Manage source file inclusion and exclusion in ebuild

    ebuild uses a system of includes and excludes to determine which files participate in processes like e2txt, txt2e, and compilation.

    • includes: Defines patterns for files to be managed by ebuild.
    • excludes: Defines patterns for files to be completely ignored. Files matching excludes will not participate in e2txt or compilation, regardless of whether they match an includes pattern.
    • exclude-builds: Defines files that should be processed by e2txt but should NOT be treated as compilation targets (e.g., script files).
    project:
      # ...
    includes:
      - '**/*.e'               # Include all .e files in all directories
    
    excludes:
      - '**/*.recover.e'        # Completely exclude recovery files
      - '**/*.ecode/*.e'       # Exclude files in .ecode directories
      - '**/*.代码/*.e'         # Exclude files in .代码 directories
    
    exclude-builds:
      - './scripts/**/*.e'      # Process with e2txt, but exclude from 'ebuild build'