Skip to content

Commit f3ed19e

Browse files
authored
add common publishing tasks (#252)
Signed-off-by: garyschulte <garyschulte@gmail.com>
1 parent 6751c3b commit f3ed19e

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

common/build.gradle

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515

1616
plugins {
1717
id 'java-library'
18+
id 'maven-publish'
19+
id 'com.jfrog.artifactory' version '5.2.3'
1820
}
1921

2022
dependencies {
2123
implementation 'net.java.dev.jna:jna:5.12.1'
2224
}
2325
jar {
24-
archiveBaseName = 'common'
26+
archiveBaseName = 'besu-native-common'
2527
includeEmptyDirs = false
2628
manifest {
2729
attributes(
@@ -34,3 +36,67 @@ jar {
3436
}
3537
}
3638

39+
40+
task sourcesJar(type: Jar, dependsOn: classes) {
41+
archiveBaseName = 'besu-native-common'
42+
archiveClassifier = 'sources'
43+
from sourceSets.main.allSource
44+
}
45+
46+
task javadocJar(type: Jar, dependsOn: javadoc) {
47+
archiveBaseName = 'besu-native-common'
48+
archiveClassifier = 'javadoc'
49+
from javadoc.destinationDir
50+
}
51+
52+
publishing {
53+
publications {
54+
mavenJava(MavenPublication) {
55+
groupId "org.hyperledger.besu"
56+
artifactId 'besu-native-common'
57+
version "${project.version}"
58+
59+
from components.java
60+
artifact sourcesJar
61+
artifact javadocJar
62+
63+
pom {
64+
name = "Besu Native - ${project.name}"
65+
description = 'Shared lib for besu-native implementations'
66+
url = 'http://github.com/hyperledger/besu-native'
67+
licenses {
68+
license {
69+
name = 'The Apache License, Version 2.0'
70+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
71+
}
72+
}
73+
scm {
74+
connection = 'scm:git:git://github.com/hyperledger/besu-native.git'
75+
developerConnection = 'scm:git:ssh://github.com/hyperledger/besu-native.git'
76+
url = 'https://github.com/hyperledger/besu-native'
77+
}
78+
}
79+
}
80+
}
81+
}
82+
83+
def artifactoryUser = project.hasProperty('artifactoryUser') ? project.property('artifactoryUser') : System.getenv('ARTIFACTORY_USER')
84+
def artifactoryKey = project.hasProperty('artifactoryApiKey') ? project.property('artifactoryApiKey') : System.getenv('ARTIFACTORY_KEY')
85+
def artifactoryRepo = System.getenv('ARTIFACTORY_REPO') ?: 'besu-maven'
86+
def artifactoryOrg = System.getenv('ARTIFACTORY_ORG') ?: 'hyperledger'
87+
88+
artifactory {
89+
contextUrl = "https://hyperledger.jfrog.io/${artifactoryOrg}"
90+
publish {
91+
repository {
92+
repoKey = artifactoryRepo
93+
username = artifactoryUser
94+
password = artifactoryKey
95+
}
96+
defaults {
97+
publications('mavenJava')
98+
publishArtifacts = true
99+
publishPom = true
100+
}
101+
}
102+
}

0 commit comments

Comments
 (0)