Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle deprecation fix1.0 #902

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
cherylking marked this conversation as resolved.
Show resolved Hide resolved
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2020.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -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
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2023.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -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)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class InstallLiberty_DefaultNoMavenRepo extends AbstractIntegrationTest{
.buildAndFail()

String output = result.getOutput()
assert output.contains("org.gradle.api.artifacts.ResolveException") : "Expected installLiberty to fail with ResolveException"
//gradle 8.10 is throwing TypedResolveException instead of ResolveException
assert output.contains("org.gradle.api.internal.artifacts.ivyservice.TypedResolveException") : "Expected installLiberty to fail with TypedResolveException"
}
cherylking marked this conversation as resolved.
Show resolved Hide resolved
}
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 {
cherylking marked this conversation as resolved.
Show resolved Hide resolved
acceptLicense = true
}
looseApplication = false
stripVersion = true
}
Expand Down
Loading