1+ apply plugin : ' maven-publish'
2+ apply plugin : ' signing'
3+
4+ ext {
5+ PUBLISH_GROUP_ID = ' ru.beryukhov'
6+ PUBLISH_VERSION = ' 1.0.3'
7+ PUBLISH_ARTIFACT_ID = ' flowreactivenetwork'
8+ }
9+
10+ task androidSourcesJar (type : Jar ) {
11+ archiveClassifier. set(' sources' )
12+ if (project. plugins. findPlugin(" com.android.library" )) {
13+ // For Android libraries
14+ from android. sourceSets. main. java. srcDirs
15+ from android. sourceSets. main. kotlin. srcDirs
16+ } else {
17+ // For pure Kotlin libraries, in case you have them
18+ from sourceSets. main. java. srcDirs
19+ from sourceSets. main. kotlin. srcDirs
20+ }
21+ }
22+
23+ artifacts {
24+ archives androidSourcesJar
25+ }
26+
27+ group = PUBLISH_GROUP_ID
28+ version = PUBLISH_VERSION
29+
30+ afterEvaluate {
31+ publishing {
32+ publications {
33+ release(MavenPublication ) {
34+ groupId PUBLISH_GROUP_ID
35+ artifactId PUBLISH_ARTIFACT_ID
36+ version PUBLISH_VERSION
37+
38+ // Two artifacts, the `aar` (or `jar`) and the sources
39+ if (project. plugins. findPlugin(" com.android.library" )) {
40+ from components. release
41+ } else {
42+ from components. java
43+ }
44+
45+ artifact androidSourcesJar
46+ // artifact javadocJar
47+
48+ pom {
49+ name = PUBLISH_ARTIFACT_ID
50+ description = ' Android library listening network connection state and Internet connectivity with Coroutines Flow'
51+ url = ' https://github.com/phansier/FlowReactiveNetwork'
52+ licenses {
53+ license {
54+ name = ' Apache-2.0 License'
55+ url = ' https://github.com/phansier/FlowReactiveNetwork/blob/master/LICENSE'
56+ }
57+ }
58+ developers {
59+ developer {
60+ id = ' phansier'
61+ name = ' Andrey Beryukhov'
62+ email = ' beryukhov-andrey@yandex.ru'
63+ }
64+ }
65+ scm {
66+ connection = ' scm:git:github.com/phansier/FlowReactiveNetwork.git'
67+ developerConnection = ' scm:git:ssh://github.com/phansier/FlowReactiveNetwork.git'
68+ url = ' https://github.com/phansier/FlowReactiveNetwork/tree/main'
69+ }
70+ }
71+ }
72+ }
73+ }
74+ }
75+
76+ signing {
77+ useInMemoryPgpKeys(
78+ // todo refine use of ext here
79+ " rootProject.ext[\" signing.keyId\" ]" ,
80+ " rootProject.ext[\" signing.key\" ]" ,
81+ " rootProject.ext[\" signing.password\" ]" ,
82+ )
83+ sign publishing. publications
84+ }
0 commit comments