Search in sources :

Example 1 with BuildLayoutParameters

use of org.gradle.initialization.BuildLayoutParameters in project intellij-community by JetBrains.

the class IdeaGradleSystemSettingsControlBuilder method deduceServiceDirectory.

private static void deduceServiceDirectory(@NotNull TextFieldWithBrowseButton serviceDirectoryPathField) {
    File gradleUserHomeDir = new BuildLayoutParameters().getGradleUserHomeDir();
    serviceDirectoryPathField.setText(FileUtil.toSystemIndependentName(gradleUserHomeDir.getPath()));
    serviceDirectoryPathField.getTextField().setForeground(LocationSettingType.DEDUCED.getColor());
}
Also used : BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) File(java.io.File)

Example 2 with BuildLayoutParameters

use of org.gradle.initialization.BuildLayoutParameters in project gradle by gradle.

the class ShutdownCoordinator method stop.

public void stop() {
    ServiceRegistry clientServices = clientFactory.createStopDaemonServices(outputEventListener, new DaemonParameters(new BuildLayoutParameters()));
    DaemonStopClient client = clientServices.get(DaemonStopClient.class);
    client.gracefulStop(daemons);
}
Also used : ServiceRegistry(org.gradle.internal.service.ServiceRegistry) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) DaemonStopClient(org.gradle.launcher.daemon.client.DaemonStopClient)

Example 3 with BuildLayoutParameters

use of org.gradle.initialization.BuildLayoutParameters in project gradle by gradle.

the class BuildLayoutConverter method convert.

public BuildLayoutResult convert(InitialProperties systemProperties, ParsedCommandLine commandLine, @Nullable File workingDir, Consumer<BuildLayoutParameters> defaults) {
    BuildLayoutParameters layoutParameters = new BuildLayoutParameters();
    if (workingDir != null) {
        layoutParameters.setCurrentDir(workingDir);
    }
    defaults.accept(layoutParameters);
    Map<String, String> requestedSystemProperties = systemProperties.getRequestedSystemProperties();
    new BuildLayoutParametersBuildOptions().propertiesConverter().convert(requestedSystemProperties, layoutParameters);
    buildLayoutConverter.convert(commandLine, layoutParameters);
    return new Result(layoutParameters);
}
Also used : BuildLayoutParametersBuildOptions(org.gradle.initialization.BuildLayoutParametersBuildOptions) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) BuildLayoutResult(org.gradle.launcher.configuration.BuildLayoutResult)

Example 4 with BuildLayoutParameters

use of org.gradle.initialization.BuildLayoutParameters in project gradle by gradle.

the class LayoutToPropertiesConverter method convert.

public AllProperties convert(InitialProperties initialProperties, BuildLayoutResult layout) {
    BuildLayoutParameters layoutParameters = new BuildLayoutParameters();
    layout.applyTo(layoutParameters);
    Map<String, String> properties = new HashMap<>();
    configureFromHomeDir(layoutParameters.getGradleInstallationHomeDir(), properties);
    configureFromBuildDir(layoutParameters.getSearchDir(), properties);
    configureFromHomeDir(layout.getGradleUserHomeDir(), properties);
    configureFromSystemPropertiesOfThisJvm(Cast.uncheckedNonnullCast(properties));
    properties.putAll(initialProperties.getRequestedSystemProperties());
    return new Result(properties, initialProperties);
}
Also used : HashMap(java.util.HashMap) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) BuildLayoutResult(org.gradle.launcher.configuration.BuildLayoutResult)

Example 5 with BuildLayoutParameters

use of org.gradle.initialization.BuildLayoutParameters in project intellij-community by JetBrains.

the class GradleExecutionHelper method mergeJvmArgs.

private static List<String> mergeJvmArgs(String serviceDirectory, List<String> jvmArgs, Set<String> jvmArgsFromIdeSettings) {
    File gradleUserHomeDir = serviceDirectory != null ? new File(serviceDirectory) : new BuildLayoutParameters().getGradleUserHomeDir();
    LOG.debug("Gradle home: " + gradleUserHomeDir);
    NativeServices.initialize(gradleUserHomeDir);
    Map<String, String> mergedArgs = new LinkedHashMap<>();
    for (String jvmArg : ContainerUtil.concat(jvmArgs, jvmArgsFromIdeSettings)) {
        int i = jvmArg.indexOf('=');
        if (i <= 0) {
            mergedArgs.put(jvmArg, "");
        } else {
            mergedArgs.put(jvmArg.substring(0, i), jvmArg.substring(i));
        }
    }
    List<String> mergedList = new ArrayList<>();
    for (Map.Entry<String, String> entry : mergedArgs.entrySet()) {
        mergedList.add(entry.getKey() + entry.getValue());
    }
    JvmOptions jvmOptions = new JvmOptions(null);
    jvmOptions.setAllJvmArgs(mergedList);
    return jvmOptions.getAllJvmArgs();
}
Also used : JvmOptions(org.gradle.process.internal.JvmOptions) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) File(java.io.File)

Aggregations

BuildLayoutParameters (org.gradle.initialization.BuildLayoutParameters)8 File (java.io.File)4 ServiceRegistry (org.gradle.internal.service.ServiceRegistry)2 BuildLayoutResult (org.gradle.launcher.configuration.BuildLayoutResult)2 DaemonStopClient (org.gradle.launcher.daemon.client.DaemonStopClient)2 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)2 SmartList (com.intellij.util.SmartList)1 HashMap (java.util.HashMap)1 BuildLayoutParametersBuildOptions (org.gradle.initialization.BuildLayoutParametersBuildOptions)1 LoggingServiceRegistry (org.gradle.internal.logging.services.LoggingServiceRegistry)1 JvmOptions (org.gradle.process.internal.JvmOptions)1 ProtocolToModelAdapter (org.gradle.tooling.internal.adapter.ProtocolToModelAdapter)1 ProviderConnectionParameters (org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters)1 GradleProjectSettings (org.jetbrains.plugins.gradle.settings.GradleProjectSettings)1