假设我们有四种构建类型:debug,qa,beta和release。
我们可以为特定变体定义依赖关系,如下所示:
dependencies {
// These dependencies are only included for debug and qa builds
debugCompile 'com.example:lib:1.0.0'
qaCompile 'com.example:lib:1.0.0'
}
有没有办法在不重复工件描述符的情况下为多个变体编译这些依赖项?
例如,我想做这样的事情:
dependencies {
internalCompile 'com.example:lib:1.0.0'
}
internalCompile
指定debug
和qa
版本都包含该库的位置。
我认为解决方案在于定义新的Gradle configuration,但如果我创建internalCompile
配置,我不确定如何确保仅为qa
和{编译这些依赖项{1}}构建。
答案 0 :(得分:6)
<强> extendsFrom 强>
此配置扩展的配置的名称。超配置的工件也可在此配置中使用。
tables[3]
$`NULL`
V1 V2 V3 V4
1 Value Meaning Valid From Valid To
2 Wound
3 01A Laceration 1st July 2010
4 01B Contusion 1st July 2010
5 01C Abrasion 1st July 2010
6 01D Soft tissue \r\n inflammation 1st July 2010
7 01Z Wound, other or \r\n unspecified 1st July 2010
8 Head \r\n Injury
9 02A Glasgow Coma Score \r\n 15 1st July 2010
10 02B Glasgow Coma Score \r\n <15 1st July 2010
11 02C Dental \r\nInjury 1st July 2010
12 02Z Head Injury, other or \r\n unspecified 1st July 2010
13 Fracture
14 03A Open \r\nFracture 1st July 2010
15 03B Closed \r\n Fracture 1st July 2010
16 03C Fracture \r\n Dislocation 1st July 2010
17 03Z Fracture, other or \r\n unspecified 1st July 2010
18 Joint \r\n Injury
19 04A Sprain 1st July 2010
20 04B Dislocation 1st July 2010
21 04C Subluxation 1st July 2010
22 04Z Joint Injury, other or \r\n unspecified 1st July 2010
23 Amputation
24 05Z Amputation, other or \r\n unspecified 1st July 2010
25 Soft Tissue \r\n Injury
26 06A Muscle \r\nInjury 1st July 2010
27 06B Tendon \r\nInjury 1st July 2010
28 06C Nerve Injury 1st July 2010
29 06D Visceral \r\n Injury 1st July 2010
30 06E Vascular \r\n Injury 1st July 2010
31 06Z Soft Tissue Injury, other \r\n or unspecified 1st July 2010
32 Burns, Scalds and \r\n Thermal Conditions
33 07A Electric 1st July 2010
34 07B Chemical 1st July 2010
35 07C Radiation 1st July 2010
36 07D Scald 1st July 2010
37 07E Sunburn 1st July 2010
38 07F Hyperthermia 1st July 2010
39 07G Hypothermia 1st July 2010
40 07H Frostbite 1st July 2010
41 07Z Burns, Scalds and Thermal \r\n Conditions, other or unspecified 1st July 2010
42 Foreign \r\n Body
43 08A Ingested Foreign \r\n Body 1st July 2010
44 08Z Foreign Body, other or \r\n unspecified 1st July 2010
45 Puncture \r\n Wounds
46 09A Needle Stick \r\n Injury 1st July 2010
47 09B Human Bite 1st July 2010
48 09C Animal Bite 1st July 2010
49 09D Insect Bite or \r\n Sting 1st July 2010
50 09Z Puncture Wounds, other or \r\n unspecified 1st July 2010
51 Poisoning or \r\n Overdose
52 10A Alcohol 1st July 2010
53 10B Prescribed \r\n Drug 1st July 2010
54 10C Non-prescribed/purchased \r\n drug 1st July 2010
55 10D Illicit \r\n Drug 1st July 2010
56 10Z Poisoning or Overdose, \r\n other or unspecified 1st July 2010
57 Drowning
58 11A Near \r\nDrowning 1st July 2010
59 11Z Drowning, other or \r\n unspecified 1st July 2010
60 Infectious \r\n Disease
61 12A Notifiable \r\n Disease 1st July 2010
62 12B Non-notifiable \r\n Disease 1st July 2010
63 Local \r\n Infection
64 13A Septicaemia 1st July 2010
65 13Z Infection, other or \r\n unspecified 1st July 2010
66 Respiratory \r\n Conditions
67 14A Asthma 1st July 2010
68 14B Chronic Obstructive \r\n Pulmonary disease 1st July 2010
69 14Z Respiratory Conditions, \r\n other or unspecified 1st July 2010
70 Endocrinological \r\n Conditions
71 15A Diabetes 1st July 2010
72 15Z Endocrinological \r\n Conditions, other or unspecified 1st July 2010
73 Cardiovascular \r\n Conditions
74 16A Myocardial \r\n Infarction 1st July 2010
75 16B Vascular Condition 1st July 2010
76 16Z Cardiovascular Conditions, \r\n other or unspecified 1st July 2010
77 Neurological Conditions
78 17A Seizure/Convulsion 1st July 2010
79 17B Cerebrovascular \r\n Event 1st July 2010
80 17Z Neurological Conditions, \r\n other or unspecified 1st July 2010
81 Gastrointestinal \r\n Conditions
82 18Z Gastrointestinal \r\n Conditions, other or unspecified 1st July 2010
83 Urological Conditions
84 19Z Urological Conditions, \r\n other or unspecified 1st July 2010
85 Dermatological \r\n Conditions
86 20Z Dermatological Conditions, \r\n other or unspecified 1st July 2010
87 Psychological/Psychiatric \r\n Conditions
88 21Z Psychological/Psychiatric \r\n Conditions, other or unspecified 1st July 2010
89 Obstetric \r\n Conditions
90 22Z Obstetric Conditions, \r\n other or unspecified 1st July 2010
91 Gynaecological \r\n Conditions
92 23Z Gynaecological Conditions, \r\n other or unspecified 1st July 2010
93 Haematological \r\n Conditions
94 24Z Haematological Conditions, \r\n other or unspecified 1st July 2010
95 Ophthalmic \r\n Conditions
96 25Z Ophthalmic Conditions, \r\n other or unspecified 1st July 2010
97 Rheumatological \r\n Conditions
98 26Z Rheumatological \r\n Conditions, other or unspecified 1st July 2010
99 Genito-Urinary \r\n Medicine
100 27Z Genito-urinary Medicine, \r\n other or unspecified 1st July 2010
101 Ear, Nose and Throat \r\n Conditions
102 28Z Ear, Nose and Throat \r\n Conditions, other or unspecified 1st July 2010
103 Pain
104 29A Chest Pain, non \r\n cardiac 1st July 2010
105 29B Abdominal \r\n Pain 1st July 2010
106 29Z Pain, other or \r\n unspecified 1st July 2010
107 Allergy (including \r\n Anaphylaxis)
108 30Z Allergy (including \r\n Anaphylaxis), other or unspecified 1st July 2010
109 Social \r\n Problems/Homelessness
110 31A Chronic Alcohol \r\n Abuse 1st July 2010
111 31B Chronic Drug \r\n Abuse 1st July 2010
112 31Z Social \r\n Problems/Homelessness, other or unspecified 1st July 2010
113 97Z Nothing Abnormal \r\n Detected 1st July 2010
114 98Z Diagnosis Type Not \r\n Otherwise Specified 1st July 2010
115 99Z Diagnosis Not \r\n Recorded 1st July 2010
您可以创建工件描述符集合,并将其与多个配置一起使用。
configurations {
// debugCompile and qaCompile are already created by the Android Plugin
internalCompile
}
debugCompile.extendsFrom(internalCompile)
qaCompile.extendsFrom(internalCompile)
dependencies {
//this adds lib to both debugCompile and qaCompile
internalCompile 'com.example:lib:1.0.0'
}