-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
92 lines (73 loc) · 3.9 KB
/
build.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
apply plugin: 'application'
apply plugin: 'distribution'
apply plugin: 'maven-publish'
def secretsProperties = new Properties()
project.ext.projectreponame = project.property('repo.name')
project.ext.buildDependencyRepoName = project.property('build.dependency.reponame')
project.ext.buildDependencyOrganization = project.property('build.dependency.organization')
def buildDependencySecretTokenSource = project.property('build.dependency.secret.token.source')
def tempbuildDependencyToken = System.getenv("${buildDependencySecretTokenSource}")
if(tempbuildDependencyToken==null||tempbuildDependencyToken==""){
def secretsPropertiesFile = rootProject.file("./secrets.properties")
secretsProperties.load(new FileInputStream(secretsPropertiesFile))
project.ext.buildDependencyToken = secretsProperties['build.dependency.organization.token']
}else{
project.ext.buildDependencyToken = tempbuildDependencyToken
}
project.ext.buildDependencyURL = project.property('build.dependency.url')
//Build SNAPSHOT details
project.ext.buildSnapshotUrl = project.property('build.snapshot.url')
project.ext.buildSnapshotOrganizationName = project.property('build.snapshot.organization')
project.ext.buildSnapshotRepoName = project.property('build.snapshot.reponame')
def buildSnapshotSecretTokenSource = project.property('build.snapshot.secret.token.source')
def tempbuildSnapshotToken = System.getenv("${buildSnapshotSecretTokenSource}")
if(tempbuildSnapshotToken==null||tempbuildSnapshotToken==""){
project.ext.buildSnapshotToken = secretsProperties['build.snapshot.organization.token']
}else project.ext.buildSnapshotToken = tempbuildSnapshotToken
def buildSnapshotRunNumberSource = project.property('build.snapshot.run.number.source')
def buildSnapshotRunNumber = System.getenv("${buildSnapshotRunNumberSource}")
if(buildSnapshotRunNumber==null||buildSnapshotRunNumber==""){
buildSnapshotRunNumber = "0"
}
project.ext.providerPackageName = project.property("provider.package.name")
project.ext.providerExtPackageName = project.property("providerext.package.name")
repositories {
// Use JCenter for resolving dependencies.
mavenCentral()
maven{
url "${project.buildDependencyURL}/${project.buildDependencyOrganization}/${project.buildDependencyRepoName}"//#####################################--build.dependency.url
credentials {
username project.buildDependencyOrganization //##############################--build.dependency.organization
password project.buildDependencyToken //secretsProperties['build.dependency.organization.token']//#############"e8a7800a8044f4386447b946073e4325435efe7d"
}
}
}
task createProjectZip(type: Zip, group: 'wm') {
archiveName "${projectreponame.toLowerCase()}.zip"
destinationDir file("build/distributions")
from "${rootDir}/build/tmpzip" //code,connectors,config,resources"
description "Assemble archive"
exclude "build"
exclude "libs"
}
publishing {
repositories {
maven {
name = "SNAPSHOT"
url = "${project.buildSnapshotUrl}/${project.buildSnapshotOrganizationName}/${project.buildSnapshotRepoName}"
credentials {
username project.buildSnapshotOrganizationName
password project.buildSnapshotToken//System.getenv("GH_SECRET_TOKEN")//secretsProperties['GH_SEC_TOKEN']//password "e8a7800a8044f4386447b946073e4325435efe7d"//project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
groupId = 'com.sag.connectors'
artifactId = "${rootProject.name.toLowerCase()}"
version = "${project.property('build.version.major')}.${project.property('build.version.minor')}.${project.property('build.version.micro')}-${buildSnapshotRunNumber}"
artifact source: createProjectZip, extension: 'zip'
}
}
}
publish.dependsOn createProjectZip