mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rename AndroidSdk -> AndroidSdkData
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
package org.jetbrains.android;
|
||||
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -33,6 +33,6 @@ public class AndroidPlugin implements ApplicationComponent {
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
AndroidSdk.terminateDdmlib();
|
||||
AndroidSdkData.terminateDdmlib();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.logcat.AndroidLogcatToolWindowFactory;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -72,7 +72,7 @@ public class AndroidEnableDdmsAction extends ToggleAction {
|
||||
hidden = true;
|
||||
toolWindow.hide(null);
|
||||
}
|
||||
AndroidSdk.terminateDdmlib();
|
||||
AndroidSdkData.terminateDdmlib();
|
||||
if (hidden) {
|
||||
toolWindow.show(null);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -39,9 +39,9 @@ public abstract class AndroidRunSdkToolAction extends AnAction {
|
||||
assert facets.size() > 0;
|
||||
Set<String> sdkSet = new HashSet<String>();
|
||||
for (AndroidFacet facet : facets) {
|
||||
AndroidSdk sdk = facet.getConfiguration().getAndroidSdk();
|
||||
if (sdk != null) {
|
||||
sdkSet.add(sdk.getLocation());
|
||||
AndroidSdkData sdkData = facet.getConfiguration().getAndroidSdk();
|
||||
if (sdkData != null) {
|
||||
sdkSet.add(sdkData.getLocation());
|
||||
}
|
||||
}
|
||||
if (sdkSet.size() == 0) {
|
||||
|
||||
@@ -223,7 +223,7 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
|
||||
}
|
||||
|
||||
final IAndroidTarget target = platform.getTarget();
|
||||
final int platformToolsRevision = platform.getSdk().getPlatformToolsRevision();
|
||||
final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
|
||||
|
||||
String[] resPaths = AndroidCompileUtil.collectResourceDirs(facet, false, myContext);
|
||||
if (resPaths.length <= 0) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class AndroidAutogenerator {
|
||||
}
|
||||
|
||||
final IAndroidTarget target = platform.getTarget();
|
||||
final int platformToolsRevision = platform.getSdk().getPlatformToolsRevision();
|
||||
final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
|
||||
final String[] resPaths = AndroidCompileUtil.collectResourceDirs(facet, false, context);
|
||||
|
||||
if (resPaths.length == 0) {
|
||||
@@ -419,7 +419,7 @@ public class AndroidAutogenerator {
|
||||
}
|
||||
|
||||
final IAndroidTarget target = platform.getTarget();
|
||||
final String sdkLocation = platform.getSdk().getLocation();
|
||||
final String sdkLocation = platform.getSdkData().getLocation();
|
||||
|
||||
final String packageName = AndroidUtils.computePackageName(module, file);
|
||||
if (packageName == null) {
|
||||
|
||||
@@ -530,7 +530,7 @@ public class AndroidCompileUtil {
|
||||
|
||||
if (collectResCacheDirs) {
|
||||
final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
|
||||
final int platformToolsRevision = platform != null ? platform.getSdk().getPlatformToolsRevision() : -1;
|
||||
final int platformToolsRevision = platform != null ? platform.getSdkData().getPlatformToolsRevision() : -1;
|
||||
|
||||
if (platformToolsRevision < 0 || platformToolsRevision > 7) {
|
||||
// png cache is supported since platform-tools-r8
|
||||
|
||||
@@ -93,7 +93,7 @@ public class AndroidIncludingCompiler implements SourceGeneratingCompiler {
|
||||
for (AndroidFacet depFacet : AndroidSdkUtils.getAllAndroidDependencies(module, true)) {
|
||||
final AndroidPlatform platform = depFacet.getConfiguration().getAndroidPlatform();
|
||||
|
||||
final int platformToolsRevision = platform != null ? platform.getSdk().getPlatformToolsRevision() : -1;
|
||||
final int platformToolsRevision = platform != null ? platform.getSdkData().getPlatformToolsRevision() : -1;
|
||||
if (platformToolsRevision < 0 || platformToolsRevision > 7) {
|
||||
// "including" style building of library projects is deprecated since platform-tools-r8
|
||||
continue;
|
||||
|
||||
@@ -126,7 +126,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
AndroidBundle.message("android.compilation.error.specify.platform", module.getName()), null, -1, -1);
|
||||
continue;
|
||||
}
|
||||
String sdkPath = platform.getSdk().getLocation();
|
||||
String sdkPath = platform.getSdkData().getLocation();
|
||||
String outputPath = AndroidRootUtil.getApkPath(facet);
|
||||
if (outputPath == null) {
|
||||
context.addMessage(CompilerMessageCategory.ERROR,
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class AndroidPngFilesCachingCompiler implements SourceGeneratingCompiler
|
||||
continue;
|
||||
}
|
||||
|
||||
final int platformToolsRevision = platform.getSdk().getPlatformToolsRevision();
|
||||
final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
|
||||
if (platformToolsRevision > 0 && platformToolsRevision <= 7) {
|
||||
// png files cache is supported since platform-tools-r8
|
||||
continue;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class AndroidPrecompileTask implements CompileTask {
|
||||
}
|
||||
|
||||
final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
|
||||
final int platformToolsRevision = platform != null ? platform.getSdk().getPlatformToolsRevision() : -1;
|
||||
final int platformToolsRevision = platform != null ? platform.getSdkData().getPlatformToolsRevision() : -1;
|
||||
|
||||
LOG.debug("Platform-tools revision for module " + module.getName() + " is " + platformToolsRevision);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ public class AndroidProguardCompiler implements ClassPostProcessingCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
final String sdkPath = FileUtil.toSystemDependentName(platform.getSdk().getLocation());
|
||||
final String sdkPath = FileUtil.toSystemDependentName(platform.getSdkData().getLocation());
|
||||
|
||||
final VirtualFile outputDir = AndroidDexCompiler.getOutputDirectoryForDex(module);
|
||||
final String outputJarOsPath = FileUtil.toSystemDependentName(outputDir.getPath() + '/' + PROGUARD_OUTPUT_JAR_NAME);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AndroidRenderscriptCompiler implements SourceGeneratingCompiler {
|
||||
}
|
||||
|
||||
final IAndroidTarget target = platform.getTarget();
|
||||
final String sdkLocation = platform.getSdk().getLocation();
|
||||
final String sdkLocation = platform.getSdkData().getLocation();
|
||||
|
||||
final String resourceDirPath = AndroidRootUtil.getResourceDirPath(facet);
|
||||
assert resourceDirPath != null;
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
|
||||
String assetsDirPath = assetsDir != null ? assetsDir.getPath() : null;
|
||||
String[] resourcesDirPaths = AndroidCompileUtil.collectResourceDirs(facet, true, context);
|
||||
final IAndroidTarget target = platform.getTarget();
|
||||
final int platformToolsRevision = platform.getSdk().getPlatformToolsRevision();
|
||||
final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
|
||||
|
||||
if (resourcesDirPaths.length == 0) {
|
||||
context.addMessage(CompilerMessageCategory.WARNING, "Resource directory not found for module " + module.getName(),
|
||||
|
||||
@@ -419,7 +419,7 @@ public class AndroidApkBuilder {
|
||||
}
|
||||
|
||||
// we exclude sources of library modules automatically for tools r7 or previous
|
||||
return platform.getSdk().getPlatformToolsRevision() > 7;
|
||||
return platform.getSdkData().getPlatformToolsRevision() > 7;
|
||||
}
|
||||
|
||||
private static void writeStandardSourceFolderResources(Collection<VirtualFile> resources,
|
||||
|
||||
@@ -71,10 +71,10 @@ public class AndroidModuleConverter1 extends ConversionProcessor<ModuleSettings>
|
||||
|
||||
if (androidPlatform != null) {
|
||||
|
||||
Sdk androidSdk = AndroidSdkUtils.findAppropriateAndroidPlatform(androidPlatform.getTarget(), androidPlatform.getSdk());
|
||||
Sdk androidSdk = AndroidSdkUtils.findAppropriateAndroidPlatform(androidPlatform.getTarget(), androidPlatform.getSdkData());
|
||||
|
||||
if (androidSdk == null) {
|
||||
androidSdk = AndroidSdkUtils.createNewAndroidPlatform(androidPlatform.getTarget(), androidPlatform.getSdk().getLocation(), false);
|
||||
androidSdk = AndroidSdkUtils.createNewAndroidPlatform(androidPlatform.getTarget(), androidPlatform.getSdkData().getLocation(), false);
|
||||
final SdkModificator modificator = androidSdk.getSdkModificator();
|
||||
|
||||
for (OrderRootType type : OrderRootType.getAllTypes()) {
|
||||
|
||||
@@ -195,7 +195,7 @@ class ApkStep extends ExportSignedPackageWizardStep {
|
||||
private void createAndAlignApk(final String apkPath) {
|
||||
AndroidPlatform platform = myWizard.getFacet().getConfiguration().getAndroidPlatform();
|
||||
assert platform != null;
|
||||
String sdkPath = platform.getSdk().getLocation();
|
||||
String sdkPath = platform.getSdkData().getLocation();
|
||||
String zipAlignPath = sdkPath + File.separatorChar + AndroidSdkUtils.toolPath(SdkConstants.FN_ZIPALIGN);
|
||||
File zipalign = new File(zipAlignPath);
|
||||
final boolean runZipAlign = zipalign.isFile();
|
||||
|
||||
@@ -211,7 +211,7 @@ public class AndroidFacet extends Facet<AndroidFacetConfiguration> {
|
||||
public AndroidDebugBridge getDebugBridge() {
|
||||
AndroidPlatform platform = getConfiguration().getAndroidPlatform();
|
||||
if (platform != null) {
|
||||
return platform.getSdk().getDebugBridge(getModule().getProject());
|
||||
return platform.getSdkData().getDebugBridge(getModule().getProject());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -376,10 +376,10 @@ public class AndroidFacet extends Facet<AndroidFacetConfiguration> {
|
||||
public AvdManager getAvdManager() throws AvdsNotSupportedException, AndroidLocation.AndroidLocationException {
|
||||
if (myAvdManager == null) {
|
||||
AndroidPlatform platform = getConfiguration().getAndroidPlatform();
|
||||
AndroidSdk sdk = platform != null ? platform.getSdk() : null;
|
||||
AndroidSdkData sdkData = platform != null ? platform.getSdkData() : null;
|
||||
Project project = getModule().getProject();
|
||||
if (sdk != null) {
|
||||
SdkManager sdkManager = sdk.getSdkManager();
|
||||
if (sdkData != null) {
|
||||
SdkManager sdkManager = sdkData.getSdkManager();
|
||||
myAvdManager = new AvdManager(sdkManager, AndroidSdkUtils.getSdkLog(project));
|
||||
}
|
||||
else {
|
||||
@@ -392,7 +392,7 @@ public class AndroidFacet extends Facet<AndroidFacetConfiguration> {
|
||||
public void launchEmulator(@Nullable final String avdName, @NotNull final String commands, @Nullable ProcessHandler handler) {
|
||||
AndroidPlatform platform = getConfiguration().getAndroidPlatform();
|
||||
if (platform != null) {
|
||||
final String emulatorPath = platform.getSdk().getLocation() + File.separator + AndroidSdkUtils.toolPath(SdkConstants.FN_EMULATOR);
|
||||
final String emulatorPath = platform.getSdkData().getLocation() + File.separator + AndroidSdkUtils.toolPath(SdkConstants.FN_EMULATOR);
|
||||
final GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
commandLine.setExePath(FileUtil.toSystemDependentName(emulatorPath));
|
||||
if (avdName != null) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.android.sdk.AndroidPlatform;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.android.sdk.AndroidSdkAdditionalData;
|
||||
import org.jetbrains.android.sdk.AndroidSdkType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -122,9 +122,9 @@ public class AndroidFacetConfiguration implements FacetConfiguration {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public AndroidSdk getAndroidSdk() {
|
||||
public AndroidSdkData getAndroidSdk() {
|
||||
AndroidPlatform platform = getAndroidPlatform();
|
||||
return platform != null ? platform.getSdk() : null;
|
||||
return platform != null ? platform.getSdkData() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -409,7 +409,7 @@ public abstract class AndroidLogcatToolWindowView implements Disposable {
|
||||
private void updateDevices() {
|
||||
AndroidPlatform platform = getAndroidPlatform(myProject);
|
||||
if (platform != null) {
|
||||
final AndroidDebugBridge debugBridge = platform.getSdk().getDebugBridge(myProject);
|
||||
final AndroidDebugBridge debugBridge = platform.getSdkData().getDebugBridge(myProject);
|
||||
if (debugBridge != null) {
|
||||
IDevice[] devices = debugBridge.getDevices();
|
||||
Object temp = myDeviceCombo.getSelectedItem();
|
||||
|
||||
@@ -618,11 +618,11 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
|
||||
return null;
|
||||
}
|
||||
|
||||
AndroidSdk sdk = AndroidSdk.parse(sdkPath, new EmptySdkLog());
|
||||
if (sdk != null) {
|
||||
IAndroidTarget target = sdk.findTargetByApiLevel(apiLevel);
|
||||
AndroidSdkData sdkData = AndroidSdkData.parse(sdkPath, new EmptySdkLog());
|
||||
if (sdkData != null) {
|
||||
IAndroidTarget target = sdkData.findTargetByApiLevel(apiLevel);
|
||||
if (target != null) {
|
||||
Sdk library = AndroidSdkUtils.findAppropriateAndroidPlatform(target, sdk);
|
||||
Sdk library = AndroidSdkUtils.findAppropriateAndroidPlatform(target, sdkData);
|
||||
if (library == null) {
|
||||
library = AndroidSdkUtils.createNewAndroidPlatform(target, sdkPath, true);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class AndroidModuleBuilder extends JavaModuleBuilder {
|
||||
IAndroidTarget target = platform.getTarget();
|
||||
|
||||
final String androidToolPath =
|
||||
platform.getSdk().getLocation() + File.separator + AndroidSdkUtils.toolPath(SdkConstants.androidCmdName());
|
||||
platform.getSdkData().getLocation() + File.separator + AndroidSdkUtils.toolPath(SdkConstants.androidCmdName());
|
||||
|
||||
if (!new File(androidToolPath).exists()) {
|
||||
return false;
|
||||
|
||||
@@ -167,7 +167,7 @@ public class AndroidModuleWizardStep extends ModuleWizardStep {
|
||||
return;
|
||||
}
|
||||
|
||||
RunAndroidAvdManagerAction.runAvdManager(platform.getSdk().getLocation());
|
||||
RunAndroidAvdManagerAction.runAvdManager(platform.getSdkData().getLocation());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -390,8 +390,8 @@ public class AndroidModuleWizardStep extends ModuleWizardStep {
|
||||
|
||||
@NotNull
|
||||
private static String[] getAvds(@NotNull AndroidPlatform androidPlatform) {
|
||||
final AndroidSdk sdkObject = androidPlatform.getSdk();
|
||||
final SdkManager sdkManager = sdkObject.getSdkManager();
|
||||
final AndroidSdkData sdkData = androidPlatform.getSdkData();
|
||||
final SdkManager sdkManager = sdkData.getSdkManager();
|
||||
try {
|
||||
final AvdManager avdManager = new AvdManager(sdkManager, new MessageBuildingSdkLog());
|
||||
final AvdInfo[] validAvds = avdManager.getValidAvds();
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class SystemResourceManager extends ResourceManager {
|
||||
|
||||
@Nullable
|
||||
public synchronized AttributeDefinitions getAttributeDefinitions() {
|
||||
final AndroidTargetData targetData = myPlatform.getSdk().getTargetData(myPlatform.getTarget());
|
||||
final AndroidTargetData targetData = myPlatform.getSdkData().getTargetData(myPlatform.getTarget());
|
||||
return targetData != null ? targetData.getAttrDefs(myModule.getProject()) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public abstract class AndroidRunConfigurationBase extends ModuleBasedConfigurati
|
||||
return null;
|
||||
}
|
||||
|
||||
if (platform.getSdk().getDebugBridge(getProject()) == null) return null;
|
||||
if (platform.getSdkData().getDebugBridge(getProject()) == null) return null;
|
||||
|
||||
boolean debug = DefaultDebugExecutor.EXECUTOR_ID.equals(executor.getId());
|
||||
if (debug) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.android.sdk.AndroidSdkUtils;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.android.util.AndroidUtils;
|
||||
@@ -68,10 +68,10 @@ public class AvdChooser extends DialogWrapper {
|
||||
|
||||
@Nullable
|
||||
private static String getAndroidToolPath(@NotNull AndroidFacet facet) {
|
||||
AndroidSdk sdk = facet.getConfiguration().getAndroidSdk();
|
||||
if (sdk == null) return null;
|
||||
AndroidSdkData sdkData = facet.getConfiguration().getAndroidSdk();
|
||||
if (sdkData == null) return null;
|
||||
String androidCmd = SdkConstants.androidCmdName();
|
||||
return sdk.getLocation() + File.separator + AndroidSdkUtils.toolPath(androidCmd);
|
||||
return sdkData.getLocation() + File.separator + AndroidSdkUtils.toolPath(androidCmd);
|
||||
}
|
||||
|
||||
public AvdChooser(@NotNull final Project project,
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class AvdComboBox extends ComboboxWithBrowseButton {
|
||||
return;
|
||||
}
|
||||
|
||||
RunAndroidAvdManagerAction.runAvdManager(platform.getSdk().getLocation());
|
||||
RunAndroidAvdManagerAction.runAvdManager(platform.getSdkData().getLocation());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.ui.CollectionComboBoxModel;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.android.sdk.AndroidSdkUtils;
|
||||
import org.jetbrains.android.sdk.MessageBuildingSdkLog;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
@@ -163,9 +163,9 @@ public class CreateAvdDialog extends DialogWrapper {
|
||||
setTitle(AndroidBundle.message("create.avd.dialog.title"));
|
||||
init();
|
||||
myAvdManager = manager;
|
||||
final AndroidSdk sdk = facet.getConfiguration().getAndroidSdk();
|
||||
assert sdk != null;
|
||||
IAndroidTarget[] targets = sdk.getTargets();
|
||||
final AndroidSdkData sdkData = facet.getConfiguration().getAndroidSdk();
|
||||
assert sdkData != null;
|
||||
IAndroidTarget[] targets = sdkData.getTargets();
|
||||
myTargetBox.setModel(new DefaultComboBoxModel(targets));
|
||||
myTargetBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
@@ -41,11 +41,11 @@ import java.util.Set;
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class AndroidPlatform {
|
||||
private final AndroidSdk mySdk;
|
||||
private final AndroidSdkData mySdkData;
|
||||
private final IAndroidTarget myTarget;
|
||||
|
||||
public AndroidPlatform(@NotNull AndroidSdk sdk, @NotNull IAndroidTarget target) {
|
||||
mySdk = sdk;
|
||||
public AndroidPlatform(@NotNull AndroidSdkData sdkData, @NotNull IAndroidTarget target) {
|
||||
mySdkData = sdkData;
|
||||
myTarget = target;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ public class AndroidPlatform {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AndroidSdk getSdk() {
|
||||
return mySdk;
|
||||
public AndroidSdkData getSdkData() {
|
||||
return mySdkData;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -80,12 +80,12 @@ public class AndroidPlatform {
|
||||
}
|
||||
String sdkPath = sdk.getHomePath();
|
||||
if (sdkPath != null) {
|
||||
AndroidSdk sdkObject = AndroidSdk.parse(sdkPath, new EmptySdkLog());
|
||||
if (sdkObject != null) {
|
||||
AndroidSdkData sdkData = AndroidSdkData.parse(sdkPath, new EmptySdkLog());
|
||||
if (sdkData != null) {
|
||||
AndroidSdkAdditionalData data = (AndroidSdkAdditionalData)sdk.getSdkAdditionalData();
|
||||
IAndroidTarget target = data != null ? data.getBuildTarget(sdkObject) : null;
|
||||
IAndroidTarget target = data != null ? data.getBuildTarget(sdkData) : null;
|
||||
if (target != null) {
|
||||
return new AndroidPlatform(sdkObject, target);
|
||||
return new AndroidPlatform(sdkData, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class AndroidPlatform {
|
||||
@Deprecated
|
||||
public static AndroidPlatform parse(@NotNull Library library,
|
||||
@Nullable Library.ModifiableModel model,
|
||||
@Nullable Map<String, AndroidSdk> parsedSdks) {
|
||||
@Nullable Map<String, AndroidSdkData> parsedSdks) {
|
||||
VirtualFile[] files = model != null ? model.getFiles(OrderRootType.CLASSES) : library.getFiles(OrderRootType.CLASSES);
|
||||
Set<String> jarPaths = new HashSet<String>();
|
||||
VirtualFile frameworkLibrary = null;
|
||||
@@ -119,16 +119,16 @@ public class AndroidPlatform {
|
||||
if (sdkDir == null) return null;
|
||||
}
|
||||
String sdkPath = sdkDir.getPath();
|
||||
AndroidSdk sdk = parsedSdks != null ? parsedSdks.get(sdkPath) : null;
|
||||
if (sdk == null) {
|
||||
sdk = AndroidSdk.parse(sdkPath, new EmptySdkLog());
|
||||
if (sdk == null) return null;
|
||||
AndroidSdkData sdkData = parsedSdks != null ? parsedSdks.get(sdkPath) : null;
|
||||
if (sdkData == null) {
|
||||
sdkData = AndroidSdkData.parse(sdkPath, new EmptySdkLog());
|
||||
if (sdkData == null) return null;
|
||||
if (parsedSdks != null) {
|
||||
parsedSdks.put(sdkPath, sdk);
|
||||
parsedSdks.put(sdkPath, sdkData);
|
||||
}
|
||||
}
|
||||
IAndroidTarget resultTarget = null;
|
||||
for (IAndroidTarget target : sdk.getTargets()) {
|
||||
for (IAndroidTarget target : sdkData.getTargets()) {
|
||||
String targetsFrameworkLibPath = PathUtil.getCanonicalPath(target.getPath(IAndroidTarget.ANDROID_JAR));
|
||||
if (frameworkLibrary.getPath().equals(targetsFrameworkLibPath)) {
|
||||
if (target.isPlatform()) {
|
||||
@@ -153,7 +153,7 @@ public class AndroidPlatform {
|
||||
}
|
||||
}
|
||||
if (resultTarget != null) {
|
||||
return new AndroidPlatform(sdk, resultTarget);
|
||||
return new AndroidPlatform(sdkData, resultTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class AndroidPlatform {
|
||||
|
||||
AndroidPlatform platform = (AndroidPlatform)o;
|
||||
|
||||
if (!mySdk.equals(platform.mySdk)) return false;
|
||||
if (!mySdkData.equals(platform.mySdkData)) return false;
|
||||
if (!myTarget.equals(platform.myTarget)) return false;
|
||||
|
||||
return true;
|
||||
@@ -175,7 +175,7 @@ public class AndroidPlatform {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = mySdk.hashCode();
|
||||
int result = mySdkData.hashCode();
|
||||
result = 31 * result + myTarget.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ public class AndroidSdkAdditionalData implements SdkAdditionalData {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IAndroidTarget getBuildTarget(@NotNull AndroidSdk sdkObject) {
|
||||
return myBuildTarget != null ? sdkObject.findTargetByHashString(myBuildTarget) : null;
|
||||
public IAndroidTarget getBuildTarget(@NotNull AndroidSdkData sdkData) {
|
||||
return myBuildTarget != null ? sdkData.findTargetByHashString(myBuildTarget) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -106,7 +106,7 @@ public class AndroidSdkConfigurable implements AdditionalDataConfigurable {
|
||||
}
|
||||
final AndroidSdkAdditionalData androidData = (AndroidSdkAdditionalData)data;
|
||||
AndroidPlatform platform = androidData.getAndroidPlatform();
|
||||
myForm.init(androidData.getJavaSdk(), mySdk, platform != null ? androidData.getBuildTarget(platform.getSdk()) : null);
|
||||
myForm.init(androidData.getJavaSdk(), mySdk, platform != null ? androidData.getBuildTarget(platform.getSdkData()) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -134,8 +134,8 @@ class AndroidSdkConfigurableForm {
|
||||
}
|
||||
|
||||
mySdkLocation = androidSdk != null ? androidSdk.getHomePath() : null;
|
||||
AndroidSdk androidSdkObject = mySdkLocation != null ? AndroidSdk.parse(mySdkLocation, new EmptySdkLog()) : null;
|
||||
updateBuildTargets(androidSdkObject);
|
||||
AndroidSdkData androidSdkData = mySdkLocation != null ? AndroidSdkData.parse(mySdkLocation, new EmptySdkLog()) : null;
|
||||
updateBuildTargets(androidSdkData);
|
||||
|
||||
if (buildTarget != null) {
|
||||
for (int i = 0; i < myBuildTargetsModel.getSize(); i++) {
|
||||
@@ -157,11 +157,11 @@ class AndroidSdkConfigurableForm {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBuildTargets(AndroidSdk androidSdk) {
|
||||
private void updateBuildTargets(AndroidSdkData androidSdkData) {
|
||||
myBuildTargetsModel.removeAllElements();
|
||||
|
||||
if (androidSdk != null) {
|
||||
for (IAndroidTarget target : androidSdk.getTargets()) {
|
||||
if (androidSdkData != null) {
|
||||
for (IAndroidTarget target : androidSdkData.getTargets()) {
|
||||
myBuildTargetsModel.addElement(target);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -46,8 +46,8 @@ import java.util.Map;
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
*/
|
||||
public class AndroidSdk {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.sdk.AndroidSdk");
|
||||
public class AndroidSdkData {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.sdk.AndroidSdkData");
|
||||
|
||||
private static volatile boolean myDdmLibInitialized = false;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AndroidSdk {
|
||||
|
||||
private final int myPlatformToolsRevision;
|
||||
|
||||
public AndroidSdk(@NotNull SdkManager sdkManager, @NotNull String sdkDirOsPath) {
|
||||
public AndroidSdkData(@NotNull SdkManager sdkManager, @NotNull String sdkDirOsPath) {
|
||||
mySdkManager = sdkManager;
|
||||
|
||||
final File platformToolsPropFile =
|
||||
@@ -150,31 +150,31 @@ public class AndroidSdk {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static AndroidSdk parse(@NotNull String path, @NotNull ISdkLog log) {
|
||||
public static AndroidSdkData parse(@NotNull String path, @NotNull ISdkLog log) {
|
||||
final SdkManager manager = AndroidCommonUtils.createSdkManager(path, log);
|
||||
return manager != null ? new AndroidSdk(manager, path) : null;
|
||||
return manager != null ? new AndroidSdkData(manager, path) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static AndroidSdk parse(@NotNull String path, @NotNull final Component component) {
|
||||
public static AndroidSdkData parse(@NotNull String path, @NotNull final Component component) {
|
||||
MessageBuildingSdkLog log = new MessageBuildingSdkLog();
|
||||
AndroidSdk sdk = parse(path, log);
|
||||
if (sdk == null) {
|
||||
AndroidSdkData sdkData = parse(path, log);
|
||||
if (sdkData == null) {
|
||||
String message = log.getErrorMessage();
|
||||
if (message.length() > 0) {
|
||||
message = "Android SDK is parsed incorrectly. Parsing log:\n" + message;
|
||||
Messages.showInfoMessage(component, message, CommonBundle.getErrorTitle());
|
||||
}
|
||||
}
|
||||
return sdk;
|
||||
return sdkData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
AndroidSdk sdk = (AndroidSdk)obj;
|
||||
return FileUtil.pathsEqual(getLocation(), sdk.getLocation());
|
||||
AndroidSdkData sdkData = (AndroidSdkData)obj;
|
||||
return FileUtil.pathsEqual(getLocation(), sdkData.getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,15 +114,15 @@ public class AndroidSdkType extends SdkType implements JavaSdkType {
|
||||
final Sdk jdk = sdkModel.findSdk(name);
|
||||
|
||||
MessageBuildingSdkLog log = new MessageBuildingSdkLog();
|
||||
AndroidSdk sdkObject = AndroidSdk.parse(sdk.getHomePath(), log);
|
||||
AndroidSdkData sdkData = AndroidSdkData.parse(sdk.getHomePath(), log);
|
||||
|
||||
if (sdkObject == null) {
|
||||
if (sdkData == null) {
|
||||
String errorMessage = log.getErrorMessage().length() > 0 ? log.getErrorMessage() : AndroidBundle.message("cannot.parse.sdk.error");
|
||||
Messages.showErrorDialog(errorMessage, "SDK Parsing Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
IAndroidTarget[] targets = sdkObject.getTargets();
|
||||
IAndroidTarget[] targets = sdkData.getTargets();
|
||||
|
||||
if (targets.length == 0) {
|
||||
Messages.showErrorDialog(AndroidBundle.message("no.android.targets.error"), CommonBundle.getErrorTitle());
|
||||
|
||||
@@ -257,7 +257,7 @@ public class AndroidSdkUtils {
|
||||
if (data != null) {
|
||||
final AndroidPlatform androidPlatform = data.getAndroidPlatform();
|
||||
if (androidPlatform != null) {
|
||||
result.add(FileUtil.toSystemIndependentName(androidPlatform.getSdk().getLocation()));
|
||||
result.add(FileUtil.toSystemIndependentName(androidPlatform.getSdkData().getLocation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public class AndroidSdkUtils {
|
||||
if (data != null) {
|
||||
final AndroidPlatform androidPlatform = data.getAndroidPlatform();
|
||||
if (androidPlatform != null) {
|
||||
final String baseDir = FileUtil.toSystemIndependentName(androidPlatform.getSdk().getLocation());
|
||||
final String baseDir = FileUtil.toSystemIndependentName(androidPlatform.getSdkData().getLocation());
|
||||
if ((sdkDir == null || FileUtil.pathsEqual(baseDir, sdkDir)) &&
|
||||
targetHashString.equals(androidPlatform.getTarget().hashString())) {
|
||||
return sdk;
|
||||
@@ -361,11 +361,11 @@ public class AndroidSdkUtils {
|
||||
}
|
||||
|
||||
private static boolean tryToCreateAndSetAndroidSdk(@NotNull Module module, @NotNull String baseDir, @NotNull String targetHashString) {
|
||||
final AndroidSdk sdkObject = AndroidSdk.parse(baseDir, new EmptySdkLog());
|
||||
if (sdkObject != null) {
|
||||
final IAndroidTarget target = sdkObject.findTargetByHashString(targetHashString);
|
||||
final AndroidSdkData sdkData = AndroidSdkData.parse(baseDir, new EmptySdkLog());
|
||||
if (sdkData != null) {
|
||||
final IAndroidTarget target = sdkData.findTargetByHashString(targetHashString);
|
||||
if (target != null) {
|
||||
final Sdk androidSdk = createNewAndroidPlatform(target, sdkObject.getLocation(), true);
|
||||
final Sdk androidSdk = createNewAndroidPlatform(target, sdkData.getLocation(), true);
|
||||
if (androidSdk != null) {
|
||||
setSdk(module, androidSdk);
|
||||
return true;
|
||||
@@ -428,18 +428,18 @@ public class AndroidSdkUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Sdk findAppropriateAndroidPlatform(@NotNull IAndroidTarget target, @NotNull AndroidSdk sdk) {
|
||||
public static Sdk findAppropriateAndroidPlatform(@NotNull IAndroidTarget target, @NotNull AndroidSdkData sdkData) {
|
||||
for (Sdk library : ProjectJdkTable.getInstance().getAllJdks()) {
|
||||
final String homePath = library.getHomePath();
|
||||
|
||||
if (homePath != null && library.getSdkType().equals(AndroidSdkType.getInstance())) {
|
||||
final AndroidSdk sdk1 = AndroidSdk.parse(homePath, new EmptySdkLog());
|
||||
final AndroidSdkData sdkData1 = AndroidSdkData.parse(homePath, new EmptySdkLog());
|
||||
|
||||
if (sdk1 != null && sdk1.equals(sdk)) {
|
||||
if (sdkData1 != null && sdkData1.equals(sdkData)) {
|
||||
final AndroidSdkAdditionalData data = (AndroidSdkAdditionalData)library.getSdkAdditionalData();
|
||||
|
||||
if (data != null) {
|
||||
final IAndroidTarget target1 = data.getBuildTarget(sdk1);
|
||||
final IAndroidTarget target1 = data.getBuildTarget(sdkData1);
|
||||
|
||||
if (target1 != null && target.hashString().equals(target1.hashString())) {
|
||||
return library;
|
||||
|
||||
@@ -33,15 +33,15 @@ import java.util.Set;
|
||||
public class AndroidTargetData {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.sdk.AndroidTargetData");
|
||||
|
||||
private final AndroidSdk mySdk;
|
||||
private final AndroidSdkData mySdkData;
|
||||
private final IAndroidTarget myTarget;
|
||||
|
||||
private volatile AttributeDefinitions myAttrDefs;
|
||||
private volatile RenderServiceFactory myRenderServiceFactory;
|
||||
private volatile Set<String> myThemes;
|
||||
|
||||
public AndroidTargetData(@NotNull AndroidSdk sdk, @NotNull IAndroidTarget target) {
|
||||
mySdk = sdk;
|
||||
public AndroidTargetData(@NotNull AndroidSdkData sdkData, @NotNull IAndroidTarget target) {
|
||||
mySdkData = sdkData;
|
||||
myTarget = target;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class AndroidTargetData {
|
||||
if (myThemes == null) {
|
||||
myThemes = new HashSet<String>();
|
||||
final Module module = facet.getModule();
|
||||
final SystemResourceManager systemResourceManager = new SystemResourceManager(facet, new AndroidPlatform(mySdk, myTarget));
|
||||
final SystemResourceManager systemResourceManager = new SystemResourceManager(facet, new AndroidPlatform(mySdkData, myTarget));
|
||||
|
||||
for (VirtualFile valueResourceDir : systemResourceManager.getResourceSubdirs("values")) {
|
||||
for (final VirtualFile valueResourceFile : valueResourceDir.getChildren()) {
|
||||
|
||||
+7
-7
@@ -682,13 +682,13 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
|
||||
}
|
||||
|
||||
public void updateDevicesAndTargets(@Nullable AndroidPlatform platform) {
|
||||
final AndroidSdk sdkObject = platform != null ? platform.getSdk() : null;
|
||||
final AndroidSdkData sdkData = platform != null ? platform.getSdkData() : null;
|
||||
final LayoutDevice selectedDevice = getSelectedDevice();
|
||||
final String selectedDeviceName = selectedDevice != null ? selectedDevice.getName() : null;
|
||||
|
||||
final List<LayoutDevice> devices;
|
||||
if (sdkObject != null) {
|
||||
myLayoutDeviceManager.loadDevices(sdkObject);
|
||||
if (sdkData != null) {
|
||||
myLayoutDeviceManager.loadDevices(sdkData);
|
||||
devices = myLayoutDeviceManager.getCombinedList();
|
||||
}
|
||||
else {
|
||||
@@ -720,9 +720,9 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
|
||||
IAndroidTarget newSelectedTarget = null;
|
||||
|
||||
final List<IAndroidTarget> targets;
|
||||
if (sdkObject != null) {
|
||||
if (sdkData != null) {
|
||||
targets = new ArrayList<IAndroidTarget>();
|
||||
for (IAndroidTarget target : sdkObject.getTargets()) {
|
||||
for (IAndroidTarget target : sdkData.getTargets()) {
|
||||
if (target.isPlatform()) {
|
||||
if (target.hashString().equals(selectedTargetHashString)) {
|
||||
newSelectedTarget = target;
|
||||
@@ -752,7 +752,7 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
|
||||
}
|
||||
|
||||
if (modulePlatformHash != null) {
|
||||
targetFromModule = sdkObject.findTargetByHashString(modulePlatformHash);
|
||||
targetFromModule = sdkData.findTargetByHashString(modulePlatformHash);
|
||||
if (targetFromModule != null && targets.indexOf(targetFromModule) >= 0) {
|
||||
newSelectedTarget = targetFromModule;
|
||||
}
|
||||
@@ -917,7 +917,7 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
|
||||
if (target == null) {
|
||||
target = androidPlatform.getTarget();
|
||||
}
|
||||
targetData = androidPlatform.getSdk().getTargetData(target);
|
||||
targetData = androidPlatform.getSdkData().getTargetData(target);
|
||||
}
|
||||
|
||||
if (targetData == null || targetData.areThemesCached()) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.android.prefs.AndroidLocation.AndroidLocationException;
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -149,13 +149,13 @@ public class LayoutDeviceManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void loadDevices(@NotNull AndroidSdk sdk) {
|
||||
loadDefaultAndUserDevices(sdk);
|
||||
loadAddOnLayoutDevices(sdk);
|
||||
public void loadDevices(@NotNull AndroidSdkData sdkData) {
|
||||
loadDefaultAndUserDevices(sdkData);
|
||||
loadAddOnLayoutDevices(sdkData);
|
||||
}
|
||||
|
||||
private void loadDefaultAndUserDevices(@NotNull AndroidSdk sdk) {
|
||||
loadDefaultLayoutDevices(sdk.getLocation());
|
||||
private void loadDefaultAndUserDevices(@NotNull AndroidSdkData sdkData) {
|
||||
loadDefaultLayoutDevices(sdkData.getLocation());
|
||||
|
||||
try {
|
||||
myUserLayoutDevices.clear();
|
||||
@@ -181,8 +181,8 @@ public class LayoutDeviceManager {
|
||||
combineLayoutDevices();
|
||||
}
|
||||
|
||||
private void loadAddOnLayoutDevices(@NotNull AndroidSdk sdk) {
|
||||
for (IAndroidTarget target : sdk.getTargets()) {
|
||||
private void loadAddOnLayoutDevices(@NotNull AndroidSdkData sdkData) {
|
||||
for (IAndroidTarget target : sdkData.getTargets()) {
|
||||
if (!target.isPlatform()) {
|
||||
File deviceXml = new File(target.getLocation(), SdkConstants.FN_DEVICES_XML);
|
||||
if (deviceXml.isFile()) {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class RenderUtil {
|
||||
|
||||
config.setVersionQualifier(new VersionQualifier(target.getVersion().getApiLevel()));
|
||||
|
||||
final RenderServiceFactory factory = platform.getSdk().getTargetData(target).getRenderServiceFactory(project);
|
||||
final RenderServiceFactory factory = platform.getSdkData().getTargetData(target).getRenderServiceFactory(project);
|
||||
if (factory == null) {
|
||||
throw new RenderingException(AndroidBundle.message("android.layout.preview.cannot.load.library.error"));
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public class RenderUtil {
|
||||
|
||||
config.setVersionQualifier(new VersionQualifier(target.getVersion().getApiLevel()));
|
||||
|
||||
final RenderServiceFactory factory = platform.getSdk().getTargetData(target).getRenderServiceFactory(project);
|
||||
final RenderServiceFactory factory = platform.getSdkData().getTargetData(target).getRenderServiceFactory(project);
|
||||
if (factory == null) {
|
||||
throw new RenderingException(AndroidBundle.message("android.layout.preview.cannot.load.library.error"));
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.facet.AndroidFacetConfiguration;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.AndroidSdkData;
|
||||
import org.jetbrains.android.sdk.AndroidSdkAdditionalData;
|
||||
import org.jetbrains.android.sdk.AndroidSdkType;
|
||||
import org.jetbrains.android.sdk.EmptySdkLog;
|
||||
@@ -156,8 +156,8 @@ public abstract class AndroidTestCase extends JavaCodeInsightFixtureTestCase {
|
||||
sdkModificator.addRoot(resFolder, OrderRootType.CLASSES);
|
||||
|
||||
AndroidSdkAdditionalData data = new AndroidSdkAdditionalData(sdk);
|
||||
AndroidSdk sdkObject = AndroidSdk.parse(sdkPath, new EmptySdkLog());
|
||||
data.setBuildTarget(sdkObject.findTargetByName("Android 1.5"));
|
||||
AndroidSdkData sdkData = AndroidSdkData.parse(sdkPath, new EmptySdkLog());
|
||||
data.setBuildTarget(sdkData.findTargetByName("Android 1.5"));
|
||||
sdkModificator.setSdkAdditionalData(data);
|
||||
sdkModificator.commitChanges();
|
||||
return sdk;
|
||||
|
||||
Reference in New Issue
Block a user