forked from JetBrains/commit-status-publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
124 lines (103 loc) · 3.05 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import java.nio.file.Paths
initializeWorkspace()
def localRepo = anyParamPath('TC_LOCAL_REPO')
def pluginVersion = anyParam('PluginVersion')
ext {
teamcityVersion = anyParam('teamcityVersion') ?: 'LOCAL-SNAPSHOT'
}
allprojects {
apply plugin: 'java'
group = 'org.jetbrains.teamcity'
version = pluginVersion
clean {
delete "target"
}
}
subprojects {
apply plugin: 'java'
repositories {
if (localRepo) {
maven {
name = "local-teamcity-artifacts"
url "file:///${localRepo}"
}
}
maven {
url = 'https://download.jetbrains.com/teamcity-repository'
}
maven {
url = 'https://repo.labs.intellij.net/teamcity'
}
maven {
url = 'https://cache-redirector.jetbrains.com/repo.maven.apache.org/maven2'
}
mavenLocal()
}
sourceCompatibility = '1.8'
}
task copyDependencies(type: Copy, dependsOn: ':commit-status-publisher-server:jar') {
project(':commit-status-publisher-server').configurations.getAt("runtime").setCanBeResolved(true)
println("implementation canBeResolved change to :" + project(':commit-status-publisher-server').configurations.getAt("runtime").canBeResolved)
from project(':commit-status-publisher-server').configurations.getAt("runtime")
include 'jsch*.jar'
into './build/dependencies'
}
task copyPluginFiles(type: Copy, dependsOn: ':commit-status-publisher-server:jar') {
from '.'
include 'teamcity-plugin.xml'
into './build/plugin-files'
expand(PluginVersion: pluginVersion)
}
task zipPlugin(type: Zip, dependsOn: ['copyDependencies', 'copyPluginFiles']) {
destinationDir = new File(rootDir, './target')
into('server') {
from project(':commit-status-publisher-server').configurations.runtime.allArtifacts.files
include '*'
from './build/dependencies'
include '*'
}
into('kotlin-dsl') {
from 'kotlin-dsl'
include 'CommitStatusPublisher.xml'
}
from './build/plugin-files'
include 'teamcity-plugin.xml'
archiveName = 'commit-status-publisher.zip'
}
build.dependsOn zipPlugin
def anyParamPath(String... names) {
def param = anyParam(names);
if (param == null || param.isEmpty()) {
return null
}
return (Paths.get(param).isAbsolute()) ?
Paths.get(param) : getRootDir().toPath().resolve(param)
}
def anyParam(String... names) {
def param
try {
param = names.findResult {
project.hasProperty(it) ? project.getProperty(it) : System.getProperty(it) ?: System.getenv(it) ?: null
}
if (param == null || param.isEmpty()) {
param = null
}
} finally {
println("AnyParam: $names -> $param")
}
return param
}
def initializeWorkspace() {
if (System.getProperty("idea.active") != null) {
println "Attempt to configure workspace in IDEA"
def coreVersionProperties = project.projectDir.toPath().parent.parent.resolve(".version.properties")
if (coreVersionProperties.toFile().exists()) {
def p = new Properties().tap {
it.load(new FileInputStream(coreVersionProperties.toFile()))
}
p.forEach { k,v ->
System.setProperty(k, v);
}
}
}
}