1818 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919 */
2020
21+ import com.android.builder.core.BuilderConstants
22+
2123apply plugin : ' com.android.library'
2224
25+ version = " 0.0.1"
26+
2327dependencies {
2428 compile ' com.parse:parse-android:1.10.3'
2529
@@ -36,5 +40,124 @@ android {
3640 defaultConfig {
3741 minSdkVersion 9
3842 targetSdkVersion 21
43+ versionName project. version
44+ versionCode 1
45+ }
46+ }
47+
48+ android. libraryVariants. all { variant ->
49+ def name = variant. buildType. name
50+
51+ def jarTask = task(" jar${ name.capitalize()} " , type : Jar ) {
52+ dependsOn variant. javaCompile
53+ from variant. javaCompile. destinationDir
54+
55+ manifest {
56+ attributes(
57+ " Bundle-Name" : ' parseui-widget-android' ,
58+ " Bundle-Version" : project. version
59+ )
60+ }
61+
62+ exclude ' **/R.class'
63+ exclude ' **/R\$ *.class'
64+ exclude ' **/Manifest.class'
65+ exclude ' **/Manifest\$ *.class'
66+ exclude ' **/BuildConfig.class'
67+
68+ baseName ' ParseUI-Widget'
69+ }
70+
71+ def javadocTask = task(" javadoc${ variant.name.capitalize()} " , type : Javadoc ) {
72+ description " Generates Javadoc for $variant . name . "
73+ source = variant. javaCompile. source
74+ ext. androidJar = " ${ android.sdkDirectory} /platforms/${ android.compileSdkVersion} /android.jar"
75+ classpath = files(variant. javaCompile. classpath. files) + files(ext. androidJar)
76+
77+ options. linksOffline(" http://d.android.com/reference" , " ${ android.sdkDirectory} /docs/reference" )
78+ options. links(" http://boltsframework.github.io/docs/android/" )
79+
80+ exclude ' **/BuildConfig.java'
81+ exclude ' **/R.java'
82+ exclude ' **/internal/**'
83+ exclude ' **/oauth/**'
84+ }
85+
86+ def javadocJarTask = task(" javadocJar${ variant.name.capitalize()} " , type : Jar , dependsOn : " javadoc${ variant.name.capitalize()} " ) {
87+ classifier = ' javadoc'
88+ from javadocTask. destinationDir
89+ }
90+
91+ if (name. equals(BuilderConstants . RELEASE )) {
92+ artifacts. add(' archives' , jarTask);
93+ artifacts. add(' archives' , javadocJarTask);
94+ }
95+ }
96+
97+ // region Maven
98+
99+ apply plugin : ' maven'
100+ apply plugin : ' signing'
101+
102+ def isSnapshot = version. endsWith(' -SNAPSHOT' )
103+ def ossrhUsername = hasProperty(' NEXUS_USERNAME' ) ? NEXUS_USERNAME : System . getenv(' CI_NEXUS_USERNAME' )
104+ def ossrhPassword = hasProperty(' NEXUS_PASSWORD' ) ? NEXUS_PASSWORD : System . getenv(' CI_NEXUS_PASSWORD' )
105+
106+ uploadArchives {
107+ repositories. mavenDeployer {
108+ beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
109+
110+ repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
111+ authentication(userName : ossrhUsername, password : ossrhPassword)
112+ }
113+
114+ snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
115+ authentication(userName : ossrhUsername, password : ossrhPassword)
116+ }
117+
118+ pom. project {
119+ name ' ParseUI-Widget-Android'
120+ artifactId = ' parseui-widget-android'
121+ packaging ' jar'
122+ description ' A library contains ui widgets for building apps with the Parse Android SDK.'
123+ url ' https://github.com/ParsePlatform/ParseUI-Android'
124+
125+ scm {
126+ connection ' scm:git@github.com:ParsePlatform/ParseUI-Android.git'
127+ developerConnection ' scm:git@github.com:ParsePlatform/ParseUI-Android.git'
128+ url ' https://github.com/ParsePlatform/ParseUI-Android'
129+ }
130+
131+ licenses {
132+ license {
133+ name ' BSD License'
134+ url ' https://github.com/ParsePlatform/ParseUI-Android/blob/master/LICENSE'
135+ distribution ' repo'
136+ }
137+ }
138+
139+ developers {
140+ developer {
141+ id ' parse'
142+ name ' Parse'
143+ }
144+ }
145+ }
39146 }
40147}
148+
149+ signing {
150+ required { ! isSnapshot && gradle. taskGraph. hasTask(" uploadArchives" ) }
151+ sign configurations. archives
152+ }
153+
154+ task androidSourcesJar (type : Jar ) {
155+ classifier = ' sources'
156+ from android. sourceSets. main. java. sourceFiles
157+ }
158+
159+ artifacts {
160+ archives androidSourcesJar
161+ }
162+
163+ // endregion
0 commit comments