use of org.jetbrains.plugins.gradle.settings.GradleExecutionSettings in project android by JetBrains.
the class GradleUtil method getOrCreateGradleExecutionSettings.
@Nullable
public static GradleExecutionSettings getOrCreateGradleExecutionSettings(@NotNull Project project, boolean useEmbeddedGradle) {
GradleExecutionSettings executionSettings = getGradleExecutionSettings(project);
if (IdeInfo.getInstance().isAndroidStudio() && useEmbeddedGradle) {
if (executionSettings == null) {
File gradlePath = EmbeddedDistributionPaths.getInstance().findEmbeddedGradleDistributionPath();
assert gradlePath != null && gradlePath.isDirectory();
executionSettings = new GradleExecutionSettings(gradlePath.getPath(), null, LOCAL, null, false);
File jdkPath = IdeSdks.getInstance().getJdkPath();
if (jdkPath != null) {
executionSettings.setJavaHome(jdkPath.getPath());
}
}
}
return executionSettings;
}
use of org.jetbrains.plugins.gradle.settings.GradleExecutionSettings in project android by JetBrains.
the class AndroidGradleBuildProcessParametersProviderTest method testPopulateJvmArgsWithGradleExecutionSettings.
public void testPopulateJvmArgsWithGradleExecutionSettings() {
executeProjectChangeAction(true, new DisposeAwareProjectChange(myProject) {
@Override
public void execute() {
removeAllKnownJdks();
String jdkHome = myJdk.getHomePath();
assertNotNull(jdkHome);
File jdkHomePath = new File(toSystemDependentName(jdkHome));
IdeSdks.getInstance().setJdkPath(jdkHomePath);
}
});
GradleExecutionSettings settings = createMock(GradleExecutionSettings.class);
expect(settings.getGradleHome()).andReturn("~/gradle-1.6");
expect(settings.isVerboseProcessing()).andReturn(true);
expect(settings.getServiceDirectory()).andReturn("~./gradle");
if (!IdeInfo.getInstance().isAndroidStudio()) {
expect(settings.getVmOptions()).andReturn(Sets.newLinkedHashSet("-Xmx2048m", "-XX:MaxPermSize=512m"));
}
replay(settings);
List<String> jvmArgList = Lists.newArrayList();
myParametersProvider.populateJvmArgs(settings, jvmArgList);
Map<String, String> jvmArgs = convertJvmArgsToMap(jvmArgList);
verify(settings);
String projectDirPath = Projects.getBaseDirPath(myProject).getPath();
assertEquals(projectDirPath, jvmArgs.get("-Dcom.android.studio.gradle.project.path"));
assertEquals("~" + File.separatorChar + "gradle-1.6", jvmArgs.get("-Dcom.android.studio.gradle.home.path"));
assertEquals("true", jvmArgs.get("-Dcom.android.studio.gradle.use.verbose.logging"));
assertEquals("~." + File.separatorChar + "gradle", jvmArgs.get("-Dcom.android.studio.gradle.service.dir.path"));
if (IdeInfo.getInstance().isAndroidStudio()) {
String javaPath = FileUtilRt.toSystemDependentName(EmbeddedDistributionPaths.getInstance().getEmbeddedJdkPath().getAbsolutePath());
assertEquals(javaPath, jvmArgs.get("-Dcom.android.studio.gradle.java.home.path"));
} else {
assertEquals("-Xmx2048m", jvmArgs.get("-Dcom.android.studio.gradle.daemon.jvm.option.0"));
assertEquals("-XX:MaxPermSize=512m", jvmArgs.get("-Dcom.android.studio.gradle.daemon.jvm.option.1"));
String javaHomeDirPath = myJdk.getHomePath();
assertNotNull(javaHomeDirPath);
javaHomeDirPath = toSystemDependentName(javaHomeDirPath);
assertEquals(javaHomeDirPath, jvmArgs.get("-Dcom.android.studio.gradle.java.home.path"));
}
}
Aggregations