forked from microsoft/fluentui-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
110 lines (104 loc) · 4.71 KB
/
publish.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
apply plugin: 'maven-publish'
apply plugin: 'signing'
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
ext["signing.keyId"] = project.hasProperty('GPGSigningKeyID') ? "$GPGSigningKeyID" : ''
ext["signing.password"] = project.hasProperty('GPGSigningPassword') ? "$GPGSigningPassword" : ''
ext["signing.secretKeyRingFile"] = project.hasProperty('SigningSecretKeyRingFile') ? "$SigningSecretKeyRingFile" : ''
ext["ossrhUsername"] = project.hasProperty('OSSRHUsername') ? "$OSSRHUsername" : ''
ext["ossrhPassword"] = project.hasProperty('OSSRHPassword') ? "$OSSRHPassword" : ''
ext["sonatypeStagingProfileId"] = project.hasProperty('SonatypeStagingProfileID') ? "$SonatypeStagingProfileID" : ''
}
project.ext.publishingFunc = { artifactIdName ->
publishing {
repositories {
maven {
url 'https://pkgs.dev.azure.com/microsoftdesign/fluentui-native/_packaging/fluentui-android/maven/v1'
credentials {
username = project.hasProperty("mavenUserName") ? "$mavenUserName" : ""
password = project.hasProperty("mavenPassword") ? "$mavenPassword" : ""
}
}
maven {
name = "sonatype"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
publications {
FluentUI(MavenPublication) {
groupId 'com.microsoft.fluentui'
artifactId artifactIdName
version = android.defaultConfig.versionName
artifact(sourceJar)
artifact(bundleReleaseAar)
pom {
name = artifactIdName
description = 'Fluent UI Android, Module : '.concat(artifactIdName)
url = project.ext.github_url
licenses {
license {
name = project.ext.license_type
url = project.ext.license_url
}
}
developers {
developer {
id = project.ext.developer_id
name = project.ext.developer_name
email = project.ext.developer_email
}
}
scm {
connection = project.ext.scm_connection
developerConnection = project.ext.scm_dev_connection
url = project.ext.scm_url
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
if (it.group != null && (it.name != null && it.name != "unspecified") && it.version != null) {
def dependencyNode = dependenciesNode.appendNode('dependency')
if (it instanceof ProjectDependency) {
dependencyNode.appendNode('groupId', 'com.microsoft.fluentui')
dependencyNode.appendNode('artifactId', it.name)
def artifactName = it.name.replaceAll('-', '_') + '_versionid'
dependencyNode.appendNode('version', getProperty(artifactName).toString())
} else {
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
}
}
}
nexusStaging {
packageGroup = 'com.microsoft.fluentui'
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
}
signing {
sign publishing.publications
}