Skip to content

Commit

Permalink
Merge pull request OpenLiberty#7 from tjwatson/spring-boot-merge-master
Browse files Browse the repository at this point in the history
Spring boot merge master
  • Loading branch information
tjwatson authored Feb 8, 2018
2 parents ab6c331 + 23b94d8 commit 55a47e4
Show file tree
Hide file tree
Showing 1,093 changed files with 30,744 additions and 13,951 deletions.
1 change: 1 addition & 0 deletions dev/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ subprojects {
task publish { }
task releaseNeeded { dependsOn release }
task copyPiiFiles { }
task prereqFeatureResources { }
}

/* For Java 9 builds, set the --release compiler flag to keep bootclasspath in sync */
Expand Down
172 changes: 107 additions & 65 deletions dev/build.image/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,75 +66,106 @@ File packageDir = new File(project.buildDir, 'openliberty')
def props = new Properties()
rootProject.file('generated.properties').withInputStream { props.load(it) }

task packageOpenLiberty {
enabled props["ghe.build.type"] == null || !props["ghe.build.type"].contains("ifix")
dependsOn parent.subprojects.assemble
dependsOn copyGeneratedToBuildImageBinTools
dependsOn copyGeneratedToCnfLib
doLast {
// Create server in order to minify an image that only includes kind=ga features
delete project.file('wlp/usr/servers/packageOpenLiberty')
exec {
workingDir project.file('wlp/bin')
def args = ["create", "packageOpenLiberty"]
if (OperatingSystem.current().windows) {
commandLine = ["cmd", "/c", "server"] + args
} else {
commandLine = ["./server"] + args
}
}
String getGaFeatures() {
String features = ""
rootProject.fileTree(dir: '.', include: '*/*.feature').visit { element ->
if (element.isDirectory()) {
return
}
Properties featureProps = new Properties()
element.getFile().withInputStream { featureProps.load(it) }
if (featureProps['kind'] == 'ga' && featureProps['IBM-ShortName'] != null) {
String shortname = featureProps['IBM-ShortName']
features += "\n<feature>" + shortname + "</feature>"
}
}

features
}

try {
String features = ""
rootProject.fileTree(dir: '.', include: '*/*.feature').visit { element ->
if (element.isDirectory()) {
return
}
Properties featureProps = new Properties()
element.getFile().withInputStream { featureProps.load(it) }
if (featureProps['kind'] == 'ga' && featureProps['IBM-ShortName'] != null) {
String shortname = featureProps['IBM-ShortName']
features += "\n<feature>" + shortname + "</feature>"
}
}
class PackageLibertyWithFeatures extends DefaultTask {
String withFeatures
File outputTo


@TaskAction
void buildPackage() {
// Create server in order to minify an image that only includes kind=ga features
project.delete project.file('wlp/usr/servers/packageOpenLiberty')
project.exec {
workingDir project.file('wlp/bin')
def args = ["create", "packageOpenLiberty"]
if (OperatingSystem.current().windows) {
commandLine = ["cmd", "/c", "server"] + args
} else {
commandLine = ["./server"] + args
}
}

try {
def serverXml = project.file("wlp/usr/servers/packageOpenLiberty/server.xml")
serverXml.text = """<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<featureManager>${withFeatures}
</featureManager>
</server>
"""

File archive = new File(project.buildDir, 'openliberty.zip')
project.delete archive
project.exec {
workingDir project.file('wlp/bin')
def args = ["package", "packageOpenLiberty", "--archive=${archive}", "--include=minify"]
if (OperatingSystem.current().windows) {
commandLine = ["cmd", "/c", "server"] + args
} else {
commandLine = ["./server"] + args
}
}

// Postprocess to remove unwanted files
project.delete outputTo
project.copy {
from project.zipTree(project.file(archive))
exclude 'wlp/usr/servers/**'
exclude 'wlp/lib/versions/package_*'
into outputTo
}
} catch (all) {
println "-- EXCEPTION PACKAGING SERVER --"
println all
def messages = project.file("wlp/usr/servers/packageOpenLiberty/logs/messages.log")
if (messages.exists()) {
messages.eachLine { String line ->
println line
}
}
}
}

def serverXml = project.file("wlp/usr/servers/packageOpenLiberty/server.xml")
serverXml.text = """<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<featureManager>${features}
</featureManager>
</server>
"""
}

File archive = new File(project.buildDir, 'openliberty.zip')
delete archive
exec {
workingDir project.file('wlp/bin')
def args = ["package", "packageOpenLiberty", "--archive=${archive}", "--include=minify"]
if (OperatingSystem.current().windows) {
commandLine = ["cmd", "/c", "server"] + args
} else {
commandLine = ["./server"] + args
}
}
task packageOpenLiberty(type: PackageLibertyWithFeatures) {
enabled props["ghe.build.type"] == null || !props["ghe.build.type"].contains("ifix")
dependsOn parent.subprojects.assemble
dependsOn copyGeneratedToBuildImageBinTools
dependsOn copyGeneratedToCnfLib

withFeatures getGaFeatures()
outputTo packageDir

}

// Postprocess to remove unwanted files
delete packageDir
copy {
from zipTree(file(archive))
exclude 'wlp/usr/servers/**'
exclude 'wlp/lib/versions/package_*'
into packageDir
}
} catch (all) {
def messages = project.file("wlp/usr/servers/packageOpenLiberty/logs/messages.log")
if (messages.exists()) {
messages.eachLine { String line ->
println line
}
}
}
}
task packageOpenLibertyKernel(type: PackageLibertyWithFeatures) {
enabled props["ghe.build.type"] == null || !props["ghe.build.type"].contains("ifix")

dependsOn parent.subprojects.assemble
dependsOn copyGeneratedToBuildImageBinTools
dependsOn copyGeneratedToCnfLib

withFeatures ''
outputTo packageDir

}

// Includes only kind=ga features.
Expand All @@ -147,6 +178,16 @@ task zipOpenLiberty(type: Zip) {
}
publish.dependsOn zipOpenLiberty

// Includes only kind=ga features.
task zipOpenLibertyKernel(type: Zip) {
dependsOn packageOpenLibertyKernel
baseName 'openliberty-kernel'
from packageDir
destinationDir distsDir
version releaseVersion
}
publish.dependsOn zipOpenLibertyKernel

// Includes all features.
task zipOpenLibertyAll(type: Zip) {
dependsOn parent.subprojects.assemble
Expand Down Expand Up @@ -385,3 +426,4 @@ task publishPublicArtifactsOnBintray {
}
}
}

Loading

0 comments on commit 55a47e4

Please sign in to comment.