mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
android+maven: fix paths of apklib module
This commit is contained in:
@@ -27,7 +27,6 @@ import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
@@ -97,15 +96,10 @@ public class AndroidFacetConfiguration implements FacetConfiguration {
|
||||
}
|
||||
|
||||
public void init(@NotNull Module module, @NotNull String baseDirectoryPath) {
|
||||
String moduleDirPath = AndroidRootUtil.getModuleDirPath(module);
|
||||
if (moduleDirPath == null) {
|
||||
final String s = AndroidRootUtil.getPathRelativeToModuleDir(module, baseDirectoryPath);
|
||||
if (s == null || s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (moduleDirPath.equals(baseDirectoryPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String s = FileUtil.getRelativePath(moduleDirPath, baseDirectoryPath, '/');
|
||||
|
||||
GEN_FOLDER_RELATIVE_PATH_APT = '/' + s + GEN_FOLDER_RELATIVE_PATH_APT;
|
||||
GEN_FOLDER_RELATIVE_PATH_AIDL = '/' + s + GEN_FOLDER_RELATIVE_PATH_AIDL;
|
||||
|
||||
@@ -514,4 +514,16 @@ public class AndroidRootUtil {
|
||||
String moduleDirPath = getModuleDirPath(facet.getModule());
|
||||
return moduleDirPath != null ? FileUtil.toSystemDependentName(moduleDirPath + path) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getPathRelativeToModuleDir(@NotNull Module module, @NotNull String path) {
|
||||
String moduleDirPath = getModuleDirPath(module);
|
||||
if (moduleDirPath == null) {
|
||||
return null;
|
||||
}
|
||||
if (moduleDirPath.equals(path)) {
|
||||
return "";
|
||||
}
|
||||
return FileUtil.getRelativePath(moduleDirPath, path, '/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,9 +389,13 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
final AndroidFacet facet = AndroidUtils.addAndroidFacet(apklibModuleModel, vApklibDir, true);
|
||||
|
||||
final AndroidFacetConfiguration configuration = facet.getConfiguration();
|
||||
configuration.RES_FOLDER_RELATIVE_PATH = '/' + AndroidMavenUtil.APK_LIB_ARTIFACT_RES_DIR;
|
||||
configuration.LIBS_FOLDER_RELATIVE_PATH = '/' + AndroidMavenUtil.APK_LIB_ARTIFACT_NATIVE_LIBS_DIR;
|
||||
configuration.MANIFEST_FILE_RELATIVE_PATH = '/' + AndroidMavenUtil.APK_LIB_ARTIFACT_MANIFEST_FILE;
|
||||
String s = AndroidRootUtil.getPathRelativeToModuleDir(apklibModule, vApklibDir.getPath());
|
||||
if (s != null) {
|
||||
s = s.length() > 0 ? '/' + s + '/' : "/";
|
||||
configuration.RES_FOLDER_RELATIVE_PATH = s + AndroidMavenUtil.APK_LIB_ARTIFACT_RES_DIR;
|
||||
configuration.LIBS_FOLDER_RELATIVE_PATH = s + AndroidMavenUtil.APK_LIB_ARTIFACT_NATIVE_LIBS_DIR;
|
||||
configuration.MANIFEST_FILE_RELATIVE_PATH = s + AndroidMavenUtil.APK_LIB_ARTIFACT_MANIFEST_FILE;
|
||||
}
|
||||
|
||||
importSdkAndDependenciesForApklibArtifact(project, rootModelAdapter, apklibModuleModel, modelsProvider, mavenTree, artifact,
|
||||
mavenProject2ModuleName);
|
||||
|
||||
Reference in New Issue
Block a user