As with any other software API or
framework, you'll want to become
very comfortable with finding your
way around the Gradle documentation.
Gradle provides a few different
forms of documentation, but
we'll focus specifically on the DSL
reference, which is a good first place
to look if you want to know what all
configuration options are available,
in any given part of your build script.
The Gradle DSL reference covers all
the different build script components.
Many of which we'll talk
about later in this course.
Since we're currently concerned with
tasks, let's take a look at the task
types that are available as part
of the Gradle distribution.
As you can see there are a number
of built in task types,
varying from followup operations to
compilation, to source code analysis.
Since one of the most common build
actions involves copying files.
Let's take a look at the copy task API.
For most built in task types
examples are provided for
common configuration use cases.
If we look further, we can see the
various task configuration properties
as well as methods available.
Many of the method descriptions
reference other greater API types.
Since many API methods take
a groovy closure as an argument,
it's helpful to know what arguments
will be passed into the closure.
The eachFile method, for example,
takes a closure as an argument.
The closure that we
pass in as an argument,
is then given an instance of
FileCopyDetails as its argument.
We can click this link, and then get
additional details about the options
that are available on this class.
The Gradle DSL reference
is your best friend.
Learn it, love it, and it will
help you out of all sorts of jams.
كما هو الحال مع أي واجهة API للبرامج أو
إطار عمل، سوف تحتاجون إلى وسيلة مريحة
للوصول إلى
.وثائق Gradle
يوفر Gradle عددًا من نماذج
الوثائق المختلفة، لكننا
سنركز بشكل خاص على مرجع DSL
وهو أول مكان مناسب
للبحث إذا أرتم التعرف على كل
،خيارات التكوين المتاحة
.في أي جزء من البرامج النصية للبنية
إن مرجع Gradle DSL يشمل جميع
.المكونات المختلفة من البرامج النصية للبنية
وسوف نتحدث عن العديد منها
.في جزء لاحق من هذه الدورة التدريبية
ونظرًا لأننا معنيون حاليًا
بالمهام، فدعونا نلقي نظرة على أنواع
المهام المتاحة كجزء
.من توزيع Gradle
وكما تشاهدون هناك عدد
،من أنواع المهام المضمنة
تتراوح ما بين عمليات المتابعة
.إلى التجميع، إلى تحليل التعليمات البرمجية المصدر
ولأن من أشهر إجراءات البنية
.نسخ الملفات
.فدعونا نلقي نظرة على واجهة API لمهمة النسخ
وبالنسبة لمعظم أنواع المهام المضمنة
توجد أمثلة
.لحالات استخدام التكوين الشائعة
وإذا أمعنّا النظر، يمكننا مشاهدة
خصائص تكوين المهام المتنوعة
.والأساليب المتاحة
وتشير الكثير من أوصاف الأساليب
.إلى أنواع أخرى من واجهات API
ونظرًا لأن العديد من أساليب API
،تأخذ إغلاق groovy كوسيطة
فمن المفيد معرفة نوع الوسيطة
.التي يتم تمريرها إلى الإغلاق
،وأسلوب eachFile على سبيل المثال
.يجعل من الإغلاق وسيطة
والإغلاق الذي يتم
،تمريره كوسيطة
يُعطى مثيلاً من
.FileCopyDetails ليكون بمثابة وسيطة له
ويمكننا النقر فوق هذا الرابط والحصول على
تفاصيل إضافية حول الخيارات
.المتاحة في هذه الفئة
إن مرجع Gradle DSL
.هو أفضل صديق لكم
تعلموه وأحبوه وسوف
.يساعدكم في كثير من الحالات
Como qualquer API ou framework de
software, você deve se sentir
confortável para se localizar na documentação
do Gradle.
O Gradle oferece algumas formas
de documentação, mas
vamos nos concentrar na referência DSL,
que é um bom ponto de partida
para saber quais todas as opções de
configuração disponíveis,
em qualquer parte do script de compilação.
A referência Gradle DSL abrange
todos os diferentes componentes de script de compilação.
Muitos dos quais falaremos
posteriormente neste curso.
Como nos preocupamos com tarefas no
momento, vamos ver os tipos de
disponíveis como parte
da distribuição do Gradle.
Como podemos ver há uma série de
tipos de tarefa
internos, desde operações de
acompanhamento a compilação até análise de código fonte.
Como uma das ações mais comuns na
compilação envolve cópia de arquivos,
vamos dar uma olhada na API da tarefa copy.
Na maior parte dos tipos de
tarefa internos são
fornecidos exemplos de casos de uso de configuração comum.
Mais adiante, podemos ver diversas
propriedades de configuração bem
como métodos disponíveis.
Muitas descrições de método
fazem referência a outros tipos de API.
Como vários métodos de API têm
closure de groovy como
argumento, é interessante saber quais
argumentos serão passados no closure.
O método eachFile, por exemplo,
assume um closure como argumento.
O closure passado
como argumento,
recebe uma instância
de FileCopyDetails como seu argumento.
Clicando neste link, você encontra
outros detalhes sobre as opções
disponíveis nesta classe.
A referência Gradle DSL
está sempre do seu lado.
Aprenda e apaixone-se!
Ela estará presente em todas as situações.
对于任何其他 API 或
框架,您会希望
能够在 Gradle 文档中
方便地找到方向。
Gradle 提供了一些不同的
文档形式,但
我们将重点介绍 DSL
参考,如果您想要
了解构建脚本的任何给定部分
中提供的所有配置选项,这将是
要查看的第一个好去处。
Gradle DSL 参考包括各种
不同的构建脚本组件。
我们将在本节课稍后
的时间对其中多个组件进行介绍。
由于我们目前关注的是任务,
所以让我们来看看
作为 Gradle 分发的一部分
提供的任务类型。
您可以看到,有多种不同的内置
任务类型,
从跟进操作到编译
再到源代码分析。
由于其中一种最常见的构建
操作包括复制文件,
所以让我们来看看复制任务 API。
对于大多数内置任务类型,
都提供了
常见配置用例的示例。
如果我们看得更深入一些,还可以
看到多种任务配置属性
和可用属性。
许多方法说明都
参考了其他更好的 API 类型。
由于许多 API 方法都将
Groovy 闭包用作参数,
因此了解哪些参数
会被传递到闭包中非常有用。
例如,eachFile 方法会将
闭包作为参数。
然后,系统会为我们
作为参数传递的闭包
提供一个 FileCopyDetails
实例作为其参数。
我们可以单击此链接,然后获取
有关此类中提供的选项
的附加详细信息。
Gradle DSL 参考是
您最好的伙伴。
学习它、爱上它,它将
帮助您解决各种困境。