Skip to content

Commit

Permalink
ConfigureUtils usage is removed
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 3, 2024
1 parent c29bf04 commit aeeda74
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 48 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
*/
package io.openliberty.tools.gradle.extensions

import org.gradle.util.ConfigureUtil
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory

import javax.inject.Inject

class LibertyExtension {

Expand All @@ -29,35 +31,43 @@ class LibertyExtension {

// For overriding the group, name or version of the libertyRuntime installed from Maven Central repository.
// Default is group 'io.openliberty', name 'openliberty-kernel' and version '[19.0.0.9,)' which gets the latest version.
Properties runtime = new Properties()
Properties runtime =new Properties();

CompileJSPExtension jsp = new CompileJSPExtension()
CompileJSPExtension jsp;

InstallExtension install = new InstallExtension()
SpringBootExtension thin = new SpringBootExtension()
InstallExtension install;
SpringBootExtension thin;
ServerExtension server;

ServerExtension server = server = new ServerExtension()
DevExtension dev;

DevExtension dev = new DevExtension();
@Inject
LibertyExtension(ObjectFactory objectFactory) {
this.jsp = objectFactory.newInstance(CompileJSPExtension.class)
this.install = objectFactory.newInstance(InstallExtension.class)
this.thin = objectFactory.newInstance(SpringBootExtension.class)
this.server = objectFactory.newInstance(ServerExtension.class)
this.dev = objectFactory.newInstance(DevExtension.class)
}

def jsp(Closure closure) {
ConfigureUtil.configure(closure, jsp)
def jsp(Action action) {
action.execute(jsp);
}

def thin(Closure closure) {
ConfigureUtil.configure(closure, thin)
def thin(Action action) {
action.execute(thin);
}

def install(Closure closure) {
ConfigureUtil.configure(closure, install)
def install(Action action) {
action.execute(install);
}

def server(Closure closure){
ConfigureUtil.configure(closure, server)
def server(Action action) {
action.execute(server);
}

def dev(Closure closure) {
ConfigureUtil.configure(closure, dev)
def dev(Action action) {
action.execute(dev);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

package io.openliberty.tools.gradle.extensions

import org.gradle.util.ConfigureUtil
import org.gradle.api.Task
import java.util.Properties
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory

import javax.inject.Inject

class ServerExtension {
//Server properties
Expand Down Expand Up @@ -51,47 +52,59 @@ class ServerExtension {

int verifyAppStartTimeout = 0

FeatureExtension features = new FeatureExtension()
UninstallFeatureExtension uninstallfeatures = new UninstallFeatureExtension()
CleanExtension cleanDir = new CleanExtension()

DeployExtension deploy = new DeployExtension()
UndeployExtension undeploy = new UndeployExtension()

PackageExtension packageLiberty = new PackageExtension()
DumpExtension dumpLiberty = new DumpExtension()
DumpExtension javaDumpLiberty = new DumpExtension()
FeatureExtension features;
UninstallFeatureExtension uninstallfeatures;
CleanExtension cleanDir;

DeployExtension deploy;
UndeployExtension undeploy;

PackageExtension packageLiberty;
DumpExtension dumpLiberty;
DumpExtension javaDumpLiberty;

@Inject
ServerExtension(ObjectFactory objectFactory) {
this.features = objectFactory.newInstance(FeatureExtension.class)
this.uninstallfeatures = objectFactory.newInstance(UninstallFeatureExtension.class)
this.cleanDir = objectFactory.newInstance(CleanExtension.class)
this.deploy = objectFactory.newInstance(DeployExtension.class)
this.undeploy = objectFactory.newInstance(UndeployExtension.class)
this.packageLiberty = objectFactory.newInstance(PackageExtension.class)
this.dumpLiberty = objectFactory.newInstance(DumpExtension.class)
this.javaDumpLiberty = objectFactory.newInstance(DumpExtension.class)
}

def uninstallfeatures(Closure closure) {
ConfigureUtil.configure(closure, uninstallfeatures)
def uninstallfeatures(Action action) {
action.execute(uninstallfeatures)
}

def features(Closure closure) {
ConfigureUtil.configure(closure, features)
def features(Action action) {
action.execute(features)
}

def cleanDir(Closure closure) {
ConfigureUtil.configure(closure, cleanDir)
def cleanDir(Action action) {
action.execute(cleanDir)
}

def deploy(Closure closure) {
ConfigureUtil.configure(closure, deploy)
def deploy(Action action) {
action.execute(deploy)
}

def undeploy(Closure closure) {
ConfigureUtil.configure(closure, undeploy)
def undeploy(Action action) {
action.execute(undeploy)
}

def packageLiberty(Closure closure) {
ConfigureUtil.configure(closure, packageLiberty)
def packageLiberty(Action action) {
action.execute(packageLiberty)
}

def dumpLiberty(Closure closure) {
ConfigureUtil.configure(closure, dumpLiberty)
def dumpLiberty(Action action) {
action.execute(dumpLiberty)
}

def javaDumpLiberty(Closure closure) {
ConfigureUtil.configure(closure, javaDumpLiberty)
def javaDumpLiberty(Action action) {
action.execute(javaDumpLiberty)
}

}
6 changes: 6 additions & 0 deletions src/test/resources/sampleJSP.servlet/testCompileJSP17.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ liberty {
deploy {
apps = [war]
}
undeploy {
apps = [war]
}
features {
acceptLicense = true
}
looseApplication = false
stripVersion = true
}
Expand Down

0 comments on commit aeeda74

Please sign in to comment.