mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
-25
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.android.exportSignedPackage;
|
||||
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
*/
|
||||
class AndroidExportPackageUtil {
|
||||
private AndroidExportPackageUtil() {
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,9 @@
|
||||
|
||||
package org.jetbrains.android.exportSignedPackage;
|
||||
|
||||
import com.intellij.openapi.compiler.DummyCompileContext;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -39,29 +35,7 @@ public class CheckModulePanel extends JPanel {
|
||||
}
|
||||
|
||||
public void updateMessages(AndroidFacet facet) {
|
||||
Module module = facet.getModule();
|
||||
clearMessages();
|
||||
final DummyCompileContext compileContext = DummyCompileContext.getInstance();
|
||||
VirtualFile outputDirectory = compileContext.getModuleOutputDirectory(module);
|
||||
if (outputDirectory != null) {
|
||||
/*String apkFilePath = facet.getApkPath();
|
||||
File f = new File(apkFilePath);
|
||||
if (!f.isFile()) {
|
||||
addError(AndroidBundle.message("android.file.not.exist.error", f.getPath()));
|
||||
}*/
|
||||
}
|
||||
else {
|
||||
addError(AndroidBundle.message("android.unable.to.get.output.directory.error"));
|
||||
}
|
||||
|
||||
/*Manifest manifest = facet.getManifest();
|
||||
assert manifest != null;
|
||||
Application application = manifest.getApplication();
|
||||
assert application != null;
|
||||
String debuggable = application.getDebuggable().getValue();
|
||||
if (debuggable != null && BooleanValueConverter.getInstance(true).isTrue(debuggable)) {
|
||||
addWarning(AndroidBundle.message("android.export.signed.package.debuggable.warning"));
|
||||
}*/
|
||||
revalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,8 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
List<MavenProjectsProcessorTask> postTasks) {
|
||||
configurePaths(facet, mavenProject);
|
||||
configureAndroidPlatform(facet, mavenProject, modelsProvider);
|
||||
importExternalApklibDependencies(module.getProject(), rootModel, modelsProvider, mavenTree, mavenProject, postTasks);
|
||||
importExternalApklibDependencies(module.getProject(), rootModel, modelsProvider, mavenTree, mavenProject, mavenProjectToModuleName,
|
||||
postTasks);
|
||||
|
||||
if (hasApklibDependencies(mavenProject) &&
|
||||
MavenProjectsManager.getInstance(module.getProject()).getImportingSettings().isUseMavenOutput()) {
|
||||
@@ -149,7 +150,8 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
MavenRootModelAdapter rootModelAdapter,
|
||||
MavenModifiableModelsProvider modelsProvider,
|
||||
MavenProjectsTree mavenTree,
|
||||
MavenProject mavenProject,
|
||||
MavenProject mavenProject,
|
||||
Map<MavenProject, String> mavenProject2ModuleName,
|
||||
List<MavenProjectsProcessorTask> tasks) {
|
||||
final ModifiableRootModel rootModel = rootModelAdapter.getRootModel();
|
||||
removeExtApklibDependencies(rootModel);
|
||||
@@ -165,7 +167,7 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
if (apklibModule == null || apklibModule.getUserData(MODULE_IMPORTED) == null) {
|
||||
apklibModule =
|
||||
importExternalApklibArtifact(project, rootModelAdapter, apklibModule, modelsProvider, mavenProject, mavenTree, depArtifact,
|
||||
moduleModel);
|
||||
moduleModel, mavenProject2ModuleName);
|
||||
if (apklibModule != null) {
|
||||
apklibModule.putUserData(MODULE_IMPORTED, Boolean.TRUE);
|
||||
}
|
||||
@@ -240,19 +242,24 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
|
||||
@Nullable
|
||||
private static Module importExternalApklibArtifact(Project project,
|
||||
MavenRootModelAdapter rootModelAdapter,
|
||||
MavenRootModelAdapter rootModelAdapter,
|
||||
Module apklibModule,
|
||||
MavenModifiableModelsProvider modelsProvider,
|
||||
MavenProject mavenProject,
|
||||
MavenProjectsTree mavenTree,
|
||||
MavenArtifact artifact,
|
||||
ModifiableModuleModel moduleModel) {
|
||||
ModifiableModuleModel moduleModel,
|
||||
Map<MavenProject, String> mavenProject2ModuleName) {
|
||||
final MavenId artifactMavenId = artifact.getMavenId();
|
||||
|
||||
final String genModuleName = AndroidMavenUtil.getModuleNameForExtApklibArtifact(artifactMavenId);
|
||||
|
||||
String targetDirPath =
|
||||
AndroidMavenUtil.computePathToUnpackExtApklibArtifact(artifactMavenId, mavenProject, mavenTree.getProjects());
|
||||
final String genExternalApklibsDirPath =
|
||||
AndroidMavenUtil.computePathForGenExternalApklibsDir(artifactMavenId, mavenProject, mavenTree.getProjects());
|
||||
|
||||
final String targetDirPath = genExternalApklibsDirPath != null
|
||||
? genExternalApklibsDirPath + '/' + AndroidMavenUtil.getMavenIdStringForFileName(artifactMavenId)
|
||||
: null;
|
||||
|
||||
if (targetDirPath == null) {
|
||||
return null;
|
||||
@@ -297,7 +304,7 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
}
|
||||
|
||||
if (apklibModule == null) {
|
||||
final String genModuleFilePath = vApklibDir.getPath() + '/' + genModuleName + ModuleFileType.DOT_DEFAULT_EXTENSION;
|
||||
final String genModuleFilePath = genExternalApklibsDirPath + '/' + genModuleName + ModuleFileType.DOT_DEFAULT_EXTENSION;
|
||||
apklibModule = moduleModel.newModule(genModuleFilePath, StdModuleTypes.JAVA);
|
||||
}
|
||||
|
||||
@@ -319,7 +326,8 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
configuration.LIBS_FOLDER_RELATIVE_PATH = '/' + AndroidMavenUtil.APK_LIB_ARTIFACT_NATIVE_LIBS_DIR;
|
||||
configuration.MANIFEST_FILE_RELATIVE_PATH = '/' + AndroidMavenUtil.APK_LIB_ARTIFACT_MANIFEST_FILE;
|
||||
|
||||
importSdkAndDependenciesForApklibArtifact(project, rootModelAdapter, apklibModuleModel, modelsProvider, mavenTree, artifact);
|
||||
importSdkAndDependenciesForApklibArtifact(project, rootModelAdapter, apklibModuleModel, modelsProvider, mavenTree, artifact,
|
||||
mavenProject2ModuleName);
|
||||
|
||||
return apklibModule;
|
||||
}
|
||||
@@ -329,7 +337,8 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
ModifiableRootModel apklibModuleModel,
|
||||
MavenModifiableModelsProvider modelsProvider,
|
||||
MavenProjectsTree mavenTree,
|
||||
MavenArtifact artifact) {
|
||||
MavenArtifact artifact,
|
||||
Map<MavenProject, String> mavenProject2ModuleName) {
|
||||
final AndroidExternalApklibDependenciesManager adm = AndroidExternalApklibDependenciesManager.getInstance(project);
|
||||
final AndroidExternalApklibDependenciesManager.MyResolvedInfo resolvedInfo =
|
||||
adm.getResolvedInfoForArtifact(artifact.getMavenId());
|
||||
@@ -358,9 +367,10 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
final MavenProject depProject = mavenTree.findProject(depMavenId);
|
||||
|
||||
if (depProject != null) {
|
||||
final Module depModule = MavenProjectsManager.getInstance(project).findModule(depProject);
|
||||
if (depModule != null && findModuleDependency(apklibModuleModel, depModule.getName()) == null) {
|
||||
apklibModuleModel.addModuleOrderEntry(depModule);
|
||||
final String depModuleName = mavenProject2ModuleName.get(depProject);
|
||||
|
||||
if (depModuleName != null) {
|
||||
addCompileModuleDependency(modelsProvider, apklibModuleModel, depModuleName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -42,14 +42,15 @@ public class AndroidMavenUtil {
|
||||
public static final String APK_LIB_ARTIFACT_NATIVE_LIBS_DIR = "libs";
|
||||
public static final String APK_LIB_ARTIFACT_MANIFEST_FILE = "AndroidManifest.xml";
|
||||
@NonNls private static final String APKLIB_MODULE_PREFIX = "~apklib-";
|
||||
@NonNls private static final String GEN_EXTERNAL_APKLIBS_DIRNAME = "gen-external-apklibs";
|
||||
|
||||
private AndroidMavenUtil() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String computePathToUnpackExtApklibArtifact(@NotNull MavenId mavenId,
|
||||
@NotNull MavenProject project,
|
||||
@NotNull Collection<MavenProject> allProjects) {
|
||||
public static String computePathForGenExternalApklibsDir(@NotNull MavenId mavenId,
|
||||
@NotNull MavenProject project,
|
||||
@NotNull Collection<MavenProject> allProjects) {
|
||||
String path = null;
|
||||
boolean resultUnderApp = false;
|
||||
|
||||
@@ -58,23 +59,18 @@ public class AndroidMavenUtil {
|
||||
final VirtualFile projectDir = p.getDirectoryFile();
|
||||
final boolean app = APK_PACKAGING_TYPE.equals(p.getPackaging());
|
||||
if (path == null || !resultUnderApp && app) {
|
||||
path = projectDir.getPath() + '/' + getDirNameToUnpackExtApklibArtifact(mavenId);
|
||||
path = projectDir.getPath() + '/' + GEN_EXTERNAL_APKLIBS_DIRNAME;
|
||||
resultUnderApp = app;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (path == null) {
|
||||
path = project.getDirectoryFile().getPath() + '/' + getDirNameToUnpackExtApklibArtifact(mavenId);
|
||||
path = project.getDirectoryFile().getPath() + '/' + GEN_EXTERNAL_APKLIBS_DIRNAME;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getDirNameToUnpackExtApklibArtifact(@NotNull MavenId mavenId) {
|
||||
return "gen-external-apklibs/" + getMavenIdStringForFileName(mavenId);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getModuleNameForExtApklibArtifact(MavenId mavenId) {
|
||||
return APKLIB_MODULE_PREFIX + getMavenIdStringForFileName(mavenId);
|
||||
|
||||
Reference in New Issue
Block a user