mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Gradle] Composite build tasks are executed with root build project path IDEA-231604 IJBTS-67
GitOrigin-RevId: 0abea3a3b59add45375d91862624b342cbdfa0a0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b20a848a68
commit
2d09d39336
+1
-1
@@ -698,7 +698,7 @@ public class CommonGradleProjectResolverExtension extends AbstractProjectResolve
|
||||
|
||||
String rootProjectPath = ideProject.getData().getLinkedExternalProjectPath();
|
||||
try {
|
||||
File rootDir = resolverCtx.getModels().getMainBuild().getBuildIdentifier().getRootDir();
|
||||
File rootDir = gradleModule.getGradleProject().getProjectIdentifier().getBuildIdentifier().getRootDir();
|
||||
rootProjectPath = ExternalSystemApiUtil.toCanonicalPath(rootDir.getCanonicalPath());
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
+24
@@ -16,10 +16,16 @@
|
||||
package org.jetbrains.plugins.gradle.importing;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.externalSystem.model.DataNode;
|
||||
import com.intellij.openapi.externalSystem.model.ProjectKeys;
|
||||
import com.intellij.openapi.externalSystem.model.task.TaskData;
|
||||
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider;
|
||||
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions;
|
||||
import org.jetbrains.plugins.gradle.util.GradleUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.intellij.openapi.roots.DependencyScope.COMPILE;
|
||||
@@ -81,6 +87,10 @@ public class GradleCompositeImportingTest extends GradleImportingTestCase {
|
||||
assertModuleModuleDepScope("my-app.main", "my-utils.number-utils.main", COMPILE);
|
||||
assertModuleModuleDepScope("my-app.main", "my-utils.string-utils.main", COMPILE);
|
||||
assertModuleLibDepScope("my-app.main", "Gradle: org.apache.commons:commons-lang3:3.4", COMPILE);
|
||||
|
||||
assertTasksProjectPath("adhoc", getProjectPath());
|
||||
assertTasksProjectPath("my-app", path("../my-app"));
|
||||
assertTasksProjectPath("my-utils", path("../my-utils"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -107,6 +117,9 @@ public class GradleCompositeImportingTest extends GradleImportingTestCase {
|
||||
"lib.runtime.runtime-mod", "lib.runtime.runtime-mod.main", "lib.runtime.runtime-mod.test");
|
||||
|
||||
assertModuleModuleDepScope("app.main", "lib.runtime.runtime-mod.main", COMPILE);
|
||||
|
||||
assertTasksProjectPath("app", getProjectPath());
|
||||
assertTasksProjectPath("lib", path("lib"));
|
||||
}
|
||||
|
||||
|
||||
@@ -598,4 +611,15 @@ public class GradleCompositeImportingTest extends GradleImportingTestCase {
|
||||
|
||||
assertModuleModuleDepScope("pA.pA-2.main", "pC.main", COMPILE);
|
||||
}
|
||||
|
||||
private void assertTasksProjectPath(String moduleName, String expectedTaskProjectPath) {
|
||||
for (DataNode<TaskData> node : ExternalSystemApiUtil
|
||||
.findAll(GradleUtil.findGradleModuleData(getModule(moduleName)), ProjectKeys.TASK)) {
|
||||
TaskData taskData = node.getData();
|
||||
String actual = taskData.getLinkedExternalProjectPath();
|
||||
if (expectedTaskProjectPath != null) expectedTaskProjectPath = FileUtil.toCanonicalPath(expectedTaskProjectPath);
|
||||
if (actual != null) actual = FileUtil.toCanonicalPath(actual);
|
||||
assertEquals(expectedTaskProjectPath, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user