forked from corretto/corretto-8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
240 lines (222 loc) · 9.71 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/*
* Copyright (c) 2018, Amazon.com, Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Amazon designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// Tasks can refer to version information using the project.version
// property. For an example of its usage, see ':installers:linux:rpm:buildLogic'
// where the version numbers are used to populate a templated RPM spec file.
import org.apache.tools.ant.taskdefs.condition.Os
allprojects {
apply plugin: 'base'
configurations {
compile {
transitive = false
}
}
version = {
def full = file('version.txt').text.trim()
def tokens = full.tokenize(".")
[full : full,
major : tokens[0],
update : tokens[1],
build : tokens[2],
revision: tokens[3],
upstream: "1.${tokens[0]}.0_${tokens[1]}.b${tokens[2]}"]
}.call()
buildDir = 'corretto-build'
ext {
buildRoot = file("$buildDir/buildRoot")
distributionDir = file("$buildDir/distributions")
packageInfo = [
url : "https://github.com/corretto/corretto-${project.version.major}",
vendor : 'Amazon',
packager : 'Amazon',
license : 'ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv2 and GPLv2 with ' +
'exceptions and IJG and LGPLv2+ and MIT and MPLv2.0 and Public Domain and W3C and zlib.',
maintainer: 'Amazon Corretto Team <[email protected]>',
buildHost : 'build.amazon.com'
]
jdkTools = ['javac', 'appletviewer', 'extcheck', 'extcheck', 'jar', 'jarsigner', 'java-rmi.cgi', 'javadoc',
'javah', 'javap', 'jcmd', 'jconsole', 'jdb', 'jdeps', 'jhat', 'jinfo', 'jmap', 'jps', 'jrunscript',
'jsadebugd', 'jstack', 'jstat', 'jstatd', 'native2ascii', 'rmic', 'schemagen', 'serialver',
'wsgen', 'wsimport', 'xjc']
jreTools = ['java', 'jjs', 'keytool', 'orbd', 'pack200', 'policytool', 'rmid', 'rmiregistry',
'servertool', 'tnameserv', 'unpack200']
configurationFiles = [
"jre/lib/calendars.properties",
"jre/lib/logging.properties",
"jre/lib/net.properties",
"jre/lib/security/policy/limited/local_policy.jar",
"jre/lib/security/policy/limited/US_export_policy.jar",
"jre/lib/security/policy/unlimited/local_policy.jar",
"jre/lib/security/policy/unlimited/US_export_policy.jar",
"jre/lib/security/blacklisted.certs",
"jre/lib/security/java.policy",
"jre/lib/security/java.security"
];
def milestone = project.findProperty("corretto.milestone") ?: "fcs"
correttoCommonFlags = [
"--with-update-version=${project.version.update}",
"--with-build-number=b${project.version.build}",
"--with-corretto-revision=${project.version.revision}",
"--with-milestone=${milestone}",
'--enable-jfr',
'--with-vendor-name=Amazon.com Inc.',
'--with-vendor-url=https://aws.amazon.com/corretto/',
"--with-vendor-bug-url=https://github.com/corretto/corretto-${version.major}/issues/",
"--with-vendor-vm-bug-url=https://github.com/corretto/corretto-${version.major}/issues/"
]
is_x86 = false
if (project.hasProperty("x86")) {
is_x86 = Boolean.valueOf("${project.getProperty('x86')}")
}
if (is_x86) {
correttoCommonFlags += ["--with-target-bits=32"]
} else {
correttoCommonFlags += ["--with-target-bits=64"]
}
// Valid value: null, release, debug, fastdebug, slowdebug
correttoDebugLevel = "release" // Default: release
switch(project.findProperty("corretto.debug_level")) {
case null:
case "release":
break
case "fastdebug":
correttoDebugLevel = "fastdebug"
correttoCommonFlags += ['--with-debug-level=fastdebug']
break
case "debug":
case "slowdebug":
correttoDebugLevel = "slowdebug"
correttoCommonFlags += ['--with-debug-level=slowdebug', '--disable-zip-debug-info']
break
default:
throw new RuntimeException("Invalid corretto.debug_level")
}
def freetypeIncludePath = project.findProperty("corretto.freetype_include")
def freetypeLibPath = project.findProperty("corretto.freetype_lib")
def jnfFrameworkPath = project.findProperty("corretto.jnf_path")
// If freetype location is specified, pass to configure
if (freetypeIncludePath && freetypeLibPath) {
correttoCommonFlags += ["--with-freetype-include=${freetypeIncludePath}", "--with-freetype-lib=${freetypeLibPath}"]
}
// If JNF location is specified, pass to configure
if (jnfFrameworkPath) {
correttoCommonFlags += ["--with-extra-ldflags=-F${jnfFrameworkPath}"]
}
// customized flags. Identify the index of double dashes as the start of a flag
String extraConfig = project.findProperty("corretto.extra_config")
def lastIndex = -1
if (extraConfig != null) {
for (int index = extraConfig.indexOf("--"); index >= 0; index = extraConfig.indexOf("--", index + 1)) {
if (lastIndex != -1) {
correttoCommonFlags += extraConfig.substring(lastIndex, index).trim()
}
lastIndex = index
}
if (lastIndex != -1) {
correttoCommonFlags += extraConfig.substring(lastIndex).trim()
}
}
// Determine the system architecture
def jdkArch = ""
def os = ""
if (Os.isFamily(Os.FAMILY_MAC)) {
os = 'macosx'
nativeArch = ['uname', '-m'].execute().text.trim()
if (nativeArch == "arm64") {
jdkArch = "aarch64"
} else {
jdkArch = "x86_64"
}
} else if (Os.isFamily(Os.FAMILY_UNIX)) {
os = 'linux'
jdkArch = ['uname', '-m'].execute().text.trim()
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
os = 'windows'
def arch = System.getenv('PROCESSOR_ARCHITECTURE')
if (arch == 'AMD64') {
jdkArch = "x86_64"
} else { //x86
jdkArch = arch
}
} else {
throw new GradleException("OS is not supported")
}
// Ext property: correttoArch
switch (jdkArch) {
case 'x86':
case 'aarch64':
correttoArch = jdkArch
break
case 'x86_64':
correttoArch = 'x64'
break
default:
throw new GradleException("${jdkArch} is not supported")
}
// Call toString explicitly to avoid lazy evaluation
jdkImageName = "${os}-${jdkArch}-normal-server-${correttoDebugLevel}".toString()
// no debug level suffix for release build
if (correttoDebugLevel == "release") {
correttoJdkArchiveName = "amazon-corretto-${project.version.full}-${os}-${correttoArch}".toString()
} else {
correttoJdkArchiveName =
"amazon-corretto-${project.version.full}-${os}-${correttoArch}-${correttoDebugLevel}".toString()
}
correttoDebugSymbolsArchiveName = "amazon-corretto-debugsymbols-${project.version.full}-${os}-${correttoArch}".toString()
}
}
project(':openjdksrc') {
/**
* Compresses a snapshot of the source code used to perform the build.
*/
task sourceDistributionTarball(type: Tar) {
description 'Assemble source files required for building and distributing Corretto.'
compression Compression.GZIP
archiveName "amazon-corretto-source-${project.version.full}.tar.gz"
from fileTree(rootDir) {
exclude 'corretto-build/**'
include 'LICENSE',
'README.md',
'README',
'THIRD_PARTY_README',
'ASSEMBLY_EXCEPTION',
'Makefile',
'commitId.txt',
'version.txt',
'amazon-cacerts',
'common/**',
'configure',
'corba/**',
'get_source.sh',
'hotspot/**',
'jaxp/**',
'jaxws/**',
'jdk/**',
'langtools/**',
'make/**',
'nashorn/**',
'test/**'
}
}
artifacts {
archives sourceDistributionTarball
}
}