use of org.jetbrains.android.sdk.AndroidSdkType in project kotlin by JetBrains.
the class IntellijLintClient method getSdkHome.
@Nullable
@Override
public File getSdkHome() {
Module module = getModule();
if (module != null) {
Sdk moduleSdk = ModuleRootManager.getInstance(module).getSdk();
if (moduleSdk != null && moduleSdk.getSdkType() instanceof AndroidSdkType) {
String path = moduleSdk.getHomePath();
if (path != null) {
File home = new File(path);
if (home.exists()) {
return home;
}
}
}
}
File sdkHome = super.getSdkHome();
if (sdkHome != null) {
return sdkHome;
}
for (Module m : ModuleManager.getInstance(myProject).getModules()) {
Sdk moduleSdk = ModuleRootManager.getInstance(m).getSdk();
if (moduleSdk != null) {
if (moduleSdk.getSdkType() instanceof AndroidSdkType) {
String path = moduleSdk.getHomePath();
if (path != null) {
File home = new File(path);
if (home.exists()) {
return home;
}
}
}
}
}
return IdeSdks.getAndroidSdkPath();
}
use of org.jetbrains.android.sdk.AndroidSdkType in project android by JetBrains.
the class LintIdeClient method getSdkHome.
@Nullable
@Override
public File getSdkHome() {
Module module = getModule();
if (module != null) {
Sdk moduleSdk = ModuleRootManager.getInstance(module).getSdk();
if (moduleSdk != null && moduleSdk.getSdkType() instanceof AndroidSdkType) {
String path = moduleSdk.getHomePath();
if (path != null) {
File home = new File(path);
if (home.exists()) {
return home;
}
}
}
}
File sdkHome = super.getSdkHome();
if (sdkHome != null) {
return sdkHome;
}
for (Module m : ModuleManager.getInstance(myProject).getModules()) {
Sdk moduleSdk = ModuleRootManager.getInstance(m).getSdk();
if (moduleSdk != null) {
if (moduleSdk.getSdkType() instanceof AndroidSdkType) {
String path = moduleSdk.getHomePath();
if (path != null) {
File home = new File(path);
if (home.exists()) {
return home;
}
}
}
}
}
return IdeSdks.getInstance().getAndroidSdkPath();
}
use of org.jetbrains.android.sdk.AndroidSdkType in project android by JetBrains.
the class AndroidJunitPatcher method patchJavaParameters.
@Override
public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) {
if (module == null) {
return;
}
AndroidModuleModel androidModel = AndroidModuleModel.get(module);
if (androidModel == null) {
return;
}
// Modify the class path only if we're dealing with the unit test artifact.
PathsList classPath = javaParameters.getClassPath();
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk == null || !(sdk.getSdkType() instanceof AndroidSdkType)) {
return;
}
SdkAdditionalData data = sdk.getSdkAdditionalData();
if (!(data instanceof AndroidSdkAdditionalData)) {
return;
}
AndroidPlatform platform = ((AndroidSdkAdditionalData) data).getAndroidPlatform();
if (platform == null) {
return;
}
classPath.remove(platform.getTarget().getPath(IAndroidTarget.ANDROID_JAR));
// Move the mockable android jar to the end.
String mockableJarPath = null;
for (String path : classPath.getPathList()) {
if (new File(FileUtil.toSystemDependentName(path)).getName().startsWith("mockable-android")) {
// PathsList stores strings - use the one that's actually stored there.
mockableJarPath = path;
break;
}
}
if (mockableJarPath != null) {
classPath.remove(mockableJarPath);
classPath.addTail(mockableJarPath);
}
}
use of org.jetbrains.android.sdk.AndroidSdkType in project android by JetBrains.
the class AndroidSdkResolveScopeProvider method getResolveScope.
@Nullable
@Override
public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, Project project) {
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID))
return null;
ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
JdkOrderEntry entry = ContainerUtil.findInstance(index.getOrderEntriesForFile(file), JdkOrderEntry.class);
final Sdk sdk = entry == null ? null : entry.getJdk();
if (sdk == null || !(sdk.getSdkType() instanceof AndroidSdkType)) {
return null;
}
return new MyJdkScope(project, entry, index.isInLibrarySource(file));
}
Aggregations