Re: Gradle Task Configuration Avoidance

2022-12-09 Thread Luke Cwik via dev
I'm talking about the build scans that take you to gradle.com

For example in one of our Jenkins job

there
is this build scan . You can also get
these for builds that you do locally.

On Fri, Dec 9, 2022 at 3:05 PM Damon Douglas 
wrote:

> Thank you, Luke and Daniel,
>
> I wasn't aware that these tools were possible.  Luke, the build report to
> which you refer is a local HTML file produced after executing a task?  I
> see it when I fail tests or various checks.
>
> Best,
>
> Damon
>
> On Thu, Dec 8, 2022 at 8:59 AM Daniel Collins 
> wrote:
>
>> We could probably add a lint that rejects the spelling `task("` pretty
>> easily that would catch most of these.
>>
>> On Thu, Dec 8, 2022 at 11:34 AM Luke Cwik via dev 
>> wrote:
>>
>>> I have found the Gradle build reports very useful to enumerate
>>> deprecations and an easier thing to look at over the command line output.
>>>
>>> On Thu, Dec 8, 2022 at 8:26 AM Damon Douglas via dev <
>>> dev@beam.apache.org> wrote:
>>>
 Thank you, Kerry, for your kind and encouraging words!

 Kenn, I wondered as well whether there exist proactive options.  I know
 that gradle will warn of soon-to-be deprecated syntax in the build.gradle
 files when executing gradle tasks on the command-line.  Perhaps we can
 start there.  Not to sound cliche, but with any process improvement,
 awareness is the first step.

 On Mon, Dec 5, 2022 at 3:54 PM Kenneth Knowles  wrote:

> Nice!
>
> I believe at some point in the past we made a pass to try to convert
> our stuff to this model. I wonder if we can prevent it proactively 
> somehow,
> like disabling the legacy way of creating tasks or something.
>
> Kenn
>
> On Mon, Dec 5, 2022 at 6:25 AM Kerry Donny-Clark via dev <
> dev@beam.apache.org> wrote:
>
>> Thanks Damon! I really appreciate how clear your emails are here.
>> Instead of my usual feeling of "I don't quite understand, and don't have
>> time to get context" I can read all the context in the mail.
>> This error message had confused me, so I really appreciate the
>> cleanup and explanation.
>>
>> On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev <
>> dev@beam.apache.org> wrote:
>>
>>> Hello Everyone,
>>>
>>> *If you are new to Beam and coming from non-Java language
>>> conventions, it is likely you are new to gradle.  At the end of this 
>>> email
>>> is a list of definitions and references to help understand this email.*
>>>
>>> *Short Version (For those who know gradle)*:
>>> A pull request [1] may fix the continual error message "Error:
>>> Backend initialization required, please run "terraform init"".  The PR
>>> applies Task Configuration Avoidance [2] by applying changes to a few 
>>> tasks
>>> from tasks(String) to tasks.register(String).
>>>
>>> *Long Version (For those who are not as familiar with gradle)*:
>>>
>>> I write this not as an expert but as someone still learning.  Gradle
>>> [3] is the software we use in the Beam repository to automate many 
>>> needed
>>> tasks associated with building and testing code.  It is typically used 
>>> in
>>> Java projects but can be extended for other purposes.  We store code
>>> related to our Beam Playground [4] that also uses gradle though it is 
>>> not
>>> mainly a Java project.  The unit of work for Gradle is what is called a
>>> task.  To run a task you open a terminal and type "./gradlew
>>> nameOfMyTask".  There are two main ways to create a custom task in our
>>> build.gradle files.  One is writing task("doSomething") and the other is
>>> tasks.register("doSomethingElse").  According to [2], the 
>>> recommendation is
>>> to use the tasks.register("doSomething").  This avoids executing other 
>>> work
>>> (configuration but don't worry about it for now) until one runs the
>>> doSomething task or another task we are running depends on it.
>>>
>>> So why were we seeing this "Error: Backend initialization required"
>>> message all the time?  The reason is that tasks were configured as
>>> task("doSomething").  All I had to do was change this to
>>> tasks.register("doSomething") and it removed the message.
>>>
>>> *Definitions/References*
>>>
>>> 1. https://github.com/apache/beam/pull/24509
>>> 2.
>>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>>> 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
>>> 4. https://play.beam.apache.org/
>>>
>>> *Suggested Learning Path To Understand This Email*
>>> 1.
>>> https://docs.gradle.org/current/samples/sample_building_java_libraries.html
>>> 2. https://docs.gradle.org/current/userguide/build_lifecycle.html

Re: Gradle Task Configuration Avoidance

2022-12-09 Thread Damon Douglas via dev
Thank you, Luke and Daniel,

I wasn't aware that these tools were possible.  Luke, the build report to
which you refer is a local HTML file produced after executing a task?  I
see it when I fail tests or various checks.

Best,

Damon

On Thu, Dec 8, 2022 at 8:59 AM Daniel Collins  wrote:

> We could probably add a lint that rejects the spelling `task("` pretty
> easily that would catch most of these.
>
> On Thu, Dec 8, 2022 at 11:34 AM Luke Cwik via dev 
> wrote:
>
>> I have found the Gradle build reports very useful to enumerate
>> deprecations and an easier thing to look at over the command line output.
>>
>> On Thu, Dec 8, 2022 at 8:26 AM Damon Douglas via dev 
>> wrote:
>>
>>> Thank you, Kerry, for your kind and encouraging words!
>>>
>>> Kenn, I wondered as well whether there exist proactive options.  I know
>>> that gradle will warn of soon-to-be deprecated syntax in the build.gradle
>>> files when executing gradle tasks on the command-line.  Perhaps we can
>>> start there.  Not to sound cliche, but with any process improvement,
>>> awareness is the first step.
>>>
>>> On Mon, Dec 5, 2022 at 3:54 PM Kenneth Knowles  wrote:
>>>
 Nice!

 I believe at some point in the past we made a pass to try to convert
 our stuff to this model. I wonder if we can prevent it proactively somehow,
 like disabling the legacy way of creating tasks or something.

 Kenn

 On Mon, Dec 5, 2022 at 6:25 AM Kerry Donny-Clark via dev <
 dev@beam.apache.org> wrote:

> Thanks Damon! I really appreciate how clear your emails are here.
> Instead of my usual feeling of "I don't quite understand, and don't have
> time to get context" I can read all the context in the mail.
> This error message had confused me, so I really appreciate the cleanup
> and explanation.
>
> On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev <
> dev@beam.apache.org> wrote:
>
>> Hello Everyone,
>>
>> *If you are new to Beam and coming from non-Java language
>> conventions, it is likely you are new to gradle.  At the end of this 
>> email
>> is a list of definitions and references to help understand this email.*
>>
>> *Short Version (For those who know gradle)*:
>> A pull request [1] may fix the continual error message "Error:
>> Backend initialization required, please run "terraform init"".  The PR
>> applies Task Configuration Avoidance [2] by applying changes to a few 
>> tasks
>> from tasks(String) to tasks.register(String).
>>
>> *Long Version (For those who are not as familiar with gradle)*:
>>
>> I write this not as an expert but as someone still learning.  Gradle
>> [3] is the software we use in the Beam repository to automate many needed
>> tasks associated with building and testing code.  It is typically used in
>> Java projects but can be extended for other purposes.  We store code
>> related to our Beam Playground [4] that also uses gradle though it is not
>> mainly a Java project.  The unit of work for Gradle is what is called a
>> task.  To run a task you open a terminal and type "./gradlew
>> nameOfMyTask".  There are two main ways to create a custom task in our
>> build.gradle files.  One is writing task("doSomething") and the other is
>> tasks.register("doSomethingElse").  According to [2], the recommendation 
>> is
>> to use the tasks.register("doSomething").  This avoids executing other 
>> work
>> (configuration but don't worry about it for now) until one runs the
>> doSomething task or another task we are running depends on it.
>>
>> So why were we seeing this "Error: Backend initialization required"
>> message all the time?  The reason is that tasks were configured as
>> task("doSomething").  All I had to do was change this to
>> tasks.register("doSomething") and it removed the message.
>>
>> *Definitions/References*
>>
>> 1. https://github.com/apache/beam/pull/24509
>> 2.
>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>> 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
>> 4. https://play.beam.apache.org/
>>
>> *Suggested Learning Path To Understand This Email*
>> 1.
>> https://docs.gradle.org/current/samples/sample_building_java_libraries.html
>> 2. https://docs.gradle.org/current/userguide/build_lifecycle.html
>> 3.
>> https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
>> 4.
>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>>
>> Best,
>>
>> Damon
>>
>>


Re: Gradle Task Configuration Avoidance

2022-12-08 Thread Daniel Collins via dev
We could probably add a lint that rejects the spelling `task("` pretty
easily that would catch most of these.

On Thu, Dec 8, 2022 at 11:34 AM Luke Cwik via dev 
wrote:

> I have found the Gradle build reports very useful to enumerate
> deprecations and an easier thing to look at over the command line output.
>
> On Thu, Dec 8, 2022 at 8:26 AM Damon Douglas via dev 
> wrote:
>
>> Thank you, Kerry, for your kind and encouraging words!
>>
>> Kenn, I wondered as well whether there exist proactive options.  I know
>> that gradle will warn of soon-to-be deprecated syntax in the build.gradle
>> files when executing gradle tasks on the command-line.  Perhaps we can
>> start there.  Not to sound cliche, but with any process improvement,
>> awareness is the first step.
>>
>> On Mon, Dec 5, 2022 at 3:54 PM Kenneth Knowles  wrote:
>>
>>> Nice!
>>>
>>> I believe at some point in the past we made a pass to try to convert our
>>> stuff to this model. I wonder if we can prevent it proactively somehow,
>>> like disabling the legacy way of creating tasks or something.
>>>
>>> Kenn
>>>
>>> On Mon, Dec 5, 2022 at 6:25 AM Kerry Donny-Clark via dev <
>>> dev@beam.apache.org> wrote:
>>>
 Thanks Damon! I really appreciate how clear your emails are here.
 Instead of my usual feeling of "I don't quite understand, and don't have
 time to get context" I can read all the context in the mail.
 This error message had confused me, so I really appreciate the cleanup
 and explanation.

 On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev 
 wrote:

> Hello Everyone,
>
> *If you are new to Beam and coming from non-Java language conventions,
> it is likely you are new to gradle.  At the end of this email is a list of
> definitions and references to help understand this email.*
>
> *Short Version (For those who know gradle)*:
> A pull request [1] may fix the continual error message "Error: Backend
> initialization required, please run "terraform init"".  The PR applies 
> Task
> Configuration Avoidance [2] by applying changes to a few tasks from
> tasks(String) to tasks.register(String).
>
> *Long Version (For those who are not as familiar with gradle)*:
>
> I write this not as an expert but as someone still learning.  Gradle
> [3] is the software we use in the Beam repository to automate many needed
> tasks associated with building and testing code.  It is typically used in
> Java projects but can be extended for other purposes.  We store code
> related to our Beam Playground [4] that also uses gradle though it is not
> mainly a Java project.  The unit of work for Gradle is what is called a
> task.  To run a task you open a terminal and type "./gradlew
> nameOfMyTask".  There are two main ways to create a custom task in our
> build.gradle files.  One is writing task("doSomething") and the other is
> tasks.register("doSomethingElse").  According to [2], the recommendation 
> is
> to use the tasks.register("doSomething").  This avoids executing other 
> work
> (configuration but don't worry about it for now) until one runs the
> doSomething task or another task we are running depends on it.
>
> So why were we seeing this "Error: Backend initialization required"
> message all the time?  The reason is that tasks were configured as
> task("doSomething").  All I had to do was change this to
> tasks.register("doSomething") and it removed the message.
>
> *Definitions/References*
>
> 1. https://github.com/apache/beam/pull/24509
> 2.
> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
> 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
> 4. https://play.beam.apache.org/
>
> *Suggested Learning Path To Understand This Email*
> 1.
> https://docs.gradle.org/current/samples/sample_building_java_libraries.html
> 2. https://docs.gradle.org/current/userguide/build_lifecycle.html
> 3. https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
> 4.
> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>
> Best,
>
> Damon
>
>


Re: Gradle Task Configuration Avoidance

2022-12-08 Thread Luke Cwik via dev
I have found the Gradle build reports very useful to enumerate deprecations
and an easier thing to look at over the command line output.

On Thu, Dec 8, 2022 at 8:26 AM Damon Douglas via dev 
wrote:

> Thank you, Kerry, for your kind and encouraging words!
>
> Kenn, I wondered as well whether there exist proactive options.  I know
> that gradle will warn of soon-to-be deprecated syntax in the build.gradle
> files when executing gradle tasks on the command-line.  Perhaps we can
> start there.  Not to sound cliche, but with any process improvement,
> awareness is the first step.
>
> On Mon, Dec 5, 2022 at 3:54 PM Kenneth Knowles  wrote:
>
>> Nice!
>>
>> I believe at some point in the past we made a pass to try to convert our
>> stuff to this model. I wonder if we can prevent it proactively somehow,
>> like disabling the legacy way of creating tasks or something.
>>
>> Kenn
>>
>> On Mon, Dec 5, 2022 at 6:25 AM Kerry Donny-Clark via dev <
>> dev@beam.apache.org> wrote:
>>
>>> Thanks Damon! I really appreciate how clear your emails are here.
>>> Instead of my usual feeling of "I don't quite understand, and don't have
>>> time to get context" I can read all the context in the mail.
>>> This error message had confused me, so I really appreciate the cleanup
>>> and explanation.
>>>
>>> On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev 
>>> wrote:
>>>
 Hello Everyone,

 *If you are new to Beam and coming from non-Java language conventions,
 it is likely you are new to gradle.  At the end of this email is a list of
 definitions and references to help understand this email.*

 *Short Version (For those who know gradle)*:
 A pull request [1] may fix the continual error message "Error: Backend
 initialization required, please run "terraform init"".  The PR applies Task
 Configuration Avoidance [2] by applying changes to a few tasks from
 tasks(String) to tasks.register(String).

 *Long Version (For those who are not as familiar with gradle)*:

 I write this not as an expert but as someone still learning.  Gradle
 [3] is the software we use in the Beam repository to automate many needed
 tasks associated with building and testing code.  It is typically used in
 Java projects but can be extended for other purposes.  We store code
 related to our Beam Playground [4] that also uses gradle though it is not
 mainly a Java project.  The unit of work for Gradle is what is called a
 task.  To run a task you open a terminal and type "./gradlew
 nameOfMyTask".  There are two main ways to create a custom task in our
 build.gradle files.  One is writing task("doSomething") and the other is
 tasks.register("doSomethingElse").  According to [2], the recommendation is
 to use the tasks.register("doSomething").  This avoids executing other work
 (configuration but don't worry about it for now) until one runs the
 doSomething task or another task we are running depends on it.

 So why were we seeing this "Error: Backend initialization required"
 message all the time?  The reason is that tasks were configured as
 task("doSomething").  All I had to do was change this to
 tasks.register("doSomething") and it removed the message.

 *Definitions/References*

 1. https://github.com/apache/beam/pull/24509
 2.
 https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
 4. https://play.beam.apache.org/

 *Suggested Learning Path To Understand This Email*
 1.
 https://docs.gradle.org/current/samples/sample_building_java_libraries.html
 2. https://docs.gradle.org/current/userguide/build_lifecycle.html
 3. https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
 4.
 https://docs.gradle.org/current/userguide/task_configuration_avoidance.html

 Best,

 Damon




Re: Gradle Task Configuration Avoidance

2022-12-08 Thread Damon Douglas via dev
Thank you, Kerry, for your kind and encouraging words!

Kenn, I wondered as well whether there exist proactive options.  I know
that gradle will warn of soon-to-be deprecated syntax in the build.gradle
files when executing gradle tasks on the command-line.  Perhaps we can
start there.  Not to sound cliche, but with any process improvement,
awareness is the first step.

On Mon, Dec 5, 2022 at 3:54 PM Kenneth Knowles  wrote:

> Nice!
>
> I believe at some point in the past we made a pass to try to convert our
> stuff to this model. I wonder if we can prevent it proactively somehow,
> like disabling the legacy way of creating tasks or something.
>
> Kenn
>
> On Mon, Dec 5, 2022 at 6:25 AM Kerry Donny-Clark via dev <
> dev@beam.apache.org> wrote:
>
>> Thanks Damon! I really appreciate how clear your emails are here. Instead
>> of my usual feeling of "I don't quite understand, and don't have time to
>> get context" I can read all the context in the mail.
>> This error message had confused me, so I really appreciate the cleanup
>> and explanation.
>>
>> On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev 
>> wrote:
>>
>>> Hello Everyone,
>>>
>>> *If you are new to Beam and coming from non-Java language conventions,
>>> it is likely you are new to gradle.  At the end of this email is a list of
>>> definitions and references to help understand this email.*
>>>
>>> *Short Version (For those who know gradle)*:
>>> A pull request [1] may fix the continual error message "Error: Backend
>>> initialization required, please run "terraform init"".  The PR applies Task
>>> Configuration Avoidance [2] by applying changes to a few tasks from
>>> tasks(String) to tasks.register(String).
>>>
>>> *Long Version (For those who are not as familiar with gradle)*:
>>>
>>> I write this not as an expert but as someone still learning.  Gradle [3]
>>> is the software we use in the Beam repository to automate many needed tasks
>>> associated with building and testing code.  It is typically used in Java
>>> projects but can be extended for other purposes.  We store code related to
>>> our Beam Playground [4] that also uses gradle though it is not mainly a
>>> Java project.  The unit of work for Gradle is what is called a task.  To
>>> run a task you open a terminal and type "./gradlew nameOfMyTask".  There
>>> are two main ways to create a custom task in our build.gradle files.  One
>>> is writing task("doSomething") and the other is
>>> tasks.register("doSomethingElse").  According to [2], the recommendation is
>>> to use the tasks.register("doSomething").  This avoids executing other work
>>> (configuration but don't worry about it for now) until one runs the
>>> doSomething task or another task we are running depends on it.
>>>
>>> So why were we seeing this "Error: Backend initialization required"
>>> message all the time?  The reason is that tasks were configured as
>>> task("doSomething").  All I had to do was change this to
>>> tasks.register("doSomething") and it removed the message.
>>>
>>> *Definitions/References*
>>>
>>> 1. https://github.com/apache/beam/pull/24509
>>> 2.
>>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>>> 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
>>> 4. https://play.beam.apache.org/
>>>
>>> *Suggested Learning Path To Understand This Email*
>>> 1.
>>> https://docs.gradle.org/current/samples/sample_building_java_libraries.html
>>> 2. https://docs.gradle.org/current/userguide/build_lifecycle.html
>>> 3. https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
>>> 4.
>>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>>>
>>> Best,
>>>
>>> Damon
>>>
>>>


Re: Gradle Task Configuration Avoidance

2022-12-05 Thread Kenneth Knowles
Nice!

I believe at some point in the past we made a pass to try to convert our
stuff to this model. I wonder if we can prevent it proactively somehow,
like disabling the legacy way of creating tasks or something.

Kenn

On Mon, Dec 5, 2022 at 6:25 AM Kerry Donny-Clark via dev <
dev@beam.apache.org> wrote:

> Thanks Damon! I really appreciate how clear your emails are here. Instead
> of my usual feeling of "I don't quite understand, and don't have time to
> get context" I can read all the context in the mail.
> This error message had confused me, so I really appreciate the cleanup and
> explanation.
>
> On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev 
> wrote:
>
>> Hello Everyone,
>>
>> *If you are new to Beam and coming from non-Java language conventions, it
>> is likely you are new to gradle.  At the end of this email is a list of
>> definitions and references to help understand this email.*
>>
>> *Short Version (For those who know gradle)*:
>> A pull request [1] may fix the continual error message "Error: Backend
>> initialization required, please run "terraform init"".  The PR applies Task
>> Configuration Avoidance [2] by applying changes to a few tasks from
>> tasks(String) to tasks.register(String).
>>
>> *Long Version (For those who are not as familiar with gradle)*:
>>
>> I write this not as an expert but as someone still learning.  Gradle [3]
>> is the software we use in the Beam repository to automate many needed tasks
>> associated with building and testing code.  It is typically used in Java
>> projects but can be extended for other purposes.  We store code related to
>> our Beam Playground [4] that also uses gradle though it is not mainly a
>> Java project.  The unit of work for Gradle is what is called a task.  To
>> run a task you open a terminal and type "./gradlew nameOfMyTask".  There
>> are two main ways to create a custom task in our build.gradle files.  One
>> is writing task("doSomething") and the other is
>> tasks.register("doSomethingElse").  According to [2], the recommendation is
>> to use the tasks.register("doSomething").  This avoids executing other work
>> (configuration but don't worry about it for now) until one runs the
>> doSomething task or another task we are running depends on it.
>>
>> So why were we seeing this "Error: Backend initialization required"
>> message all the time?  The reason is that tasks were configured as
>> task("doSomething").  All I had to do was change this to
>> tasks.register("doSomething") and it removed the message.
>>
>> *Definitions/References*
>>
>> 1. https://github.com/apache/beam/pull/24509
>> 2.
>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>> 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
>> 4. https://play.beam.apache.org/
>>
>> *Suggested Learning Path To Understand This Email*
>> 1.
>> https://docs.gradle.org/current/samples/sample_building_java_libraries.html
>> 2. https://docs.gradle.org/current/userguide/build_lifecycle.html
>> 3. https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
>> 4.
>> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>>
>> Best,
>>
>> Damon
>>
>>


Re: Gradle Task Configuration Avoidance

2022-12-05 Thread Kerry Donny-Clark via dev
Thanks Damon! I really appreciate how clear your emails are here. Instead
of my usual feeling of "I don't quite understand, and don't have time to
get context" I can read all the context in the mail.
This error message had confused me, so I really appreciate the cleanup and
explanation.

On Fri, Dec 2, 2022, 7:28 PM Damon Douglas via dev 
wrote:

> Hello Everyone,
>
> *If you are new to Beam and coming from non-Java language conventions, it
> is likely you are new to gradle.  At the end of this email is a list of
> definitions and references to help understand this email.*
>
> *Short Version (For those who know gradle)*:
> A pull request [1] may fix the continual error message "Error: Backend
> initialization required, please run "terraform init"".  The PR applies Task
> Configuration Avoidance [2] by applying changes to a few tasks from
> tasks(String) to tasks.register(String).
>
> *Long Version (For those who are not as familiar with gradle)*:
>
> I write this not as an expert but as someone still learning.  Gradle [3]
> is the software we use in the Beam repository to automate many needed tasks
> associated with building and testing code.  It is typically used in Java
> projects but can be extended for other purposes.  We store code related to
> our Beam Playground [4] that also uses gradle though it is not mainly a
> Java project.  The unit of work for Gradle is what is called a task.  To
> run a task you open a terminal and type "./gradlew nameOfMyTask".  There
> are two main ways to create a custom task in our build.gradle files.  One
> is writing task("doSomething") and the other is
> tasks.register("doSomethingElse").  According to [2], the recommendation is
> to use the tasks.register("doSomething").  This avoids executing other work
> (configuration but don't worry about it for now) until one runs the
> doSomething task or another task we are running depends on it.
>
> So why were we seeing this "Error: Backend initialization required"
> message all the time?  The reason is that tasks were configured as
> task("doSomething").  All I had to do was change this to
> tasks.register("doSomething") and it removed the message.
>
> *Definitions/References*
>
> 1. https://github.com/apache/beam/pull/24509
> 2.
> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
> 3. https://docs.gradle.org/current/userguide/what_is_gradle.html
> 4. https://play.beam.apache.org/
>
> *Suggested Learning Path To Understand This Email*
> 1.
> https://docs.gradle.org/current/samples/sample_building_java_libraries.html
> 2. https://docs.gradle.org/current/userguide/build_lifecycle.html
> 3. https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
> 4.
> https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
>
> Best,
>
> Damon
>
>


Gradle Task Configuration Avoidance

2022-12-02 Thread Damon Douglas via dev
Hello Everyone,

*If you are new to Beam and coming from non-Java language conventions, it
is likely you are new to gradle.  At the end of this email is a list of
definitions and references to help understand this email.*

*Short Version (For those who know gradle)*:
A pull request [1] may fix the continual error message "Error: Backend
initialization required, please run "terraform init"".  The PR applies Task
Configuration Avoidance [2] by applying changes to a few tasks from
tasks(String) to tasks.register(String).

*Long Version (For those who are not as familiar with gradle)*:

I write this not as an expert but as someone still learning.  Gradle [3] is
the software we use in the Beam repository to automate many needed tasks
associated with building and testing code.  It is typically used in Java
projects but can be extended for other purposes.  We store code related to
our Beam Playground [4] that also uses gradle though it is not mainly a
Java project.  The unit of work for Gradle is what is called a task.  To
run a task you open a terminal and type "./gradlew nameOfMyTask".  There
are two main ways to create a custom task in our build.gradle files.  One
is writing task("doSomething") and the other is
tasks.register("doSomethingElse").  According to [2], the recommendation is
to use the tasks.register("doSomething").  This avoids executing other work
(configuration but don't worry about it for now) until one runs the
doSomething task or another task we are running depends on it.

So why were we seeing this "Error: Backend initialization required" message
all the time?  The reason is that tasks were configured as
task("doSomething").  All I had to do was change this to
tasks.register("doSomething") and it removed the message.

*Definitions/References*

1. https://github.com/apache/beam/pull/24509
2.
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
3. https://docs.gradle.org/current/userguide/what_is_gradle.html
4. https://play.beam.apache.org/

*Suggested Learning Path To Understand This Email*
1.
https://docs.gradle.org/current/samples/sample_building_java_libraries.html
2. https://docs.gradle.org/current/userguide/build_lifecycle.html
3. https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
4.
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html

Best,

Damon