Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
aa5270e7
Commit
aa5270e7
authored
6 years ago
by
Dmitriy.Panov
Browse files
Options
Download
Email Patches
Plain Diff
JBR-1295: JBR layout with top level directories (jbr, jbrsdk) support
parent
9060dc1c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
build/dependencies/setupJbre.gradle
+7
-2
build/dependencies/setupJbre.gradle
build/dependencies/setupJdk.gradle
+21
-3
build/dependencies/setupJdk.gradle
platform/build-scripts/groovy/org/jetbrains/intellij/build/BuildOptions.groovy
+5
-0
...s/groovy/org/jetbrains/intellij/build/BuildOptions.groovy
platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BundledJreManager.groovy
+31
-35
...rg/jetbrains/intellij/build/impl/BundledJreManager.groovy
platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MacDmgBuilder.groovy
+3
-2
...vy/org/jetbrains/intellij/build/impl/MacDmgBuilder.groovy
with
67 additions
and
42 deletions
+67
-42
build/dependencies/setupJbre.gradle
+
7
-
2
View file @
aa5270e7
...
...
@@ -63,18 +63,23 @@ def createJbreTasks(String defaultBuild, int version, String targetOs, String pr
}
}
@SuppressWarnings
(
"GrMethodMayBeStatic"
)
def
jreUrl
()
{
// base url of TeamCity build to download JRE from
System
.
getProperty
(
'intellij.jre.teamcity.build.url'
)
?:
'https://cache-redirector.jetbrains.com/intellij-jbr'
}
def
createDownloadJbreTask
(
String
artifactName
,
String
build
,
boolean
doRepackage
)
{
def
outputDir
=
"$project.buildDir/jbre"
def
suffix
=
doRepackage
?
'_origin'
:
''
def
outputFile
=
"$outputDir/${artifactName}${suffix}.tar.gz"
task
(
"download${artifactName.capitalize()}"
)
{
def
jdkRepo
=
'https://cache-redirector.jetbrains.com/intellij-jbr'
inputs
.
property
(
'build'
,
build
)
outputs
.
file
(
outputFile
)
doLast
{
logger
.
info
(
"Downloading $artifactName to $outputFile"
)
download
{
src
"$
jdkRepo
/${artifactName}.tar.gz"
src
"$
{jreUrl()}
/${artifactName}.tar.gz"
dest
outputFile
tempAndMove
true
timeout
TimeUnit
.
MINUTES
.
toMillis
(
30
).
toInteger
()
...
...
This diff is collapsed.
Click to expand it.
build/dependencies/setupJdk.gradle
+
21
-
3
View file @
aa5270e7
import
org.gradle.internal.os.OperatingSystem
import
java.nio.file.Files
import
java.nio.file.Paths
import
java.util.concurrent.TimeUnit
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
...
...
@@ -96,9 +98,25 @@ def unpackJdk(jdkArchive, outputDir) {
else
{
exec
{
commandLine
'mkdir'
,
'-p'
,
outputDir
}
exec
{
commandLine
'tar'
,
'xpf'
,
"$jdkArchive.absolutePath"
,
'--directory'
,
outputDir
}
if
(
currentOs
.
isMacOsX
()
&&
file
(
"${outputDir}/jdk/Contents"
).
exists
())
{
exec
{
commandLine
'mv'
,
"${outputDir}/jdk/Contents"
,
outputDir
}
exec
{
commandLine
'rm'
,
'-rf'
,
"${outputDir}/jdk"
}
}
def
rootDirs
=
[
'jbrsdk'
,
'jbr'
,
'jdk'
]
if
(
file
(
outputDir
).
list
()?.
any
{
rootDirs
.
contains
(
it
)
})
{
// unpack top level jbrsdk/jbr/jdk directory
file
(
outputDir
).
listFiles
().
findAll
{
rootDirs
.
contains
(
it
.
name
)
}.
each
{
rootDir
->
rootDir
.
listFiles
().
each
{
File
file
->
if
(
currentOs
.
isWindows
())
{
Files
.
move
(
Paths
.
get
(
file
.
absolutePath
),
Paths
.
get
(
outputDir
).
resolve
(
file
.
name
))
}
else
{
exec
{
commandLine
'mv'
,
file
,
outputDir
}
}
}
if
(
currentOs
.
isWindows
())
{
rootDir
.
deleteDir
()
}
else
{
exec
{
commandLine
'rm'
,
'-rf'
,
rootDir
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
platform/build-scripts/groovy/org/jetbrains/intellij/build/BuildOptions.groovy
+
5
-
0
View file @
aa5270e7
...
...
@@ -128,6 +128,11 @@ class BuildOptions {
*/
String
bundledJreBuild
=
System
.
getProperty
(
"intellij.build.bundled.jre.build"
)
/**
* If {@code true} then JRE top directory was renamed to JBR, see JBR-1295
*/
boolean
bundledJreRenamedToJbr
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
'intellij.build.bundled.jreRenamedToJbr'
))
/**
* Directory path to unpack Jetbrains JDK builds into
*/
...
...
This diff is collapsed.
Click to expand it.
platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BundledJreManager.groovy
+
31
-
35
View file @
aa5270e7
...
...
@@ -52,7 +52,6 @@ class BundledJreManager {
return
version
}
@CompileDynamic
String
extractSecondJre
(
String
osName
,
String
secondJreBuild
)
{
String
targetDir
=
"$baseDirectoryForJre/secondJre.${osName}_${JvmArchitecture.x64}"
if
(
new
File
(
targetDir
).
exists
())
{
...
...
@@ -73,20 +72,7 @@ class BundledJreManager {
String
destination
=
"$targetDir/jre64"
def
destinationDir
=
new
File
(
destination
)
if
(
destinationDir
.
exists
())
destinationDir
.
deleteDir
()
if
(
SystemInfo
.
isWindows
)
{
buildContext
.
ant
.
untar
(
src:
archive
.
absolutePath
,
dest:
destination
,
compression:
'gzip'
)
}
else
{
//'tar' command is used instead of Ant task to ensure that executable flags will be preserved
buildContext
.
ant
.
mkdir
(
dir:
destination
)
buildContext
.
ant
.
exec
(
executable:
"tar"
,
dir:
archive
.
parent
)
{
arg
(
value:
"-xf"
)
arg
(
value:
archive
.
name
)
arg
(
value:
"--directory"
)
arg
(
value:
destination
)
}
}
untar
(
archive
,
destination
)
}
return
targetDir
}
...
...
@@ -125,8 +111,6 @@ class BundledJreManager {
return
"jre-for-${buildContext.buildNumber}.tar.gz"
}
@CompileDynamic
private
String
extractJre
(
String
osName
,
JvmArchitecture
arch
=
JvmArchitecture
.
x64
,
JreVendor
vendor
=
JreVendor
.
JetBrains
)
{
String
vendorSuffix
=
vendor
==
JreVendor
.
Oracle
?
".oracle"
:
""
String
targetDir
=
arch
==
JvmArchitecture
.
x64
?
...
...
@@ -147,29 +131,41 @@ class BundledJreManager {
destination
=
"$targetDir/jre32"
}
buildContext
.
messages
.
progress
(
"Extracting JRE from '$archive.name' archive"
)
if
(
SystemInfo
.
isWindows
)
{
buildContext
.
ant
.
untar
(
src:
archive
.
absolutePath
,
dest:
destination
,
compression:
'gzip'
)
{
if
(!
buildContext
.
isBundledJreModular
())
{
cutdirsmapper
(
dirs:
1
)
}
untar
(
archive
,
destination
)
}
return
targetDir
}
/**
* @param archive linux or windows JRE archive
*/
@CompileDynamic
private
def
untar
(
File
archive
,
String
destination
)
{
// jbr8 with `jre` top level directory
def
unpackTopLevelDir
=
!
buildContext
.
isBundledJreModular
()
||
// or jbr11+ with `jbr` top level directory
buildContext
.
options
.
bundledJreRenamedToJbr
if
(
SystemInfo
.
isWindows
)
{
buildContext
.
ant
.
untar
(
src:
archive
.
absolutePath
,
dest:
destination
,
compression:
'gzip'
)
{
if
(
unpackTopLevelDir
)
{
cutdirsmapper
(
dirs:
1
)
}
}
else
{
//'tar' command is used instead of Ant task to ensure that executable flags will be preserved
buildContext
.
ant
.
mkdir
(
dir:
destination
)
buildContext
.
ant
.
exec
(
executable:
"tar"
,
dir:
archive
.
parent
)
{
arg
(
value:
"-xf"
)
arg
(
value:
archive
.
name
)
if
(!
buildContext
.
isBundledJreModular
())
{
arg
(
value:
"--strip"
)
arg
(
value:
"1"
)
}
arg
(
value:
"--directory"
)
arg
(
value:
destination
)
}
else
{
// 'tar' command is used instead of Ant task to ensure that executable flags will be preserved
buildContext
.
ant
.
mkdir
(
dir:
destination
)
buildContext
.
ant
.
exec
(
executable:
"tar"
,
dir:
archive
.
parent
)
{
arg
(
value:
"-xf"
)
arg
(
value:
archive
.
name
)
if
(
unpackTopLevelDir
)
{
arg
(
value:
"--strip"
)
arg
(
value:
"1"
)
}
arg
(
value:
"--directory"
)
arg
(
value:
destination
)
}
}
return
targetDir
}
private
File
dependenciesDir
()
{
...
...
This diff is collapsed.
Click to expand it.
platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MacDmgBuilder.groovy
+
3
-
2
View file @
aa5270e7
...
...
@@ -104,13 +104,14 @@ class MacDmgBuilder {
def
zipRoot
=
MacDistributionBuilder
.
getZipRoot
(
buildContext
,
customizer
)
String
suffix
=
"-no-jdk"
,
javaExePath
=
null
def
topLevelDir
=
buildContext
.
options
.
bundledJreRenamedToJbr
?
'jbr'
:
'jdk'
if
(
secondJreArchive
!=
null
)
{
suffix
=
"-jbr${buildContext.bundledJreManager.getSecondJreVersion()}"
javaExePath
=
"../
jdk
/Contents/Home/bin/java"
javaExePath
=
"../
${topLevelDir}
/Contents/Home/bin/java"
}
else
if
(
jreArchivePath
!=
null
)
{
suffix
=
buildContext
.
bundledJreManager
.
jreSuffix
()
javaExePath
=
"../
jdk
/Contents/Home/${buildContext.isBundledJreModular() ? '' : 'jre/'}bin/java"
javaExePath
=
"../
${topLevelDir}
/Contents/Home/${buildContext.isBundledJreModular() ? '' : 'jre/'}bin/java"
}
def
productJsonDir
=
new
File
(
buildContext
.
paths
.
temp
,
"mac.dist.product-info.json.dmg$suffix"
).
absolutePath
MacDistributionBuilder
.
generateProductJson
(
buildContext
,
productJsonDir
,
javaExePath
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help