Skip to content
Open
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
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ repositories {
maven {
url "https://central.sonatype.com/repository/maven-snapshots/"
}
mavenLocal()
}

dependencies {
Expand All @@ -36,7 +37,7 @@ gradlePlugin {
implementationClass = 'com.gluonhq.gradle.GluonFXPlugin'
website = 'https://github.com/gluonhq/gluonfx-gradle-plugin'
vcsUrl = 'https://github.com/gluonhq/gluonfx-gradle-plugin'
tags.set([ 'java', 'javafx', 'gluon', 'client', 'substrate', 'graalvm', 'aot' ])
tags.set(['java', 'javafx', 'gluon', 'client', 'substrate', 'graalvm', 'aot'])
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/gluonhq/gradle/tasks/NativeRunAgentTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
import java.util.List;
import java.util.Locale;

import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.options.Option;

public class NativeRunAgentTask extends NativeBaseTask {

private static final String AGENTLIB_NATIVE_IMAGE_AGENT_STRING =
Expand All @@ -64,12 +68,24 @@ public class NativeRunAgentTask extends NativeBaseTask {

private final ClientExtension clientExtension;

private List<String> applicationArgs = new ArrayList<>();

@Inject
public NativeRunAgentTask(Project project) {
super(project);
clientExtension = project.getExtensions().getByType(ClientExtension.class);
}

@Option(option = "args", description = "Arguments to pass to the application")
public void setApplicationArgs(List<String> args) {
this.applicationArgs = args;
}

@Internal
public List<String> getApplicationArgs() {
return applicationArgs;
}

@TaskAction
public void action() {
getProject().getLogger().info("ClientNativeRunAgent action");
Expand Down Expand Up @@ -113,6 +129,11 @@ public void action() {
var jvmArgs = List.of(AGENTLIB_NATIVE_IMAGE_AGENT_STRING);
execTask.getJvmArgumentProviders().add(() -> jvmArgs);

// set application args
if (applicationArgs != null && !applicationArgs.isEmpty()) {
execTask.args(applicationArgs);
}

// run
execTask.exec();
} catch (Exception e) {
Expand Down