Skip to content

Commit

Permalink
#38: Better integration with the installLiberty task
Browse files Browse the repository at this point in the history
  • Loading branch information
jgawor committed Nov 28, 2015
1 parent b91f6af commit 02b9940
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ In certain cases, the Liberty license code may need to be provided in order to i
| licenseCode | Liberty profile license code. See [above](#install-liberty-task). | Yes, if `type` is `webProfile6` or `runtimeUrl` specifies a `.jar` file. |
| version | Exact or wildcard version of the Liberty profile server to install. Available versions are listed in the [index.yml](http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/index.yml) file. Only used if `runtimeUrl` is not set. The default value is `8.5.+`. | No |
| runtimeUrl | URL to the Liberty profile's `.jar` or a `.zip` file. If not set, the Liberty repository will be used to find the Liberty runtime archive. | No |
| baseDir | The base installation directory. The actual installation directory of Liberty profile will be `${baseDir}/wlp`. The default value is `.` (current working directory). | No |
| baseDir | The base installation directory. The actual installation directory of Liberty profile will be `${baseDir}/wlp`. The default value is `${project.buildDir}`. | No |
| cacheDir | The directory used for caching downloaded files such as the license or `.jar` files. The default value is `${java.io.tmpdir}/wlp-cache`. | No |
| username | Username needed for basic authentication. | No |
| password | Password needed for basic authentication. | No |
Expand Down Expand Up @@ -489,4 +489,4 @@ liberty {
}
```
Note: If you want to delete files from `${wlp_output_dir}/workarea` and `${wlp_output_dir}/logs` directories, the server needs to be stopped.
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class InstallExtension {
String licenseCode
String version = "8.5.+"
String runtimeUrl
String baseDir = "."
String baseDir
String cacheDir
String username
String password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ abstract class AbstractTask extends DefaultTask {
protected Map<String, String> buildLibertyMap(Project project) {
Map<String, String> result = new HashMap();
result.put('serverName', project.liberty.serverName)
def libertyUserDirFile = getUserDir(project)
if (!libertyUserDirFile.isDirectory()) {
libertyUserDirFile.mkdirs()
}
result.put('userDir', libertyUserDirFile)
result.put('installDir', project.liberty.wlpDir)

def installDir = getInstallDir(project)
result.put('installDir', installDir)

def userDir = getUserDir(project, installDir)
result.put('userDir', userDir)

if (project.liberty.outputDir != null) {
result.put('outputDir', project.liberty.outputDir)
}
Expand All @@ -49,9 +50,20 @@ abstract class AbstractTask extends DefaultTask {
return result;
}

protected File getUserDir(Project project) {
String wlpDir = project.liberty.wlpDir == null ? "" : project.liberty.wlpDir
return (project.liberty.userDir == null) ? new File(wlpDir, 'usr') : new File(project.liberty.userDir)
protected File getInstallDir(Project project) {
if (project.liberty.wlpDir == null) {
if (project.liberty.install.baseDir == null) {
return new File(project.buildDir, 'wlp')
} else {
return new File(project.liberty.install.baseDir, 'wlp')
}
} else {
return new File(project.liberty.wlpDir)
}
}

protected File getUserDir(Project project, File installDir) {
return (project.liberty.userDir == null) ? new File(installDir, 'usr') : new File(project.liberty.userDir)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ class InstallLibertyTask extends AbstractTask {

private Map<String, String> buildInstallLibertyMap(Project project) {
Map<String, String> result = new HashMap();
result.put('licenseCode', project.liberty.install.licenseCode)
if (project.liberty.install.licenseCode != null) {
result.put('licenseCode', project.liberty.install.licenseCode)
}

result.put('version', project.liberty.install.version)

if (project.liberty.install.runtimeUrl != null) {
result.put('runtimeUrl', project.liberty.install.runtimeUrl)
}

result.put('baseDir', project.liberty.install.baseDir)
if (project.liberty.install.baseDir == null) {
result.put('baseDir', project.buildDir)
} else {
result.put('baseDir', project.liberty.install.baseDir)
}

if (project.liberty.install.cacheDir != null) {
result.put('cacheDir', project.liberty.install.cacheDir)
Expand Down

0 comments on commit 02b9940

Please sign in to comment.