forked from microsoft/azure-tools-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
167 lines (137 loc) · 4.54 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import org.gradle.internal.os.OperatingSystem
import org.ajoberstar.grgit.*
plugins {
id "org.ajoberstar.grgit" version "4.1.0"
}
def gradleExec = file(OperatingSystem.current().isWindows() ? "gradlew.bat" : "gradlew")
def mavenExec = file(OperatingSystem.current().isWindows() ? "mvnw.cmd" : "mvnw")
def IJ_VERSION_LATEST = IJ_VERSION_MINOR?.trim()?.isEmpty() ? IJ_VERSION_MAJOR : "${IJ_VERSION_MAJOR}.${IJ_VERSION_MINOR}"
def mavenArgs = { conf ->
List<String> mvnArgs = (forceClean.toBoolean() ? [ 'clean' ] : []) + conf.goals + [
'-B',
'-T 1C',
'-Didea.io.use.fallback=true' // A workaround to remove Maven Kotlin script exec warnings on Windows
]
if (conf.pom != null) {
mvnArgs << "-f" << conf.pom.toString()
}
if (skipTest.toBoolean()) {
mvnArgs << "-Dmaven.test.skip=true"
}
if (skipCheckstyle.toBoolean()) {
mvnArgs << "-Dcheckstyle.skip=true"
}
boolean isMavenQuiet = mavenQuiet.equalsIgnoreCase("auto")
? (!(logger.isInfoEnabled() || logger.isDebugEnabled()))
: mavenQuiet.toBoolean()
if (isMavenQuiet) {
mvnArgs << "-q"
}
mvnArgs
}
ext.maven = { Closure mavenClosure ->
def envVars = [:]
envVars['JAVA_OPTS'] = "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m"
exec {
executable mavenExec
args mavenArgs(configure([:], mavenClosure))
}
tasks.withType(Exec) { environment << envVars }
}
task buildToolkitsLib {
doLast {
logger.info('Building Toolkits Lib ...')
def tempDir = File.createTempDir()
tempDir.deleteOnExit()
Grgit.clone(dir: file(tempDir), uri: 'https://github.com/microsoft/azure-maven-plugins.git')
maven {
goals = "install"
pom = file("${tempDir}/azure-toolkit-libs/pom.xml")
}
}
}
task buildUtils {
dependsOn buildToolkitsLib
doLast {
logger.info('Building Utils ...')
maven {
goals = "install"
pom = file('Utils/pom.xml')
}
}
}
task buildAdditionalLibrary {
dependsOn buildUtils
doLast {
maven {
goals = "install"
pom = file('PluginsAndFeatures/AddLibrary/AzureLibraries/pom.xml')
}
}
}
task buildEclipse {
dependsOn buildUtils, buildAdditionalLibrary
doLast {
logger.info('Building Eclipse plugin ...')
maven {
goals = "install"
pom = file('PluginsAndFeatures/azure-toolkit-for-eclipse/pom.xml')
}
copy {
from file('PluginsAndFeatures/azure-toolkit-for-eclipse/WindowsAzurePlugin4EJ/target')
include 'WindowsAzurePlugin4EJ*.zip'
into file(ARTIFACTS_DIR)
}
}
}
task buildIntelliJ {
dependsOn buildUtils, buildAdditionalLibrary
doLast {
logger.info('Building IntelliJ plugin ...')
def ijBuildArgs = (forceClean.toBoolean() ? [ 'clean' ] : []) + [
'buildPlugin',
'spotbugsMain',
'bundleBuildIdeaZip',
'-s',
"-Pintellij_version=IC-$IJ_VERSION_LATEST",
"-Pdep_plugins=org.intellij.scala:$IJ_SCALA_VERSION_LATEST"
]
if (INJECT_INTELLIJ_VERSION.toBoolean()) {
ijBuildArgs << "-PpatchPluginXmlSinceBuild=$IJ_VERSION_MAJOR_BUILD"
}
// Transfer root Gradle start parameters into IntelliJ Gradle build
if (logger.isInfoEnabled()) {
ijBuildArgs << '--info'
}
if (logger.isDebugEnabled()) {
ijBuildArgs << '--debug'
}
switch (gradle.startParameter.showStacktrace) {
case ShowStacktrace.ALWAYS:
ijBuildArgs << '--stacktrace'
break
case ShowStacktrace.ALWAYS_FULL:
ijBuildArgs << '--full-stacktrace'
break
default:
break
}
exec {
workingDir file('PluginsAndFeatures/azure-toolkit-for-intellij')
executable gradleExec
args ijBuildArgs
}
copy {
from file('PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/')
into file(ARTIFACTS_DIR)
rename '(.*).zip', '$1' + "-${IJ_VERSION_LATEST}.zip"
}
}
}
task buildAll {
dependsOn buildUtils, buildAdditionalLibrary, buildEclipse, buildIntelliJ
doLast {
logger.info("ALL BUILD SUCCESSFUL")
}
}
defaultTasks 'buildAll'