-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaven-push-javalib.gradle
67 lines (56 loc) · 1.54 KB
/
maven-push-javalib.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
apply plugin: 'maven'
install {
repositories.mavenInstaller {
pom.project {
group GROUP_MAVEN_PUSH
artifactId POM_ARTIFACT_ID
version VERSION_NAME
}
}
}
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}
def getOutputDir() {
if (isReleaseBuild()) {
return "${project.buildDir}/releases"
} else {
return "${project.buildDir}/snapshots"
}
}
def getDestUrl() {
if (isReleaseBuild()) {
return "s3://plensee-maven/android/releases"
} else {
return "s3://plensee-maven/android/snapshots"
}
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///" + getOutputDir()) //can also be used to copy to local file
//repository(url: getDestUrl()) // for copying directly to S3
pom.groupId = GROUP_MAVEN_PUSH
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
}
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task copyToS3(type: Exec) {
commandLine 'aws', 's3', 'cp', '--recursive', getOutputDir(), getDestUrl()
}
copyToS3.dependsOn uploadArchives
}