wkgcass / public-chat

My public repository for chat-in-issue (public repos do not have billing when executing Github Actions)
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

gradle doFirst #53

Open wkgcass opened 1 year ago

wkgcass commented 1 year ago

/chat: What's the difference between "directly writing config in task" and "writing config in doFirst scope in the task"?

github-actions[bot] commented 1 year ago

/ai-says:

When it comes to configuring tasks in Gradle, there are two common approaches:

  1. Writing config directly in the task: This involves configuring the task properties directly within the task block in the build.gradle file. For example:

    task myTask {
       property1 = value1
       property2 = value2
    }

    In this approach, the configuration values are set directly within the task block itself.

  2. Writing config in doFirst scope in the task: With this approach, the task is configured using the doFirst method, which allows you to define a closure that will be executed before the task's main action. For example:

    task myTask {
       doFirst {
           property1 = value1
           property2 = value2
       }
    }

    In this case, the configuration values are set within the doFirst closure, which will be executed before the main action of the task.

The main difference between these two approaches is the timing of the configuration.

In summary, the difference lies in whether the configuration is applied immediately or deferred until task execution.

github-actions[bot] commented 1 year ago

/err: token usage: {"prompt_tokens":36,"completion_tokens":309,"total_tokens":345}