Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions src/main/java/io/openliberty/tools/ant/ServerTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import java.net.URLClassLoader;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;

import io.openliberty.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;

Expand Down Expand Up @@ -121,6 +123,18 @@ protected void initTask() {
}
}

/**
* used in gradle closure while calling ant task using project.ant.server
* this method is called automatically when we create an object of EnvironmentVariable using closure
* @param var environment object
*/
public void addConfiguredEnvironmentVariable(EnvironmentVariable var) {
if (this.environmentVariables == null) {
this.environmentVariables = new HashMap<>();
}
this.environmentVariables.put(var.getName(), var.getValue());
}

@Override
public void execute() {

Expand Down Expand Up @@ -689,6 +703,10 @@ public int getValue() {
}
}

public Map<String, String> getEnvironmentVariables() {
return environmentVariables;
}

public void setEnvironmentVariables(Map<String, String> environmentVariables) {
this.environmentVariables = environmentVariables;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* (C) Copyright IBM Corporation 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openliberty.tools.ant.types;

public class EnvironmentVariable {
private String name;
private String value;

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}