1+ apply plugin : ' maven-publish'
2+ apply plugin : ' signing'
3+
4+ task androidSourcesJar (type : Jar ) {
5+ archiveClassifier. set(' sources' )
6+ if (project. plugins. findPlugin(" com.android.library" )) {
7+ // For Android libraries
8+ from android. sourceSets. main. java. srcDirs
9+ from android. sourceSets. main. kotlin. srcDirs
10+ } else {
11+ // For pure Kotlin libraries, in case you have them
12+ from sourceSets. main. java. srcDirs
13+ from sourceSets. main. kotlin. srcDirs
14+ }
15+ }
16+
17+ artifacts {
18+ archives androidSourcesJar
19+ }
20+
21+ group = PUBLISH_GROUP_ID
22+ version = PUBLISH_VERSION
23+
24+ afterEvaluate {
25+ publishing {
26+ publications {
27+ release(MavenPublication ) {
28+ // The coordinates of the library, being set from variables that
29+ // we'll set up later
30+ groupId PUBLISH_GROUP_ID
31+ artifactId PUBLISH_ARTIFACT_ID
32+ version PUBLISH_VERSION
33+
34+ // Two artifacts, the `aar` (or `jar`) and the sources
35+ if (project. plugins. findPlugin(" com.android.library" )) {
36+ from components. release
37+ } else {
38+ from components. java
39+ }
40+
41+ artifact androidSourcesJar
42+
43+ // Mostly self-explanatory metadata
44+ pom {
45+ name = PUBLISH_ARTIFACT_ID
46+ description = ' Thepeer official Android SDK'
47+ url = ' https://github.com/thepeerstack/thepeer-android'
48+ licenses {
49+ license {
50+ name = ' Thepeer License'
51+ url = ' '
52+ }
53+ }
54+ developers {
55+ // Add all other devs here...
56+ }
57+
58+ // Version control info - if you're using GitHub, follow the
59+ // format as seen here
60+ scm {
61+ connection = ' scm:git:github.com/thepeerstack/thepeer-android.git'
62+ developerConnection = ' scm:git:ssh://github.com/thepeerstack/thepeer-android.git'
63+ url = ' https://github.com/thepeerstack/thepeer-android/tree/master'
64+ }
65+ }
66+ }
67+ }
68+ }
69+ }
70+
71+ signing {
72+ useInMemoryPgpKeys(
73+ rootProject. ext[" signingKeyId" ],
74+ rootProject. ext[" signingKey" ],
75+ rootProject. ext[" signingPassword" ],
76+ )
77+ sign publishing. publications
78+ }
0 commit comments