1
- apply plugin : ' com.android.library '
2
- apply plugin : ' com.github.dcendents. android-maven '
3
- apply plugin : ' com.jfrog.bintray '
4
-
5
- import org.apache.tools.ant.taskdefs.condition.Os
1
+ plugins {
2
+ id ' com.android.library '
3
+ id ' signing '
4
+ id ' maven-publish '
5
+ }
6
6
7
- version = ' 1.2.1-rc2'
8
- group = ' org.puredata.android'
7
+ group = rootProject. group
9
8
archivesBaseName = ' pd-core'
9
+ version = rootProject. version
10
10
11
11
dependencies {
12
12
api ' com.noisepages.nettoyeur:midi:1.0.0-rc1'
13
13
implementation ' com.noisepages.nettoyeur:midi:1.0.0-rc1'
14
- implementation " androidx.legacy:legacy-support-v4:" + rootProject. androidxLegacySupportVersion
14
+ implementation ' androidx.legacy:legacy-support-v4:' + rootProject. androidxLegacySupportVersion
15
15
}
16
16
17
17
android {
@@ -78,11 +78,13 @@ android {
78
78
79
79
libraryVariants. all { variant ->
80
80
variant. outputs. all { output ->
81
- outputFileName = " ${ archivesBaseName} - ${ version } .aar"
81
+ outputFileName = " ${ archivesBaseName} .aar"
82
82
}
83
83
}
84
84
}
85
85
86
+ import org.apache.tools.ant.taskdefs.condition.Os
87
+
86
88
// TODO: Move to convention plugin?
87
89
def getNdkBuildExecutablePath () {
88
90
// android.ndkDirectory should return project.android.ndkVersion ndkDirectory
@@ -95,49 +97,19 @@ def getNdkBuildExecutablePath() {
95
97
return ndkBuildFullPath
96
98
}
97
99
98
- def siteUrl = ' https://github.com/libpd/pd-for-android'
99
- def gitUrl = ' https://github.com/libpd/pd-for-android.git'
100
-
101
- install {
102
- repositories. mavenInstaller {
103
-
104
- pom {
105
- project {
106
- packaging ' aar'
107
-
108
- name ' Pure Data for Android'
109
- url siteUrl
110
-
111
- licenses {
112
- license {
113
- name ' BSD New'
114
- url ' https://raw.githubusercontent.com/libpd/pd-for-android/master/PdCore/LICENSE.txt'
115
- }
116
- }
117
-
118
- scm {
119
- connection gitUrl
120
- developerConnection gitUrl
121
- url siteUrl
122
-
123
- }
124
- }
125
- }
126
- }
127
- }
128
-
129
100
task sourcesJar (type : Jar ) {
101
+ archiveClassifier. set(' sources' )
130
102
from android. sourceSets. main. java. srcDirs
131
- classifier = ' sources'
132
103
}
133
104
134
105
task javadoc (type : Javadoc ) {
135
106
source = android. sourceSets. main. java. srcDirs
136
107
classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
108
+ failOnError = false // TODO: fix javadoc issues
137
109
}
138
110
139
111
task javadocJar (type : Jar , dependsOn : javadoc) {
140
- classifier = ' javadoc'
112
+ archiveClassifier . set( ' javadoc' )
141
113
from javadoc. destinationDir
142
114
}
143
115
@@ -146,29 +118,85 @@ artifacts {
146
118
archives sourcesJar
147
119
}
148
120
149
- bintray {
150
- def localProperties = new Properties ()
151
- def localPropertiesFile = rootProject. file(' local.properties' )
152
- if (localPropertiesFile. exists()) {
153
- localProperties. load(localPropertiesFile. newDataInputStream())
154
- user = localProperties. getProperty(" bintray.user" )
155
- key = localProperties. getProperty(" bintray.apikey" )
156
- }
121
+ def siteUrl = ' https://github.com/libpd/pd-for-android'
157
122
158
- if (user != null && key != null ) {
159
- logger. info(' Bintray user/apikey found' )
160
- } else {
161
- logger. info(' Bintray user/apikey not found' )
123
+ publishing {
124
+ publications {
125
+ maven(MavenPublication ) {
126
+ groupId group
127
+ artifactId archivesBaseName
128
+ version version
129
+ // TODO: include aar artifact from components?
130
+ artifact " ${ buildDir} /outputs/aar/${ archivesBaseName} .aar"
131
+ // ossrh requires javadoc and sources
132
+ artifact sourcesJar
133
+ artifact javadocJar
134
+
135
+ pom {
136
+ name = " ${ project.group} :${ project.archivesBaseName} "
137
+ description = ' Pure Data for Android'
138
+ url = siteUrl
139
+ licenses {
140
+ license {
141
+ name = ' BSD New'
142
+ url = ' https://raw.githubusercontent.com/libpd/pd-for-android/master/PdCore/LICENSE.txt'
143
+ }
144
+ }
145
+ developers {
146
+ developer {
147
+ id = ' joebowbeer'
148
+ name = ' Joe Bowbeer'
149
+ }
150
+ // TODO: Add all other devs here...
151
+ }
152
+ scm {
153
+ connection = ' scm:git:https://github.com/libpd/pd-for-android'
154
+ developerConnection = ' scm:git:ssh://github.com/libpd/pd-for-android.git'
155
+ url = siteUrl
156
+ }
157
+ }
158
+ }
162
159
}
160
+ }
163
161
164
- configurations = [' archives' ]
165
- pkg {
166
- repo = " maven"
167
- name = " pd-for-android"
168
- userOrg = ' pd-for-android'
169
- websiteUrl = siteUrl
170
- vcsUrl = gitUrl
171
- licenses = [" BSD New" ]
172
- publish = false
162
+ // configure publishing to a local directory for testing (not necessary)
163
+ // ./gradlew publishMavenPublicationToLocalRepository
164
+ // tree ./PdCore/build/repos
165
+ publishing {
166
+ repositories {
167
+ maven {
168
+ name = ' local'
169
+ def releasesRepoUrl = " $buildDir /repos/releases"
170
+ def snapshotsRepoUrl = " $buildDir /repos/snapshots"
171
+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
172
+ }
173
173
}
174
174
}
175
+
176
+ // ossrh requires signed releases, but not snapshots.
177
+ // This configures signing if a key is found.
178
+ // The following environment variables provide a signing key and passphrase:
179
+ // export ORG_GRADLE_PROJECT_signingKey=`cat private.pgp`
180
+ // export ORG_GRADLE_PROJECT_signingPassword="<passphrase>"
181
+ // After making the above available, you can try signing using
182
+ // ./gradlew signMavenPublication
183
+ def hasSigningKey = project. hasProperty(' signingKeyId' ) || project. hasProperty(' signingKey' )
184
+ if (hasSigningKey) {
185
+ sign(project)
186
+ }
187
+ void sign (Project project ) {
188
+ project. signing {
189
+ required { project. gradle. taskGraph. hasTask(' required' ) }
190
+ def signingKeyId = project. findProperty(' signingKeyId' )
191
+ def signingKey = project. findProperty(' signingKey' )
192
+ def signingPassword = project. findProperty(' signingPassword' )
193
+ if (signingKeyId) {
194
+ // use in-memory ascii-armored OpenPGP subkey
195
+ useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
196
+ } else if (signingKey) {
197
+ // use in-memory ascii-armored key
198
+ useInMemoryPgpKeys(signingKey, signingPassword)
199
+ }
200
+ sign publishing. publications. maven
201
+ }
202
+ }
0 commit comments