Skip to content

Commit

Permalink
changing all accessors occurance to getter and setter
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Sep 5, 2024
1 parent 8d64b0f commit 258a6c5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/main/groovy/io/openliberty/tools/gradle/Liberty.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Liberty implements Plugin<Project> {
return installDir
} else if (project.liberty.installDir == null) {
if (project.liberty.baseDir == null) {
return new File(project.layout.buildDirectory.asFile.get(), 'wlp')
return new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'wlp')
} else {
return new File(project.liberty.baseDir, 'wlp')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class AbstractLibertyTask extends DefaultTask {
protected boolean isInstallDirChanged(Project project) {

XmlParser pluginXmlParser = new XmlParser()
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml'))
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml'))
if (!libertyPluginConfig.getAt('installDirectory').isEmpty()) {
Node installDirNode = libertyPluginConfig.getAt('installDirectory').get(0)
File previousInstallDir = new File(installDirNode.text())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ abstract class AbstractServerTask extends AbstractLibertyTask {

protected void writeServerPropertiesToXml(Project project) {
XmlParser pluginXmlParser = new XmlParser()
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml'))
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml'))
if (libertyPluginConfig.getAt('servers').isEmpty()) {
libertyPluginConfig.appendNode('servers')
} else {
Expand All @@ -747,14 +747,14 @@ abstract class AbstractServerTask extends AbstractLibertyTask {

libertyPluginConfig.getAt('servers')[0].append(serverNode)

new File( project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml' ).withWriter('UTF-8') { output ->
new File( project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml' ).withWriter('UTF-8') { output ->
output << new StreamingMarkupBuilder().bind { mkp.xmlDeclaration(encoding: 'UTF-8', version: '1.0' ) }
XmlNodePrinter printer = new XmlNodePrinter( new PrintWriter(output) )
printer.preserveWhitespace = true
printer.print( libertyPluginConfig )
}

logger.info ("Adding Liberty plugin config info to ${project.layout.buildDirectory.asFile.get()}/liberty-plugin-config.xml.")
logger.info ("Adding Liberty plugin config info to ${project.getLayout().getBuildDirectory().getAsFile().get()}/liberty-plugin-config.xml.")
}

private void writeBootstrapProperties(File file, Properties properties, Map<String, String> projectProperties) throws IOException {
Expand Down Expand Up @@ -1209,7 +1209,7 @@ abstract class AbstractServerTask extends AbstractLibertyTask {
}

if (container) {
File devcDestDir = new File(new File(project.layout.buildDirectory.asFile.get(), DevUtil.DEVC_HIDDEN_FOLDER), appsDir)
File devcDestDir = new File(new File(project.getLayout().getBuildDirectory().getAsFile().get(), DevUtil.DEVC_HIDDEN_FOLDER), appsDir)
return (new File(devcDestDir, looseConfigFileName));
} else {
File destDir = new File(getServerDir(project), appsDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CreateTask extends AbstractServerTask {

@InputFile
File getPluginConfigXml() {
return new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml')
return new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml')
}

@TaskAction
Expand All @@ -96,12 +96,12 @@ class CreateTask extends AbstractServerTask {
}

protected boolean isServerDirChanged(Project project) {
if (!project.layout.buildDirectory.asFile.get().exists() || !(new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml')).exists()) {
if (!project.getLayout().getBuildDirectory().getAsFile().get().exists() || !(new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml')).exists()) {
return false
}

XmlParser pluginXmlParser = new XmlParser()
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml'))
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml'))
if (!libertyPluginConfig.getAt('serverDirectory').isEmpty()) {
File currentDir = getServerDir(project)
File previousDir = new File(libertyPluginConfig.getAt('serverDirectory')[0].value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ class DevTask extends AbstractFeatureTask {

// Instantiate util before any child gradle tasks launched so it can help find available port if needed
try {
this.util = new DevTaskUtil(project.layout.buildDirectory.asFile.get(), serverInstallDir, getUserDir(project, serverInstallDir),
this.util = new DevTaskUtil(project.getLayout().getBuildDirectory().getAsFile().get(), serverInstallDir, getUserDir(project, serverInstallDir),
serverDirectory, sourceDirectory, testSourceDirectory, configDirectory, project.getRootDir(),
resourceDirs, changeOnDemandTestsAction.booleanValue(), hotTests.booleanValue(), skipTests.booleanValue(), skipInstallFeature.booleanValue(), artifactId, serverStartTimeout.intValue(),
verifyAppStartTimeout.intValue(), verifyAppStartTimeout.intValue(), compileWait.doubleValue(),
Expand Down Expand Up @@ -1401,9 +1401,9 @@ class DevTask extends AbstractFeatureTask {
}

private boolean isInstallDirChanged(Project project, File currentInstallDir) {
if (project.layout.buildDirectory.asFile.get().exists() && new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml').exists()) {
if (project.getLayout().getBuildDirectory().getAsFile().get().exists() && new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml').exists()) {
XmlParser pluginXmlParser = new XmlParser()
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml'))
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml'))
if (!libertyPluginConfig.getAt('installDirectory').isEmpty()) {
Node installDirNode = libertyPluginConfig.getAt('installDirectory').get(0)
String installDirValue = installDirNode.text()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class InstallLibertyTask extends AbstractLibertyTask {
outputs.upToDateWhen {
// ensure a Liberty installation exists at the install directory
getInstallDir(project).exists() && new File(getInstallDir(project), 'lib/ws-launch.jar').exists() &&
project.layout.buildDirectory.asFile.get().exists() && new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml').exists() &&
project.getLayout().getBuildDirectory().getAsFile().get().exists() && new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml').exists() &&
!isInstallDirChanged(project)
}
}
Expand Down Expand Up @@ -119,7 +119,7 @@ class InstallLibertyTask extends AbstractLibertyTask {

String licenseFilePath = project.configurations.getByName('libertyLicense').getAsPath()
if (licenseFilePath) {
def command = "java -jar " + licenseFilePath + " --acceptLicense " + project.layout.buildDirectory.asFile.get()
def command = "java -jar " + licenseFilePath + " --acceptLicense " + project.getLayout().getBuildDirectory().getAsFile().get()
def process = command.execute()
process.waitFor()
}
Expand All @@ -129,7 +129,7 @@ class InstallLibertyTask extends AbstractLibertyTask {

protected void updatePluginXmlFile() {
XmlParser pluginXmlParser = new XmlParser()
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml'))
Node libertyPluginConfig = pluginXmlParser.parse(new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml'))

Node installDirNode = libertyPluginConfig.getAt('installDirectory').isEmpty() ? libertyPluginConfig.appendNode('installDirectory') : libertyPluginConfig.getAt('installDirectory').get(0)
installDirNode.setValue(getInstallDir(project).toString())
Expand Down Expand Up @@ -181,36 +181,36 @@ class InstallLibertyTask extends AbstractLibertyTask {
}
}

new File( project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml' ).withWriter('UTF-8') { output ->
new File( project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml' ).withWriter('UTF-8') { output ->
output << new StreamingMarkupBuilder().bind { mkp.xmlDeclaration(encoding: 'UTF-8', version: '1.0' ) }
XmlNodePrinter printer = new XmlNodePrinter( new PrintWriter(output) )
printer.preserveWhitespace = true
printer.print( libertyPluginConfig )
}

logger.info ("Updating Liberty plugin config info at ${project.layout.buildDirectory.asFile.get()}/liberty-plugin-config.xml.")
logger.info ("Updating Liberty plugin config info at ${project.getLayout().getBuildDirectory().getAsFile().get()}/liberty-plugin-config.xml.")

}

protected void createPluginXmlFile(boolean isExisting) {
if(!this.state.upToDate) {
if (!project.layout.buildDirectory.asFile.get().exists()) {
logger.info ("Creating missing project buildDir at ${project.layout.buildDirectory.asFile.get()}.")
project.layout.buildDirectory.asFile.get().mkdirs()
if (!project.getLayout().getBuildDirectory().getAsFile().get().exists()) {
logger.info ("Creating missing project buildDir at ${project.getLayout().getBuildDirectory().getAsFile().get()}.")
project.getLayout().getBuildDirectory().getAsFile().get().mkdirs()
}

// if the file already exists, update it instead of replacing it
if (new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml').exists()) {
if (new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml').exists()) {
updatePluginXmlFile()
} else {
new File(project.layout.buildDirectory.asFile.get(), 'liberty-plugin-config.xml').withWriter { writer ->
new File(project.getLayout().getBuildDirectory().getAsFile().get(), 'liberty-plugin-config.xml').withWriter { writer ->
def xmlDoc = new MarkupBuilder(writer)
xmlDoc.mkp.xmlDeclaration(version: "1.0", encoding: "UTF-8")
xmlDoc.'liberty-plugin-config'('version':'2.0') {
outputLibertyPropertiesToXml(xmlDoc, isExisting)
}
}
logger.info ("Creating Liberty plugin config info to ${project.layout.buildDirectory.asFile.get()}/liberty-plugin-config.xml.")
logger.info ("Creating Liberty plugin config info to ${project.getLayout().getBuildDirectory().getAsFile().get()}/liberty-plugin-config.xml.")
}
}
}
Expand Down Expand Up @@ -322,7 +322,7 @@ class InstallLibertyTask extends AbstractLibertyTask {
}

if (project.liberty.baseDir == null) {
result.put('baseDir', project.layout.buildDirectory.asFile.get())
result.put('baseDir', project.getLayout().getBuildDirectory().getAsFile().get())
} else {
result.put('baseDir', project.liberty.baseDir)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PackageTask extends AbstractServerTask {
void packageServer() {
// Set default server.outputDir to liberty-alt-output-dir for libertyPackage task.
if (getOutputDir(project).equals(getUserDir(project).toString() + "/servers")) {
server.outputDir = new File(project.layout.buildDirectory.asFile.get(), "liberty-alt-output-dir");
server.outputDir = new File(project.getLayout().getBuildDirectory().getAsFile().get(), "liberty-alt-output-dir");
}

def params = buildLibertyMap(project)
Expand Down Expand Up @@ -125,7 +125,7 @@ class PackageTask extends AbstractServerTask {
* @throws IOException
*/
private String getPackageDirectory() throws IOException {
def buildDirLibFolder = new File(project.layout.buildDirectory.asFile.get(),'libs')
def buildDirLibFolder = new File(project.getLayout().getBuildDirectory().getAsFile().get(),'libs')
if (server.packageLiberty.packageDirectory != null && !server.packageLiberty.packageDirectory.isEmpty()) {
// check if path is relative or absolute, convert to canonical
def dir = new File(server.packageLiberty.packageDirectory)
Expand Down

0 comments on commit 258a6c5

Please sign in to comment.