forked from corretto/corretto-8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
128 lines (115 loc) · 4.14 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
/*
* Copyright (c) 2019, 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.
*/
import org.apache.tools.ant.taskdefs.condition.Os
import static org.apache.tools.ant.taskdefs.condition.Os.OS_NAME
import static org.apache.tools.ant.taskdefs.condition.Os.OS_ARCH
Properties openJfxVersion = readAsProperties('upstream.version')
configurations {
source
}
repositories {
ivy {
url 'https://hg.openjdk.java.net'
patternLayout {
artifact '[organization]/[module]/rt/archive/[revision].[ext]'
metadataSources {
artifact()
}
}
}
}
dependencies {
source "openjfx:8u-dev:${openJfxVersion.getProperty('tag')}@tar.gz"
}
task unpackSource(type: Copy) {
if (project.hasProperty("openjfxPath")) {
// Get source from local path
def openjfx = file("${project.getProperty('openjfxPath')}")
doFirst {
assert openJfxVersion.getProperty('sha256') == sha256(openjfx)
}
from tarTree(openjfx)
into buildRoot
} else {
// Get source from HG
dependsOn configurations.source
doFirst {
assert openJfxVersion.getProperty('sha256') == sha256(configurations.source.singleFile)
}
from tarTree(configurations.source.singleFile)
into buildRoot
}
}
task patchJfx {
dependsOn unpackSource
doLast {
fileTree('patches/shared').matching {
include '*.patch'
}.files.sort().each { f ->
ant.patch(patchfile: f,
dir: "$buildRoot/rt-${openJfxVersion.getProperty('tag')}", strip: "1", failonerror: true)
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
fileTree("patches/windows").matching {
include '*.patch'
}.files.sort().each { f ->
ant.patch(patchfile: f,
dir: "$buildRoot/rt-${openJfxVersion.getProperty('tag')}", strip: "1", failonerror: true)
}
} else {
fileTree("patches/${OS_NAME}").matching {
include '*.patch'
}.files.sort().each { f ->
ant.patch(patchfile: f,
dir: "$buildRoot/rt-${openJfxVersion.getProperty('tag')}", strip: "1", failonerror: true)
}
}
}
}
task buildJfx(type: Exec) {
dependsOn patchJfx
workingDir "$buildRoot/rt-${openJfxVersion.getProperty('tag')}"
commandLine 'bash', 'gradlew', 'sdk',
'-PCOMPILE_WEBKIT=false',
'-PCOMPILE_MEDIA=false',
'-PBUILD_JAVADOC=false',
'-PBUILD_SRC_ZIP=true',
'-PCONF=Release'
outputs.dir "$workingDir/build/sdk"
}
task packageJfx(type: Tar) {
dependsOn buildJfx
archiveName "amazon-corretto-openjfx-${openJfxVersion.getProperty('tag')}-${OS_NAME}-${OS_ARCH}.tar.gz"
compression Compression.GZIP
from buildJfx.outputs
}
Properties readAsProperties(String filename) {
Properties prop = new Properties()
file(filename).withInputStream { prop.load(it) }
return prop
}
String sha256(File file) {
ant.checksum(file: file, property: "sha256-${file.name}", algorithm: 'SHA-256')
return ant.properties["sha256-${file.name}"]
}
artifacts {
archives packageJfx
}