forked from Vorlonsoft/GradleMavenPush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MavenPush.groovy
781 lines (718 loc) · 28.4 KB
/
MavenPush.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
/*
* Copyright 2018 Vorlonsoft LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* <p>MavenPush Class - class with gradle properties getters, thread-safe and
* a fast singleton implementation.</p>
*
* @since 1.5.0 Tokyo
* @version 1.6.0 Yokohama
* @author Alexander Savin
*/
final class MavenPush {
private static volatile MavenPush singleton = null
private final def project
private MavenPush(project) {
this.project = project
}
final private class InvalidUserDataException extends Exception {
InvalidUserDataException(String message) {
super(message)
}
}
/**
* Only method to get singleton object of MavenPush Class
*
* @param project project
* @return thread-safe singleton
*/
static MavenPush with(project) {
if (singleton == null) {
synchronized (MavenPush.class) {
if (singleton == null) {
singleton = new MavenPush(project)
}
}
}
return singleton
}
/**
* Checks Android or non-Android project.
*
* @return true if Android project, false otherwise
*/
private boolean isAndroid() {
return project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library') ||
project.getPlugins().hasPlugin('com.android.feature') ||
project.getPlugins().hasPlugin('com.android.dynamic-feature') ||
project.getPlugins().hasPlugin('com.android.instantapp') ||
project.getPlugins().hasPlugin('android') ||
project.getPlugins().hasPlugin('android-library')
}
/**
* Checks if you're putting builds of your project on JCenter.
*
* @return true if JCenter, false otherwise
*/
boolean isJCenter() {
return (project.hasProperty('IS_JCENTER') && 'true'.equalsIgnoreCase(project.IS_JCENTER))
}
/**
* Checks if it's Release Build or SNAPSHOT Build of your project.
*
* @return true if Release Build, false otherwise
*/
boolean isReleaseBuild() {
return !getPomVersionName().contains('SNAPSHOT')
}
/**
* Returns release repository url.
*
* @return RELEASE_REPOSITORY_URL gradle property value or
* "https://bintray.com/api/v1/maven/{project.NEXUS_USERNAME}/maven/{project.POM_ARTIFACT_ID}/;publish=1"
* for JCenter and "https://oss.sonatype.org/service/local/staging/deploy/maven2/" for Maven Central
* if project hasn't this property
* @see #getSnapshotRepositoryUrl()
*/
String getReleaseRepositoryUrl() {
if (project.hasProperty('RELEASE_REPOSITORY_URL')) {
return project.RELEASE_REPOSITORY_URL
} else if (isJCenter()) {
// https://bintray.com/api/v1/maven/{project.NEXUS_USERNAME}/maven/{project.POM_ARTIFACT_ID}/;publish=1
return 'https://bintray.com/api/v1/maven/' +
getRepositoryUsername() +
'/maven/' +
getPomArtifactUrl() +
'/;publish=1'
} else {
return 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}
}
/**
* Returns snapshot repository url.
*
* @return SNAPSHOT_REPOSITORY_URL gradle property value or
* "https://oss.jfrog.org/artifactory/oss-snapshot-local/" for JCenter and
* "https://oss.sonatype.org/content/repositories/snapshots/" for Maven Central
* if project hasn't this property
* @see #getReleaseRepositoryUrl()
*/
String getSnapshotRepositoryUrl() {
if (project.hasProperty('SNAPSHOT_REPOSITORY_URL')) {
return project.SNAPSHOT_REPOSITORY_URL
} else if (isJCenter()) {
return 'https://oss.jfrog.org/artifactory/oss-snapshot-local/'
} else {
return 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
/**
* Returns repository username.
*
* @return if IS_JCENTER gradle property value equals "true" returns JCENTER_USERNAME system environment variable
* or JCENTER_USERNAME gradle property value if System hasn't this environment variable,
* returns NEXUS_USERNAME environment variable value or NEXUS_USERNAME gradle property value
* if System hasn't this environment variable or "" if System hasn't this environment variable
* and project hasn't this property
* @see #getRepositoryPassword()
*/
String getRepositoryUsername() {
if (isJCenter()) {
if (System.getenv().containsKey('JCENTER_USERNAME')) {
return System.getenv('JCENTER_USERNAME')
} else if (project.hasProperty('JCENTER_USERNAME')) {
return project.JCENTER_USERNAME
}
}
if (System.getenv().containsKey('NEXUS_USERNAME')) {
return System.getenv('NEXUS_USERNAME')
} else {
return project.hasProperty('NEXUS_USERNAME') ? project.NEXUS_USERNAME : ''
}
}
/**
* Returns repository password (API Key for JCenter).
*
* @return if IS_JCENTER gradle property value equals "true" returns JCENTER_API_KEY system environment variable
* or JCENTER_API_KEY gradle property value if System hasn't this environment variable,
* returns NEXUS_PASSWORD environment variable value or NEXUS_PASSWORD gradle property value
* if System hasn't this environment variable or "" if System hasn't this environment variable
* and project hasn't this property
* @see #getRepositoryUsername()
*/
String getRepositoryPassword() {
if (isJCenter()) {
if (System.getenv().containsKey('JCENTER_API_KEY')) {
return System.getenv('JCENTER_API_KEY')
} else if (project.hasProperty('JCENTER_API_KEY')) {
return project.JCENTER_API_KEY
}
}
if (System.getenv().containsKey('NEXUS_PASSWORD')) {
return System.getenv('NEXUS_PASSWORD')
} else {
return project.hasProperty('NEXUS_PASSWORD') ? project.NEXUS_PASSWORD : ''
}
}
/**
* Checks if apklib artifact must be generated.
*
* @return true if it's Android project and APKLIB_ARTIFACT gradle property value is "true", false otherwise
* @see #getVarArtifact()
*/
boolean getApklibArtifact() {
return (isAndroid() && project.hasProperty('APKLIB_ARTIFACT')) ? 'true'.equalsIgnoreCase(project.APKLIB_ARTIFACT) : false
}
/**
* Checks if fatjar artifact must be generated.
*
* @return true if FATJAR_ARTIFACT gradle property value is "true", false otherwise
* @see #getAndroidJarMainClass()
*/
boolean getFatjarArtifact() {
return project.hasProperty('FATJAR_ARTIFACT') ? 'true'.equalsIgnoreCase(project.FATJAR_ARTIFACT) : false
}
/**
* Checks if Android jar artifact must be generated.
*
* @return true if it's Android project and ANDROID_JAR_ARTIFACT gradle property value is "true", false otherwise
* @see #getAndroidJarMainClass()
* @see #getVarArtifact()
*/
boolean getAndroidJarArtifact() {
return (isAndroid() && project.hasProperty('ANDROID_JAR_ARTIFACT')) ? 'true'.equalsIgnoreCase(project.ANDROID_JAR_ARTIFACT) : false
}
/**
* Returns "Main-Class" attribute for Android's "var", "jar" and "fatjar" MANIFEST.MF files.
*
* @return ANDROID_JAR_MAIN_CLASS gradle property value or "" if project hasn't this property
*/
String getAndroidJarMainClass() {
return project.hasProperty('ANDROID_JAR_MAIN_CLASS') ? project.ANDROID_JAR_MAIN_CLASS : ''
}
/**
* Checks if var artifact must be generated.
*
* @return true if it's Android project and VAR_ARTIFACT gradle property value is "true" or project hasn't this property, false otherwise
* @see #getAndroidJarMainClass()
*/
boolean getVarArtifact() {
return (isAndroid() && project.hasProperty('VAR_ARTIFACT')) ? 'true'.equalsIgnoreCase(project.VAR_ARTIFACT) : true
}
/**
* Checks if Dokka documentation engine must be used.
*
* @return true if JAVADOC_BY_DOKKA gradle property value is "true", false otherwise
*/
boolean isDokka() {
return project.hasProperty('JAVADOC_BY_DOKKA') ? 'true'.equalsIgnoreCase(project.JAVADOC_BY_DOKKA) : false
}
/**
* Returns Dokka fatjar version
*
* @return DOKKA_FATJAR_VERSION gradle property value or "0.9.17" if project hasn't
* this property
*/
String getDokkaFatJarVersion() {
return project.hasProperty('DOKKA_FATJAR_VERSION') ? project.DOKKA_FATJAR_VERSION : '0.9.17'
}
/**
* Returns Dokka output format
*
* @return DOKKA_OUTPUT_FORMAT gradle property value or "javadoc" if project hasn't
* this property
*/
String getDokkaOutputFormat() {
return project.hasProperty('DOKKA_OUTPUT_FORMAT') ? project.DOKKA_OUTPUT_FORMAT : 'javadoc'
}
/**
* Checks if doclint check on Javadoc generation must be enable.
*
* @return true if DOCLINT_CHECK gradle property value is "true", false otherwise
*/
boolean getDoclintCheck() {
return project.hasProperty('DOCLINT_CHECK') ? 'true'.equalsIgnoreCase(project.DOCLINT_CHECK) : false
}
/**
* Returns Javadoc encoding.
*
* @return JAVADOC_ENCODING gradle property value or "UTF-8" if project hasn't this property
* @see #getJavadocDocEncoding()
* @see #getJavadocCharSet()
*/
String getJavadocEncoding() {
return project.hasProperty('JAVADOC_ENCODING') ? project.JAVADOC_ENCODING : 'UTF-8'
}
/**
* Returns Javadoc doc encoding.
*
* @return JAVADOC_DOC_ENCODING gradle property value or "UTF-8" if project hasn't this property
* @see #getJavadocEncoding()
* @see #getJavadocCharSet()
*/
String getJavadocDocEncoding() {
return project.hasProperty('JAVADOC_DOC_ENCODING') ? project.JAVADOC_DOC_ENCODING : 'UTF-8'
}
/**
* Returns Javadoc charset.
*
* @return JAVADOC_CHARSET gradle property value or "UTF-8" if project hasn't this property
* @see #getJavadocEncoding()
* @see #getJavadocDocEncoding()
*/
String getJavadocCharSet() {
return project.hasProperty('JAVADOC_CHARSET') ? project.JAVADOC_CHARSET : 'UTF-8'
}
/**
* Checks HTML version in the Javadoc comments.
*
* @return true if JAVADOC_HTML_VERSION gradle property value is "5", false otherwise
*/
boolean isHtml5() {
return project.hasProperty('JAVADOC_HTML_VERSION') ? (project.JAVADOC_HTML_VERSION == '5') : false
}
/**
* Returns Group ID.
*
* @return GROUP gradle property value or libraryVariants[0].applicationId value
* if project hasn't this property and it's Android project
* @throws InvalidUserDataException if Group ID can't be return.
*/
String getPomGroupId() throws InvalidUserDataException {
if (project.hasProperty('GROUP')) {
return project.GROUP
} else if (isAndroid() && (project.android.libraryVariants != null) && (project.android.libraryVariants.size() > 0)) {
return project.android.libraryVariants[0].applicationId
} else {
throw new InvalidUserDataException('You must set GROUP in gradle.properties file.')
}
}
/**
* Returns Artifact ID.
*
* @return POM_ARTIFACT_ID gradle property value
* @throws InvalidUserDataException if Artifact ID can't be return
* @see #getPomArtifactUrl()
*/
String getPomArtifactId() throws InvalidUserDataException {
if (project.hasProperty('POM_ARTIFACT_ID')) {
return project.POM_ARTIFACT_ID
} else {
throw new InvalidUserDataException('You must set POM_ARTIFACT_ID in gradle.properties file.')
}
}
/**
* Returns Artifact URL.
*
* @return POM_ARTIFACT_URL gradle property value or POM_ARTIFACT_ID gradle property value
* if project hasn't this property
* @throws InvalidUserDataException if Artifact URL can't be return
* @see #getPomArtifactId()
*/
String getPomArtifactUrl() throws InvalidUserDataException {
return project.hasProperty('POM_ARTIFACT_URL') ? project.POM_ARTIFACT_URL : getPomArtifactId()
}
/**
* Returns version name.
*
* @return VERSION_NAME gradle property value + VERSION_NAME_EXTRAS environment variable value
* or defaultConfig.versionName value + VERSION_NAME_EXTRAS environment variable value
* if project hasn't VERSION_NAME gradle property and it's Android project
* @throws InvalidUserDataException if version name can't be return
*/
String getPomVersionName() throws InvalidUserDataException {
final String versionNameExtras = (System.getenv().containsKey('VERSION_NAME_EXTRAS')) ? System.getenv('VERSION_NAME_EXTRAS') : ''
if (project.hasProperty('VERSION_NAME')) {
return project.VERSION_NAME + versionNameExtras
} else if (isAndroid() && (project.android.defaultConfig.versionName != null)) {
return project.android.defaultConfig.versionName + versionNameExtras
} else {
throw new InvalidUserDataException('You must set VERSION_NAME in gradle.properties file.')
}
}
/**
* Returns packaging.
*
* @return POM_PACKAGING gradle property value or "aar" for Android project and
* "jar" for non-Android project if project hasn't POM_PACKAGING gradle property
*/
String getPomPackaging() {
if (project.hasProperty('POM_PACKAGING')) {
return project.POM_PACKAGING
} else {
return isAndroid() ? 'aar' : 'jar'
}
}
/**
* Returns library name.
*
* @return POM_NAME gradle property value
* @throws InvalidUserDataException if library name can't be return
*/
String getPomName() throws InvalidUserDataException {
if (project.hasProperty('POM_NAME')) {
return project.POM_NAME
} else {
throw new InvalidUserDataException('You must set POM_NAME in gradle.properties file.')
}
}
/**
* Returns library description.
*
* @return POM_DESCRIPTION gradle property value
* @throws InvalidUserDataException if library description can't be return
*/
String getPomDescription() throws InvalidUserDataException {
if (project.hasProperty('POM_DESCRIPTION')) {
return project.POM_DESCRIPTION
} else {
throw new InvalidUserDataException('You must set POM_DESCRIPTION in gradle.properties file.')
}
}
/**
* Checks if unique snapshots must be enable.
*
* @return true if POM_GENERATE_UNIQUE_SNAPSHOTS gradle property value is "true" or
* if project hasn't POM_GENERATE_UNIQUE_SNAPSHOTS gradle property, false otherwise
*/
boolean getPomUniqueVersion() {
return project.hasProperty('POM_GENERATE_UNIQUE_SNAPSHOTS') ? 'true'.equalsIgnoreCase(project.POM_GENERATE_UNIQUE_SNAPSHOTS) : true
}
/**
* Returns library url.
*
* @return POM_URL gradle property value
* @throws InvalidUserDataException if library url can't be return
*/
String getPomUrl() throws InvalidUserDataException {
if (project.hasProperty('POM_URL')) {
return project.POM_URL
} else {
throw new InvalidUserDataException('You must set POM_URL in gradle.properties file.')
}
}
/**
* Returns inception year.
*
* @return POM_INCEPTION_YEAR gradle property value or "" if project hasn't
* POM_INCEPTION_YEAR gradle property
*/
String getPomInceptionYear() {
return project.hasProperty('POM_INCEPTION_YEAR') ? project.POM_INCEPTION_YEAR : ''
}
/**
* Returns library publicly browsable repository url.
*
* @return POM_SCM_URL gradle property value or POM_URL gradle property value if project hasn't
* POM_SCM_URL gradle property
* @throws InvalidUserDataException if library publicly browsable repository url can't be return
* @see #getPomUrl()
*/
String getPomScmUrl() throws InvalidUserDataException {
return project.hasProperty('POM_SCM_URL') ? project.POM_SCM_URL : getPomUrl()
}
/**
* Returns connection element convey to how one is to connect to the version control system through Maven.
*
* @return POM_SCM_CONNECTION gradle property value
* @throws InvalidUserDataException if connection element can't be return
*/
String getPomScmConnection() throws InvalidUserDataException {
if (project.hasProperty('POM_SCM_CONNECTION')) {
return project.POM_SCM_CONNECTION
} else {
throw new InvalidUserDataException('You must set POM_SCM_CONNECTION in gradle.properties file.')
}
}
/**
* Returns connection element convey to how one is to connect to the version control system through Maven.
*
* @return POM_SCM_DEV_CONNECTION gradle property value or POM_SCM_CONNECTION gradle property value if project hasn't
* POM_SCM_DEV_CONNECTION gradle property
* @throws InvalidUserDataException if connection element can't be return
* @see #getPomScmConnection()
*/
String getPomScmDevConnection() throws InvalidUserDataException {
return project.hasProperty('POM_SCM_DEV_CONNECTION') ? project.POM_SCM_DEV_CONNECTION : getPomScmConnection()
}
/**
* Returns the tag that your project lives under.
*
* @return POM_SCM_TAG gradle property value or "HEAD" (meaning, the Software Configuration Management (SCM) root)
* if project hasn't POM_SCM_TAG gradle property
*/
String getPomScmTag() {
return project.hasProperty('POM_SCM_TAG') ? project.POM_SCM_TAG : 'HEAD'
}
/**
* Returns licence name.
*
* @return POM_LICENCE_NAME gradle property value
* @throws InvalidUserDataException if licence name can't be return
*/
String getPomLicenseName() throws InvalidUserDataException {
if (project.hasProperty('POM_LICENCE_NAME')) {
return project.POM_LICENCE_NAME
} else {
throw new InvalidUserDataException('You must set POM_LICENCE_NAME in gradle.properties file.')
}
}
/**
* Returns licence url.
*
* @return POM_LICENCE_URL gradle property value
* @throws InvalidUserDataException if licence url can't be return
*/
String getPomLicenseUrl() throws InvalidUserDataException {
if (project.hasProperty('POM_LICENCE_URL')) {
return project.POM_LICENCE_URL
} else {
throw new InvalidUserDataException('You must set POM_LICENCE_URL in gradle.properties file.')
}
}
/**
* Returns licence dist.
*
* @return POM_LICENCE_DIST gradle property value or "repo"
* if project hasn't POM_LICENCE_DIST gradle property
*/
String getPomLicenseDist() {
return project.hasProperty('POM_LICENCE_DIST') ? project.POM_LICENCE_DIST : 'repo'
}
/**
* Returns licence comments.
*
* @return POM_LICENCE_COMMENTS gradle property value or ""
* if project hasn't POM_LICENCE_COMMENTS gradle property
*/
String getPomLicenseComments() {
return project.hasProperty('POM_LICENCE_COMMENTS') ? project.POM_LICENCE_COMMENTS : ''
}
/**
* Returns organization.
*
* @return POM_ORG gradle property value or ""
* if project hasn't POM_ORG gradle property
*/
String getOrg() {
return project.hasProperty('POM_ORG') ? project.POM_ORG : ''
}
/**
* Returns organization url.
*
* @return POM_ORG_URL gradle property value or ""
* if project hasn't POM_ORG_URL gradle property
*/
String getOrgUrl() {
return project.hasProperty('POM_ORG_URL') ? project.POM_ORG_URL : ''
}
/**
* Returns developer ID.
*
* @return POM_DEVELOPER_ID gradle property value
* @throws InvalidUserDataException if developer ID can't be return
* @see #getDevelopers()
*/
String getDeveloperId() throws InvalidUserDataException {
if (project.hasProperty('POM_DEVELOPER_ID')) {
return project.POM_DEVELOPER_ID
} else {
throw new InvalidUserDataException('You must set POM_DEVELOPER_ID in gradle.properties file.')
}
}
/**
* Returns developer name.
*
* @return POM_DEVELOPER_NAME gradle property value
* @throws InvalidUserDataException if developer name can't be return
* @see #getDevelopers()
*/
String getDeveloperName() throws InvalidUserDataException {
if (project.hasProperty('POM_DEVELOPER_NAME')) {
return project.POM_DEVELOPER_NAME
} else {
throw new InvalidUserDataException('You must set POM_DEVELOPER_NAME in gradle.properties file.')
}
}
/**
* Returns developer email.
*
* @return POM_DEVELOPER_EMAIL gradle property value or "[email protected]"
* if project hasn't POM_DEVELOPER_EMAIL gradle property
* @see #getDevelopers()
*/
String getDeveloperEmail() {
return project.hasProperty('POM_DEVELOPER_EMAIL') ? project.POM_DEVELOPER_EMAIL : '[email protected]'
}
/**
* Returns developer url.
*
* @return POM_DEVELOPER_URL gradle property value or ""
* if project hasn't POM_DEVELOPER_URL gradle property
*/
String getDeveloperUrl() {
return project.hasProperty('POM_DEVELOPER_URL') ? project.POM_DEVELOPER_URL : ''
}
/**
* Returns developer organization.
*
* @return POM_DEVELOPER_ORG gradle property value or ""
* if project hasn't POM_DEVELOPER_ORG gradle property
* @see #getOrg()
*/
String getDeveloperOrg() {
return project.hasProperty('POM_DEVELOPER_ORG') ? project.POM_DEVELOPER_ORG : getOrg()
}
/**
* Returns developer organization url.
*
* @return POM_DEVELOPER_ORG_URL gradle property value or POM_ORG_URL gradle property value if project hasn't
* POM_DEVELOPER_ORG_URL gradle property or "" if project hasn't POM_DEVELOPER_ORG_URL gradle property and
* POM_ORG_URL gradle property
* @see #getOrgUrl()
*/
String getDeveloperOrgUrl() {
return project.hasProperty('POM_DEVELOPER_ORG_URL') ? project.POM_DEVELOPER_ORG_URL : getOrgUrl()
}
/**
* Returns array of developer roles.
*
* @return developer roles from POM_DEVELOPER_ROLE gradle property and POM_DEVELOPER_ROLES gradle property
* or ['Software Developer'] if project hasn't POM_DEVELOPER_ROLE gradle property and
* POM_DEVELOPER_ROLES gradle property
*/
String[] getDeveloperRoles() {
if (project.hasProperty('POM_DEVELOPER_ROLES')) {
if (project.hasProperty('POM_DEVELOPER_ROLE')) {
final String developerRoles = project.getProperty('POM_DEVELOPER_ROLE') + ',' + project.getProperty('POM_DEVELOPER_ROLES')
return developerRoles.split(',')
} else {
return project.getProperty('POM_DEVELOPER_ROLES').split(',')
}
} else {
return project.hasProperty('POM_DEVELOPER_ROLE') ? [project.POM_DEVELOPER_ROLE] : ['Software Developer']
}
}
/**
* Returns developer timezone.
*
* @return POM_DEVELOPER_TIMEZONE gradle property value or ""
* if project hasn't POM_DEVELOPER_TIMEZONE gradle property
*/
String getDeveloperTimezone() {
return project.hasProperty('POM_DEVELOPER_TIMEZONE') ? project.POM_DEVELOPER_TIMEZONE : ''
}
/**
* Returns array of developers (id, name and email for each developer). Example:
* {@code [ ' B i l l G ' , 'Bill Gates' , '[email protected]' , 'SteveJ' , 'Steve Jobs' , '[email protected]']}
*
* @return developers from POM_DEVELOPERS gradle property or ['']
* if project hasn't POM_DEVELOPERS gradle property
* @see #getContributors()
*/
String[] getDevelopers() {
return project.hasProperty('POM_DEVELOPERS') ? project.getProperty('POM_DEVELOPERS').split(',') : ['']
}
/**
* Returns array of contributors (name and email for each contributor). Example:
* {@code ['Bill Gates' , '[email protected]' , 'Steve Jobs' , '[email protected]']}
*
* @return contributors from POM_CONTRIBUTORS gradle property or ['']
* if project hasn't POM_CONTRIBUTORS gradle property
* @see #getDevelopers()
*/
String[] getContributors() {
return project.hasProperty('POM_CONTRIBUTORS') ? project.getProperty('POM_CONTRIBUTORS').split(',') : ['']
}
/**
* Returns issue tracking system.
*
* @return POM_ISSUE_SYSTEM gradle property value or ""
* if project hasn't POM_ISSUE_SYSTEM gradle property
*/
String getIssueSystem() {
return project.hasProperty('POM_ISSUE_SYSTEM') ? project.POM_ISSUE_SYSTEM : ''
}
/**
* Returns issue tracking system url.
*
* @return POM_ISSUE_SYSTEM_URL gradle property value or ""
* if project hasn't POM_ISSUE_SYSTEM_URL gradle property
*/
String getIssueSystemUrl() {
return project.hasProperty('POM_ISSUE_SYSTEM_URL') ? project.POM_ISSUE_SYSTEM_URL : ''
}
/**
* Returns continuous integration system.
*
* @return POM_CI_SYSTEM gradle property value or ""
* if project hasn't POM_CI_SYSTEM gradle property
*/
String getCiSystem() {
return project.hasProperty('POM_CI_SYSTEM') ? project.POM_CI_SYSTEM : ''
}
/**
* Returns continuous integration system url.
*
* @return POM_CI_SYSTEM_URL gradle property value or ""
* if project hasn't POM_CI_SYSTEM_URL gradle property
*/
String getCiSystemUrl() {
return project.hasProperty('POM_CI_SYSTEM_URL') ? project.POM_CI_SYSTEM_URL : ''
}
/**
* Returns array of mailing lists (name, subscribe email and unsubscribe email for each mailing list). Example:
* {@code ['Main' , '[email protected]' , '[email protected]' , 'Support' , '[email protected]' , '[email protected]']}
*
* @return mailing lists from POM_MAILING_LISTS gradle property or ['']
* if project hasn't POM_MAILING_LISTS gradle property
*/
String[] getMailingLists() {
return project.hasProperty('POM_MAILING_LISTS') ? project.getProperty('POM_MAILING_LISTS').split(',') : ['']
}
/**
* Returns array of repositories (id and url for each repository). Example:
* {@code ['mavenCentral' , 'https://repo1.maven.org/maven2/' , 'jCenter' , 'https://jcenter.bintray.com/']}
*
* @return repositories from POM_REPOSITORIES gradle property or ['']
* if project hasn't POM_REPOSITORIES gradle property if release build;
* repositories from POM_SNAPSHOT_REPOSITORIES gradle property or
* repositories from POM_REPOSITORIES gradle property
* if project hasn't POM_SNAPSHOT_REPOSITORIES gradle property or ['']
* if project hasn't POM_SNAPSHOT_REPOSITORIES and POM_REPOSITORIES gradle properties if non-release build
*/
String[] getRepositories() {
if (isReleaseBuild()) {
return project.hasProperty('POM_REPOSITORIES') ? project.getProperty('POM_REPOSITORIES').split(',') : ['']
} else {
if (project.hasProperty('POM_SNAPSHOT_REPOSITORIES')) {
return project.getProperty('POM_SNAPSHOT_REPOSITORIES').split(',')
} else {
return project.hasProperty('POM_REPOSITORIES') ? project.getProperty('POM_REPOSITORIES').split(',') : ['']
}
}
}
/**
* Returns the url of the repository from whence another POM
* may point to in order to grab this POM's artifact.
*
* @return POM_DIST_DOWNLOAD_URL gradle property value or ""
* if project hasn't POM_DIST_DOWNLOAD_URL gradle property
*/
String getDistDownloadUrl() {
return project.hasProperty('POM_DIST_DOWNLOAD_URL') ? project.POM_DIST_DOWNLOAD_URL : ''
}
}