mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Gradle: getGradlePath util by ModuleData
This commit is contained in:
+2
-9
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.gradle.action.GradleExecuteTaskAction;
|
||||
import org.jetbrains.plugins.gradle.service.execution.cmd.GradleCommandLineOptionsProvider;
|
||||
import org.jetbrains.plugins.gradle.service.project.GradleProjectResolverUtil;
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings;
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings;
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants;
|
||||
@@ -225,15 +226,7 @@ public class GradleRunAnythingProvider extends RunAnythingProviderBase<String> {
|
||||
|
||||
MultiMap<String, String> projectTasks = MultiMap.createOrderedSet();
|
||||
for (DataNode<ModuleData> moduleDataNode : getChildren(projectData.getExternalProjectStructure(), ProjectKeys.MODULE)) {
|
||||
String gradlePath;
|
||||
String moduleId = moduleDataNode.getData().getId();
|
||||
if (moduleId.charAt(0) != ':') {
|
||||
int colonIndex = moduleId.indexOf(':');
|
||||
gradlePath = colonIndex > 0 ? moduleId.substring(colonIndex) : ":";
|
||||
}
|
||||
else {
|
||||
gradlePath = moduleId;
|
||||
}
|
||||
String gradlePath = GradleProjectResolverUtil.getGradlePath(moduleDataNode.getData());
|
||||
for (DataNode<TaskData> node : getChildren(moduleDataNode, ProjectKeys.TASK)) {
|
||||
TaskData taskData = node.getData();
|
||||
String taskName = taskData.getName();
|
||||
|
||||
+14
@@ -302,6 +302,20 @@ public class GradleProjectResolverUtil {
|
||||
return join.isEmpty() ? ":" : ":" + join;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getGradlePath(@NotNull ModuleData moduleData) {
|
||||
String gradlePath;
|
||||
String moduleId = moduleData.getId();
|
||||
if (moduleId.charAt(0) != ':') {
|
||||
int colonIndex = moduleId.indexOf(':');
|
||||
gradlePath = colonIndex > 0 ? moduleId.substring(colonIndex) : ":";
|
||||
}
|
||||
else {
|
||||
gradlePath = moduleId;
|
||||
}
|
||||
return gradlePath;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static DependencyScope getDependencyScope(@Nullable String scope) {
|
||||
return scope != null ? DependencyScope.valueOf(scope) : DependencyScope.COMPILE;
|
||||
|
||||
+1
-10
@@ -75,16 +75,7 @@ public class GradleExtensionsSettings {
|
||||
DataNode<?> parent = node.getParent();
|
||||
if (parent == null) continue;
|
||||
if (!(parent.getData() instanceof ModuleData)) continue;
|
||||
ModuleData moduleData = (ModuleData)parent.getData();
|
||||
String gradlePath;
|
||||
String moduleId = moduleData.getId();
|
||||
if (moduleId.charAt(0) != ':') {
|
||||
int colonIndex = moduleId.indexOf(':');
|
||||
gradlePath = colonIndex > 0 ? moduleId.substring(colonIndex) : ":";
|
||||
}
|
||||
else {
|
||||
gradlePath = moduleId;
|
||||
}
|
||||
String gradlePath = GradleProjectResolverUtil.getGradlePath((ModuleData)parent.getData());
|
||||
extensionMap.put(gradlePath, node.getData());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user