Is there any way to execute custom shell script through Build Tool Plugin for generating few source files?

Please note that I want to access the script through relative path as in my development environment I cannot refer absolute path to invoke the script.

So would avoid statements like this to obtain scriptPath:

@main
struct FilesGenerationPlugin: BuildToolPlugin {
    func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
        let scriptPath = context.package.directory.appending(["..", "FilesGenerationPlugin", "bin", "FilesGeneration.sh"])

As of now I am getting following error:

/Users/jenkins/jenkins-root/workspace/MyAppUsingPlugin : No such file or directory

You should be able to just use scriptPath as the path for a build command. What issues are you seeing with this?

I just updated the description of my initial question with the error I am getting. Please have a look.

Note that in my case Jenkins does not expose any path below its working directory. So this is inaccessible:

/Users/jenkins/jenkins-root/workspace/MyAppUsingPlugin

But this can be accessed:

MyAppUsingPlugin/Classes