use of org.gradle.process.CommandLineArgumentProvider in project MyLuaApp-Build-Core by dingyi222666.
the class DefaultJavaForkOptions method copyTo.
@Override
public JavaForkOptions copyTo(JavaForkOptions target) {
super.copyTo(target);
options.copyTo(target);
if (jvmArgumentProviders != null) {
for (CommandLineArgumentProvider jvmArgumentProvider : jvmArgumentProviders) {
target.jvmArgs(jvmArgumentProvider.asArguments());
}
}
return this;
}
use of org.gradle.process.CommandLineArgumentProvider in project gradle-baseline by palantir.
the class BaselineEnablePreviewFlag method apply.
@Override
public void apply(Project project) {
// The idea behind registering a single 'extra property' is that other plugins (like
// sls-packaging) can easily detect this and also also add the --enable-preview jvm arg
Provider<Boolean> enablePreview = project.provider(() -> {
JavaVersion jvmExecutingGradle = JavaVersion.current();
JavaPluginConvention javaConvention = project.getConvention().findPlugin(JavaPluginConvention.class);
if (javaConvention == null) {
return false;
}
return javaConvention.getSourceCompatibility() == jvmExecutingGradle;
});
project.getExtensions().getExtraProperties().set("enablePreview", enablePreview);
project.getPlugins().withId("java", _unused -> {
project.getTasks().withType(JavaCompile.class).configureEach(t -> {
List<CommandLineArgumentProvider> args = t.getOptions().getCompilerArgumentProviders();
// mutation is gross, but it's the gradle convention
args.add(new MaybeEnablePreview(enablePreview));
});
project.getTasks().withType(Test.class).configureEach(t -> {
t.getJvmArgumentProviders().add(new MaybeEnablePreview(enablePreview));
});
project.getTasks().withType(JavaExec.class).configureEach(t -> {
t.getJvmArgumentProviders().add(new MaybeEnablePreview(enablePreview));
});
// sadly we have to use afterEvaluate because the Javadoc task doesn't support passing in providers
project.afterEvaluate(_unused2 -> {
if (enablePreview.get()) {
JavaVersion sourceCompat = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceCompatibility();
project.getTasks().withType(Javadoc.class).configureEach(t -> {
CoreJavadocOptions options = (CoreJavadocOptions) t.getOptions();
// Yes truly javadoc wants a single leading dash, other javac wants a double leading dash.
// We also have to use these manual string options because they don't have first-class methods
// yet (e.g. https://github.com/gradle/gradle/issues/12898)
options.addBooleanOption("-enable-preview", true);
options.addStringOption("source", sourceCompat.getMajorVersion());
});
}
});
});
}
use of org.gradle.process.CommandLineArgumentProvider in project MyLuaApp-Build-Core by dingyi222666.
the class ProcessArgumentsSpec method getAllArguments.
public List<String> getAllArguments() {
List<String> allArgs;
List<String> args = getArgs();
if (args == null) {
allArgs = new ArrayList<>();
} else {
allArgs = new ArrayList<>(args);
}
for (CommandLineArgumentProvider argumentProvider : argumentProviders) {
Iterables.addAll(allArgs, argumentProvider.asArguments());
}
return allArgs;
}
use of org.gradle.process.CommandLineArgumentProvider in project MyLuaApp-Build-Core by dingyi222666.
the class ProviderAwareCompilerDaemonForkOptions method getAllJvmArgs.
/**
* Returns the full set of arguments to use to launch the JVM for the compiler process. This includes arguments to define
* system properties, the minimum/maximum heap size, and the bootstrap classpath.
*
* @return The arguments. Returns an empty list if there are no arguments.
*/
@Internal
public List<String> getAllJvmArgs() {
ImmutableList.Builder<String> builder = ImmutableList.builder();
builder.addAll(CollectionUtils.stringize(getJvmArgs()));
for (CommandLineArgumentProvider argumentProvider : getJvmArgumentProviders()) {
builder.addAll(argumentProvider.asArguments());
}
return builder.build();
}
use of org.gradle.process.CommandLineArgumentProvider in project gradle by gradle.
the class ProcessArgumentsSpec method getAllArguments.
public List<String> getAllArguments() {
List<String> allArgs;
List<String> args = getArgs();
if (args == null) {
allArgs = new ArrayList<>();
} else {
allArgs = new ArrayList<>(args);
}
for (CommandLineArgumentProvider argumentProvider : argumentProviders) {
Iterables.addAll(allArgs, argumentProvider.asArguments());
}
return allArgs;
}
Aggregations