1
+
2
+ apply plugin : ' com.github.dcendents.android-maven'
3
+ apply plugin : ' com.jfrog.bintray'
4
+
5
+ // load properties
6
+ Properties properties = new Properties ()
7
+ File localPropertiesFile = project. file(" local.properties" );
8
+ if (localPropertiesFile. exists()){
9
+ properties. load(localPropertiesFile. newDataInputStream())
10
+ }
11
+ File projectPropertiesFile = project. file(" project.properties" );
12
+ if (projectPropertiesFile. exists()){
13
+ properties. load(projectPropertiesFile. newDataInputStream())
14
+ }
15
+
16
+ // read properties
17
+ def projectName = properties. getProperty(" project.name" )
18
+ def projectGroupId = properties. getProperty(" project.groupId" )
19
+ def projectArtifactId = properties. getProperty(" project.artifactId" )
20
+ def projectVersionName = android. defaultConfig. versionName
21
+ def projectPackaging = properties. getProperty(" project.packaging" )
22
+ def projectSiteUrl = properties. getProperty(" project.siteUrl" )
23
+ def projectGitUrl = properties. getProperty(" project.gitUrl" )
24
+
25
+ def developerId = properties. getProperty(" developer.id" )
26
+ def developerName = properties. getProperty(" developer.name" )
27
+ def developerEmail = properties. getProperty(" developer.email" )
28
+
29
+ def bintrayUser = properties. getProperty(" bintray.user" )
30
+ def bintrayApikey = properties. getProperty(" bintray.apikey" )
31
+
32
+ def javadocName = properties. getProperty(" javadoc.name" )
33
+
34
+ group = projectGroupId
35
+
36
+ // This generates POM.xml with proper parameters
37
+ install {
38
+ repositories. mavenInstaller {
39
+ pom {
40
+ project {
41
+ name projectName
42
+ groupId projectGroupId
43
+ artifactId projectArtifactId
44
+ version projectVersionName
45
+ packaging projectPackaging
46
+ url projectSiteUrl
47
+ licenses {
48
+ license {
49
+ name ' The Apache Software License, Version 2.0'
50
+ url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
51
+ }
52
+ }
53
+ developers {
54
+ developer {
55
+ id developerId
56
+ name developerName
57
+ email developerEmail
58
+ }
59
+ }
60
+ scm {
61
+ connection projectGitUrl
62
+ developerConnection projectGitUrl
63
+ url projectSiteUrl
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ // This generates sources.jar
71
+ task sourcesJar (type : Jar ) {
72
+ from android. sourceSets. main. java. srcDirs
73
+ classifier = ' sources'
74
+ }
75
+
76
+ task javadoc (type : Javadoc ) {
77
+ source = android. sourceSets. main. java. srcDirs
78
+ classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
79
+ }
80
+
81
+ // This generates javadoc.jar
82
+ task javadocJar (type : Jar , dependsOn : javadoc) {
83
+ classifier = ' javadoc'
84
+ from javadoc. destinationDir
85
+ }
86
+
87
+ artifacts {
88
+ archives javadocJar
89
+ archives sourcesJar
90
+ }
91
+
92
+ // javadoc configuration
93
+ javadoc {
94
+ options{
95
+ encoding " UTF-8"
96
+ charSet ' UTF-8'
97
+ author true
98
+ version projectVersionName
99
+ links " http://docs.oracle.com/javase/7/docs/api"
100
+ title javadocName
101
+ }
102
+ }
103
+
104
+ // bintray configuration
105
+ bintray {
106
+ user = bintrayUser
107
+ key = bintrayApikey
108
+ configurations = [' archives' ]
109
+ pkg {
110
+ repo = " maven"
111
+ name = projectName
112
+ websiteUrl = projectSiteUrl
113
+ vcsUrl = projectGitUrl
114
+ licenses = [" Apache-2.0" ]
115
+ publish = true
116
+ }
117
+ }
0 commit comments