Merge changes I2e4f0fb6,I59d09956 into studio-1.1-dev
automerge: 42027a3
* commit '42027a37542f3c93f6e047bb16e14eda3a21d321':
82837: Update wizards to use new headers
Update headers for module and project wizards
diff --git a/adt-branding/src/artwork/androidstudio.ico b/adt-branding/src/artwork/androidstudio.ico
index bee7f21..6f0cbc1 100644
--- a/adt-branding/src/artwork/androidstudio.ico
+++ b/adt-branding/src/artwork/androidstudio.ico
Binary files differ
diff --git a/adt-branding/src/idea/AndroidStudioApplicationInfo.xml b/adt-branding/src/idea/AndroidStudioApplicationInfo.xml
index f0b4630..a75b699 100755
--- a/adt-branding/src/idea/AndroidStudioApplicationInfo.xml
+++ b/adt-branding/src/idea/AndroidStudioApplicationInfo.xml
@@ -14,13 +14,13 @@
~ limitations under the License.
-->
<component>
- <version codename="Preview" major="1" minor="1.0" eap="true" />
+ <version codename="Preview" major="1" minor="2.0" eap="true" />
<company name="Google Inc." url="http://developer.android.com"/>
- <build number="__BUILD_NUMBER__" date="__BUILD_DATE__" apiVersion="135.1286"/>
+ <build number="__BUILD_NUMBER__" date="__BUILD_DATE__" apiVersion="139.791"/>
<install-over minbuild="0.1" maxbuild="999.999999" version="0"/>
<logo url="/artwork/studio_splash.png" textcolor="cccccc" progressColor="90c653" progressY="238" progressTailIcon="/community_progress_tail.png"/>
<about url="/artwork/studio_about.png" foreground="cccccc"/>
- <icon size32="/artwork/icon_AS.png" size16="/artwork/icon_AS_small.png" size32opaque="/artwork/icon_AS_white.png" size12="/artwork/toolWindowProject_AS.png"/>
+ <icon size32="/artwork/icon_AS.png" size16="/artwork/icon_AS_small.png" size32opaque="/artwork/icon_AS_white.png" size12="/artwork/toolWindowProject_AS.png" ico="artwork/androidstudio.ico"/>
<package code="__PACKAGE_CODE__"/>
<names product="Android Studio" fullname="Android Studio" script="studio"/> <!-- fullname is used by NPW to show default folder for projects as -->
diff --git a/adt-branding/src/idea/android_studio_launcher.properties b/adt-branding/src/idea/android_studio_launcher.properties
new file mode 100644
index 0000000..2d0d8b0
--- /dev/null
+++ b/adt-branding/src/idea/android_studio_launcher.properties
@@ -0,0 +1,7 @@
+IDS_APP_TITLE=Android Studio Launcher
+IDS_JDK_ENV_VAR=STUDIO_JDK
+IDS_VM_OPTIONS_PATH=%USERPROFILE%\\.__PRODUCT_PATHS_SELECTOR__
+IDC_WINLAUNCHER=ANDROID_STUDIO_LAUNCHER
+IDS_PROPS_ENV_VAR=STUDIO_PROPERTIES
+IDS_VM_OPTIONS_ENV_VAR=STUDIO_VM_OPTIONS
+IDS_ERROR_LAUNCHING_APP=Error launching Android Studio
\ No newline at end of file
diff --git a/android-gradle-jps/src/com/android/tools/idea/jps/builder/AndroidGradleTargetBuilder.java b/android-gradle-jps/src/com/android/tools/idea/jps/builder/AndroidGradleTargetBuilder.java
index 9d71a2e..53a5ac9 100644
--- a/android-gradle-jps/src/com/android/tools/idea/jps/builder/AndroidGradleTargetBuilder.java
+++ b/android-gradle-jps/src/com/android/tools/idea/jps/builder/AndroidGradleTargetBuilder.java
@@ -18,6 +18,7 @@
import com.android.builder.model.AndroidProject;
import com.android.tools.idea.gradle.output.GradleMessage;
import com.android.tools.idea.gradle.output.parser.BuildOutputParser;
+import com.android.tools.idea.gradle.output.parser.PatternAwareOutputParser;
import com.android.tools.idea.gradle.util.AndroidGradleSettings;
import com.android.tools.idea.gradle.util.BuildMode;
import com.android.tools.idea.gradle.util.GradleBuilds;
@@ -54,6 +55,7 @@
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsTypedModule;
+import org.jetbrains.jps.service.JpsServiceManager;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -293,7 +295,8 @@
* "Problems" view. The idea is that we need to somehow inform the user that something went wrong.
*/
private static void handleBuildException(BuildException e, CompileContext context, String stdErr) throws ProjectBuildException {
- Collection<GradleMessage> compilerMessages = new BuildOutputParser().parseGradleOutput(stdErr);
+ Iterable<PatternAwareOutputParser> parsers = JpsServiceManager.getInstance().getExtensions(PatternAwareOutputParser.class);
+ Collection<GradleMessage> compilerMessages = new BuildOutputParser(parsers).parseGradleOutput(stdErr);
if (!compilerMessages.isEmpty()) {
boolean hasError = false;
for (GradleMessage message : compilerMessages) {
diff --git a/android/android.iml b/android/android.iml
index da26697..e5dea19 100755
--- a/android/android.iml
+++ b/android/android.iml
@@ -74,10 +74,11 @@
</orderEntry>
<orderEntry type="module" module-name="testutils" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Eclipse" level="project" />
+ <orderEntry type="module" module-name="properties-psi-api" />
<orderEntry type="library" name="asm4" level="project" />
<orderEntry type="library" scope="TEST" name="fest" level="project" />
<orderEntry type="module" module-name="platform-main" scope="TEST" />
<orderEntry type="module" module-name="bootstrap" scope="TEST" />
<orderEntry type="library" name="jcip" level="project" />
</component>
-</module>
\ No newline at end of file
+</module>
diff --git a/android/common/android-common.iml b/android/common/android-common.iml
index e5e2a70..c333245 100644
--- a/android/common/android-common.iml
+++ b/android/common/android-common.iml
@@ -4,8 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/../rt/resources" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
diff --git a/android/common/resources/META-INF/services/com.android.tools.idea.gradle.output.parser.PatternAwareOutputParser b/android/common/resources/META-INF/services/com.android.tools.idea.gradle.output.parser.PatternAwareOutputParser
new file mode 100644
index 0000000..9be3611
--- /dev/null
+++ b/android/common/resources/META-INF/services/com.android.tools.idea.gradle.output.parser.PatternAwareOutputParser
@@ -0,0 +1,9 @@
+com.android.tools.idea.gradle.output.parser.androidPlugin.AndroidPluginOutputParser
+com.android.tools.idea.gradle.output.parser.GradleOutputParser
+com.android.tools.idea.gradle.output.parser.aapt.AaptOutputParser
+com.android.tools.idea.gradle.output.parser.androidPlugin.XmlValidationErrorParser
+com.android.tools.idea.gradle.output.parser.BuildFailureParser
+com.android.tools.idea.gradle.output.parser.androidPlugin.ManifestMergeFailureParser
+com.android.tools.idea.gradle.output.parser.androidPlugin.DexExceptionParser
+com.android.tools.idea.gradle.output.parser.javac.JavacOutputParser
+com.android.tools.idea.gradle.output.parser.androidPlugin.MergingExceptionParser
\ No newline at end of file
diff --git a/android/common/src/com/android/tools/idea/gradle/output/parser/BuildFailureParser.java b/android/common/src/com/android/tools/idea/gradle/output/parser/BuildFailureParser.java
index 6f37724..e0d6879 100644
--- a/android/common/src/com/android/tools/idea/gradle/output/parser/BuildFailureParser.java
+++ b/android/common/src/com/android/tools/idea/gradle/output/parser/BuildFailureParser.java
@@ -49,7 +49,7 @@
* The Where section may not appear (it usually only shows up if there's a problem in the build.gradle file itself). We parse this
* out to get the failure message and module, and the where output if it appears.
*/
-class BuildFailureParser implements PatternAwareOutputParser {
+public class BuildFailureParser implements PatternAwareOutputParser {
private static final Pattern[] BEGINNING_PATTERNS =
{Pattern.compile("^FAILURE: Build failed with an exception."), Pattern.compile("^\\* What went wrong:")};
diff --git a/android/common/src/com/android/tools/idea/gradle/output/parser/BuildOutputParser.java b/android/common/src/com/android/tools/idea/gradle/output/parser/BuildOutputParser.java
index 8225594..711727c 100644
--- a/android/common/src/com/android/tools/idea/gradle/output/parser/BuildOutputParser.java
+++ b/android/common/src/com/android/tools/idea/gradle/output/parser/BuildOutputParser.java
@@ -16,9 +16,6 @@
package com.android.tools.idea.gradle.output.parser;
import com.android.tools.idea.gradle.output.GradleMessage;
-import com.android.tools.idea.gradle.output.parser.aapt.AaptOutputParser;
-import com.android.tools.idea.gradle.output.parser.androidPlugin.*;
-import com.android.tools.idea.gradle.output.parser.javac.JavacOutputParser;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
@@ -29,11 +26,11 @@
* Parses Gradle's build output and creates the messages to be displayed in the "Messages" tool window.
*/
public class BuildOutputParser {
- private static final PatternAwareOutputParser[] PARSERS = {
- new AndroidPluginOutputParser(), new GradleOutputParser(), new AaptOutputParser(), new XmlValidationErrorParser(),
- new BuildFailureParser(), new ManifestMergeFailureParser(), new DexExceptionParser(),
- new JavacOutputParser(), new MergingExceptionParser()
- };
+ private Iterable<? extends PatternAwareOutputParser> myParsers;
+
+ public BuildOutputParser(Iterable<? extends PatternAwareOutputParser> parsers) {
+ myParsers = parsers;
+ }
/**
* Parses the given Gradle output and creates the messages to be displayed in the "Messages" tool window.
@@ -57,7 +54,7 @@
continue;
}
boolean handled = false;
- for (PatternAwareOutputParser parser : PARSERS) {
+ for (PatternAwareOutputParser parser : myParsers) {
try {
if (parser.parse(line, outputReader, messages)) {
handled = true;
diff --git a/android/common/src/com/android/tools/idea/gradle/output/parser/GradleOutputParser.java b/android/common/src/com/android/tools/idea/gradle/output/parser/GradleOutputParser.java
index 392f9c5..8e6b037 100644
--- a/android/common/src/com/android/tools/idea/gradle/output/parser/GradleOutputParser.java
+++ b/android/common/src/com/android/tools/idea/gradle/output/parser/GradleOutputParser.java
@@ -21,7 +21,7 @@
import java.util.List;
import java.util.regex.Pattern;
-class GradleOutputParser implements PatternAwareOutputParser {
+public class GradleOutputParser implements PatternAwareOutputParser {
private static final Pattern ERROR_COUNT_PATTERN = Pattern.compile("[\\d]+ error(s)?");
@Override
diff --git a/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java b/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java
index fc95ee3..8b145a5 100644
--- a/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java
+++ b/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java
@@ -20,6 +20,7 @@
import com.android.jarutils.JavaResourceFilter;
import com.android.jarutils.SignedJarBuilder;
import com.android.prefs.AndroidLocation;
+import com.android.sdklib.IAndroidTarget;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
@@ -118,6 +119,7 @@
@NotNull String finalApk,
boolean unsigned,
@NotNull String sdkPath,
+ @NotNull IAndroidTarget target,
@Nullable String customKeystorePath,
@NotNull Condition<File> resourceFilter) throws IOException {
final AndroidBuildTestingManager testingManager = AndroidBuildTestingManager.getTestingManager();
@@ -161,7 +163,7 @@
finalPackage(dexPath, resourceRoots, externalJars, nativeLibsFolders, finalApk, resPackagePath, customKeystorePath, false,
resourceFilter));
}
- final String zipAlignPath = sdkPath + File.separator + AndroidCommonUtils.toolPath(SdkConstants.FN_ZIPALIGN);
+ final String zipAlignPath = AndroidCommonUtils.getZipAlign(sdkPath, target);
boolean withAlignment = new File(zipAlignPath).exists();
String unalignedApk = AndroidCommonUtils.addSuffixToFileName(finalApk, UNALIGNED_SUFFIX);
diff --git a/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java b/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java
index 80e3cf9..eaced6f 100644
--- a/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java
+++ b/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java
@@ -19,6 +19,7 @@
import com.android.jarutils.SignedJarBuilder;
import com.android.resources.ResourceFolderType;
import com.android.resources.ResourceType;
+import com.android.sdklib.BuildToolInfo;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.internal.project.ProjectProperties;
import com.google.common.base.Charsets;
@@ -286,7 +287,7 @@
path = path.substring(1);
}
- files.add(new Pair<File, String>(file, path));
+ files.add(Pair.create(file, path));
}
}
@@ -346,6 +347,7 @@
@NotNull String[] proguardConfigFileOsPaths,
@NotNull String inputJarOsPath,
@NotNull String[] externalJarOsPaths,
+ @NotNull String[] providedJarOsPaths,
@NotNull String outputJarFileOsPath,
@Nullable String logDirOutputOsPath) throws IOException {
final List<String> commands = new ArrayList<String>();
@@ -393,6 +395,10 @@
builder.append(quotePath(lib.getJarPath()));
}
}
+ for (String path : providedJarOsPaths) {
+ builder.append(File.pathSeparatorChar);
+ builder.append(quotePath(path));
+ }
commands.add(builder.toString());
if (logDirOutputOsPath != null) {
@@ -649,6 +655,7 @@
public static Map<AndroidCompilerMessageKind, List<String>> buildArtifact(@NotNull String artifactName,
@NotNull String messagePrefix,
@NotNull String sdkLocation,
+ @NotNull IAndroidTarget target,
@Nullable String artifactFilePath,
@NotNull String keyStorePath,
@Nullable String keyAlias,
@@ -677,8 +684,7 @@
messages.get(AndroidCompilerMessageKind.ERROR).add(prefix + "file " + artifactFilePath + " hasn't been generated");
return messages;
}
- final String zipAlignPath =
- FileUtil.toSystemDependentName(sdkLocation + '/' + toolPath(SdkConstants.FN_ZIPALIGN));
+ final String zipAlignPath = getZipAlign(sdkLocation, target);
final boolean runZipAlign = new File(zipAlignPath).isFile();
File tmpDir = null;
@@ -779,4 +785,22 @@
}
}
}
+
+ @NotNull
+ public static String getZipAlign(@NotNull String sdkPath, @NotNull IAndroidTarget target) {
+ final BuildToolInfo buildToolInfo = target.getBuildToolInfo();
+
+ if (buildToolInfo != null) {
+ String path = null;
+ try {
+ path = buildToolInfo.getPath(BuildToolInfo.PathId.ZIP_ALIGN);
+ }
+ catch (Throwable ignored) {
+ }
+ if (path != null && new File(path).exists()) {
+ return path;
+ }
+ }
+ return sdkPath + File.separatorChar + toolPath(SdkConstants.FN_ZIPALIGN);
+ }
}
diff --git a/android/common/testSrc/com/android/tools/idea/gradle/output/parser/BuildOutputParserTest.java b/android/common/testSrc/com/android/tools/idea/gradle/output/parser/BuildOutputParserTest.java
index c8b9f38..5b9bc60 100644
--- a/android/common/testSrc/com/android/tools/idea/gradle/output/parser/BuildOutputParserTest.java
+++ b/android/common/testSrc/com/android/tools/idea/gradle/output/parser/BuildOutputParserTest.java
@@ -37,6 +37,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Locale;
+import java.util.ServiceLoader;
import static com.android.SdkConstants.*;
import static com.android.utils.SdkUtils.createPathComment;
@@ -57,7 +58,7 @@
@Override
public void setUp() throws Exception {
super.setUp();
- parser = new BuildOutputParser();
+ parser = new BuildOutputParser(ServiceLoader.load(PatternAwareOutputParser.class));
}
@Override
@@ -336,6 +337,7 @@
}
}
finally {
+ //noinspection deprecation
Closeables.close(out, true /* swallowIOException */);
}
}
diff --git a/android/resources/icons/AndroidDesignerIcons.java b/android/gen/icons/AndroidDesignerIcons.java
similarity index 100%
rename from android/resources/icons/AndroidDesignerIcons.java
rename to android/gen/icons/AndroidDesignerIcons.java
diff --git a/android/resources/icons/AndroidIcons.java b/android/gen/icons/AndroidIcons.java
similarity index 100%
rename from android/resources/icons/AndroidIcons.java
rename to android/gen/icons/AndroidIcons.java
diff --git a/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/IdeTestApplication.java b/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/IdeTestApplication.java
index 6af6743..f68375f 100644
--- a/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/IdeTestApplication.java
+++ b/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/IdeTestApplication.java
@@ -244,7 +244,7 @@
Application application = ApplicationManager.getApplication();
if (application != null) {
if (application instanceof ApplicationEx) {
- ((ApplicationEx)application).exit(true);
+ ((ApplicationEx)application).exit(true, true);
}
else {
application.exit();
diff --git a/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/fixture/ExecutionToolWindowFixture.java b/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/fixture/ExecutionToolWindowFixture.java
index 3a0f679..f045adf 100644
--- a/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/fixture/ExecutionToolWindowFixture.java
+++ b/android/guiTestSrc/com/android/tools/idea/tests/gui/framework/fixture/ExecutionToolWindowFixture.java
@@ -16,7 +16,7 @@
package com.android.tools.idea.tests.gui.framework.fixture;
import com.android.tools.idea.tests.gui.framework.GuiTests;
-import com.intellij.execution.actions.StopAction;
+import com.intellij.execution.DefaultExecutionResult;
import com.intellij.execution.impl.ConsoleViewImpl;
import com.intellij.execution.ui.layout.impl.GridImpl;
import com.intellij.execution.ui.layout.impl.JBRunnerTabs;
@@ -118,7 +118,7 @@
assertNotNull(toolbar);
List<ActionButton> buttons = UIUtil.findComponentsOfType(toolbar, ActionButton.class);
for (ActionButton button : buttons) {
- if (button.getAction() instanceof StopAction) {
+ if ("com.intellij.execution.actions.StopAction".equals(button.getAction().getClass().getCanonicalName())) {
return Reflection.method("isButtonEnabled").withReturnType(boolean.class).in(button).invoke();
}
}
@@ -130,7 +130,7 @@
assertNotNull(toolbar);
List<ActionButton> buttons = UIUtil.findComponentsOfType(toolbar, ActionButton.class);
for (ActionButton button : buttons) {
- if (button.getAction() instanceof StopAction) {
+ if (button.getAction() instanceof DefaultExecutionResult.StopAction) {
boolean enabled = Reflection.method("isButtonEnabled").withReturnType(boolean.class).in(button).invoke();
if (enabled) {
button.click();
diff --git a/android/guiTestSrc/com/android/tools/idea/tests/gui/layout/NewProjectTest.java b/android/guiTestSrc/com/android/tools/idea/tests/gui/layout/NewProjectTest.java
index 3e5b356..4ae1119 100644
--- a/android/guiTestSrc/com/android/tools/idea/tests/gui/layout/NewProjectTest.java
+++ b/android/guiTestSrc/com/android/tools/idea/tests/gui/layout/NewProjectTest.java
@@ -31,6 +31,7 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
+import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import org.jetbrains.annotations.NotNull;
@@ -78,7 +79,7 @@
LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(projectFrame.getProject());
assertThat(projectExt.getLanguageLevel()).as("Project Java language level").isSameAs(LanguageLevel.JDK_1_6);
for (Module module : ModuleManager.getInstance(projectFrame.getProject()).getModules()) {
- LanguageLevelModuleExtension moduleExt = LanguageLevelModuleExtension.getInstance(module);
+ LanguageLevelModuleExtension moduleExt = LanguageLevelModuleExtensionImpl.getInstance(module);
assertThat(moduleExt.getLanguageLevel()).as("Gradle Java language level in module " + module.getName()).isNull();
}
}
@@ -159,7 +160,7 @@
LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(projectFrame.getProject());
assertThat(projectExt.getLanguageLevel()).as("Project Java language level").isSameAs(LanguageLevel.JDK_1_7);
for (Module module : ModuleManager.getInstance(projectFrame.getProject()).getModules()) {
- LanguageLevelModuleExtension moduleExt = LanguageLevelModuleExtension.getInstance(module);
+ LanguageLevelModuleExtension moduleExt = LanguageLevelModuleExtensionImpl.getInstance(module);
assertThat(moduleExt.getLanguageLevel()).as("Gradle Java language level in module " + module.getName()).isNull();
}
}
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidArtifactBuildTaskProvider.java b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidArtifactBuildTaskProvider.java
index 2f8719e..9ff3dff 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidArtifactBuildTaskProvider.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidArtifactBuildTaskProvider.java
@@ -105,7 +105,7 @@
? Base64Converter.decode(keyPassword) : null;
try {
final Map<AndroidCompilerMessageKind,List<String>> messages =
- AndroidCommonUtils.buildArtifact(artifactName, messagePrefix, sdkLocation, artifactFilePath,
+ AndroidCommonUtils.buildArtifact(artifactName, messagePrefix, sdkLocation, platform.getTarget(), artifactFilePath,
keyStorePath, myProps.getKeyAlias(), plainKeyStorePassword, plainKeyPassword);
AndroidJpsUtil.addMessages(context, messages, BUILDER_NAME, entryName);
}
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyProcessor.java b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyProcessor.java
index 8d23c69..7c2295b 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyProcessor.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyProcessor.java
@@ -12,6 +12,9 @@
public void processExternalLibrary(@NotNull File file) {
}
+ public void processProvidedLibrary(@NotNull File file) {
+ }
+
public void processAndroidLibraryPackage(@NotNull File file, @NotNull JpsModule depModule) {
}
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyType.java b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyType.java
index 177c489..b86e854 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyType.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDependencyType.java
@@ -4,5 +4,5 @@
* @author Eugene.Kudelevsky
*/
public enum AndroidDependencyType {
- EXTERNAL_LIBRARY, ANDROID_LIBRARY_PACKAGE, JAVA_MODULE_OUTPUT_DIR, ANDROID_LIBRARY_OUTPUT_DIRECTORY
+ EXTERNAL_LIBRARY, PROVIDED_LIBRARY, ANDROID_LIBRARY_PACKAGE, JAVA_MODULE_OUTPUT_DIR, ANDROID_LIBRARY_OUTPUT_DIRECTORY
}
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java
index ebec8c1..c295789 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java
@@ -428,6 +428,7 @@
final List<String> classesDirs = new ArrayList<String>();
final List<String> libClassesDirs = new ArrayList<String>();
final List<String> externalJars = new ArrayList<String>();
+ final List<String> providedJars = new ArrayList<String>();
final List<BuildRootDescriptor> roots = context.getProjectDescriptor().getBuildRootIndex().getTargetRoots(target, context);
@@ -457,10 +458,14 @@
externalJars.add(rootFile.getPath());
}
}
+ else if (root instanceof AndroidDexBuildTarget.MyProvidedJarBuildRootDescriptor) {
+ providedJars.add(rootFile.getPath());
+ }
}
final String[] classFilesDirOsPaths = ArrayUtil.toStringArray(classesDirs);
final String[] libClassFilesDirOsPaths = ArrayUtil.toStringArray(libClassesDirs);
final String[] externalJarOsPaths = ArrayUtil.toStringArray(externalJars);
+ final String[] providedJarOsPaths = ArrayUtil.toStringArray(providedJars);
final String inputJarOsPath = AndroidCommonUtils.buildTempInputJar(classFilesDirOsPaths, libClassFilesDirOsPaths);
final AndroidBuildTestingManager testingManager = AndroidBuildTestingManager.getTestingManager();
@@ -487,7 +492,7 @@
final Map<AndroidCompilerMessageKind, List<String>> messages =
AndroidCommonUtils.launchProguard(platform.getTarget(), platform.getSdkToolsRevision(), platform.getSdk().getHomePath(),
javaExecutable, proguardVmOptions, proguardCfgPaths, inputJarOsPath, externalJarOsPaths,
- outputJarPath, logsDir.getPath());
+ providedJarOsPaths, outputJarPath, logsDir.getPath());
AndroidJpsUtil.addMessages(context, messages, PRO_GUARD_BUILDER_NAME, module.getName());
return messages.get(AndroidCompilerMessageKind.ERROR).isEmpty()
? Pair.create(true, newState) : null;
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidJpsUtil.java b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidJpsUtil.java
index 5cfdaaa..399074e 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidJpsUtil.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidJpsUtil.java
@@ -38,9 +38,7 @@
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactService;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
-import org.jetbrains.jps.model.java.JavaSourceRootType;
-import org.jetbrains.jps.model.java.JpsJavaClasspathKind;
-import org.jetbrains.jps.model.java.JpsJavaExtensionService;
+import org.jetbrains.jps.model.java.*;
import org.jetbrains.jps.model.java.impl.JpsJavaDependenciesEnumerationHandler;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryRoot;
@@ -245,6 +243,24 @@
return result;
}
+ @NotNull
+ public static Set<String> getProvidedLibraries(@NotNull BuildDataPaths paths,
+ @NotNull JpsModule module) {
+ final Set<String> result = new HashSet<String>();
+ processClasspath(paths, module, new AndroidDependencyProcessor() {
+ @Override
+ public void processProvidedLibrary(@NotNull File file) {
+ result.add(file.getPath());
+ }
+
+ @Override
+ public boolean isToProcess(@NotNull AndroidDependencyType type) {
+ return type == AndroidDependencyType.PROVIDED_LIBRARY;
+ }
+ }, false, false);
+ return result;
+ }
+
private static void addAnnotationsJarIfNecessary(@NotNull AndroidPlatform platform, @NotNull Set<String> libs) {
if (platform.needToAddAnnotationsJarToClasspath()) {
final String sdkHomePath = platform.getSdk().getHomePath();
@@ -280,7 +296,7 @@
if (item instanceof JpsLibraryDependency) {
final JpsLibrary library = ((JpsLibraryDependency)item).getLibrary();
- if (library != null && (withAarDeps || getResDirAndClassesJarIfAar(library) == null)) {
+ if (library != null && (withAarDeps || getResDirAndJarsIfAar(library) == null)) {
for (JpsLibraryRoot root : library.getRoots(JpsOrderRootType.COMPILED)) {
final File file = JpsPathUtil.urlToFile(root.getUrl());
@@ -301,6 +317,20 @@
}
}
}
+ if (processor.isToProcess(AndroidDependencyType.PROVIDED_LIBRARY)) {
+ for (JpsDependencyElement item : module.getDependenciesList().getDependencies()) {
+ if (item instanceof JpsLibraryDependency) {
+ final JpsLibrary library = ((JpsLibraryDependency)item).getLibrary();
+ final JpsJavaDependencyExtension extension = JpsJavaExtensionService.getInstance().getDependencyExtension(item);
+
+ if (library != null && extension != null && extension.getScope() == JpsJavaDependencyScope.PROVIDED) {
+ for (JpsLibraryRoot root : library.getRoots(JpsOrderRootType.COMPILED)) {
+ processor.processProvidedLibrary(JpsPathUtil.urlToFile(root.getUrl()));
+ }
+ }
+ }
+ }
+ }
for (JpsDependencyElement item : JpsJavaExtensionService.getInstance().getDependencies(module, JpsJavaClasspathKind.PRODUCTION_RUNTIME, false)) {
if (item instanceof JpsModuleDependency) {
@@ -907,7 +937,7 @@
runtimeOnly().productionOnly().getLibraries();
for (JpsLibrary lib : libs) {
- final Pair<File, File> pair = getResDirAndClassesJarIfAar(lib);
+ final Pair<File, List<File>> pair = getResDirAndJarsIfAar(lib);
final File resDir = pair != null ? pair.getFirst() : null;
if (resDir != null) {
@@ -917,7 +947,7 @@
}
@Nullable
- public static Pair<File, File> getResDirAndClassesJarIfAar(@NotNull JpsLibrary lib) {
+ public static Pair<File, List<File>> getResDirAndJarsIfAar(@NotNull JpsLibrary lib) {
final List<File> files = lib.getFiles(JpsOrderRootType.COMPILED);
if (files.size() == 1) {
@@ -927,20 +957,34 @@
return Pair.create(file, null);
}
}
- else if (files.size() == 2) {
+ else if (files.size() >= 2) {
File resDir = null;
File classesJar = null;
+ List<File> allJars = new ArrayList<File>();
for (File file : files) {
- if (file.isDirectory() && SdkConstants.FD_RES.equals(file.getName())) {
- resDir = file;
+ if (file.isDirectory()) {
+ if (SdkConstants.FD_RES.equals(file.getName())) {
+ resDir = file;
+ }
+ else {
+ return null;
+ }
}
- else if (file.isFile() && SdkConstants.FN_CLASSES_JAR.equals(file.getName())) {
- classesJar = file;
+ else if (file.isFile()) {
+ if (SdkConstants.FN_CLASSES_JAR.equals(file.getName())) {
+ classesJar = file;
+ }
+ if (FileUtilRt.extensionEquals(file.getName(), "jar")) {
+ allJars.add(file);
+ }
+ else {
+ return null;
+ }
}
}
if (resDir != null && classesJar != null && FileUtil.pathsEqual(resDir.getParent(), classesJar.getParent())) {
- return Pair.create(resDir, classesJar);
+ return Pair.create(resDir, allJars);
}
}
return null;
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java
index f4f871b..7449049 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java
@@ -24,7 +24,6 @@
import org.jetbrains.jps.incremental.CompileContext;
import org.jetbrains.jps.incremental.ProjectBuildException;
import org.jetbrains.jps.incremental.StopBuildException;
-import org.jetbrains.jps.incremental.TargetBuilder;
import org.jetbrains.jps.incremental.messages.BuildMessage;
import org.jetbrains.jps.incremental.messages.CompilerMessage;
import org.jetbrains.jps.incremental.messages.ProgressMessage;
@@ -183,8 +182,8 @@
final Map<AndroidCompilerMessageKind, List<String>> messages = AndroidApkBuilder
.execute(resPackagePath, classesDexFilePath, resourceRoots, externalJars,
- nativeLibDirs, additionalNativeLibs, outputPath, release, sdkPath, customKeyStorePath,
- new MyExcludedSourcesFilter(context.getProjectDescriptor().getProject()));
+ nativeLibDirs, additionalNativeLibs, outputPath, release, sdkPath, platform.getTarget(),
+ customKeyStorePath, new MyExcludedSourcesFilter(context.getProjectDescriptor().getProject()));
if (messages.get(AndroidCompilerMessageKind.ERROR).size() == 0) {
final List<String> srcFiles = new ArrayList<String>();
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidAarDepsBuildTarget.java b/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidAarDepsBuildTarget.java
index f16ebbe..31b20d6 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidAarDepsBuildTarget.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidAarDepsBuildTarget.java
@@ -41,11 +41,13 @@
final List<BuildRootDescriptor> result = new ArrayList<BuildRootDescriptor>();
for (JpsLibrary library : libraries) {
- final Pair<File,File> pair = AndroidJpsUtil.getResDirAndClassesJarIfAar(library);
- final File classesJarFile = pair != null ? pair.getSecond() : null;
+ final Pair<File, List<File>> pair = AndroidJpsUtil.getResDirAndJarsIfAar(library);
+ final List<File> jars = pair != null ? pair.getSecond() : null;
- if (classesJarFile != null) {
- result.add(new BuildRootDescriptorImpl(this, classesJarFile));
+ if (jars != null) {
+ for (File jar : jars) {
+ result.add(new BuildRootDescriptorImpl(this, jar));
+ }
}
}
return result;
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidDexBuildTarget.java b/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidDexBuildTarget.java
index 685ca18..4e6538f 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidDexBuildTarget.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidDexBuildTarget.java
@@ -150,6 +150,9 @@
result.add(new MyJarBuildRootDescriptor(this, preDexedFile, false, true));
}
}
+ for (String path : AndroidJpsUtil.getProvidedLibraries(dataPaths, myModule)) {
+ result.add(new MyProvidedJarBuildRootDescriptor(this, new File(path)));
+ }
return result;
}
@@ -212,6 +215,12 @@
}
}
+ public static class MyProvidedJarBuildRootDescriptor extends AndroidFileBasedBuildRootDescriptor {
+ public MyProvidedJarBuildRootDescriptor(@NotNull BuildTarget target, @NotNull File file) {
+ super(target, file);
+ }
+ }
+
public static class MyJarBuildRootDescriptor extends AndroidFileBasedBuildRootDescriptor {
private final boolean myLibPackage;
private final boolean myPreDexed;
diff --git a/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidResourcePackagingBuildTarget.java b/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidResourcePackagingBuildTarget.java
index 4f602ca..b2f3258 100644
--- a/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidResourcePackagingBuildTarget.java
+++ b/android/jps-plugin/src/org/jetbrains/jps/android/builder/AndroidResourcePackagingBuildTarget.java
@@ -1,5 +1,6 @@
package org.jetbrains.jps.android.builder;
+import com.android.SdkConstants;
import org.jetbrains.android.util.AndroidCommonUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.android.AndroidJpsUtil;
@@ -104,6 +105,23 @@
result.add(depAssetsDir.getPath());
}
}
+ collectAssetDirsFromAarDeps(extension.getModule(), result);
+ }
+ }
+
+ private static void collectAssetDirsFromAarDeps(@NotNull JpsModule module, @NotNull Collection<String> result) {
+ final List<String> resDirsFromAarDeps = new ArrayList<String>();
+ AndroidJpsUtil.collectResDirectoriesFromAarDeps(module, resDirsFromAarDeps);
+
+ if (resDirsFromAarDeps.isEmpty()) {
+ return;
+ }
+ for (String path : resDirsFromAarDeps) {
+ final File assetsSibling = new File(new File(path).getParentFile(), SdkConstants.FD_ASSETS);
+
+ if (assetsSibling.isDirectory()) {
+ result.add(assetsSibling.getPath());
+ }
}
}
diff --git a/android/jps-plugin/testData/1/expected_log.txt b/android/jps-plugin/testData/1/expected_log.txt
index 5bb3bdb..c5424f9 100644
--- a/android/jps-plugin/testData/1/expected_log.txt
+++ b/android/jps-plugin/testData/1/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -35,7 +35,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log.txt b/android/jps-plugin/testData/2/expected_log.txt
index f77dbef..0c39586 100644
--- a/android/jps-plugin/testData/2/expected_log.txt
+++ b/android/jps-plugin/testData/2/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -35,7 +35,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_10.txt b/android/jps-plugin/testData/2/expected_log_10.txt
index 019535f..246794f 100644
--- a/android/jps-plugin/testData/2/expected_log_10.txt
+++ b/android/jps-plugin/testData/2/expected_log_10.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -7,7 +7,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_1:0
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_13.txt b/android/jps-plugin/testData/2/expected_log_13.txt
index 9a3571d..cedb082 100644
--- a/android/jps-plugin/testData/2/expected_log_13.txt
+++ b/android/jps-plugin/testData/2/expected_log_13.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -12,7 +12,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -20,7 +20,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_2.txt b/android/jps-plugin/testData/2/expected_log_2.txt
index d3b1992..fb44653 100644
--- a/android/jps-plugin/testData/2/expected_log_2.txt
+++ b/android/jps-plugin/testData/2/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -12,7 +12,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -20,7 +20,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_3.txt b/android/jps-plugin/testData/2/expected_log_3.txt
index f77dbef..0c39586 100644
--- a/android/jps-plugin/testData/2/expected_log_3.txt
+++ b/android/jps-plugin/testData/2/expected_log_3.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -35,7 +35,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_4.txt b/android/jps-plugin/testData/2/expected_log_4.txt
index f77dbef..0c39586 100644
--- a/android/jps-plugin/testData/2/expected_log_4.txt
+++ b/android/jps-plugin/testData/2/expected_log_4.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -35,7 +35,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_5.txt b/android/jps-plugin/testData/2/expected_log_5.txt
index f77dbef..0c39586 100644
--- a/android/jps-plugin/testData/2/expected_log_5.txt
+++ b/android/jps-plugin/testData/2/expected_log_5.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -35,7 +35,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_6.txt b/android/jps-plugin/testData/2/expected_log_6.txt
index a39c7e7..db01eb2 100644
--- a/android/jps-plugin/testData/2/expected_log_6.txt
+++ b/android/jps-plugin/testData/2/expected_log_6.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_7.txt b/android/jps-plugin/testData/2/expected_log_7.txt
index 3186e36..6b5abac 100644
--- a/android/jps-plugin/testData/2/expected_log_7.txt
+++ b/android/jps-plugin/testData/2/expected_log_7.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_8.txt b/android/jps-plugin/testData/2/expected_log_8.txt
index a39c7e7..db01eb2 100644
--- a/android/jps-plugin/testData/2/expected_log_8.txt
+++ b/android/jps-plugin/testData/2/expected_log_8.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/2/expected_log_9.txt b/android/jps-plugin/testData/2/expected_log_9.txt
index a39c7e7..db01eb2 100644
--- a/android/jps-plugin/testData/2/expected_log_9.txt
+++ b/android/jps-plugin/testData/2/expected_log_9.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/3/expected_log.txt b/android/jps-plugin/testData/3/expected_log.txt
index 904a648..58f3abb 100644
--- a/android/jps-plugin/testData/3/expected_log.txt
+++ b/android/jps-plugin/testData/3/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -43,7 +43,7 @@
--exclude
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -51,7 +51,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_4:3
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/3/expected_log_1.txt b/android/jps-plugin/testData/3/expected_log_1.txt
index dd4caf9..31ff688 100644
--- a/android/jps-plugin/testData/3/expected_log_1.txt
+++ b/android/jps-plugin/testData/3/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
diff --git a/android/jps-plugin/testData/3/expected_log_5.txt b/android/jps-plugin/testData/3/expected_log_5.txt
index e1dafa4..4b921da 100644
--- a/android/jps-plugin/testData/3/expected_log_5.txt
+++ b/android/jps-plugin/testData/3/expected_log_5.txt
@@ -1,4 +1,33 @@
______ENTRY_0:
+$ANDROID_SDK_DIR$/platform-tools/aapt
+package
+-m
+-J
+$AAPT_OUTPUT_TMP$
+-M
+$PROJECT_DIR$/root/AndroidManifest.xml
+-S
+$PROJECT_DIR$/root/res
+-I
+$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
+
+______ENTRY_1:0
+$JAVA_PATH$
+-Xmx1024M
+-classpath
+$IDEA_RT_PATH$
+com.intellij.rt.execution.CommandLineWrapper
+$CLASSPATH_TMP$
+org.jetbrains.android.compiler.tools.AndroidDxRunner
+$ANDROID_SDK_DIR$/platform-tools/lib/dx.jar
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/classes.dex
+--optimize
+true
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/pre_dexed_libs/external_jar2.jar
+$PROJECT_DIR$/out/production/module/com
+--exclude
+
+______ENTRY_2:0,1
apk_builder
$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/module.apk.res
$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/classes.dex
@@ -14,5 +43,4 @@
[]
$PROJECT_DIR$/out/production/module/module.apk
false
-$ANDROID_SDK_DIR$
-
+$ANDROID_SDK_DIR$
\ No newline at end of file
diff --git a/android/jps-plugin/testData/4/expected_log.txt b/android/jps-plugin/testData/4/expected_log.txt
index 5977f1c..fbe1bb5 100644
--- a/android/jps-plugin/testData/4/expected_log.txt
+++ b/android/jps-plugin/testData/4/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -27,7 +27,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -35,7 +35,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/4/expected_log_1.txt b/android/jps-plugin/testData/4/expected_log_1.txt
index bad8dda..7ea729d 100644
--- a/android/jps-plugin/testData/4/expected_log_1.txt
+++ b/android/jps-plugin/testData/4/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
diff --git a/android/jps-plugin/testData/4/expected_log_4.txt b/android/jps-plugin/testData/4/expected_log_4.txt
index 421c77f..141944d 100644
--- a/android/jps-plugin/testData/4/expected_log_4.txt
+++ b/android/jps-plugin/testData/4/expected_log_4.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
diff --git a/android/jps-plugin/testData/5/expected_log.txt b/android/jps-plugin/testData/5/expected_log.txt
index 68c94e1..f2d5b7f 100644
--- a/android/jps-plugin/testData/5/expected_log.txt
+++ b/android/jps-plugin/testData/5/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -36,7 +36,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -44,7 +44,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_4:3
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_1.txt b/android/jps-plugin/testData/5/expected_log_1.txt
index 86ed699..03c332e 100644
--- a/android/jps-plugin/testData/5/expected_log_1.txt
+++ b/android/jps-plugin/testData/5/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_2.txt b/android/jps-plugin/testData/5/expected_log_2.txt
index 66cf612..3f8cc6f 100644
--- a/android/jps-plugin/testData/5/expected_log_2.txt
+++ b/android/jps-plugin/testData/5/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_3.txt b/android/jps-plugin/testData/5/expected_log_3.txt
index 66cf612..3f8cc6f 100644
--- a/android/jps-plugin/testData/5/expected_log_3.txt
+++ b/android/jps-plugin/testData/5/expected_log_3.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_4.txt b/android/jps-plugin/testData/5/expected_log_4.txt
index 34fd7bb..7813431 100644
--- a/android/jps-plugin/testData/5/expected_log_4.txt
+++ b/android/jps-plugin/testData/5/expected_log_4.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -7,7 +7,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_1:0
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_5.txt b/android/jps-plugin/testData/5/expected_log_5.txt
index 5fa57e1..ae827d8 100644
--- a/android/jps-plugin/testData/5/expected_log_5.txt
+++ b/android/jps-plugin/testData/5/expected_log_5.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -7,7 +7,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_1:0
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_6.txt b/android/jps-plugin/testData/5/expected_log_6.txt
index 0570c8a..37c3376 100644
--- a/android/jps-plugin/testData/5/expected_log_6.txt
+++ b/android/jps-plugin/testData/5/expected_log_6.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/5/expected_log_7.txt b/android/jps-plugin/testData/5/expected_log_7.txt
index 18480dc..1c09fd7 100644
--- a/android/jps-plugin/testData/5/expected_log_7.txt
+++ b/android/jps-plugin/testData/5/expected_log_7.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -39,7 +39,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -47,7 +47,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_4:1,3
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/6/expected_log.txt b/android/jps-plugin/testData/6/expected_log.txt
index ce34cd4..fbbceb0 100644
--- a/android/jps-plugin/testData/6/expected_log.txt
+++ b/android/jps-plugin/testData/6/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -12,7 +12,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -20,7 +20,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/6/expected_log_1.txt b/android/jps-plugin/testData/6/expected_log_1.txt
index c2e898c..0986a87 100644
--- a/android/jps-plugin/testData/6/expected_log_1.txt
+++ b/android/jps-plugin/testData/6/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -12,7 +12,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -20,7 +20,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/7/expected_log.txt b/android/jps-plugin/testData/7/expected_log.txt
index da68bb9..6ac9dcb 100644
--- a/android/jps-plugin/testData/7/expected_log.txt
+++ b/android/jps-plugin/testData/7/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -36,7 +36,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_4:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -44,7 +44,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_5:4
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/7/expected_log_1.txt b/android/jps-plugin/testData/7/expected_log_1.txt
index 33a46c3..04c97bc 100644
--- a/android/jps-plugin/testData/7/expected_log_1.txt
+++ b/android/jps-plugin/testData/7/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/7/expected_log_4.txt b/android/jps-plugin/testData/7/expected_log_4.txt
index f1c49bf..c3f95c4 100644
--- a/android/jps-plugin/testData/7/expected_log_4.txt
+++ b/android/jps-plugin/testData/7/expected_log_4.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -30,7 +30,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
diff --git a/android/jps-plugin/testData/8/expected_log.txt b/android/jps-plugin/testData/8/expected_log.txt
index eaed9e1..2d33da9 100644
--- a/android/jps-plugin/testData/8/expected_log.txt
+++ b/android/jps-plugin/testData/8/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/8/expected_log_1.txt b/android/jps-plugin/testData/8/expected_log_1.txt
index cb6f5f4..62e73ca 100644
--- a/android/jps-plugin/testData/8/expected_log_1.txt
+++ b/android/jps-plugin/testData/8/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/9/expected_log.txt b/android/jps-plugin/testData/9/expected_log.txt
index a7713d0..73a1dd6 100644
--- a/android/jps-plugin/testData/9/expected_log.txt
+++ b/android/jps-plugin/testData/9/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -36,7 +36,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_4:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app2/res
@@ -44,7 +44,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app2
______ENTRY_5:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app2
@@ -91,7 +91,7 @@
$ANDROID_SDK_DIR$
______ENTRY_8:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -104,7 +104,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_9:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app1/res
@@ -112,7 +112,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app1
______ENTRY_10:9
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app1
diff --git a/android/jps-plugin/testData/9/expected_log_1.txt b/android/jps-plugin/testData/9/expected_log_1.txt
index 380797d..4536ebe 100644
--- a/android/jps-plugin/testData/9/expected_log_1.txt
+++ b/android/jps-plugin/testData/9/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app1
diff --git a/android/jps-plugin/testData/9/expected_log_2.txt b/android/jps-plugin/testData/9/expected_log_2.txt
index 161f119..1412ddd 100644
--- a/android/jps-plugin/testData/9/expected_log_2.txt
+++ b/android/jps-plugin/testData/9/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app2
diff --git a/android/jps-plugin/testData/9/expected_log_3.txt b/android/jps-plugin/testData/9/expected_log_3.txt
index 6a5174d..c0797fb 100644
--- a/android/jps-plugin/testData/9/expected_log_3.txt
+++ b/android/jps-plugin/testData/9/expected_log_3.txt
@@ -14,7 +14,7 @@
--exclude
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
diff --git a/android/jps-plugin/testData/9/expected_log_4.txt b/android/jps-plugin/testData/9/expected_log_4.txt
index 6414440..731f42e 100644
--- a/android/jps-plugin/testData/9/expected_log_4.txt
+++ b/android/jps-plugin/testData/9/expected_log_4.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
diff --git a/android/jps-plugin/testData/additionalParameters/expected_log.txt b/android/jps-plugin/testData/additionalParameters/expected_log.txt
index 4473447..2dfeeb7 100644
--- a/android/jps-plugin/testData/additionalParameters/expected_log.txt
+++ b/android/jps-plugin/testData/additionalParameters/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/additionalParameters/expected_log_1.txt b/android/jps-plugin/testData/additionalParameters/expected_log_1.txt
index 99ea891..d5f4176 100644
--- a/android/jps-plugin/testData/additionalParameters/expected_log_1.txt
+++ b/android/jps-plugin/testData/additionalParameters/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/customManifestPackage/expected_log.txt b/android/jps-plugin/testData/customManifestPackage/expected_log.txt
index f215991..a1e9482 100644
--- a/android/jps-plugin/testData/customManifestPackage/expected_log.txt
+++ b/android/jps-plugin/testData/customManifestPackage/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/customManifestPackage/expected_log_1.txt b/android/jps-plugin/testData/customManifestPackage/expected_log_1.txt
index 761ae1e..0977e30 100644
--- a/android/jps-plugin/testData/customManifestPackage/expected_log_1.txt
+++ b/android/jps-plugin/testData/customManifestPackage/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/filteredResources/expected_log.txt b/android/jps-plugin/testData/filteredResources/expected_log.txt
index cf53065..9b4cabf 100644
--- a/android/jps-plugin/testData/filteredResources/expected_log.txt
+++ b/android/jps-plugin/testData/filteredResources/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -12,7 +12,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/target/filtered-res
@@ -20,7 +20,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/filteredResources/expected_log_1.txt b/android/jps-plugin/testData/filteredResources/expected_log_1.txt
index f192a04..3cea5ae 100644
--- a/android/jps-plugin/testData/filteredResources/expected_log_1.txt
+++ b/android/jps-plugin/testData/filteredResources/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/target/filtered-res
@@ -7,7 +7,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/generatedSources/expected_log.txt b/android/jps-plugin/testData/generatedSources/expected_log.txt
index 09914b9..5b173e8 100644
--- a/android/jps-plugin/testData/generatedSources/expected_log.txt
+++ b/android/jps-plugin/testData/generatedSources/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/targets/java-production/module/android/copied_sources/com/example/simple/R.java
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -31,7 +31,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/manifestMerging/expected_log.txt b/android/jps-plugin/testData/manifestMerging/expected_log.txt
index 686b51f..c5573a1 100644
--- a/android/jps-plugin/testData/manifestMerging/expected_log.txt
+++ b/android/jps-plugin/testData/manifestMerging/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -29,7 +29,7 @@
$DATA_STORAGE_ROOT$/android/preprocessed_manifest/app/AndroidManifest.xml
______ENTRY_3:2
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -45,7 +45,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_4:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -53,7 +53,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_5:2,4
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/manifestMerging/expected_log_1.txt b/android/jps-plugin/testData/manifestMerging/expected_log_1.txt
index 1d88c24..e7cd223 100644
--- a/android/jps-plugin/testData/manifestMerging/expected_log_1.txt
+++ b/android/jps-plugin/testData/manifestMerging/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/manifestMerging/expected_log_2.txt b/android/jps-plugin/testData/manifestMerging/expected_log_2.txt
index b3b039f..4f91152 100644
--- a/android/jps-plugin/testData/manifestMerging/expected_log_2.txt
+++ b/android/jps-plugin/testData/manifestMerging/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/manifestMerging/expected_log_3.txt b/android/jps-plugin/testData/manifestMerging/expected_log_3.txt
index 0ed75d6..e13184c 100644
--- a/android/jps-plugin/testData/manifestMerging/expected_log_3.txt
+++ b/android/jps-plugin/testData/manifestMerging/expected_log_3.txt
@@ -5,7 +5,7 @@
$DATA_STORAGE_ROOT$/android/preprocessed_manifest/app/AndroidManifest.xml
______ENTRY_1:0
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/manifestMerging/expected_log_4.txt b/android/jps-plugin/testData/manifestMerging/expected_log_4.txt
index 0ed75d6..e13184c 100644
--- a/android/jps-plugin/testData/manifestMerging/expected_log_4.txt
+++ b/android/jps-plugin/testData/manifestMerging/expected_log_4.txt
@@ -5,7 +5,7 @@
$DATA_STORAGE_ROOT$/android/preprocessed_manifest/app/AndroidManifest.xml
______ENTRY_1:0
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/maven/expected_log.txt b/android/jps-plugin/testData/maven/expected_log.txt
index 70db025..4074b6c 100644
--- a/android/jps-plugin/testData/maven/expected_log.txt
+++ b/android/jps-plugin/testData/maven/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -30,7 +30,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib1/res
@@ -38,7 +38,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib1
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -72,7 +72,7 @@
--exclude
______ENTRY_5:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -80,7 +80,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_6:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -96,7 +96,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_7:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -104,7 +104,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_8:5,7
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/maven/expected_log_2.txt b/android/jps-plugin/testData/maven/expected_log_2.txt
index 090f32e..26dec05 100644
--- a/android/jps-plugin/testData/maven/expected_log_2.txt
+++ b/android/jps-plugin/testData/maven/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -30,7 +30,7 @@
--exclude
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib2/res
@@ -38,7 +38,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib2
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -57,7 +57,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_4:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -75,7 +75,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_5:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/non_maven_app/res
@@ -83,7 +83,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/non_maven_app
______ENTRY_6:2,5
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/non_maven_app
diff --git a/android/jps-plugin/testData/maven1/expected_log.txt b/android/jps-plugin/testData/maven1/expected_log.txt
index 2895b00..78ca25c 100644
--- a/android/jps-plugin/testData/maven1/expected_log.txt
+++ b/android/jps-plugin/testData/maven1/expected_log.txt
@@ -14,7 +14,7 @@
--exclude
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
diff --git a/android/jps-plugin/testData/maven1/expected_log_1.txt b/android/jps-plugin/testData/maven1/expected_log_1.txt
index c884081..c674ca3 100644
--- a/android/jps-plugin/testData/maven1/expected_log_1.txt
+++ b/android/jps-plugin/testData/maven1/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -17,7 +17,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$COMBINED_RESOURCES_TMP$
@@ -25,7 +25,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/maven1/expected_log_2.txt b/android/jps-plugin/testData/maven1/expected_log_2.txt
index 68cf064..c719a06 100644
--- a/android/jps-plugin/testData/maven1/expected_log_2.txt
+++ b/android/jps-plugin/testData/maven1/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
diff --git a/android/jps-plugin/testData/maven1/expected_log_3.txt b/android/jps-plugin/testData/maven1/expected_log_3.txt
new file mode 100644
index 0000000..01126dc
--- /dev/null
+++ b/android/jps-plugin/testData/maven1/expected_log_3.txt
@@ -0,0 +1,43 @@
+______ENTRY_0:
+$ANDROID_SDK_DIR$/platform-tools/aapt
+package
+-S
+$DATA_STORAGE_ROOT$/android/res_cache/app
+-S
+$PROJECT_DIR$/root/app/res
+-S
+$PROJECT_DIR$/root/myaar/res
+-S
+$DATA_STORAGE_ROOT$/android/res_cache/lib
+-S
+$PROJECT_DIR$/root/lib/res
+-f
+--no-crunch
+--auto-add-overlay
+--debug-mode
+-M
+$PROJECT_DIR$/root/app/AndroidManifest.xml
+-A
+$PROJECT_DIR$/root/myaar/assets
+-I
+$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
+-F
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/app.apk.res
+
+______ENTRY_1:0
+apk_builder
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/app.apk.res
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/classes.dex
+[
+$PROJECT_DIR$/out/production/app
+$PROJECT_DIR$/out/production/lib
+]
+[
+$PROJECT_DIR$/root/myaar/classes.jar
+]
+[]
+[]
+$PROJECT_DIR$/out/production/app/app.apk
+false
+$ANDROID_SDK_DIR$
+
diff --git a/android/jps-plugin/testData/maven1/expected_log_4.txt b/android/jps-plugin/testData/maven1/expected_log_4.txt
new file mode 100644
index 0000000..36b2b57
--- /dev/null
+++ b/android/jps-plugin/testData/maven1/expected_log_4.txt
@@ -0,0 +1,68 @@
+______ENTRY_0:
+$ANDROID_SDK_DIR$/platform-tools/aapt
+package
+-m
+--auto-add-overlay
+-J
+$AAPT_OUTPUT_TMP$
+-M
+$PROJECT_DIR$/root/app/AndroidManifest.xml
+-S
+$PROJECT_DIR$/root/app/res
+-S
+$PROJECT_DIR$/root/myaar/res
+-S
+$PROJECT_DIR$/root/lib/res
+-I
+$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
+
+______ENTRY_1:
+$JAVA_PATH$
+-Xmx1024M
+-classpath
+$IDEA_RT_PATH$
+com.intellij.rt.execution.CommandLineWrapper
+$CLASSPATH_TMP$
+org.jetbrains.android.compiler.tools.AndroidDxRunner
+$ANDROID_SDK_DIR$/platform-tools/lib/dx.jar
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/pre_dexed_libs/aar_deps.jar
+--optimize
+true
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/aar_deps.jar
+--exclude
+
+______ENTRY_2:1
+$JAVA_PATH$
+-Xmx1024M
+-classpath
+$IDEA_RT_PATH$
+com.intellij.rt.execution.CommandLineWrapper
+$CLASSPATH_TMP$
+org.jetbrains.android.compiler.tools.AndroidDxRunner
+$ANDROID_SDK_DIR$/platform-tools/lib/dx.jar
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/classes.dex
+--optimize
+true
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/pre_dexed_libs/aar_deps.jar
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/pre_dexed_libs/lib/classes.jar
+$PROJECT_DIR$/out/production/app/com
+--exclude
+
+______ENTRY_3:0,1,2
+apk_builder
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/app.apk.res
+$DATA_STORAGE_ROOT$/android/intermediate_artifacts/app/classes.dex
+[
+$PROJECT_DIR$/out/production/app
+$PROJECT_DIR$/out/production/lib
+]
+[
+$PROJECT_DIR$/root/myaar/classes.jar
+$PROJECT_DIR$/root/myaar/libs/myjar.jar
+]
+[]
+[]
+$PROJECT_DIR$/out/production/app/app.apk
+false
+$ANDROID_SDK_DIR$
+
diff --git a/android/jps-plugin/testData/maven1/project/myaar/assets/aar_asset.txt b/android/jps-plugin/testData/maven1/project/myaar/assets/aar_asset.txt
new file mode 100644
index 0000000..2995a4d
--- /dev/null
+++ b/android/jps-plugin/testData/maven1/project/myaar/assets/aar_asset.txt
@@ -0,0 +1 @@
+dummy
\ No newline at end of file
diff --git a/android/jps-plugin/testData/maven1/project/myaar/libs/myjar.jar b/android/jps-plugin/testData/maven1/project/myaar/libs/myjar.jar
new file mode 100644
index 0000000..9da4fd4
--- /dev/null
+++ b/android/jps-plugin/testData/maven1/project/myaar/libs/myjar.jar
Binary files differ
diff --git a/android/jps-plugin/testData/preDexing/expected_log.txt b/android/jps-plugin/testData/preDexing/expected_log.txt
index 0e22413..8a1586d 100644
--- a/android/jps-plugin/testData/preDexing/expected_log.txt
+++ b/android/jps-plugin/testData/preDexing/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib1/res
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib1
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -42,7 +42,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -50,7 +50,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib
______ENTRY_4:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -68,7 +68,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_5:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -76,7 +76,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_6:1,3,5
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/preDexing/expected_log_2.txt b/android/jps-plugin/testData/preDexing/expected_log_2.txt
index c5afee1..7b9b51d 100644
--- a/android/jps-plugin/testData/preDexing/expected_log_2.txt
+++ b/android/jps-plugin/testData/preDexing/expected_log_2.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib1/res
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/lib1
______ENTRY_2:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--non-constant-id
@@ -42,7 +42,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_3:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/lib/res
@@ -95,7 +95,7 @@
--exclude
______ENTRY_7:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -113,7 +113,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_8:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/app/res
@@ -121,7 +121,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/app
______ENTRY_9:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/app
diff --git a/android/jps-plugin/testData/preDexing/project/app/proguard-project.txt b/android/jps-plugin/testData/preDexing/project/app/proguard-project.txt
index c447ff3..7ad8839 100644
--- a/android/jps-plugin/testData/preDexing/project/app/proguard-project.txt
+++ b/android/jps-plugin/testData/preDexing/project/app/proguard-project.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -14,7 +14,7 @@
$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/proguard.txt
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -22,7 +22,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/proGuardWithJar/expected_log.txt b/android/jps-plugin/testData/proGuardWithJar/expected_log.txt
index 88b9b69..1cd994f 100644
--- a/android/jps-plugin/testData/proGuardWithJar/expected_log.txt
+++ b/android/jps-plugin/testData/proGuardWithJar/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -14,7 +14,7 @@
$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/proguard.txt
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -22,7 +22,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/proGuardWithJar/expected_log_1.txt b/android/jps-plugin/testData/proGuardWithJar/expected_log_1.txt
index 0dd8e48..bff21c8 100644
--- a/android/jps-plugin/testData/proGuardWithJar/expected_log_1.txt
+++ b/android/jps-plugin/testData/proGuardWithJar/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -14,7 +14,7 @@
$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/proguard.txt
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -22,7 +22,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/proGuardWithJar/project/proguard-project.txt b/android/jps-plugin/testData/proGuardWithJar/project/proguard-project.txt
index c447ff3..7ad8839 100644
--- a/android/jps-plugin/testData/proGuardWithJar/project/proguard-project.txt
+++ b/android/jps-plugin/testData/proGuardWithJar/project/proguard-project.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -14,7 +14,7 @@
$DATA_STORAGE_ROOT$/android/intermediate_artifacts/module/proguard.txt
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$PROJECT_DIR$/root/res
@@ -22,7 +22,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/resOverlay/expected_log.txt b/android/jps-plugin/testData/resOverlay/expected_log.txt
index dbef980..82e970f 100644
--- a/android/jps-plugin/testData/resOverlay/expected_log.txt
+++ b/android/jps-plugin/testData/resOverlay/expected_log.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
--auto-add-overlay
@@ -15,7 +15,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
crunch
-S
$COMBINED_RESOURCES_TMP$
@@ -23,7 +23,7 @@
$DATA_STORAGE_ROOT$/android/res_cache/module
______ENTRY_2:1
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testData/resOverlay/expected_log_1.txt b/android/jps-plugin/testData/resOverlay/expected_log_1.txt
index 3d72043..86d3938 100644
--- a/android/jps-plugin/testData/resOverlay/expected_log_1.txt
+++ b/android/jps-plugin/testData/resOverlay/expected_log_1.txt
@@ -1,5 +1,5 @@
______ENTRY_0:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-m
-J
@@ -12,7 +12,7 @@
$ANDROID_SDK_DIR$/platforms/android-1.5/android.jar
______ENTRY_1:
-$ANDROID_SDK_DIR$/platform-tools/aapt.exe
+$ANDROID_SDK_DIR$/platform-tools/aapt
package
-S
$DATA_STORAGE_ROOT$/android/res_cache/module
diff --git a/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuildTestingCommandExecutor.java b/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuildTestingCommandExecutor.java
index da584bb..7120d3b 100644
--- a/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuildTestingCommandExecutor.java
+++ b/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuildTestingCommandExecutor.java
@@ -2,6 +2,7 @@
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.HashMap;
@@ -114,6 +115,9 @@
String subarg = subargs[i];
String s = FileUtil.toSystemIndependentName(subarg);
+ if (s.endsWith(".exe")) {
+ s = FileUtilRt.getNameWithoutExtension(s);
+ }
for (Pair<String, Pattern> pair : myPathPatterns) {
final String id = pair.getFirst();
final Pattern prefixPattern = pair.getSecond();
diff --git a/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuilderTest.java b/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuilderTest.java
index ca42b78..1c13c02 100644
--- a/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuilderTest.java
+++ b/android/jps-plugin/testSrc/org/jetbrains/jps/android/AndroidBuilderTest.java
@@ -2,6 +2,7 @@
import com.android.SdkConstants;
import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
@@ -956,6 +957,7 @@
}
public void testMaven() throws Exception {
+ createMavenConfigFile();
final MyExecutor executor = new MyExecutor("com.example.simple");
final JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> androidSdk = addJdkAndAndroidSdk();
addPathPatterns(executor, androidSdk);
@@ -1021,7 +1023,17 @@
checkBuildLog(executor, "expected_log_2");
}
+ private void createMavenConfigFile() throws IOException {
+ final File file = new File(myDataStorageRoot, MavenProjectConfiguration.CONFIGURATION_FILE_RELATIVE_PATH);
+
+ if (!file.exists()) {
+ FileUtil.writeToFile(file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<maven-project-configuration></maven-project-configuration>");
+ }
+ }
+
public void testMaven1() throws Exception {
+ createMavenConfigFile();
final MyExecutor executor = new MyExecutor("com.example.simple");
final JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> androidSdk = addJdkAndAndroidSdk();
addPathPatterns(executor, androidSdk);
@@ -1064,6 +1076,18 @@
makeAll().assertSuccessful();
checkBuildLog(executor, "expected_log_2");
checkMakeUpToDate(executor);
+
+ final JpsAndroidModuleExtension appExtension = AndroidJpsUtil.getExtension(appModule);
+ final JpsAndroidModuleProperties appProps = ((JpsAndroidModuleExtensionImpl)appExtension).getProperties();
+ appProps.myIncludeAssetsFromLibraries = true;
+ makeAll().assertSuccessful();
+ checkBuildLog(executor, "expected_log_3");
+ checkMakeUpToDate(executor);
+
+ appAarLib.addRoot(getProjectPath("myaar/libs/myjar.jar"), JpsOrderRootType.COMPILED);
+ makeAll().assertSuccessful();
+ checkBuildLog(executor, "expected_log_4");
+ checkMakeUpToDate(executor);
}
private void addMavenResourcesConf(MavenProjectConfiguration mavenConf, String appNames) {
@@ -1253,7 +1277,7 @@
executor.addRegexPathPatternPrefix("COMBINED_ASSETS_TMP", FileUtil.toSystemIndependentName(tempDirectory) +
"/android_combined_assets\\d*tmp");
executor.addRegexPathPatternPrefix("COMBINED_RESOURCES_TMP", FileUtil.toSystemIndependentName(tempDirectory) +
- "/android_combined_resources\\d*tmp");
+ "/android_combined_resources\\d*tmp");
executor.addRegexPathPatternPrefix("CLASSPATH_TMP", FileUtil.toSystemIndependentName(tempDirectory) + "/classpath\\d*\\.tmp");
executor.addRegexPathPattern("JAVA_PATH", ".*/java");
executor.addRegexPathPattern("IDEA_RT_PATH", ".*/idea_rt.jar");
@@ -1361,7 +1385,7 @@
return adtPath;
}
- return new File(PathManager.getHomePath(), "android/android").getPath();
+ return PathManagerEx.findFileUnderCommunityHome("android/android").getPath();
}
private static void createTextFile(@NotNull String path, @NotNull String text) throws IOException {
diff --git a/android/main_AndroidStudio.iml b/android/main_AndroidStudio.iml
new file mode 100644
index 0000000..8f2766c
--- /dev/null
+++ b/android/main_AndroidStudio.iml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="adt-branding" />
+ <orderEntry type="module" module-name="android" />
+ <orderEntry type="module" module-name="platform-main" />
+ <orderEntry type="module" module-name="resources" />
+ <orderEntry type="module" module-name="structuralsearch-java" />
+ <orderEntry type="module" module-name="colorSchemes" />
+ </component>
+</module>
+
diff --git a/android/src/META-INF/androidstudio.xml b/android/src/META-INF/androidstudio.xml
index 2419b2c..aee3019 100755
--- a/android/src/META-INF/androidstudio.xml
+++ b/android/src/META-INF/androidstudio.xml
@@ -26,16 +26,6 @@
</extensions>
<actions>
- <group id="Android.MainToolBarActionGroup">
- <separator/>
- <reference id="Android.SyncProject" />
- <reference id="Android.RunAndroidAvdManager" />
- <reference id="Android.RunAndroidSdkManager" />
- <reference id="Android.RunDdms" />
- <separator/>
-
- <add-to-group group-id="MainToolBar" anchor="before" relative-to-action="HelpTopics" />
- </group>
<action id="AndroidAddRTLSupport" class="com.android.tools.idea.actions.AndroidAddRtlSupportAction"
text="Add RTL Support Where Possible..." description="Add right-to-left (RTL) support where possible">
@@ -48,8 +38,15 @@
icon="AndroidIcons.SdkManagerLarge" >
<add-to-group group-id="WelcomeScreen.Configure" anchor="first" />
</action>
+
+ <action id="ShowProjectStructureSettings" class="com.android.tools.idea.actions.AndroidShowStructureSettingsAction"
+ project-type="Android" icon="AllIcons.General.ProjectStructure"/>
</actions>
+ <extensions defaultExtensionNs="com.intellij">
+ <defaultProjectTypeProvider type="Android"/>
+ </extensions>
+
<application-components>
<component>
<interface-class>com.android.tools.idea.stats.StudioBuildStatsPersistenceComponent</interface-class>
diff --git a/android/src/META-INF/database-support.xml b/android/src/META-INF/database-support.xml
index 9b6d36f..c46de59 100644
--- a/android/src/META-INF/database-support.xml
+++ b/android/src/META-INF/database-support.xml
@@ -20,11 +20,11 @@
</actions>
<extensions defaultExtensionNs="com.intellij">
- <persistence.database.dbPsiManager implementation="org.jetbrains.android.database.AndroidDbManager" order="first"/>
+ <database.dbPsiManager implementation="org.jetbrains.android.database.AndroidDbManager" order="first"/>
<projectService serviceInterface="org.jetbrains.android.database.AndroidDataSourceStorage"
serviceImplementation="org.jetbrains.android.database.AndroidDataSourceStorage"/>
<applicationService serviceInterface="org.jetbrains.android.database.AndroidRemoteDataBaseManager"
serviceImplementation="org.jetbrains.android.database.AndroidRemoteDataBaseManager"/>
- <persistence.database.synchronizeHandler implementation="org.jetbrains.android.database.AndroidSynchronizeHandler"/>
+ <database.synchronizeHandler implementation="org.jetbrains.android.database.AndroidSynchronizeHandler"/>
</extensions>
</idea-plugin>
diff --git a/android/src/META-INF/eclipse.xml b/android/src/META-INF/eclipse.xml
index 7c724d1..f360d6e 100644
--- a/android/src/META-INF/eclipse.xml
+++ b/android/src/META-INF/eclipse.xml
@@ -1,5 +1,5 @@
<idea-plugin url="http://www.jetbrains.com/idea">
- <extensions xmlns="org.jetbrains.idea.eclipse">
+ <extensions defaultExtensionNs="org.jetbrains.idea.eclipse">
<natureImporter implementation="org.jetbrains.android.newProject.AndroidEclipseNatureImporter"/>
</extensions>
</idea-plugin>
diff --git a/android/src/META-INF/maven-support.xml b/android/src/META-INF/maven-support.xml
index 20d9537..2285902 100644
--- a/android/src/META-INF/maven-support.xml
+++ b/android/src/META-INF/maven-support.xml
@@ -1,12 +1,8 @@
<idea-plugin url="http://www.jetbrains.com/idea">
- <extensions xmlns="org.jetbrains.idea.maven">
+ <extensions defaultExtensionNs="org.jetbrains.idea.maven">
<importer implementation="org.jetbrains.android.maven.AndroidFacetImporter1"/>
<importer implementation="org.jetbrains.android.maven.AndroidFacetImporter2"/>
</extensions>
- <extensions defaultExtensionNs="com.intellij">
- <compiler implementation="org.jetbrains.android.compiler.AndroidExternalApklibExtractingCompiler" order="first"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidMavenResourcesCompiler" order="first"/>
- </extensions>
<extensions defaultExtensionNs="org.jetbrains">
<android.mavenProvider implementation="org.jetbrains.android.maven.AndroidMavenProviderImpl"/>
</extensions>
diff --git a/android/src/META-INF/plugin.xml b/android/src/META-INF/plugin.xml
index 21f8ac7..9e71367 100755
--- a/android/src/META-INF/plugin.xml
+++ b/android/src/META-INF/plugin.xml
@@ -1,11 +1,22 @@
-<idea-plugin version="2" xmlns:xi="http://www.w3.org/2001/XInclude">
+<idea-plugin version="2">
<name>Android Support</name>
<id>org.jetbrains.android</id>
<description>
- Supports development of Open Handset Alliance Android applications with IntelliJ IDEA.
+ Supports the development of Open Handset Alliance Android applications with IntelliJ IDEA.
</description>
- <version>10.1.1.0</version>
+ <version>10.1.2.0</version>
<vendor>JetBrains</vendor>
+
+ <depends>JUnit</depends>
+ <depends>com.intellij.properties</depends>
+ <depends>org.jetbrains.plugins.gradle</depends>
+
+ <depends optional="true" config-file="maven-support.xml">org.jetbrains.idea.maven</depends>
+ <depends optional="true" config-file="test-ng.xml">TestNG-J</depends>
+ <depends optional="true" config-file="androidstudio.xml">com.intellij.modules.androidstudio</depends>
+ <depends optional="true" config-file="eclipse.xml">org.jetbrains.idea.eclipse</depends>
+ <depends optional="true" config-file="database-support.xml">com.intellij.database</depends>
+
<application-components>
<component>
<implementation-class>org.jetbrains.android.AndroidPlugin</implementation-class>
@@ -57,18 +68,30 @@
</action>
<group id="AndroidToolsGroup" popup="true" text="Android" icon="AndroidIcons.Android"
class="org.jetbrains.android.actions.AndroidToolsActionGroup">
+ <action id="Android.ShowNavigationEditor" class="com.android.tools.idea.actions.AndroidShowNavigationEditor"
+ icon="AndroidIcons.NavigationEditor"/>
+ <action id="Android.SyncProject" class="com.android.tools.idea.gradle.actions.SyncProjectAction" icon="AndroidIcons.GradleSync"/>
+ <action id="Android.RunDdms" class="org.jetbrains.android.actions.AndroidRunDdmsAction" icon="AndroidIcons.Android"/>
+ <action id="Android.RunAndroidAvdManager" class="org.jetbrains.android.actions.RunAndroidAvdManagerAction"
+ icon="AndroidIcons.AvdManager"/>
+ <action id="Android.RunAndroidSdkManager" class="org.jetbrains.android.actions.RunAndroidSdkManagerAction"
+ icon="AndroidIcons.SdkManager"/>
+ <action id="Android.EnableDdms" class="org.jetbrains.android.actions.AndroidEnableAdbServiceAction"/>
+ <action id="Android.GenerateSourcesAction" class="org.jetbrains.android.actions.AndroidRegenerateSourcesAction"/>
+ <action id="Android.MemoryMonitor" class="com.android.tools.idea.memory.MemoryMonitorAction" icon="AndroidIcons.MemoryMonitor"/>
<add-to-group group-id="ToolsMenu" anchor="last"/>
</group>
- <action id="Android.ShowNavigationEditor" class="com.android.tools.idea.actions.AndroidShowNavigationEditor"
- icon="AndroidIcons.NavigationEditor">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
- <action id="Android.MemoryMonitor" class="com.android.tools.idea.memory.MemoryMonitorAction" icon="AndroidIcons.MemoryMonitor">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
- <action id="Android.SyncProject" class="com.android.tools.idea.gradle.actions.SyncProjectAction" icon="AndroidIcons.GradleSync">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
+ <group id="Android.MainToolBarActionGroup">
+ <separator/>
+ <reference id="Android.SyncProject" />
+ <reference id="Android.RunAndroidAvdManager" />
+ <reference id="Android.RunAndroidSdkManager" />
+ <reference id="Android.RunDdms" />
+ <separator/>
+
+ <add-to-group group-id="MainToolBar" anchor="before" relative-to-action="HelpTopics" />
+ </group>
+
<group id="Internal.Android" text="Android" popup="true" internal="true">
<action internal="true" id="Android.CleanImportProject" class="com.android.tools.idea.gradle.actions.CleanImportProjectAction" />
<action internal="true" id="Android.StopGradleDaemons" class="com.android.tools.idea.gradle.actions.StopGradleDaemonsAction" />
@@ -76,26 +99,12 @@
<action internal="true" id="Android.TerminateAdbAction" class="com.android.tools.idea.ddms.adb.TerminateAdbAction" />
<add-to-group group-id="Internal"/>
</group>
- <action id="Android.RunDdms" class="org.jetbrains.android.actions.AndroidRunDdmsAction" icon="AndroidIcons.Android">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
<!--<action id="Android.RunHierarchyViewer" class="org.jetbrains.android.actions.AndroidRunHierarchyViewerAction">
<add-to-group group-id="AndroidToolsGroup" anchor="last"/>
</action>-->
<action id="Android.GenerateSignedApk" class="org.jetbrains.android.actions.GenerateSignedApkAction">
<add-to-group group-id="BuildMenu" anchor="last"/>
</action>
- <action id="Android.RunAndroidAvdManager" class="org.jetbrains.android.actions.RunAndroidAvdManagerAction"
- icon="AndroidIcons.AvdManager">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
- <action id="Android.RunAndroidSdkManager" class="org.jetbrains.android.actions.RunAndroidSdkManagerAction"
- icon="AndroidIcons.SdkManager">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
- <action id="Android.EnableDdms" class="org.jetbrains.android.actions.AndroidEnableAdbServiceAction">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
<action id="AndroidConnectDebuggerAction"
class="org.jetbrains.android.actions.AndroidConnectDebuggerAction"
text="Attach debugger to Android process"
@@ -123,9 +132,6 @@
<add-to-group group-id="RefactoringMenu"/>
</action>
<action id="Android.TraceViewSearch" class="com.android.tools.idea.editors.vmtrace.VmTraceEditorSearchAction" use-shortcut-of="Find" />
- <action id="Android.GenerateSourcesAction" class="org.jetbrains.android.actions.AndroidRegenerateSourcesAction">
- <add-to-group group-id="AndroidToolsGroup" anchor="last"/>
- </action>
<action id="Android.Debugger.ViewBitmapAction" class="com.android.tools.idea.run.ViewBitmapAction">
<add-to-group group-id="Debugger.FramePanelPopup" anchor="last"/>
</action>
@@ -134,21 +140,11 @@
</action>
</actions>
- <depends>JUnit</depends>
- <depends>com.intellij.properties</depends>
- <depends>org.jetbrains.plugins.gradle</depends>
-
<extensions defaultExtensionNs="org.jetbrains.plugins.gradle">
<projectResolve implementation="com.android.tools.idea.gradle.project.AndroidGradleProjectResolver"/>
<taskManager implementation="com.android.tools.idea.gradle.task.AndroidGradleTaskManager"/>
</extensions>
- <depends optional="true" config-file="maven-support.xml">org.jetbrains.idea.maven</depends>
- <depends optional="true" config-file="test-ng.xml">TestNG-J</depends>
- <depends optional="true" config-file="androidstudio.xml">com.intellij.modules.androidstudio</depends>
- <depends optional="true" config-file="eclipse.xml">org.jetbrains.idea.eclipse</depends>
- <depends optional="true" config-file="database-support.xml">com.intellij.persistence.database</depends>
-
<extensions defaultExtensionNs="com.intellij">
<externalSystemTaskNotificationListener implementation="com.android.tools.idea.gradle.AndroidGradleImportTaskNotificationListener"/>
<externalSystemNotificationExtension implementation="com.android.tools.idea.gradle.service.notification.GradleNotificationExtension"/>
@@ -171,8 +167,8 @@
<exportable serviceInterface="com.android.tools.idea.folding.AndroidFoldingSettings"/>
<stepsBeforeRunProvider implementation="com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider" />
- <projectConfigurable instance="com.android.tools.idea.gradle.compiler.GradleCompilerSettingsConfigurable" id="gradle.compiler"
- displayName="Compiler (Gradle-based Android Projects)"/>
+ <projectConfigurable groupId="build" id="gradle.compiler" parentId="project.propCompiler"
+ provider="com.android.tools.idea.gradle.compiler.GradleCompilerSettingsConfigurableProvider"/>
<compiler.optionsManager implementation="com.android.tools.idea.gradle.compiler.HideCompilerOptions" />
<errorHandler implementation="com.android.tools.idea.diagnostics.error.ErrorReporter"/>
@@ -243,19 +239,6 @@
<projectTemplatesFactory implementation="com.android.tools.idea.wizard.TemplateWizardProjectTemplateFactory"/>
<projectTemplatesFactory implementation="org.jetbrains.android.newProject.AndroidProjectTemplatesFactory"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidIncludingCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidRenderscriptCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidBuildConfigGeneratingCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidAptCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidIdlCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidLibraryPackagingCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidProguardCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidDexCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidPngFilesCachingCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidResourcesPackagingCompiler"/>
- <compiler implementation="org.jetbrains.android.compiler.AndroidPackagingCompiler"/>
- <compiler.makeDependencyProcessor implementation="org.jetbrains.android.compiler.AndroidDependencyProcessor"/>
-
<completion.contributor language="XML" implementationClass="org.jetbrains.android.AndroidCompletionContributor"
id="compositieAttributeValues" order="first"/>
<completion.contributor language="JAVA" implementationClass="org.jetbrains.android.AndroidJavaCompletionContributor" order="first"/>
@@ -527,11 +510,12 @@
conditionClass="com.android.tools.idea.gradle.invoker.console.view.GradleConsoleCondition"
icon="AndroidIcons.GradleConsoleToolWindow"
factoryClass="com.android.tools.idea.gradle.invoker.console.view.GradleConsoleToolWindowFactory"/>
- <toolWindow id="Memory Monitor"
- anchor="bottom"
- secondary="true"
- icon="AndroidIcons.MemoryMonitorToolWindow"
- factoryClass="com.android.tools.idea.memory.MemoryMonitorToolWindowFactory"/>
+ <facet.toolWindow id="Memory Monitor"
+ facetIdList="android"
+ anchor="bottom"
+ secondary="true"
+ icon="AndroidIcons.MemoryMonitorToolWindow"
+ factoryClass="com.android.tools.idea.memory.MemoryMonitorToolWindowFactory"/>
<projectService serviceImplementation="com.android.tools.idea.gradle.variant.view.BuildVariantView"/>
<projectService serviceImplementation="com.android.tools.idea.gradle.invoker.console.view.GradleConsoleView"/>
<projectService serviceImplementation="com.android.tools.idea.gradle.invoker.GradleInvoker"/>
diff --git a/android/src/com/android/tools/idea/actions/AndroidImportProjectAction.java b/android/src/com/android/tools/idea/actions/AndroidImportProjectAction.java
index 693e407..40b8a65 100644
--- a/android/src/com/android/tools/idea/actions/AndroidImportProjectAction.java
+++ b/android/src/com/android/tools/idea/actions/AndroidImportProjectAction.java
@@ -135,7 +135,7 @@
if (lastLocation != null) {
toSelect = LocalFileSystem.getInstance().refreshAndFindFileByPath(lastLocation);
}
- VirtualFile[] files = chooser.choose(toSelect, null);
+ VirtualFile[] files = chooser.choose(null, toSelect);
if (files.length == 0) {
return null;
}
diff --git a/android/src/com/android/tools/idea/actions/AndroidShowNavigationEditor.java b/android/src/com/android/tools/idea/actions/AndroidShowNavigationEditor.java
index 3c7e046..6d1385d 100644
--- a/android/src/com/android/tools/idea/actions/AndroidShowNavigationEditor.java
+++ b/android/src/com/android/tools/idea/actions/AndroidShowNavigationEditor.java
@@ -19,6 +19,7 @@
import com.android.tools.idea.editors.navigation.NavigationEditor;
import com.android.tools.idea.editors.navigation.NavigationEditorProvider;
import com.android.tools.idea.editors.navigation.Utilities;
+import com.intellij.facet.ProjectFacetManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.fileEditor.FileEditorManager;
@@ -27,6 +28,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import icons.AndroidIcons;
+import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.Nullable;
public class AndroidShowNavigationEditor extends AnAction {
@@ -68,6 +70,8 @@
@Override
public void update(AnActionEvent e) {
- e.getPresentation().setEnabled(true);
+ final Project project = e.getProject();
+ e.getPresentation().setEnabledAndVisible(
+ project != null && !ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).isEmpty());
}
}
diff --git a/android/src/com/android/tools/idea/actions/AndroidShowStructureSettingsAction.java b/android/src/com/android/tools/idea/actions/AndroidShowStructureSettingsAction.java
index 713db38..28b759f 100644
--- a/android/src/com/android/tools/idea/actions/AndroidShowStructureSettingsAction.java
+++ b/android/src/com/android/tools/idea/actions/AndroidShowStructureSettingsAction.java
@@ -17,9 +17,8 @@
import com.android.tools.idea.gradle.structure.AndroidProjectStructureConfigurable;
import com.android.tools.idea.gradle.util.Projects;
-import com.android.tools.idea.startup.AndroidStudioSpecificInitializer;
import com.intellij.ide.actions.ShowStructureSettingsAction;
-import com.intellij.idea.ActionsBundle;
+import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.Project;
@@ -28,27 +27,19 @@
/**
* Displays the "Project Structure" dialog.
*/
-public class AndroidShowStructureSettingsAction extends AndroidActionRemover {
- public AndroidShowStructureSettingsAction() {
- super(new ShowStructureSettingsAction(), ActionsBundle.message("action.ShowProjectStructureSettings.text"));
- }
+public class AndroidShowStructureSettingsAction extends AnAction {
@Override
public void actionPerformed(AnActionEvent e) {
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
- if (AndroidStudioSpecificInitializer.isAndroidStudio() && (project == null || Projects.isGradleProject(project))) {
+ if (project == null || Projects.isGradleProject(project)) {
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
AndroidProjectStructureConfigurable.getInstance(project).showDialog();
}
else {
- super.actionPerformed(e);
+ new ShowStructureSettingsAction().actionPerformed(e);
}
}
-
- @Override
- public void update(AnActionEvent e) {
- myDelegate.update(e);
- }
}
diff --git a/android/src/com/android/tools/idea/actions/AndroidTemplateProjectStructureAction.java b/android/src/com/android/tools/idea/actions/AndroidTemplateProjectStructureAction.java
index 88e9d39..d97923d 100644
--- a/android/src/com/android/tools/idea/actions/AndroidTemplateProjectStructureAction.java
+++ b/android/src/com/android/tools/idea/actions/AndroidTemplateProjectStructureAction.java
@@ -32,6 +32,6 @@
public void actionPerformed(final AnActionEvent e) {
Project defaultProject = ProjectManagerEx.getInstanceEx().getDefaultProject();
AndroidProjectStructureConfigurable configurable = AndroidProjectStructureConfigurable.getInstance(defaultProject);
- ShowSettingsUtil.getInstance().editConfigurable(defaultProject, OptionsEditorDialog.DIMENSION_KEY, configurable);
+ ShowSettingsUtil.getInstance().editConfigurable(defaultProject, OptionsEditorDialog.DIMENSION_KEY, configurable, true);
}
}
diff --git a/android/src/com/android/tools/idea/actions/CreateLibraryFromFilesAction.java b/android/src/com/android/tools/idea/actions/CreateLibraryFromFilesAction.java
index be55e09..b9b1c9e 100644
--- a/android/src/com/android/tools/idea/actions/CreateLibraryFromFilesAction.java
+++ b/android/src/com/android/tools/idea/actions/CreateLibraryFromFilesAction.java
@@ -38,7 +38,7 @@
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil;
-import com.intellij.openapi.roots.ui.configuration.ModulesCombobox;
+import com.intellij.application.options.ModulesComboBox;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.DefaultLibraryRootsComponentDescriptor;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryNameAndLevelPanel;
import com.intellij.openapi.ui.DialogWrapper;
@@ -129,7 +129,7 @@
private static class CreateGradleLibraryFromFilesDialog extends DialogWrapper {
public static final String COMMAND_TITLE = "Create Library";
- private final ModulesCombobox myModulesCombobox;
+ private final ModulesComboBox myModulesComboBox;
private final Project myProject;
private final JPanel myPanel;
private final List<OrderRoot> myRoots;
@@ -143,17 +143,17 @@
mySettingsFile = GradleSettingsFile.get(myProject);
final FormBuilder builder = LibraryNameAndLevelPanel.createFormBuilder();
- myModulesCombobox = new ModulesCombobox();
- myModulesCombobox.fillModules(myProject);
- myModulesCombobox.setSelectedModule(findModule(roots));
- for (Iterator iter = ((SortedListModel)myModulesCombobox.getModel()).iterator(); iter.hasNext(); ) {
+ myModulesComboBox = new ModulesComboBox();
+ myModulesComboBox.fillModules(myProject);
+ myModulesComboBox.setSelectedModule(findModule(roots));
+ for (Iterator iter = ((SortedListModel)myModulesComboBox.getModel()).iterator(); iter.hasNext(); ) {
Module module = (Module)iter.next();
String path = GradleSettingsFile.getModuleGradlePath(module);
if (path == null || !mySettingsFile.hasBuildFile(path)) {
iter.remove();
}
}
- builder.addLabeledComponent("&Add to module:", myModulesCombobox);
+ builder.addLabeledComponent("&Add to module:", myModulesComboBox);
myPanel = builder.getPanel();
init();
}
@@ -180,7 +180,7 @@
protected void doOKAction() {
AccessToken token = WriteAction.start();
try {
- final Module module = myModulesCombobox.getSelectedModule();
+ final Module module = myModulesComboBox.getSelectedModule();
if (module == null) { return; }
String moduleGradlePath = GradleSettingsFile.getModuleGradlePath(module);
if (moduleGradlePath == null) { return; }
diff --git a/android/src/com/android/tools/idea/avdmanager/AvdEditWizard.java b/android/src/com/android/tools/idea/avdmanager/AvdEditWizard.java
index 3408a57..e860189 100755
--- a/android/src/com/android/tools/idea/avdmanager/AvdEditWizard.java
+++ b/android/src/com/android/tools/idea/avdmanager/AvdEditWizard.java
@@ -118,7 +118,8 @@
IAndroidTarget target = avdInfo.getTarget();
if (target != null) {
ISystemImage selectedImage = target.getSystemImage(avdInfo.getTag(), avdInfo.getAbiType());
- SystemImageDescription systemImageDescription = new SystemImageDescription(target, selectedImage);
+
+ SystemImageDescription systemImageDescription = selectedImage != null ? new SystemImageDescription(target, selectedImage) : null;
state.put(SYSTEM_IMAGE_KEY, systemImageDescription);
}
diff --git a/android/src/com/android/tools/idea/configurations/Configuration.java b/android/src/com/android/tools/idea/configurations/Configuration.java
index 9d0e1d7..653eb40 100644
--- a/android/src/com/android/tools/idea/configurations/Configuration.java
+++ b/android/src/com/android/tools/idea/configurations/Configuration.java
@@ -31,6 +31,7 @@
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -289,7 +290,7 @@
*/
@NotNull
public static Configuration copyCompatible(@NotNull Configuration source, @NotNull Configuration destination) {
- assert source.myFile != destination.myFile; // This method is intended to sync configurations for resource variations
+ assert !Comparing.equal(source.myFile, destination.myFile); // This method is intended to sync configurations for resource variations
FolderConfiguration editedConfig = destination.getEditedConfig();
diff --git a/android/src/com/android/tools/idea/configurations/ConfigurationAction.java b/android/src/com/android/tools/idea/configurations/ConfigurationAction.java
index 87188eb..419cb70 100644
--- a/android/src/com/android/tools/idea/configurations/ConfigurationAction.java
+++ b/android/src/com/android/tools/idea/configurations/ConfigurationAction.java
@@ -27,6 +27,7 @@
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import icons.AndroidIcons;
import org.jetbrains.android.facet.AndroidFacet;
@@ -144,7 +145,7 @@
sb.append(FILE_ARROW);
String folderName = better.getParent().getName();
if (folderName.equals(FD_RES_LAYOUT)) {
- if (file != null && !file.getParent().equals(better.getParent())) {
+ if (file != null && !Comparing.equal(file.getParent(), better.getParent())) {
sb.append(FD_RES_LAYOUT);
sb.append(File.separatorChar);
}
diff --git a/android/src/com/android/tools/idea/configurations/ConfigurationMatcher.java b/android/src/com/android/tools/idea/configurations/ConfigurationMatcher.java
index c24436f..24ec5da 100644
--- a/android/src/com/android/tools/idea/configurations/ConfigurationMatcher.java
+++ b/android/src/com/android/tools/idea/configurations/ConfigurationMatcher.java
@@ -565,7 +565,7 @@
if (activeEditor != null) {
FileDocumentManager documentManager = FileDocumentManager.getInstance();
VirtualFile file = documentManager.getFile(activeEditor.getDocument());
- if (file != null && file != myFile && file.getFileType() == StdFileTypes.XML
+ if (file != null && !file.equals(myFile) && file.getFileType() == StdFileTypes.XML
&& ResourceHelper.getFolderType(myFile) == ResourceHelper.getFolderType(file)) {
Configuration configuration = myManager.getConfiguration(file);
FolderConfiguration fullConfig = configuration.getFullConfig();
diff --git a/android/src/com/android/tools/idea/configurations/ConfigurationMenuAction.java b/android/src/com/android/tools/idea/configurations/ConfigurationMenuAction.java
index b85a45b..3636d68 100644
--- a/android/src/com/android/tools/idea/configurations/ConfigurationMenuAction.java
+++ b/android/src/com/android/tools/idea/configurations/ConfigurationMenuAction.java
@@ -75,7 +75,7 @@
if (variations.size() > 1) {
for (VirtualFile file : variations) {
String title = String.format("Switch to %1$s", file.getParent().getName());
- group.add(new SwitchToVariationAction(title, project, file, virtualFile == file));
+ group.add(new SwitchToVariationAction(title, project, file, virtualFile.equals(file)));
}
group.addSeparator();
}
diff --git a/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtDescriptor.java b/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtDescriptor.java
index 43d715a..3a7197d 100644
--- a/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtDescriptor.java
+++ b/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtDescriptor.java
@@ -81,6 +81,7 @@
"plugins" + File.separatorChar + "android" + File.separatorChar,
".." + File.separator + "adt" + File.separator + "idea" + File.separator + "android" + File.separatorChar,
"android" + File.separatorChar + "android" + File.separatorChar,
+ "community" + File.separatorChar + "android" + File.separatorChar + "android" + File.separatorChar,
};
for (String p : paths) {
diff --git a/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtPainter.java b/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtPainter.java
index cb638f8..05dc0a6 100644
--- a/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtPainter.java
+++ b/android/src/com/android/tools/idea/ddms/screenshot/DeviceArtPainter.java
@@ -25,6 +25,7 @@
import com.google.common.collect.Maps;
import com.intellij.openapi.application.PathManager;
import com.intellij.reference.SoftReference;
+import com.intellij.ui.Gray;
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -307,8 +308,7 @@
@SuppressWarnings("UndesirableClassUsage") // Don't need Retina image here, and it's more expensive
BufferedImage result = new BufferedImage(framedWidth, framedHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = result.createGraphics();
- //noinspection UseJBColor
- g.setColor(new Color(128, 0, 0, 0));
+ g.setColor(Gray.TRANSPARENT);
g.fillRect(0, 0, result.getWidth(), result.getHeight());
RenderedImage.paintClipped(g, scaledImage, device, screenX, screenY, false);
@@ -369,8 +369,7 @@
@SuppressWarnings("UndesirableClassUsage") // Don't need Retina image here, and it's more expensive
BufferedImage composite = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = composite.createGraphics();
- //noinspection UseJBColor
- g.setColor(new Color(0, 0, 0, 0));
+ g.setColor(Gray.TRANSPARENT);
g.fillRect(0, 0, composite.getWidth(), composite.getHeight());
NinePatch ninePatch = NinePatch.load(image, true, false);
@@ -817,8 +816,7 @@
@SuppressWarnings("UndesirableClassUsage") // Don't need Retina image here, and it's more expensive
BufferedImage composite = new BufferedImage(myFrameWidth, myFrameHeight, BufferedImage.TYPE_INT_ARGB);
Graphics g = composite.createGraphics();
- //noinspection UseJBColor
- g.setColor(new Color(0, 0, 0, 0));
+ g.setColor(Gray.TRANSPARENT);
g.fillRect(0, 0, composite.getWidth(), composite.getHeight());
Graphics2D g2d = (Graphics2D)g;
diff --git a/android/src/com/android/tools/idea/diagnostics/error/ErrorReporter.java b/android/src/com/android/tools/idea/diagnostics/error/ErrorReporter.java
index 3f0faa1..4af7343 100644
--- a/android/src/com/android/tools/idea/diagnostics/error/ErrorReporter.java
+++ b/android/src/com/android/tools/idea/diagnostics/error/ErrorReporter.java
@@ -29,7 +29,6 @@
import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
@@ -46,6 +45,7 @@
import com.intellij.util.Consumer;
import org.jetbrains.android.diagnostics.error.IdeaITNProxy;
import org.jetbrains.android.util.AndroidBundle;
+import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.util.List;
@@ -59,26 +59,9 @@
}
@Override
- public SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parentComponent) {
- // obsolete API
- return new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED);
- }
-
- @Override
- public boolean trySubmitAsync(IdeaLoggingEvent[] events,
- String additionalInfo,
- Component parentComponent,
- Consumer<SubmittedReportInfo> consumer) {
- return sendError(events[0], additionalInfo, parentComponent, consumer);
- }
-
- private static boolean sendError(IdeaLoggingEvent event,
- String additionalInfo,
- final Component parentComponent,
- final Consumer<SubmittedReportInfo> callback) {
- ErrorBean errorBean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);
-
- return doSubmit(event, parentComponent, callback, errorBean, additionalInfo);
+ public boolean submit(@NotNull IdeaLoggingEvent[] events, String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
+ ErrorBean errorBean = new ErrorBean(events[0].getThrowable(), IdeaLogger.ourLastActionId);
+ return doSubmit(events[0], parentComponent, consumer, errorBean, additionalInfo);
}
private static boolean doSubmit(final IdeaLoggingEvent event,
@@ -136,11 +119,10 @@
public void consume(Exception e) {
// TODO: check for updates
String message = AndroidBundle.message("error.report.at.b.android", e.getMessage());
- NotificationListener listener = new NotificationListener.UrlOpeningListener(true);
ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT,
message,
NotificationType.ERROR,
- listener).setImportant(false).notify(project);
+ NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(project);
}
};
AnonymousFeedbackTask task =
diff --git a/android/src/com/android/tools/idea/editors/AutoImportNotificationProvider.java b/android/src/com/android/tools/idea/editors/AutoImportNotificationProvider.java
index 04141d1..395636c 100644
--- a/android/src/com/android/tools/idea/editors/AutoImportNotificationProvider.java
+++ b/android/src/com/android/tools/idea/editors/AutoImportNotificationProvider.java
@@ -43,6 +43,7 @@
myNotifications = notifications;
}
+ @NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
return KEY;
@@ -50,7 +51,7 @@
@Nullable
@Override
- public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
+ public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
String name = file.getName();
if (SdkConstants.FN_BUILD_GRADLE.equals(name) || SdkConstants.FN_SETTINGS_GRADLE.equals(name)) {
GradleProjectSettings settings = GradleUtil.getGradleProjectSettings(myProject);
diff --git a/android/src/com/android/tools/idea/editors/GeneratedFileNotificationProvider.java b/android/src/com/android/tools/idea/editors/GeneratedFileNotificationProvider.java
index 34a21b0..6f510a2 100644
--- a/android/src/com/android/tools/idea/editors/GeneratedFileNotificationProvider.java
+++ b/android/src/com/android/tools/idea/editors/GeneratedFileNotificationProvider.java
@@ -47,6 +47,7 @@
myGeneratedSourceFileChangeTracker = changeTracker;
}
+ @NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
return KEY;
@@ -54,7 +55,7 @@
@Nullable
@Override
- public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
+ public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
AndroidProject androidProject = getAndroidProject(file);
if (androidProject == null) {
return null;
diff --git a/android/src/com/android/tools/idea/editors/ProjectSyncStatusNotificationProvider.java b/android/src/com/android/tools/idea/editors/ProjectSyncStatusNotificationProvider.java
index 21b23d0..e12cce6 100644
--- a/android/src/com/android/tools/idea/editors/ProjectSyncStatusNotificationProvider.java
+++ b/android/src/com/android/tools/idea/editors/ProjectSyncStatusNotificationProvider.java
@@ -54,6 +54,7 @@
myProject = project;
}
+ @NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
return KEY;
diff --git a/android/src/com/android/tools/idea/editors/UnimportedModuleNotificationProvider.java b/android/src/com/android/tools/idea/editors/UnimportedModuleNotificationProvider.java
index 25083d0..3116386 100644
--- a/android/src/com/android/tools/idea/editors/UnimportedModuleNotificationProvider.java
+++ b/android/src/com/android/tools/idea/editors/UnimportedModuleNotificationProvider.java
@@ -25,8 +25,6 @@
import com.google.common.collect.ImmutableSet;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
@@ -77,6 +75,7 @@
return ImmutableSet.of(SdkConstants.FN_BUILD_GRADLE, SdkConstants.FN_SETTINGS_GRADLE).contains(file.getName());
}
+ @NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
return KEY;
@@ -84,7 +83,7 @@
@Nullable
@Override
- public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
+ public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (!Projects.isGradleProject(myProject) || myIsImporting.get()) {
return null;
}
diff --git a/android/src/com/android/tools/idea/editors/vmtrace/treemodel/VmStatsTreeUtils.java b/android/src/com/android/tools/idea/editors/vmtrace/treemodel/VmStatsTreeUtils.java
index 56be279..5b11b59 100644
--- a/android/src/com/android/tools/idea/editors/vmtrace/treemodel/VmStatsTreeUtils.java
+++ b/android/src/com/android/tools/idea/editors/vmtrace/treemodel/VmStatsTreeUtils.java
@@ -6,7 +6,6 @@
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.TableSpeedSearch;
import com.intellij.ui.treeStructure.treetable.TreeTable;
-import sun.swing.table.DefaultTableCellHeaderRenderer;
import javax.swing.*;
import javax.swing.table.*;
@@ -148,8 +147,8 @@
public TableHeaderCellRenderer(TreeTable table) {
myDefaultRenderer = table.getTableHeader().getDefaultRenderer();
- if (myDefaultRenderer instanceof DefaultTableCellHeaderRenderer) {
- ((DefaultTableCellHeaderRenderer)myDefaultRenderer).setHorizontalAlignment(SwingConstants.CENTER);
+ if (myDefaultRenderer instanceof DefaultTableCellRenderer) {
+ ((DefaultTableCellRenderer)myDefaultRenderer).setHorizontalAlignment(SwingConstants.CENTER);
}
}
diff --git a/android/src/com/android/tools/idea/gradle/actions/StopGradleDaemonsAction.java b/android/src/com/android/tools/idea/gradle/actions/StopGradleDaemonsAction.java
index ec5fd0d..fb5ed79 100644
--- a/android/src/com/android/tools/idea/gradle/actions/StopGradleDaemonsAction.java
+++ b/android/src/com/android/tools/idea/gradle/actions/StopGradleDaemonsAction.java
@@ -18,6 +18,9 @@
import com.android.tools.idea.gradle.util.GradleUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.ui.Messages;
+
+import java.io.IOException;
/**
* Internal action that stops all running Gradle daemons.
@@ -31,6 +34,13 @@
@Override
public void actionPerformed(AnActionEvent e) {
- GradleUtil.stopAllGradleDaemons();
+ try {
+ GradleUtil.stopAllGradleDaemons(true);
+ }
+ catch (IOException error) {
+ Messages.showErrorDialog("Failed to stop Gradle daemons. Please run 'gradle --stop' from the command line.\n\n" +
+ "Cause:\n" + error.getMessage(), TITLE
+ );
+ }
}
}
diff --git a/android/src/com/android/tools/idea/gradle/compiler/AndroidGradleBuildProcessParametersProvider.java b/android/src/com/android/tools/idea/gradle/compiler/AndroidGradleBuildProcessParametersProvider.java
index a748e47..714a607 100644
--- a/android/src/com/android/tools/idea/gradle/compiler/AndroidGradleBuildProcessParametersProvider.java
+++ b/android/src/com/android/tools/idea/gradle/compiler/AndroidGradleBuildProcessParametersProvider.java
@@ -47,55 +47,15 @@
import static com.android.tools.idea.gradle.util.AndroidGradleSettings.createJvmArg;
/**
- * Adds Gradle jars to the build process' classpath and adds extra Gradle-related configuration options.
+ * Adds extra Android-Gradle related configuration options.
*/
public class AndroidGradleBuildProcessParametersProvider extends BuildProcessParametersProvider {
@NotNull private final Project myProject;
- private List<String> myClasspath;
-
public AndroidGradleBuildProcessParametersProvider(@NotNull Project project) {
myProject = project;
}
- /**
- * Adds Gradle to the build process' classpath.
- *
- * @return a list containing the locations of all jars necessary to include Gradle in the classpath.
- */
- @Override
- @NotNull
- public List<String> getClassPath() {
- if (myClasspath == null) {
- myClasspath = getGradleClassPath();
- }
- return myClasspath;
- }
-
- @NotNull
- private static List<String> getGradleClassPath() {
- String gradleLibDirPath = null;
- String gradleToolingApiJarPath = PathUtil.getJarPathForClass(ProjectConnection.class);
- if (!Strings.isNullOrEmpty(gradleToolingApiJarPath)) {
- gradleLibDirPath = PathUtil.getParentPath(gradleToolingApiJarPath);
- }
- if (gradleLibDirPath == null || gradleLibDirPath.isEmpty()) {
- return Collections.emptyList();
- }
- List<String> classpath = Lists.newArrayList();
- File gradleLibDir = new File(gradleLibDirPath);
- if (!gradleLibDir.isDirectory()) {
- return Collections.emptyList();
- }
- File[] children = FileUtil.notNullize(gradleLibDir.listFiles());
- for (File child : children) {
- if (child.isFile() && child.getName().endsWith(SdkConstants.DOT_JAR)) {
- classpath.add(child.getAbsolutePath());
- }
- }
- return classpath;
- }
-
@Override
@NotNull
public List<String> getVMArguments() {
diff --git a/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurable.java b/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurable.java
index ddb0514..0cbb576 100644
--- a/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurable.java
+++ b/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurable.java
@@ -59,8 +59,10 @@
private JCheckBox myConfigureOnDemandCheckBox;
@SuppressWarnings("UnusedDeclaration")
private HyperlinkLabel myConfigureOnDemandDocHyperlinkLabel;
+ private final String myDisplayName;
- public GradleCompilerSettingsConfigurable(@NotNull Project project) {
+ public GradleCompilerSettingsConfigurable(@NotNull Project project, @NotNull String displayName) {
+ myDisplayName = displayName;
myCompilerConfiguration = CompilerWorkspaceConfiguration.getInstance(project);
myBuildConfiguration = AndroidGradleBuildConfiguration.getInstance(project);
myGradleSettings = GradleSettings.getInstance(project);
@@ -86,7 +88,7 @@
@Override
@Nls
public String getDisplayName() {
- return "Gradle";
+ return myDisplayName;
}
@Override
@@ -154,6 +156,7 @@
myVmOptionsEditor.setText(vmOptions);
myAutoMakeCheckBox.setSelected(myCompilerConfiguration.MAKE_PROJECT_ON_SAVE);
myUseInProcessBuildCheckBox.setSelected(myBuildConfiguration.USE_EXPERIMENTAL_FASTER_BUILD);
+ myConfigureOnDemandCheckBox.setSelected(myBuildConfiguration.USE_CONFIGURATION_ON_DEMAND);
myAutoMakeCheckBox.setText("Make project automatically (only works while not running / debugging" +
(PowerSaveMode.isEnabled() ? ", disabled in Power Save mode" : "") +
")");
diff --git a/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurableProvider.java b/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurableProvider.java
new file mode 100644
index 0000000..ddcb1bc
--- /dev/null
+++ b/android/src/com/android/tools/idea/gradle/compiler/GradleCompilerSettingsConfigurableProvider.java
@@ -0,0 +1,28 @@
+package com.android.tools.idea.gradle.compiler;
+
+import com.android.tools.idea.startup.AndroidStudioSpecificInitializer;
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurableProvider;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class GradleCompilerSettingsConfigurableProvider extends ConfigurableProvider {
+ private final Project myProject;
+
+ public GradleCompilerSettingsConfigurableProvider(Project project) {
+ myProject = project;
+ }
+
+ @Nullable
+ @Override
+ public Configurable createConfigurable() {
+ if (myProject == null) {
+ return null;
+ }
+ final String displayName = AndroidStudioSpecificInitializer.isAndroidStudio() ? "Compiler" : "Gradle-Android Compiler";
+ return new GradleCompilerSettingsConfigurable(myProject, displayName);
+ }
+}
diff --git a/android/src/com/android/tools/idea/gradle/eclipse/AdtImportLocationStep.java b/android/src/com/android/tools/idea/gradle/eclipse/AdtImportLocationStep.java
index c4d5a9f..6def353 100644
--- a/android/src/com/android/tools/idea/gradle/eclipse/AdtImportLocationStep.java
+++ b/android/src/com/android/tools/idea/gradle/eclipse/AdtImportLocationStep.java
@@ -73,8 +73,8 @@
descriptor.setDescription("Pick a directory to import the given Eclipse Android project into");
myDestDirText.addBrowseFolderListener(new TextBrowseFolderListener(descriptor) {
@Override
- protected void onFileChoosen(@NotNull VirtualFile chosenFile) {
- super.onFileChoosen(chosenFile);
+ protected void onFileChosen(@NotNull VirtualFile chosenFile) {
+ super.onFileChosen(chosenFile);
myIsPathChangedByUser = true;
}
diff --git a/android/src/com/android/tools/idea/gradle/facet/AndroidGradleFacetEditorTab.java b/android/src/com/android/tools/idea/gradle/facet/AndroidGradleFacetEditorTab.java
index 651fb51..03337cb 100644
--- a/android/src/com/android/tools/idea/gradle/facet/AndroidGradleFacetEditorTab.java
+++ b/android/src/com/android/tools/idea/gradle/facet/AndroidGradleFacetEditorTab.java
@@ -7,7 +7,6 @@
import com.intellij.openapi.util.Disposer;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -28,7 +27,7 @@
return "Android Gradle Module Settings";
}
- @Nullable
+ @NotNull
@Override
public JComponent createComponent() {
return myModuleEditor.getPanel();
diff --git a/android/src/com/android/tools/idea/gradle/invoker/GradleOutputForwarder.java b/android/src/com/android/tools/idea/gradle/invoker/GradleOutputForwarder.java
index 189c700..9c403e3 100644
--- a/android/src/com/android/tools/idea/gradle/invoker/GradleOutputForwarder.java
+++ b/android/src/com/android/tools/idea/gradle/invoker/GradleOutputForwarder.java
@@ -132,4 +132,4 @@
myOutput.write(myContentType, b, off, len);
}
}
-}
\ No newline at end of file
+}
diff --git a/android/src/com/android/tools/idea/gradle/invoker/GradleTasksExecutor.java b/android/src/com/android/tools/idea/gradle/invoker/GradleTasksExecutor.java
index 0ae7615..c299683 100755
--- a/android/src/com/android/tools/idea/gradle/invoker/GradleTasksExecutor.java
+++ b/android/src/com/android/tools/idea/gradle/invoker/GradleTasksExecutor.java
@@ -25,6 +25,7 @@
import com.android.tools.idea.gradle.output.GradleMessage;
import com.android.tools.idea.gradle.output.GradleProjectAwareMessage;
import com.android.tools.idea.gradle.output.parser.BuildOutputParser;
+import com.android.tools.idea.gradle.output.parser.PatternAwareOutputParser;
import com.android.tools.idea.gradle.project.BuildSettings;
import com.android.tools.idea.gradle.service.notification.errors.AbstractSyncErrorHandler;
import com.android.tools.idea.gradle.util.AndroidGradleSettings;
@@ -61,7 +62,7 @@
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
-import com.intellij.openapi.progress.util.ProgressIndicatorBase;
+import com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase;
import com.intellij.openapi.project.DumbModeAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
@@ -93,6 +94,7 @@
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jps.service.JpsServiceManager;
import org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper;
import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings;
@@ -167,6 +169,7 @@
return "GradleTaskInvocation";
}
+ @NotNull
@Override
public DumbModeAction getDumbModeAction() {
return DumbModeAction.WAIT;
@@ -260,8 +263,7 @@
Function<ProjectConnection, Void> executeTasksFunction = new Function<ProjectConnection, Void>() {
@Override
public Void fun(ProjectConnection connection) {
- final Stopwatch stopwatch = Stopwatch.createUnstarted();
- stopwatch.start();
+ final Stopwatch stopwatch = Stopwatch.createStarted();
GradleConsoleView consoleView = GradleConsoleView.getInstance(project);
consoleView.clear();
@@ -443,7 +445,8 @@
@NotNull
private List<GradleMessage> showMessages(@NotNull String gradleOutput) {
- List<GradleMessage> compilerMessages = new BuildOutputParser().parseGradleOutput(gradleOutput);
+ Iterable<PatternAwareOutputParser> parsers = JpsServiceManager.getInstance().getExtensions(PatternAwareOutputParser.class);
+ List<GradleMessage> compilerMessages = new BuildOutputParser(parsers).parseGradleOutput(gradleOutput);
for (GradleMessage msg : compilerMessages) {
addMessage(msg, null);
}
@@ -979,7 +982,7 @@
}
}
- private class ProgressIndicatorStateDelegate extends ProgressIndicatorBase {
+ private class ProgressIndicatorStateDelegate extends AbstractProgressIndicatorExBase {
@Override
public void cancel() {
super.cancel();
diff --git a/android/src/com/android/tools/idea/gradle/invoker/console/view/GradleConsoleToolWindowFactory.java b/android/src/com/android/tools/idea/gradle/invoker/console/view/GradleConsoleToolWindowFactory.java
index 19581c8..63ac7fb 100644
--- a/android/src/com/android/tools/idea/gradle/invoker/console/view/GradleConsoleToolWindowFactory.java
+++ b/android/src/com/android/tools/idea/gradle/invoker/console/view/GradleConsoleToolWindowFactory.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
+import org.jetbrains.annotations.NotNull;
/**
* Created the "Gradle Console" tool window.
@@ -27,7 +28,7 @@
public static final String ID = "Gradle Console";
@Override
- public void createToolWindowContent(Project project, ToolWindow toolWindow) {
+ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
GradleConsoleView.getInstance(project).createToolWindowContent(toolWindow);
}
}
diff --git a/android/src/com/android/tools/idea/gradle/project/GradleProjectImporter.java b/android/src/com/android/tools/idea/gradle/project/GradleProjectImporter.java
index ad2f787..4eff32a 100755
--- a/android/src/com/android/tools/idea/gradle/project/GradleProjectImporter.java
+++ b/android/src/com/android/tools/idea/gradle/project/GradleProjectImporter.java
@@ -45,6 +45,7 @@
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.project.ProjectTypeService;
import com.intellij.openapi.roots.CompilerProjectExtension;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable;
@@ -60,6 +61,7 @@
import com.intellij.util.SystemProperties;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.android.facet.AndroidFacet;
+import org.jetbrains.android.newProject.AndroidModuleBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.remote.GradleJavaHelper;
@@ -404,6 +406,8 @@
assert compilerProjectExt != null;
compilerProjectExt.setCompilerOutputUrl(compilerOutputDirUrl);
setUpGradleSettings(newProject);
+ // This allows to customize UI when android project is opened inside IDEA with android plugin.
+ ProjectTypeService.setProjectType(newProject, AndroidModuleBuilder.ANDROID_PROJECT_TYPE);
}
});
}
diff --git a/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/FileBugHyperlink.java b/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/FileBugHyperlink.java
index 9de84d2..05377c4 100644
--- a/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/FileBugHyperlink.java
+++ b/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/FileBugHyperlink.java
@@ -26,6 +26,6 @@
@Override
protected void execute(@NotNull Project project) {
- SendFeedbackAction.launchBrowser();
+ SendFeedbackAction.launchBrowser(project);
}
}
diff --git a/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/OpenHttpSettingsHyperlink.java b/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/OpenHttpSettingsHyperlink.java
index c13f48b..53d8361 100644
--- a/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/OpenHttpSettingsHyperlink.java
+++ b/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/OpenHttpSettingsHyperlink.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +17,7 @@
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
-import com.intellij.util.net.HTTPProxySettingsPanel;
-import com.intellij.util.net.HttpConfigurable;
+import com.intellij.util.net.HttpProxyConfigurable;
import org.jetbrains.annotations.NotNull;
public class OpenHttpSettingsHyperlink extends NotificationHyperlink {
@@ -28,6 +27,6 @@
@Override
protected void execute(@NotNull Project project) {
- ShowSettingsUtil.getInstance().editConfigurable(project, new HTTPProxySettingsPanel(HttpConfigurable.getInstance()));
+ ShowSettingsUtil.getInstance().editConfigurable(project, new HttpProxyConfigurable());
}
}
diff --git a/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/StopGradleDaemonsHyperlink.java b/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/StopGradleDaemonsHyperlink.java
index f5a0a9a..2b22e2d 100644
--- a/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/StopGradleDaemonsHyperlink.java
+++ b/android/src/com/android/tools/idea/gradle/service/notification/hyperlink/StopGradleDaemonsHyperlink.java
@@ -21,6 +21,8 @@
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;
+import java.io.IOException;
+
public class StopGradleDaemonsHyperlink extends NotificationHyperlink {
@NotNull
public static NotificationHyperlink createStopGradleDaemonsHyperlink() {
@@ -43,8 +45,14 @@
"Do you want to continue?";
int answer = Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon());
if (answer == Messages.YES) {
- GradleUtil.stopAllGradleDaemons();
- ApplicationManager.getApplication().restart();
+ try {
+ GradleUtil.stopAllGradleDaemons(true);
+ ApplicationManager.getApplication().restart();
+ }
+ catch (IOException error) {
+ Messages.showErrorDialog("Failed to stop Gradle daemons. Please run 'gradle --stop' from the command line.\n\n" +
+ "Cause:\n" + error.getMessage(), title);
+ }
}
}
}
diff --git a/android/src/com/android/tools/idea/gradle/util/GradleUtil.java b/android/src/com/android/tools/idea/gradle/util/GradleUtil.java
index 05d7b2c..44ec460 100644
--- a/android/src/com/android/tools/idea/gradle/util/GradleUtil.java
+++ b/android/src/com/android/tools/idea/gradle/util/GradleUtil.java
@@ -23,16 +23,19 @@
import com.android.tools.idea.gradle.IdeaAndroidProject;
import com.android.tools.idea.gradle.eclipse.GradleImport;
import com.android.tools.idea.gradle.facet.AndroidGradleFacet;
+import com.android.tools.idea.gradle.project.ChooseGradleHomeDialog;
import com.android.tools.idea.startup.AndroidStudioSpecificInitializer;
import com.android.tools.idea.templates.TemplateManager;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.WriteCommandAction;
+import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.extensions.ExtensionPoint;
@@ -43,6 +46,7 @@
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurableEP;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
@@ -58,13 +62,17 @@
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.net.HttpConfigurable;
import icons.AndroidIcons;
-import org.gradle.tooling.internal.consumer.DefaultGradleConnector;
+import org.gradle.StartParameter;
+import org.gradle.wrapper.PathAssembler;
+import org.gradle.wrapper.WrapperConfiguration;
+import org.gradle.wrapper.WrapperExecutor;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.sdk.AndroidSdkData;
import org.jetbrains.android.sdk.AndroidSdkUtils;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.gradle.service.GradleInstallationManager;
import org.jetbrains.plugins.gradle.settings.DistributionType;
import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings;
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings;
@@ -75,6 +83,7 @@
import javax.swing.*;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
@@ -85,6 +94,7 @@
import static com.android.tools.idea.gradle.util.EmbeddedDistributionPaths.findEmbeddedGradleDistributionPath;
import static com.android.tools.idea.startup.AndroidStudioSpecificInitializer.GRADLE_DAEMON_TIMEOUT_MS;
import static org.gradle.wrapper.WrapperExecutor.DISTRIBUTION_URL_PROPERTY;
+import static org.jetbrains.plugins.gradle.util.GradleUtil.getLastUsedGradleHome;
/**
* Utilities related to Gradle.
@@ -101,6 +111,9 @@
@NonNls public static final String GRADLEW_PROPERTIES_PATH =
FileUtil.join(SdkConstants.FD_GRADLE_WRAPPER, SdkConstants.FN_GRADLE_WRAPPER_PROPERTIES);
+ @NonNls private static final String GRADLE_EXECUTABLE_NAME =
+ SystemInfo.isWindows ? SdkConstants.FN_GRADLE_WIN : SdkConstants.FN_GRADLE_UNIX;
+
private static final Logger LOG = Logger.getInstance(GradleUtil.class);
private static final Pattern GRADLE_JAR_NAME_PATTERN = Pattern.compile("gradle-(.*)-(.*)\\.jar");
private static final ProjectSystemId SYSTEM_ID = GradleConstants.SYSTEM_ID;
@@ -391,8 +404,107 @@
return null;
}
- public static void stopAllGradleDaemons() {
- DefaultGradleConnector.close();
+ public static void stopAllGradleDaemons(boolean interactive) throws IOException {
+ File gradleHome = findAnyGradleHome(interactive);
+ if (gradleHome == null) {
+ throw new FileNotFoundException("Unable to find path to Gradle home directory");
+ }
+ File gradleExecutable = new File(gradleHome, "bin" + File.separatorChar + GRADLE_EXECUTABLE_NAME);
+ if (!gradleExecutable.isFile()) {
+ throw new FileNotFoundException("Unable to find Gradle executable: " + gradleExecutable.getPath());
+ }
+ new ProcessBuilder(gradleExecutable.getPath(), "--stop").start();
+ }
+
+ @Nullable
+ public static File findAnyGradleHome(boolean interactive) {
+ // Try cheapest option first:
+ String lastUsedGradleHome = getLastUsedGradleHome();
+ if (!lastUsedGradleHome.isEmpty()) {
+ File path = new File(lastUsedGradleHome);
+ if (isValidGradleHome(path)) {
+ return path;
+ }
+ }
+
+ ProjectManager projectManager = ProjectManager.getInstance();
+ for (Project project : projectManager.getOpenProjects()) {
+ File gradleHome = findGradleHome(project);
+ if (gradleHome != null) {
+ return gradleHome;
+ }
+ }
+
+ if (interactive) {
+ ChooseGradleHomeDialog chooseGradleHomeDialog = new ChooseGradleHomeDialog();
+ chooseGradleHomeDialog.setTitle("Choose Gradle Installation");
+ String description = "A Gradle installation is necessary to stop all daemons.\n" +
+ "Please select the home directory of a Gradle installation, otherwise the project won't be closed.";
+ chooseGradleHomeDialog.setDescription(description);
+ if (!chooseGradleHomeDialog.showAndGet()) {
+ return null;
+ }
+ String enteredPath = chooseGradleHomeDialog.getEnteredGradleHomePath();
+ File gradleHomePath = new File(enteredPath);
+ if (isValidGradleHome(gradleHomePath)) {
+ chooseGradleHomeDialog.storeLastUsedGradleHome();
+ return gradleHomePath;
+ }
+ }
+
+ return null;
+ }
+
+ @Nullable
+ private static File findGradleHome(@NotNull Project project) {
+ GradleExecutionSettings settings = getGradleExecutionSettings(project);
+ if (settings != null) {
+ String gradleHome = settings.getGradleHome();
+ if (!Strings.isNullOrEmpty(gradleHome)) {
+ File path = new File(gradleHome);
+ if (isValidGradleHome(path)) {
+ return path;
+ }
+ }
+ }
+
+ File wrapperPropertiesFile = findWrapperPropertiesFile(project);
+ if (wrapperPropertiesFile != null) {
+ WrapperExecutor wrapperExecutor = WrapperExecutor.forWrapperPropertiesFile(wrapperPropertiesFile, new StringBuilder());
+ WrapperConfiguration configuration = wrapperExecutor.getConfiguration();
+ File gradleHome = getGradleHome(project, configuration);
+ if (gradleHome != null) {
+ return gradleHome;
+ }
+ }
+
+ return null;
+ }
+
+ @Nullable
+ private static File getGradleHome(@NotNull Project project, @NotNull WrapperConfiguration configuration) {
+ File systemHomePath = StartParameter.DEFAULT_GRADLE_USER_HOME;
+ if ("PROJECT".equals(configuration.getDistributionBase())) {
+ systemHomePath = new File(project.getBasePath(), SdkConstants.DOT_GRADLE);
+ }
+ if (!systemHomePath.isDirectory()) {
+ return null;
+ }
+ PathAssembler.LocalDistribution localDistribution = new PathAssembler(systemHomePath).getDistribution(configuration);
+ File distributionPath = localDistribution.getDistributionDir();
+ if (distributionPath != null) {
+ File[] children = FileUtil.notNullize(distributionPath.listFiles());
+ for (File child : children) {
+ if (child.isDirectory() && child.getName().startsWith("gradle-") && isValidGradleHome(child)) {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static boolean isValidGradleHome(@NotNull File path) {
+ return path.isDirectory() && ServiceManager.getService(GradleInstallationManager.class).isGradleSdkHome(path);
}
/**
@@ -705,6 +817,72 @@
return null;
}
+ /**
+ * Delegates to the {@link #forPluginDefinition(String, String, Function)} and just returns target plugin's definition string (unquoted).
+ *
+ * @param fileContents target gradle config text
+ * @param pluginName target plugin's name in a form <code>'group-id:artifact-id:'</code>
+ * @return target plugin's definition string if found (unquoted); <code>null</code> otherwise
+ * @see #forPluginDefinition(String, String, Function)
+ */
+ @Nullable
+ public static String getPluginDefinitionString(@NotNull String fileContents, @NotNull String pluginName) {
+ return forPluginDefinition(fileContents, pluginName, new Function<Pair<String, GroovyLexer>, String>() {
+ @Override
+ public String fun(Pair<String, GroovyLexer> pair) {
+ return pair.getFirst();
+ }
+ });
+ }
+
+ /**
+ * Checks given file contents (assuming that it's build.gradle config) and finds target plugin's definition (given the plugin
+ * name in a form <code>'group-id:artifact-id:'</code>. Supplies given callback with the plugin definition string (unquoted) and
+ * a {@link GroovyLexer} which state points to the plugin definition string (quoted).
+ * <p/>
+ * Example:
+ * <pre>
+ * buildscript {
+ * repositories {
+ * mavenCentral()
+ * }
+ * dependencies {
+ * classpath 'com.google.appengine:gradle-appengine-plugin:1.9.4'
+ * }
+ * }
+ * </pre>
+ * Suppose that this method is called for the given build script content and
+ * <code>'com.google.appengine:gradle-appengine-plugin:'</code> as a plugin name argument. Given callback is supplied by a
+ * string <code>'com.google.appengine:gradle-appengine-plugin:1.9.4'</code> (without quotes) and a {@link GroovyLexer} which
+ * {@link GroovyLexer#getTokenStart() points} to the string <code>'com.google.appengine:gradle-appengine-plugin:1.9.4'</code>
+ * (with quotes), i.e. we can get exact text range for the target string in case we need to do something like replacing plugin's
+ * version.
+ *
+ * @param fileContents target gradle config text
+ * @param pluginName target plugin's name in a form <code>'group-id:artifact-id:'</code>
+ * @param consumer a callback to be notified for the target plugin's definition string
+ * @param <T> given callback's return type
+ * @return given callback's call result if target plugin definition is found; <code>null</code> otherwise
+ */
+ @Nullable
+ public static <T> T forPluginDefinition(@NotNull String fileContents,
+ @NotNull String pluginName,
+ @NotNull Function<Pair<String, GroovyLexer>, T> consumer) {
+ GroovyLexer lexer = new GroovyLexer();
+ lexer.start(fileContents);
+ while (lexer.getTokenType() != null) {
+ IElementType type = lexer.getTokenType();
+ if (type == GroovyTokenTypes.mSTRING_LITERAL) {
+ String text = StringUtil.unquoteString(lexer.getTokenText());
+ if (text.startsWith(pluginName)) {
+ return consumer.fun(Pair.create(text, lexer));
+ }
+ }
+ lexer.advance();
+ }
+ return null;
+ }
+
@Nullable
private static String getAndroidGradleModelVersion(@NotNull GradleCoordinate coordinate, @Nullable Project project) {
String revision = coordinate.getFullRevision();
diff --git a/android/src/com/android/tools/idea/gradle/util/Projects.java b/android/src/com/android/tools/idea/gradle/util/Projects.java
index 8afcda1..377dc12 100644
--- a/android/src/com/android/tools/idea/gradle/util/Projects.java
+++ b/android/src/com/android/tools/idea/gradle/util/Projects.java
@@ -22,11 +22,10 @@
import com.android.tools.idea.gradle.facet.JavaGradleFacet;
import com.android.tools.idea.gradle.messages.ProjectSyncMessages;
import com.android.tools.idea.startup.AndroidStudioSpecificInitializer;
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
-import com.intellij.compiler.options.ExternalBuildOptionListener;
import com.intellij.ide.DataManager;
import com.intellij.ide.impl.ProjectUtil;
import com.intellij.ide.projectView.ProjectView;
+import com.intellij.ide.projectView.impl.AbstractProjectViewPane;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.diagnostic.Logger;
@@ -42,7 +41,6 @@
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.IdeFrameEx;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
-import com.intellij.util.messages.MessageBus;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -191,17 +189,6 @@
if (!AndroidStudioSpecificInitializer.isAndroidStudio()) {
AndroidGradleBuildConfiguration.getInstance(project).USE_EXPERIMENTAL_FASTER_BUILD = false;
}
-
- CompilerWorkspaceConfiguration workspaceConfiguration = CompilerWorkspaceConfiguration.getInstance(project);
- boolean wasUsingExternalMake = workspaceConfiguration.useOutOfProcessBuild();
- if (!wasUsingExternalMake) {
- String format = "Enabled 'External Build' for Android project '%1$s'. Otherwise, the project will not be built with Gradle";
- String msg = String.format(format, project.getName());
- LOG.info(msg);
- workspaceConfiguration.USE_OUT_OF_PROCESS_BUILD = true;
- MessageBus messageBus = project.getMessageBus();
- messageBus.syncPublisher(ExternalBuildOptionListener.TOPIC).externalBuildOptionChanged(true);
- }
}
}
@@ -218,8 +205,15 @@
public static Module[] getModulesToBuildFromSelection(@NotNull Project project, @Nullable DataContext dataContext) {
if (dataContext == null) {
ProjectView projectView = ProjectView.getInstance(project);
- JComponent treeComponent = projectView.getCurrentProjectViewPane().getComponentToFocus();
- dataContext = DataManager.getInstance().getDataContext(treeComponent);
+ final AbstractProjectViewPane pane = projectView.getCurrentProjectViewPane();
+
+ if (pane != null) {
+ JComponent treeComponent = pane.getComponentToFocus();
+ dataContext = DataManager.getInstance().getDataContext(treeComponent);
+ }
+ else {
+ return NO_MODULES;
+ }
}
Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext);
if (modules != null) {
diff --git a/android/src/com/android/tools/idea/gradle/variant/view/BuildVariantToolWindowFactory.java b/android/src/com/android/tools/idea/gradle/variant/view/BuildVariantToolWindowFactory.java
index c555dca..37654b1 100644
--- a/android/src/com/android/tools/idea/gradle/variant/view/BuildVariantToolWindowFactory.java
+++ b/android/src/com/android/tools/idea/gradle/variant/view/BuildVariantToolWindowFactory.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
+import org.jetbrains.annotations.NotNull;
/**
* Creates the contents of the "Build Variants" tool window.
@@ -27,7 +28,7 @@
public static final String ID = "Build Variants";
@Override
- public void createToolWindowContent(Project project, ToolWindow toolWindow) {
+ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
BuildVariantView.getInstance(project).createToolWindowContent(toolWindow);
}
}
diff --git a/android/src/com/android/tools/idea/memory/MemoryMonitorAction.java b/android/src/com/android/tools/idea/memory/MemoryMonitorAction.java
index a4016c1..7d7830c 100644
--- a/android/src/com/android/tools/idea/memory/MemoryMonitorAction.java
+++ b/android/src/com/android/tools/idea/memory/MemoryMonitorAction.java
@@ -15,12 +15,15 @@
*/
package com.android.tools.idea.memory;
+import com.intellij.facet.ProjectFacetManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowManager;
+import org.jetbrains.android.facet.AndroidFacet;
+import org.jetbrains.annotations.NotNull;
public class MemoryMonitorAction extends AnAction {
@@ -29,12 +32,21 @@
}
@Override
+ public void update(@NotNull AnActionEvent e) {
+ final Project project = e.getProject();
+ e.getPresentation().setEnabledAndVisible(
+ project != null && !ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).isEmpty());
+ }
+
+ @Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (project != null) {
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow toolWindow = toolWindowManager.getToolWindow(MemoryMonitorToolWindowFactory.ID);
- toolWindow.show(null);
+ if (toolWindow != null) {
+ toolWindow.show(null);
+ }
}
}
}
diff --git a/android/src/com/android/tools/idea/rendering/AarResourceClassGenerator.java b/android/src/com/android/tools/idea/rendering/AarResourceClassGenerator.java
index 3e03c76..62dbd39 100644
--- a/android/src/com/android/tools/idea/rendering/AarResourceClassGenerator.java
+++ b/android/src/com/android/tools/idea/rendering/AarResourceClassGenerator.java
@@ -24,14 +24,14 @@
import org.jetbrains.android.util.AndroidResourceUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.asm4.ClassWriter;
-import org.jetbrains.asm4.MethodVisitor;
+import org.jetbrains.org.objectweb.asm.ClassWriter;
+import org.jetbrains.org.objectweb.asm.MethodVisitor;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import static org.jetbrains.asm4.Opcodes.*;
+import static org.jetbrains.org.objectweb.asm.Opcodes.*;
/**
* The {@linkplain AarResourceClassGenerator} can generate R classes on the fly for a given resource repository.
@@ -204,7 +204,7 @@
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+ mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
mv.visitInsn(RETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
diff --git a/android/src/com/android/tools/idea/rendering/ClassConverter.java b/android/src/com/android/tools/idea/rendering/ClassConverter.java
index b50f808..8ed21b1 100644
--- a/android/src/com/android/tools/idea/rendering/ClassConverter.java
+++ b/android/src/com/android/tools/idea/rendering/ClassConverter.java
@@ -19,10 +19,10 @@
import com.google.common.primitives.Shorts;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.asm4.ClassReader;
-import org.jetbrains.asm4.ClassVisitor;
-import org.jetbrains.asm4.ClassWriter;
-import org.jetbrains.asm4.Opcodes;
+import org.jetbrains.org.objectweb.asm.ClassReader;
+import org.jetbrains.org.objectweb.asm.ClassVisitor;
+import org.jetbrains.org.objectweb.asm.ClassWriter;
+import org.jetbrains.org.objectweb.asm.Opcodes;
import java.util.Collection;
@@ -53,7 +53,7 @@
assert maxVersion >= minVersion;
ClassWriter classWriter = new ClassWriter(0);
- ClassVisitor classVisitor = new ClassVisitor(Opcodes.ASM4, classWriter) {
+ ClassVisitor classVisitor = new ClassVisitor(Opcodes.ASM5, classWriter) {
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
if (version > maxVersion) {
diff --git a/android/src/com/android/tools/idea/rendering/GutterIconCache.java b/android/src/com/android/tools/idea/rendering/GutterIconCache.java
index 9efef0b..7710531 100644
--- a/android/src/com/android/tools/idea/rendering/GutterIconCache.java
+++ b/android/src/com/android/tools/idea/rendering/GutterIconCache.java
@@ -17,6 +17,7 @@
import com.google.common.collect.Maps;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.ui.Gray;
import com.intellij.util.RetinaImage;
import com.intellij.util.ui.UIUtil;
import icons.AndroidIcons;
@@ -111,7 +112,7 @@
BufferedImage bg = UIUtil.createImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_ARGB);
Graphics g = bg.getGraphics();
//noinspection UseJBColor
- g.setColor(new Color(255, 255, 255, 0));
+ g.setColor(Gray.TRANSPARENT);
g.fillRect(0, 0, bg.getWidth(), bg.getHeight());
//noinspection ConstantConditions
UIUtil.drawImage(g, image, 0, 0, null);
diff --git a/android/src/com/android/tools/idea/rendering/IncludeReference.java b/android/src/com/android/tools/idea/rendering/IncludeReference.java
index 9c84f99..fdee2c9 100644
--- a/android/src/com/android/tools/idea/rendering/IncludeReference.java
+++ b/android/src/com/android/tools/idea/rendering/IncludeReference.java
@@ -135,7 +135,7 @@
// consider prepending layout/ on ids that don't have it (to make the display
// more uniform) or ripping out all layout[-constraint] prefixes out and
// instead prepending @ etc.
- if (myToFile != null && myToFile.getParent() == myFromFile.getParent()) {
+ if (myToFile != null && myToFile.getParent() != null && myToFile.getParent().equals(myFromFile.getParent())) {
return myFromFile.getName();
}
diff --git a/android/src/com/android/tools/idea/rendering/RenderService.java b/android/src/com/android/tools/idea/rendering/RenderService.java
index 3448f0d..57155f8 100644
--- a/android/src/com/android/tools/idea/rendering/RenderService.java
+++ b/android/src/com/android/tools/idea/rendering/RenderService.java
@@ -52,6 +52,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModuleRootManager;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Computable;
@@ -725,7 +726,7 @@
myIncludedWithin = layout != null ? IncludeReference.get(myModule, myPsiFile, resolver) : IncludeReference.NONE;
}
if (myIncludedWithin != IncludeReference.NONE) {
- assert myIncludedWithin.getToFile() == myPsiFile.getVirtualFile();
+ assert Comparing.equal(myIncludedWithin.getToFile(), myPsiFile.getVirtualFile());
// TODO: Validate that we're really including the same layout here!
//ResourceValue contextLayout = resolver.findResValue(myIncludedWithin.getFromResourceUrl(), false /* forceFrameworkOnly*/);
//if (contextLayout != null) {
diff --git a/android/src/com/android/tools/idea/rendering/ResourceFolderRepository.java b/android/src/com/android/tools/idea/rendering/ResourceFolderRepository.java
index 9e3938a..da0e395 100644
--- a/android/src/com/android/tools/idea/rendering/ResourceFolderRepository.java
+++ b/android/src/com/android/tools/idea/rendering/ResourceFolderRepository.java
@@ -377,7 +377,7 @@
PsiDirectory parentDirectory = directory.getParentDirectory();
if (parentDirectory != null) {
VirtualFile dir = parentDirectory.getVirtualFile();
- return dir == myResourceDir;
+ return dir.equals(myResourceDir);
}
}
return false;
diff --git a/android/src/com/android/tools/idea/rendering/multi/RenderPreview.java b/android/src/com/android/tools/idea/rendering/multi/RenderPreview.java
index 414bd44..0c85ac6 100644
--- a/android/src/com/android/tools/idea/rendering/multi/RenderPreview.java
+++ b/android/src/com/android/tools/idea/rendering/multi/RenderPreview.java
@@ -37,7 +37,7 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.Couple;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
@@ -993,10 +993,10 @@
}
final int xf = x + 5;
final int yf = y + HEADER_HEIGHT + fontBaseline;
- painter.draw(gc, new PairFunction<Integer, Integer, Pair<Integer, Integer>>() {
+ painter.draw(gc, new PairFunction<Integer, Integer, Couple<Integer>>() {
@Override
- public Pair<Integer, Integer> fun(Integer width, Integer height) {
- return Pair.create(xf, yf);
+ public Couple<Integer> fun(Integer width, Integer height) {
+ return Couple.of(xf, yf);
}
});
gc.setClip(prevClip);
diff --git a/android/src/com/android/tools/idea/rendering/multi/RenderPreviewManager.java b/android/src/com/android/tools/idea/rendering/multi/RenderPreviewManager.java
index e6fe390..18d3a53 100755
--- a/android/src/com/android/tools/idea/rendering/multi/RenderPreviewManager.java
+++ b/android/src/com/android/tools/idea/rendering/multi/RenderPreviewManager.java
@@ -43,6 +43,7 @@
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.xml.XmlFile;
@@ -1305,7 +1306,7 @@
* Updates the configuration preview thumbnails
*/
public void renderPreviews() {
- if (myRenderContext.getVirtualFile() != myCurrentFile) {
+ if (!Comparing.equal(myRenderContext.getVirtualFile(), myCurrentFile)) {
recomputePreviews(true);
return;
}
diff --git a/android/src/com/android/tools/idea/sdk/DefaultSdks.java b/android/src/com/android/tools/idea/sdk/DefaultSdks.java
index c67a3bd..dc1024e 100644
--- a/android/src/com/android/tools/idea/sdk/DefaultSdks.java
+++ b/android/src/com/android/tools/idea/sdk/DefaultSdks.java
@@ -144,8 +144,9 @@
public static void setDefaultJavaHome(@NotNull File path) {
if (JavaSdk.checkForJdk(path)) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
-
File canonicalPath = resolvePath(path);
+ Sdk chosenJdk = null;
+
if (AndroidStudioSpecificInitializer.isAndroidStudio()) {
// Delete all JDKs in Android Studio. We want to have only one.
List<Sdk> jdks = ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance());
@@ -153,24 +154,35 @@
ProjectJdkTable.getInstance().removeJdk(jdk);
}
}
-
- VirtualFile virtualPath = VfsUtil.findFileByIoFile(canonicalPath, true);
- if (virtualPath != null) {
- Sdk newJdk = createJdk(virtualPath);
- if (newJdk == null) {
- // Unlikely to happen
- throw new IllegalStateException("Failed to create IDEA JDK from '" + path.getPath() + "'");
- }
- updateAllSdks(newJdk);
-
- ProjectManager projectManager = ApplicationManager.getApplication().getComponent(ProjectManager.class);
- Project[] openProjects = projectManager.getOpenProjects();
- for (Project project : openProjects) {
- NewProjectUtil.applyJdkToProject(project, newJdk);
+ else {
+ for (Sdk jdk : ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance())) {
+ if (FileUtil.pathsEqual(jdk.getHomePath(), canonicalPath.getPath())) {
+ chosenJdk = jdk;
+ break;
+ }
}
}
- else {
- throw new IllegalStateException("The resolved path '" + canonicalPath.getPath() + "' was not found");
+
+ if (chosenJdk == null) {
+ VirtualFile virtualPath = VfsUtil.findFileByIoFile(canonicalPath, true);
+ if (virtualPath != null) {
+ chosenJdk = createJdk(virtualPath);
+ if (chosenJdk == null) {
+ // Unlikely to happen
+ throw new IllegalStateException("Failed to create IDEA JDK from '" + path.getPath() + "'");
+ }
+ }
+ else {
+ throw new IllegalStateException("The resolved path '" + canonicalPath.getPath() + "' was not found");
+ }
+ }
+
+ updateAllSdks(chosenJdk);
+
+ ProjectManager projectManager = ApplicationManager.getApplication().getComponent(ProjectManager.class);
+ Project[] openProjects = projectManager.getOpenProjects();
+ for (Project project : openProjects) {
+ NewProjectUtil.applyJdkToProject(project, chosenJdk);
}
}
}
diff --git a/android/src/com/android/tools/idea/sdk/wizard/SmwOldApiDirectInstall.java b/android/src/com/android/tools/idea/sdk/wizard/SmwOldApiDirectInstall.java
index 9ac5641..a5f80c6 100755
--- a/android/src/com/android/tools/idea/sdk/wizard/SmwOldApiDirectInstall.java
+++ b/android/src/com/android/tools/idea/sdk/wizard/SmwOldApiDirectInstall.java
@@ -36,6 +36,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.JBColor;
import com.intellij.ui.components.JBLabel;
+import com.intellij.util.TimeoutUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.android.sdk.AndroidSdkData;
import org.jetbrains.android.sdk.AndroidSdkUtils;
@@ -224,12 +225,7 @@
true); // includeDependencies
while (myBackgroundSuccess == null) {
- try {
- Thread.sleep(100);
- }
- catch (InterruptedException e) {
- // Pass
- }
+ TimeoutUtil.sleep(100);
}
UIUtil.invokeLaterIfNeeded(new Runnable() {
diff --git a/android/src/com/android/tools/idea/startup/AndroidCodeStyleSettingsModifier.java b/android/src/com/android/tools/idea/startup/AndroidCodeStyleSettingsModifier.java
index db7fd3b..5835fd5 100644
--- a/android/src/com/android/tools/idea/startup/AndroidCodeStyleSettingsModifier.java
+++ b/android/src/com/android/tools/idea/startup/AndroidCodeStyleSettingsModifier.java
@@ -42,7 +42,7 @@
settings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND = 99; // Name count to use static import with "*"
// set margin to 100 columns
- settings.RIGHT_MARGIN = 100;
+ settings.setDefaultRightMargin(100);
}
private static PackageEntryTable getAndroidImportOrder() {
diff --git a/android/src/com/android/tools/idea/startup/AndroidStudioSpecificInitializer.java b/android/src/com/android/tools/idea/startup/AndroidStudioSpecificInitializer.java
index 6d82ff1..1a61383 100755
--- a/android/src/com/android/tools/idea/startup/AndroidStudioSpecificInitializer.java
+++ b/android/src/com/android/tools/idea/startup/AndroidStudioSpecificInitializer.java
@@ -80,19 +80,11 @@
/** Initialization performed only in the context of the Android IDE. */
public class AndroidStudioSpecificInitializer implements Runnable {
- private static final Logger LOG = Logger.getInstance("#com.android.tools.idea.startup.AndroidStudioSpecificInitializer");
-
- private static final List<String> IDE_SETTINGS_TO_REMOVE = Lists.newArrayList(
- "org.jetbrains.plugins.javaFX.JavaFxSettingsConfigurable", "org.intellij.plugins.xpathView.XPathConfigurable",
- "org.intellij.lang.xpath.xslt.impl.XsltConfigImpl$UIImpl"
- );
-
/**
* We set the timeout for Gradle daemons to -1, this way IDEA will not set it to 1 minute and it will use the default instead (3 hours.)
* We need to keep Gradle daemons around as much as possible because creating new daemons is resource-consuming and slows down the IDE.
*/
public static final int GRADLE_DAEMON_TIMEOUT_MS = -1;
-
static {
System.setProperty("external.system.remote.process.idle.ttl.ms", String.valueOf(GRADLE_DAEMON_TIMEOUT_MS));
@@ -101,7 +93,11 @@
System.setProperty("gradle.disable.enhanced.tooling.api", "true");
}
}
-
+ private static final Logger LOG = Logger.getInstance("#com.android.tools.idea.startup.AndroidStudioSpecificInitializer");
+ private static final List<String> IDE_SETTINGS_TO_REMOVE = Lists.newArrayList(
+ "org.jetbrains.plugins.javaFX.JavaFxSettingsConfigurable", "org.intellij.plugins.xpathView.XPathConfigurable",
+ "org.intellij.lang.xpath.xslt.impl.XsltConfigImpl$UIImpl"
+ );
@NonNls private static final String USE_IDEA_NEW_PROJECT_WIZARDS = "use.idea.newProjectWizard";
@NonNls private static final String USE_JPS_MAKE_ACTIONS = "use.idea.jpsMakeActions";
@NonNls private static final String USE_IDEA_NEW_FILE_POPUPS = "use.idea.newFilePopupActions";
@@ -118,59 +114,6 @@
return "AndroidStudio".equals(PlatformUtils.getPlatformPrefix());
}
- @Override
- public void run() {
- checkInstallation();
- cleanUpIdePreferences();
-
- if (!Boolean.getBoolean(USE_IDEA_NEW_PROJECT_WIZARDS)) {
- replaceIdeaNewProjectActions();
- }
-
- if (!Boolean.getBoolean(USE_IDEA_PROJECT_STRUCTURE)) {
- replaceProjectStructureActions();
- }
-
- if (!Boolean.getBoolean(USE_JPS_MAKE_ACTIONS)) {
- replaceIdeaMakeActions();
- }
-
- if (!Boolean.getBoolean(USE_IDEA_NEW_FILE_POPUPS)) {
- hideIdeaNewFilePopupActions();
- }
-
- try {
- // Setup JDK and Android SDK if necessary
- setupSdks();
- } catch (Exception e) {
- LOG.error("Unexpected error while setting up SDKs: ", e);
- }
-
- registerAppClosing();
-
- // Always reset the Default scheme to match Android standards
- // User modifications won't be lost since they are made in a separate scheme (copied off of this default scheme)
- CodeStyleScheme scheme = CodeStyleSchemes.getInstance().getDefaultScheme();
- if (scheme != null) {
- CodeStyleSettings settings = scheme.getCodeStyleSettings();
- if (settings != null) {
- AndroidCodeStyleSettingsModifier.modify(settings);
- }
- }
-
- // Modify built-in "Default" color scheme to remove background from XML tags.
- // "Darcula" and user schemes will not be touched.
- EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME);
- TextAttributes textAttributes = colorsScheme.getAttributes(HighlighterColors.TEXT);
- TextAttributes xmlTagAttributes = colorsScheme.getAttributes(XmlHighlighterColors.XML_TAG);
- xmlTagAttributes.setBackgroundColor(textAttributes.getBackgroundColor());
-
- NodeRendererSettings.getInstance().addPluginRenderer(new ArrayMapRenderer("android.util.ArrayMap"));
- NodeRendererSettings.getInstance().addPluginRenderer(new ArrayMapRenderer("android.support.v4.util.ArrayMap"));
-
- checkAndSetAndroidSdkSources();
- }
-
private static void checkInstallation() {
String studioHome = PathManager.getHomePath();
if (StringUtil.isEmpty(studioHome)) {
@@ -275,8 +218,6 @@
}
private static void replaceProjectStructureActions() {
- replaceAction("ShowProjectStructureSettings", new AndroidShowStructureSettingsAction());
-
AndroidTemplateProjectStructureAction showDefaultProjectStructureAction = new AndroidTemplateProjectStructureAction();
showDefaultProjectStructureAction.getTemplatePresentation().setText("Default Project Structure...");
replaceAction("TemplateProjectStructure", showDefaultProjectStructureAction);
@@ -535,7 +476,12 @@
connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
@Override
public void appClosing() {
- GradleUtil.stopAllGradleDaemons();
+ try {
+ GradleUtil.stopAllGradleDaemons(false);
+ }
+ catch (IOException e) {
+ LOG.info("Failed to stop Gradle daemons", e);
+ }
}
});
}
@@ -564,4 +510,57 @@
}
}
}
+
+ @Override
+ public void run() {
+ checkInstallation();
+ cleanUpIdePreferences();
+
+ if (!Boolean.getBoolean(USE_IDEA_NEW_PROJECT_WIZARDS)) {
+ replaceIdeaNewProjectActions();
+ }
+
+ if (!Boolean.getBoolean(USE_IDEA_PROJECT_STRUCTURE)) {
+ replaceProjectStructureActions();
+ }
+
+ if (!Boolean.getBoolean(USE_JPS_MAKE_ACTIONS)) {
+ replaceIdeaMakeActions();
+ }
+
+ if (!Boolean.getBoolean(USE_IDEA_NEW_FILE_POPUPS)) {
+ hideIdeaNewFilePopupActions();
+ }
+
+ try {
+ // Setup JDK and Android SDK if necessary
+ setupSdks();
+ } catch (Exception e) {
+ LOG.error("Unexpected error while setting up SDKs: ", e);
+ }
+
+ registerAppClosing();
+
+ // Always reset the Default scheme to match Android standards
+ // User modifications won't be lost since they are made in a separate scheme (copied off of this default scheme)
+ CodeStyleScheme scheme = CodeStyleSchemes.getInstance().getDefaultScheme();
+ if (scheme != null) {
+ CodeStyleSettings settings = scheme.getCodeStyleSettings();
+ if (settings != null) {
+ AndroidCodeStyleSettingsModifier.modify(settings);
+ }
+ }
+
+ // Modify built-in "Default" color scheme to remove background from XML tags.
+ // "Darcula" and user schemes will not be touched.
+ EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME);
+ TextAttributes textAttributes = colorsScheme.getAttributes(HighlighterColors.TEXT);
+ TextAttributes xmlTagAttributes = colorsScheme.getAttributes(XmlHighlighterColors.XML_TAG);
+ xmlTagAttributes.setBackgroundColor(textAttributes.getBackgroundColor());
+
+ NodeRendererSettings.getInstance().addPluginRenderer(new ArrayMapRenderer("android.util.ArrayMap"));
+ NodeRendererSettings.getInstance().addPluginRenderer(new ArrayMapRenderer("android.support.v4.util.ArrayMap"));
+
+ checkAndSetAndroidSdkSources();
+ }
}
diff --git a/android/src/com/android/tools/idea/startup/ExternalAnnotationsSupport.java b/android/src/com/android/tools/idea/startup/ExternalAnnotationsSupport.java
index b2ebb1d..b40fcb7 100644
--- a/android/src/com/android/tools/idea/startup/ExternalAnnotationsSupport.java
+++ b/android/src/com/android/tools/idea/startup/ExternalAnnotationsSupport.java
@@ -46,6 +46,11 @@
@SuppressWarnings("SpellCheckingInspection") // "Modificator" in API usage
public class ExternalAnnotationsSupport {
private static final Logger LOG = Logger.getInstance(ExternalAnnotationsSupport.class);
+ private static final String[] DEVELOPMENT_ANNOTATIONS_PATHS = {
+ "/../adt/idea/android/annotations",
+ "/android/android/annotations",
+ "/community/android/android/annotations"
+ };
// Based on similar code in MagicConstantInspection
@SuppressWarnings("ALL")
@@ -125,16 +130,12 @@
// release build?
String releaseLocation = homePath + "/plugins/android/lib/androidAnnotations.jar";
VirtualFile root = fileManager.findFileByUrl("jar://" + releaseLocation + "!/");
- if (root == null) {
- // development
- String developmentLocation = homePath + "/../adt/idea/android/annotations";
+
+ for (String relativePath : DEVELOPMENT_ANNOTATIONS_PATHS) {
+ if (root != null) break;
+ String developmentLocation = homePath + relativePath;
root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(developmentLocation));
}
- if (root == null) {
- // development
- String jetbrainsDevelopmentLocation = homePath + "/android/android/annotations";
- root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(jetbrainsDevelopmentLocation));
- }
if (root == null) {
// error message tailored for release build file layout
diff --git a/android/src/com/android/tools/idea/stats/StudioBuildStatsPersistenceComponent.java b/android/src/com/android/tools/idea/stats/StudioBuildStatsPersistenceComponent.java
index 607b3cf..210a315 100755
--- a/android/src/com/android/tools/idea/stats/StudioBuildStatsPersistenceComponent.java
+++ b/android/src/com/android/tools/idea/stats/StudioBuildStatsPersistenceComponent.java
@@ -48,11 +48,10 @@
*/
@State(
name = "StudioBuildStatistic",
- roamingType = RoamingType.DISABLED,
storages = {
- @Storage(
- file = StoragePathMacros.APP_CONFIG + "/studio.build.statistics.xml"
- )})
+ @Storage(file = StoragePathMacros.APP_CONFIG + "/studio.build.statistics.xml", roamingType = RoamingType.DISABLED)
+ }
+)
public class StudioBuildStatsPersistenceComponent
implements ApplicationComponent, PersistentStateComponent<Element> {
diff --git a/android/src/com/android/tools/idea/templates/Template.java b/android/src/com/android/tools/idea/templates/Template.java
index 02d4352..b6f081f 100755
--- a/android/src/com/android/tools/idea/templates/Template.java
+++ b/android/src/com/android/tools/idea/templates/Template.java
@@ -45,6 +45,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileFactory;
@@ -955,7 +956,7 @@
project = ProjectManagerEx.getInstanceEx().getDefaultProject();
}
FileType type = FileTypeRegistry.getInstance().getFileTypeByFileName(to.getName());
- PsiFile file = PsiFileFactory.getInstance(project).createFileFromText(to.getName(), type, contents);
+ PsiFile file = PsiFileFactory.getInstance(project).createFileFromText(to.getName(), type, StringUtil.convertLineSeparators(contents));
CodeStyleManager.getInstance(project).reformat(file);
return file.getText();
}
diff --git a/android/src/com/android/tools/idea/templates/TemplateManager.java b/android/src/com/android/tools/idea/templates/TemplateManager.java
index 03f5022..5c0ea05 100644
--- a/android/src/com/android/tools/idea/templates/TemplateManager.java
+++ b/android/src/com/android/tools/idea/templates/TemplateManager.java
@@ -22,6 +22,7 @@
import com.google.common.collect.*;
import com.google.common.io.Files;
import com.intellij.ide.actions.NonEmptyActionGroup;
+import com.intellij.ide.IdeView;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -60,7 +61,7 @@
* templates with the application instead of waiting for SDK updates.
*/
private static final String BUNDLED_TEMPLATE_PATH = "/plugins/android/lib/templates";
- private static final String[] DEVELOPMENT_TEMPLATE_PATHS = {"/../../tools/base/templates", "/android/tools-base/templates"};
+ private static final String[] DEVELOPMENT_TEMPLATE_PATHS = {"/../../tools/base/templates", "/android/tools-base/templates", "/community/android/tools-base/templates"};
private static final String EXPLODED_AAR_PATH = "build/intermediates/exploded-aar";
public static final String CATEGORY_OTHER = "Other";
@@ -412,12 +413,13 @@
NonEmptyActionGroup categoryGroup = new NonEmptyActionGroup() {
@Override
public void update(AnActionEvent e) {
+ IdeView view = LangDataKeys.IDE_VIEW.getData(e.getDataContext());
final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
final AndroidFacet facet = module != null ? AndroidFacet.getInstance(module) : null;
Presentation presentation = e.getPresentation();
boolean isProjectReady = facet != null && facet.getIdeaAndroidProject() != null;
presentation.setText(category + (isProjectReady ? "" : " (Project not ready)"));
- presentation.setVisible(getChildrenCount() > 0 && facet != null && facet.isGradleProject());
+ presentation.setVisible(getChildrenCount() > 0 && view != null && facet != null && facet.isGradleProject());
}
};
categoryGroup.setPopup(true);
@@ -480,8 +482,8 @@
if (newMetadata != null) {
String title = newMetadata.getTitle();
if (title == null || (newMetadata.getCategory() == null &&
- myCategoryTable.columnKeySet().contains(title) &&
- myCategoryTable.get(CATEGORY_OTHER, title) == null)) {
+ myCategoryTable.columnKeySet().contains(title) &&
+ myCategoryTable.get(CATEGORY_OTHER, title) == null)) {
// If this template is uncategorized, and we already have a template of this name that has a category,
// that is NOT "Other," then ignore this new template since it's undoubtedly older.
return;
diff --git a/android/src/com/android/tools/idea/wizard/ConfigureAndroidModuleStep.java b/android/src/com/android/tools/idea/wizard/ConfigureAndroidModuleStep.java
index 8b0e54b..e6f649b 100755
--- a/android/src/com/android/tools/idea/wizard/ConfigureAndroidModuleStep.java
+++ b/android/src/com/android/tools/idea/wizard/ConfigureAndroidModuleStep.java
@@ -150,19 +150,15 @@
}
}
if (highest != null) {
- myTemplateState.put(ATTR_BUILD_API, highest.getFeatureLevel());
+ myTemplateState.put(ATTR_BUILD_API, getItemId(highest));
myTemplateState.put(ATTR_BUILD_API_STRING, getBuildApiString(highest));
myTemplateState.myModified.add(ATTR_TARGET_API);
myTemplateState.myModified.add(ATTR_TARGET_API_STRING);
- myTemplateState.put(ATTR_TARGET_API, highest.getFeatureLevel());
+ myTemplateState.put(ATTR_TARGET_API, getItemId(highest));
myTemplateState.put(ATTR_TARGET_API_STRING, getBuildApiString(highest));
myTemplateState.myModified.add(ATTR_BUILD_API);
myTemplateState.myModified.add(ATTR_BUILD_API_STRING);
- if (highest.getFeatureLevel() >= SdkVersionInfo.HIGHEST_KNOWN_API) {
- myTemplateState.put(ATTR_TARGET_API, highest.getFeatureLevel());
- myTemplateState.put(ATTR_TARGET_API_STRING, highest.getApiString());
- }
}
// If using KitKat platform tools, we can support language level
@@ -811,6 +807,16 @@
}
}
+ private static Object getItemId(@NotNull AndroidVersion version) {
+ if (version.isPreview()) {
+ String codename = version.getCodename();
+ assert codename != null; // because isPreview()
+ return codename;
+ } else {
+ return version.getFeatureLevel();
+ }
+ }
+
public static class SourceLevelComboBoxItem extends ComboBoxItem {
public final LanguageLevel level;
@@ -840,20 +846,15 @@
apiLevel = target.getVersion().getFeatureLevel();
}
- @NotNull
- private static Object getId(@NotNull IAndroidTarget target) {
- if (target.getVersion().isPreview()) {
- String codename = target.getVersion().getCodename();
- assert codename != null; // because isPreview()
- return codename;
- } else {
- return target.getVersion().getFeatureLevel();
- }
- }
-
@Override
public String toString() {
return label;
}
+
+ @NotNull
+ private static Object getId(@NotNull IAndroidTarget target) {
+ final AndroidVersion version = target.getVersion();
+ return getItemId(version);
+ }
}
}
diff --git a/android/src/com/android/tools/idea/wizard/GetSdkStep.java b/android/src/com/android/tools/idea/wizard/GetSdkStep.java
index 181718e..61de3eb 100644
--- a/android/src/com/android/tools/idea/wizard/GetSdkStep.java
+++ b/android/src/com/android/tools/idea/wizard/GetSdkStep.java
@@ -225,7 +225,7 @@
}
FileChooserDescriptor chooserDescriptor = AndroidSdkType.getInstance().getHomeChooserDescriptor();
FileChooserDialog chooser = new FileChooserDialogImpl(chooserDescriptor, (Project)null);
- VirtualFile[] files = chooser.choose(currentFile, null);
+ VirtualFile[] files = chooser.choose(null, currentFile);
if (files.length == 0) {
return null;
} else {
diff --git a/android/src/com/android/tools/idea/wizard/ImportWizardModuleBuilder.java b/android/src/com/android/tools/idea/wizard/ImportWizardModuleBuilder.java
index 2033a88..e511cb3 100644
--- a/android/src/com/android/tools/idea/wizard/ImportWizardModuleBuilder.java
+++ b/android/src/com/android/tools/idea/wizard/ImportWizardModuleBuilder.java
@@ -36,6 +36,7 @@
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectType;
import com.intellij.openapi.projectRoots.JavaSdkType;
import com.intellij.openapi.projectRoots.SdkTypeId;
import com.intellij.openapi.roots.ModifiableRootModel;
@@ -43,6 +44,7 @@
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.vfs.VirtualFile;
import icons.AndroidIcons;
+import org.jetbrains.android.newProject.AndroidModuleBuilder;
import org.jetbrains.android.sdk.AndroidSdkType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -56,20 +58,18 @@
import static com.android.SdkConstants.GRADLE_LATEST_VERSION;
import static com.android.SdkConstants.GRADLE_PLUGIN_RECOMMENDED_VERSION;
import static com.android.tools.idea.templates.TemplateMetadata.*;
-import static com.android.tools.idea.wizard.NewModuleWizardState.ATTR_PROJECT_LOCATION;
import static com.android.tools.idea.wizard.FormFactorUtils.ATTR_MODULE_NAME;
+import static com.android.tools.idea.wizard.NewModuleWizardState.ATTR_PROJECT_LOCATION;
public class ImportWizardModuleBuilder extends ModuleBuilder implements TemplateWizardStep.UpdateListener, ChooseTemplateStep.TemplateChangeListener {
- @Nullable private final VirtualFile myImportSource;
@NotNull protected final List<ModuleWizardStep> mySteps;
- @NotNull private final Map<ModuleWizardStep, WizardPath> myStepsToPath = Maps.newHashMap();
-
- @Nullable private Project myProject;
@NotNull protected final Iterable<WizardPath> myPaths;
-
protected final NewModuleWizardState myWizardState;
+ @Nullable private final VirtualFile myImportSource;
+ @NotNull private final Map<ModuleWizardStep, WizardPath> myStepsToPath = Maps.newHashMap();
@VisibleForTesting
protected boolean myInitializationComplete = false;
+ @Nullable private Project myProject;
private ImportSourceModulePath myImportSourcesPath;
public ImportWizardModuleBuilder(@Nullable File templateFile,
@@ -134,10 +134,10 @@
myWizardState.setDefaultWizardPath(getDefaultPath());
if (project != null) {
- myWizardState.put(NewModuleWizardState.ATTR_PROJECT_LOCATION, project.getBasePath());
+ myWizardState.put(ATTR_PROJECT_LOCATION, project.getBasePath());
}
- myWizardState.put(TemplateMetadata.ATTR_GRADLE_VERSION, GRADLE_LATEST_VERSION);
- myWizardState.put(TemplateMetadata.ATTR_GRADLE_PLUGIN_VERSION, GRADLE_PLUGIN_RECOMMENDED_VERSION);
+ myWizardState.put(ATTR_GRADLE_VERSION, GRADLE_LATEST_VERSION);
+ myWizardState.put(ATTR_GRADLE_PLUGIN_VERSION, GRADLE_PLUGIN_RECOMMENDED_VERSION);
update();
myInitializationComplete = true;
@@ -232,7 +232,7 @@
public void run() {
if (myProject == null) {
myWizardState.putSdkDependentParams();
- myWizardState.put(NewModuleWizardState.ATTR_PROJECT_LOCATION, project.getBasePath());
+ myWizardState.put(ATTR_PROJECT_LOCATION, project.getBasePath());
AssetStudioAssetGenerator assetGenerator = new AssetStudioAssetGenerator(myWizardState);
NewProjectWizard.createProject(myWizardState, project, assetGenerator);
}
@@ -255,6 +255,11 @@
}
@Override
+ protected ProjectType getProjectType() {
+ return AndroidModuleBuilder.ANDROID_PROJECT_TYPE;
+ }
+
+ @Override
public Icon getBigIcon() {
return AndroidIcons.Android24;
}
diff --git a/android/src/com/android/tools/idea/wizard/NewAndroidModulePath.java b/android/src/com/android/tools/idea/wizard/NewAndroidModulePath.java
index 35fe933..5edbcbf 100644
--- a/android/src/com/android/tools/idea/wizard/NewAndroidModulePath.java
+++ b/android/src/com/android/tools/idea/wizard/NewAndroidModulePath.java
@@ -26,6 +26,7 @@
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -66,7 +67,8 @@
myAssetSetStep = new AssetSetStep(myWizardState, project, null, sidePanelIcon, builder, null);
Disposer.register(disposable, myAssetSetStep);
myChooseActivityStep =
- new ChooseTemplateStep(myWizardState.getActivityTemplateState(), CATEGORY_ACTIVITIES, project, null, sidePanelIcon, builder, null);
+ new ChooseTemplateStep(myWizardState.getActivityTemplateState(), CATEGORY_ACTIVITIES, project, null, sidePanelIcon, builder, null,
+ ContainerUtil.newHashSet("Android TV Activity"));
myActivityTemplateParameterStep = new TemplateParameterStep(myWizardState.getActivityTemplateState(), project, null, sidePanelIcon, builder);
myJavaModuleTemplateParameterStep = new TemplateParameterStep(myWizardState, project, null, sidePanelIcon, builder);
myAssetSetStep.finalizeAssetType(AssetStudioAssetGenerator.AssetType.LAUNCHER);
diff --git a/android/src/com/intellij/android/designer/AndroidDesignerEditor.java b/android/src/com/intellij/android/designer/AndroidDesignerEditor.java
index adaa209..f77e5a5 100644
--- a/android/src/com/intellij/android/designer/AndroidDesignerEditor.java
+++ b/android/src/com/intellij/android/designer/AndroidDesignerEditor.java
@@ -22,6 +22,7 @@
import com.intellij.designer.designSurface.DesignerEditorPanel;
import com.intellij.designer.inspection.DesignerBackgroundEditorHighlighter;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -39,11 +40,14 @@
@Override
@Nullable
- protected Module findModule(final Project project, final VirtualFile file) {
- Module module = super.findModule(project, file);
+ protected Module findModule(Project project, VirtualFile file) {
+ Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module == null) {
module = AndroidPsiUtils.getModuleSafely(project, file);
}
+ if (module == null) {
+ throw new IllegalArgumentException("No module for file " + file + " in project " + project);
+ }
return module;
}
diff --git a/android/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java b/android/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java
index 992feac..6864853 100644
--- a/android/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java
+++ b/android/src/com/intellij/android/designer/inspection/ErrorAnalyzer.java
@@ -188,7 +188,7 @@
}
}
- return new Pair<RadComponent, String>(result[0], propertyName);
+ return Pair.create(result[0], propertyName);
}
private static Pair<XmlTag, XmlAttribute> extractTag(PsiElement element) {
@@ -207,6 +207,6 @@
element = element.getParent();
}
- return new Pair<XmlTag, XmlAttribute>(tag, attribute);
+ return Pair.create(tag, attribute);
}
}
diff --git a/android/src/com/intellij/android/designer/model/IdManager.java b/android/src/com/intellij/android/designer/model/IdManager.java
index dc24da2..169c1dd 100644
--- a/android/src/com/intellij/android/designer/model/IdManager.java
+++ b/android/src/com/intellij/android/designer/model/IdManager.java
@@ -220,4 +220,4 @@
}
}, true);
}
-}
\ No newline at end of file
+}
diff --git a/android/src/com/intellij/android/designer/model/layout/relative/ResizeHandler.java b/android/src/com/intellij/android/designer/model/layout/relative/ResizeHandler.java
index f498b9f..343d18e 100644
--- a/android/src/com/intellij/android/designer/model/layout/relative/ResizeHandler.java
+++ b/android/src/com/intellij/android/designer/model/layout/relative/ResizeHandler.java
@@ -204,10 +204,10 @@
assert myHorizontalEdgeType == null;
}
- if (myTextDirection.isLeftSegment(myVerticalEdgeType)) {
+ if (myVerticalEdgeType != null && myTextDirection.isLeftSegment(myVerticalEdgeType)) {
vEdge = new Segment(b.x, b.y, y2(b), child, childId, myVerticalEdgeType, NO_MARGIN);
}
- else if (myTextDirection.isRightSegment(myVerticalEdgeType)) {
+ else if (myVerticalEdgeType != null && myTextDirection.isRightSegment(myVerticalEdgeType)) {
vEdge = new Segment(x2(b), b.y, y2(b), child, childId, myVerticalEdgeType, NO_MARGIN);
}
else {
diff --git a/android/src/org/jetbrains/android/AndroidCompletionContributor.java b/android/src/org/jetbrains/android/AndroidCompletionContributor.java
index 8cac434..63d3a49 100644
--- a/android/src/org/jetbrains/android/AndroidCompletionContributor.java
+++ b/android/src/org/jetbrains/android/AndroidCompletionContributor.java
@@ -122,7 +122,7 @@
}
@Override
- public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet resultSet) {
+ public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet resultSet) {
PsiElement position = parameters.getPosition();
PsiElement originalPosition = parameters.getOriginalPosition();
AndroidFacet facet = AndroidFacet.getInstance(position);
diff --git a/android/src/org/jetbrains/android/AndroidJavaCompletionContributor.java b/android/src/org/jetbrains/android/AndroidJavaCompletionContributor.java
index 6b362a6..1fb17b8 100644
--- a/android/src/org/jetbrains/android/AndroidJavaCompletionContributor.java
+++ b/android/src/org/jetbrains/android/AndroidJavaCompletionContributor.java
@@ -18,7 +18,7 @@
private static final String[] EXCLUDED_PACKAGES = new String[]{"javax.swing", "javafx"};
@Override
- public void fillCompletionVariants(CompletionParameters parameters, final CompletionResultSet resultSet) {
+ public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull final CompletionResultSet resultSet) {
super.fillCompletionVariants(parameters, resultSet);
final PsiElement position = parameters.getPosition();
final AndroidFacet facet = AndroidFacet.getInstance(position);
diff --git a/android/src/org/jetbrains/android/AndroidLineMarkerProvider.java b/android/src/org/jetbrains/android/AndroidLineMarkerProvider.java
index e9bfe83..ce78e09 100644
--- a/android/src/org/jetbrains/android/AndroidLineMarkerProvider.java
+++ b/android/src/org/jetbrains/android/AndroidLineMarkerProvider.java
@@ -4,8 +4,8 @@
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.LineMarkerProvider;
+import com.intellij.codeInsight.navigation.NavigationUtil;
import com.intellij.icons.AllIcons;
-import com.intellij.ide.actions.GotoRelatedFileAction;
import com.intellij.navigation.GotoRelatedItem;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiClass;
@@ -130,7 +130,7 @@
items.get(0).navigate();
}
else {
- GotoRelatedFileAction.createPopup(items, "Go to Related Files").show(new RelativePoint(e));
+ NavigationUtil.getRelatedItemsPopup(items, "Go to Related Files").show(new RelativePoint(e));
}
}
diff --git a/android/src/org/jetbrains/android/AndroidPlugin.java b/android/src/org/jetbrains/android/AndroidPlugin.java
index 02ff8df..21acc6b 100644
--- a/android/src/org/jetbrains/android/AndroidPlugin.java
+++ b/android/src/org/jetbrains/android/AndroidPlugin.java
@@ -16,8 +16,6 @@
package org.jetbrains.android;
import com.android.tools.idea.ddms.adb.AdbService;
-import com.android.tools.idea.templates.TemplateManager;
-import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
@@ -43,17 +41,6 @@
@Override
public void initComponent() {
- createDynamicTemplateMenu();
- }
-
- public static void createDynamicTemplateMenu() {
- DefaultActionGroup newGroup = (DefaultActionGroup)ActionManager.getInstance().getAction("NewGroup");
- newGroup.addSeparator();
- final ActionGroup menu = TemplateManager.getInstance().getTemplateCreationMenu(null);
-
- if (menu != null) {
- newGroup.add(menu, new Constraints(Anchor.AFTER, "NewFromTemplate"));
- }
}
@Override
diff --git a/android/src/org/jetbrains/android/AndroidSdkLanguageLevelPusher.java b/android/src/org/jetbrains/android/AndroidSdkLanguageLevelPusher.java
index 112ca53..6af72a7 100644
--- a/android/src/org/jetbrains/android/AndroidSdkLanguageLevelPusher.java
+++ b/android/src/org/jetbrains/android/AndroidSdkLanguageLevelPusher.java
@@ -85,7 +85,7 @@
return false;
}
if (file.isDirectory()) {
- PushedFilePropertiesUpdater.findAndUpdateValue(project, file, javaPusher, LanguageLevel.HIGHEST);
+ PushedFilePropertiesUpdater.getInstance(project).findAndUpdateValue(file, javaPusher, LanguageLevel.HIGHEST);
}
return true;
}
diff --git a/android/src/org/jetbrains/android/AndroidSdkResolveScopeProvider.java b/android/src/org/jetbrains/android/AndroidSdkResolveScopeProvider.java
index f9ceb6d..96baf95 100644
--- a/android/src/org/jetbrains/android/AndroidSdkResolveScopeProvider.java
+++ b/android/src/org/jetbrains/android/AndroidSdkResolveScopeProvider.java
@@ -12,7 +12,6 @@
import org.jetbrains.android.augment.AndroidInternalRClass;
import org.jetbrains.android.sdk.AndroidSdkType;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* @author Eugene.Kudelevsky
@@ -40,19 +39,6 @@
mySdk = jdkOrderEntry.getJdk();
}
- @Nullable
- @Override
- protected VirtualFile getFileRoot(@NotNull VirtualFile file) {
- final VirtualFile resultFromSuper = super.getFileRoot(file);
-
- if (resultFromSuper != null) {
- return resultFromSuper;
- }
- return myIndex.isInLibrarySource(file)
- ? myIndex.getSourceRootForFile(file)
- : null;
- }
-
@Override
public boolean isForceSearchingInLibrarySources() {
return true;
diff --git a/android/src/org/jetbrains/android/actions/AndroidProcessChooserDialog.java b/android/src/org/jetbrains/android/actions/AndroidProcessChooserDialog.java
index 59c2362..61182544f 100644
--- a/android/src/org/jetbrains/android/actions/AndroidProcessChooserDialog.java
+++ b/android/src/org/jetbrains/android/actions/AndroidProcessChooserDialog.java
@@ -486,10 +486,6 @@
private static RunnerAndConfigurationSettings createRunConfiguration(Project project, String debugPort) {
final RemoteConfigurationType remoteConfigurationType = RemoteConfigurationType.getInstance();
- if (remoteConfigurationType == null) {
- LOG.error("Cannot create remote configuration");
- }
-
final ConfigurationFactory factory = remoteConfigurationType.getFactory();
final RunnerAndConfigurationSettings runSettings =
RunManager.getInstance(project).createRunConfiguration(getRunConfigurationName(debugPort), factory);
diff --git a/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.form b/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.form
index fefe5fb..1f95030 100644
--- a/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.form
+++ b/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.form
@@ -113,7 +113,7 @@
<text value="&Module:"/>
</properties>
</component>
- <component id="c0eea" class="javax.swing.JComboBox" binding="myModuleCombo">
+ <component id="c0eea" class="com.intellij.application.options.ModulesComboBox" binding="myModuleCombo">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
diff --git a/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.java b/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.java
index fbafff4..35dd7d4 100644
--- a/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.java
+++ b/android/src/org/jetbrains/android/actions/CreateResourceFileDialog.java
@@ -23,6 +23,7 @@
import com.android.tools.idea.rendering.ResourceHelper;
import com.android.tools.idea.rendering.ResourceNameValidator;
import com.intellij.CommonBundle;
+import com.intellij.application.options.ModulesComboBox;
import com.intellij.ide.actions.TemplateKindCombo;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
@@ -42,7 +43,6 @@
import org.jetbrains.android.uipreview.InvalidOptionValueException;
import org.jetbrains.android.util.AndroidBundle;
import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.android.util.ModuleListCellRendererWrapper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -74,7 +74,7 @@
private JPanel myRootElementFieldWrapper;
private JBLabel myRootElementLabel;
private JLabel myFileNameLabel;
- private JComboBox myModuleCombo;
+ private ModulesComboBox myModuleCombo;
private JBLabel myModuleLabel;
private JComboBox mySourceSetCombo;
private JBLabel mySourceSetLabel;
@@ -202,21 +202,13 @@
modulesSet.add(depFacet.getModule());
}
- final Module[] modules = modulesSet.toArray(new Module[modulesSet.size()]);
- Arrays.sort(modules, new Comparator<Module>() {
- @Override
- public int compare(Module m1, Module m2) {
- return m1.getName().compareTo(m2.getName());
- }
- });
- myModuleCombo.setModel(new DefaultComboBoxModel(modules));
+ myModuleCombo.setModules(modulesSet);
- if (!chooseModule || modules.length == 1) {
+ if (!chooseModule || modulesSet.size() == 1) {
myModuleLabel.setVisible(false);
myModuleCombo.setVisible(false);
}
- myModuleCombo.setRenderer(new ModuleListCellRendererWrapper(myModuleCombo.getRenderer()));
- myModuleCombo.setSelectedItem(module);
+ myModuleCombo.setSelectedModule(module);
CreateResourceActionBase.updateSourceSetCombo(mySourceSetLabel, mySourceSetCombo,
modulesSet.size() == 1 ? AndroidFacet.getInstance(modulesSet.iterator().next()) : null,
@@ -300,15 +292,6 @@
return myFileNameField.getText().trim();
}
- private static boolean containsElement(@NotNull ListModel model, @NotNull Object objectToFind) {
- for (int i = 0, n = model.getSize(); i < n; i++) {
- if (objectToFind.equals(model.getElementAt(i))) {
- return true;
- }
- }
- return false;
- }
-
@Nullable
protected InputValidator createValidator(@NotNull String subdirName) {
return null;
@@ -374,7 +357,7 @@
@NotNull
public Module getSelectedModule() {
- return (Module)myModuleCombo.getSelectedItem();
+ return myModuleCombo.getSelectedModule();
}
@NotNull
@@ -384,8 +367,7 @@
@NotNull
protected String getRootElement() {
- final String item = myRootElementField.getText().trim();
- return item != null ? item.trim() : "";
+ return myRootElementField.getText().trim();
}
public InputValidator getValidator() {
diff --git a/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.form b/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.form
index 9e06edf..3337911 100644
--- a/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.form
+++ b/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.form
@@ -27,7 +27,7 @@
</constraints>
<properties/>
</component>
- <component id="c0cba" class="javax.swing.JComboBox" binding="myModuleCombo">
+ <component id="c0cba" class="com.intellij.application.options.ModulesComboBox" binding="myModuleCombo">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
diff --git a/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.java b/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.java
index 5f58067..6459467 100644
--- a/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.java
+++ b/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.java
@@ -31,6 +31,7 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
+import com.intellij.application.options.ModulesComboBox;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.ValidationInfo;
@@ -51,7 +52,6 @@
import org.jetbrains.android.util.AndroidBundle;
import org.jetbrains.android.util.AndroidResourceUtil;
import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.android.util.ModuleListCellRendererWrapper;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -67,7 +67,7 @@
public class CreateXmlResourceDialog extends DialogWrapper {
private JPanel myPanel;
private JTextField myNameField;
- private JComboBox myModuleCombo;
+ private ModulesComboBox myModuleCombo;
private JBLabel myModuleLabel;
private JPanel myDirectoriesPanel;
private JBLabel myDirectoriesLabel;
@@ -136,18 +136,8 @@
}
else {
myModule = null;
-
- final Module[] modules = modulesSet.toArray(new Module[modulesSet.size()]);
- Arrays.sort(modules, new Comparator<Module>() {
- @Override
- public int compare(Module m1, Module m2) {
- return m1.getName().compareTo(m2.getName());
- }
- });
-
- myModuleCombo.setModel(new DefaultComboBoxModel(modules));
- myModuleCombo.setSelectedItem(module);
- myModuleCombo.setRenderer(new ModuleListCellRendererWrapper(myModuleCombo.getRenderer()));
+ myModuleCombo.setModules(modulesSet);
+ myModuleCombo.setSelectedModule(module);
}
ApplicationManager.getApplication().assertReadAccessAllowed();
@@ -232,11 +222,11 @@
}
if (myModule == null) {
- final Object prev = myModuleCombo.getSelectedItem();
+ final Module prev = myModuleCombo.getSelectedModule();
myModuleCombo.setSelectedItem(moduleForFile);
if (!moduleForFile.equals(myModuleCombo.getSelectedItem())) {
- myModuleCombo.setSelectedItem(prev);
+ myModuleCombo.setSelectedModule(prev);
return;
}
}
@@ -565,7 +555,7 @@
@Nullable
public Module getModule() {
- return myModule != null ? myModule : (Module)myModuleCombo.getSelectedItem();
+ return myModule != null ? myModule : myModuleCombo.getSelectedModule();
}
@Override
diff --git a/android/src/org/jetbrains/android/actions/RunAndroidAvdManagerAction.java b/android/src/org/jetbrains/android/actions/RunAndroidAvdManagerAction.java
index aa6f727..fcc49fa 100755
--- a/android/src/org/jetbrains/android/actions/RunAndroidAvdManagerAction.java
+++ b/android/src/org/jetbrains/android/actions/RunAndroidAvdManagerAction.java
@@ -17,12 +17,15 @@
import com.android.sdklib.internal.avd.AvdInfo;
import com.android.tools.idea.avdmanager.AvdListDialog;
+import com.intellij.facet.ProjectFacetManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
+import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.util.AndroidBundle;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -41,6 +44,13 @@
}
@Override
+ public void update(@NotNull AnActionEvent e) {
+ final Project project = e.getProject();
+ e.getPresentation().setEnabledAndVisible(
+ project != null && !ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).isEmpty());
+ }
+
+ @Override
public void actionPerformed(AnActionEvent e) {
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
openAvdManager(project);
diff --git a/android/src/org/jetbrains/android/augment/AndroidPsiElementFinder.java b/android/src/org/jetbrains/android/augment/AndroidPsiElementFinder.java
index 4de1fd8f..a0f6dab 100644
--- a/android/src/org/jetbrains/android/augment/AndroidPsiElementFinder.java
+++ b/android/src/org/jetbrains/android/augment/AndroidPsiElementFinder.java
@@ -17,7 +17,6 @@
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidFacetType;
import org.jetbrains.android.sdk.AndroidPlatform;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -91,9 +90,7 @@
@Override
public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
Project project = scope.getProject();
- if (!qualifiedName.startsWith(INTERNAL_R_CLASS_QNAME) ||
- project == null ||
- !ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
+ if (project == null || !ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return PsiClass.EMPTY_ARRAY;
}
@@ -115,7 +112,7 @@
return PsiClass.EMPTY_ARRAY;
}
List<PsiClass> result = new SmartList<PsiClass>();
- for (PsiClass parentClass : findClasses(parentName, scope)) {
+ for (PsiClass parentClass : JavaPsiFacade.getInstance(project).findClasses(parentName, scope)) {
ContainerUtil.addIfNotNull(result, parentClass.findInnerClassByName(shortName, false));
}
return result.isEmpty() ? PsiClass.EMPTY_ARRAY : result.toArray(new PsiClass[result.size()]);
diff --git a/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java
deleted file mode 100644
index 45c3e5e..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java
+++ /dev/null
@@ -1,417 +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.compiler;
-
-import com.android.SdkConstants;
-import com.android.sdklib.IAndroidTarget;
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.android.compiler.tools.AndroidApt;
-import org.jetbrains.android.dom.manifest.Manifest;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidFacetConfiguration;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.maven.AndroidMavenUtil;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.android.util.JavaFilesFilter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * Apt compiler.
- *
- * @author Alexey Efimov
- */
-public class AndroidAptCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidAptCompiler");
- private static final GenerationItem[] EMPTY_GENERATION_ITEM_ARRAY = {};
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- public static boolean isToCompileModule(Module module, AndroidFacetConfiguration configuration) {
- if (CompilerWorkspaceConfiguration.getInstance(module.getProject()).useOutOfProcessBuild()) {
- return true;
- }
- if (!(configuration.getState().RUN_PROCESS_RESOURCES_MAVEN_TASK && AndroidMavenUtil.isMavenizedModule(module))) {
- return true;
- }
- return false;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new PrepareAction(context));
- }
-
- @Override
- public GenerationItem[] generate(final CompileContext context, final GenerationItem[] items, VirtualFile outputRootDirectory) {
- if (items != null && items.length > 0) {
- context.getProgressIndicator().setText(AndroidBundle.message("android.compile.messages.generating.r.java"));
-
- if (!context.getProject().isDisposed()) {
- return doGenerate(context, items, outputRootDirectory);
- }
- }
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- private static GenerationItem[] doGenerate(final CompileContext context, GenerationItem[] items, VirtualFile outputRootDirectory) {
- if (items == null || items.length == 0) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- final String genRootPath = FileUtil.toSystemDependentName(outputRootDirectory.getPath());
- final File genRootDir = new File(genRootPath);
-
- List<GenerationItem> results = new ArrayList<GenerationItem>(items.length);
- boolean toRefresh = false;
-
- for (GenerationItem item : items) {
- if (item instanceof AptGenerationItem) {
- final AptGenerationItem aptItem = (AptGenerationItem)item;
-
- if (!AndroidCompileUtil.isModuleAffected(context, aptItem.myModule)) {
- continue;
- }
-
- File tmpOutputDir = null;
- try {
- tmpOutputDir = FileUtil.createTempDirectory("android_apt_output", "tmp");
- Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(AndroidApt.compile(
- aptItem.myAndroidTarget, aptItem.myPlatformToolsRevision, aptItem.myManifestFile.getPath(),
- aptItem.myPackage, tmpOutputDir.getPath(), aptItem.myResourcesPaths, aptItem.myLibraryPackages,
- aptItem.myNonConstantFields, aptItem.myProguardCfgOutputFileOsPath));
-
- if (aptItem.myProguardCfgOutputFileOsPath != null) {
- LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(aptItem.myProguardCfgOutputFileOsPath));
- }
- toRefresh = true;
- AndroidCompileUtil.addMessages(context, messages, aptItem.myModule);
-
- if (messages.get(CompilerMessageCategory.ERROR).isEmpty()) {
- if (!AndroidCommonUtils.directoriesContainSameContent(tmpOutputDir, genRootDir, JavaFilesFilter.INSTANCE)) {
- if (genRootDir.exists() && !FileUtil.delete(genRootDir)) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot delete directory " + genRootPath, null, -1, -1);
- continue;
- }
- final File parent = genRootDir.getParentFile();
- if (parent != null && !parent.exists() && !parent.mkdirs()) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot create directory " + parent.getPath(), null, -1, -1);
- continue;
- }
- // we use copyDir instead of moveDirWithContent here, because tmp directory may be located on other disk and
- // moveDirWithContent doesn't work for such case
- FileUtil.copyDir(tmpOutputDir, genRootDir);
- AndroidCompileUtil.markDirty(outputRootDirectory, true);
- }
- results.add(aptItem);
- }
- }
- catch (final IOException e) {
- LOG.info(e);
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) return;
- context.addMessage(CompilerMessageCategory.ERROR, "I/O error: " + e.getMessage(), null, -1, -1);
- }
- });
- }
- finally {
- if (tmpOutputDir != null) {
- FileUtil.delete(tmpOutputDir);
- }
- }
- }
- }
-
- if (toRefresh) {
- outputRootDirectory.refresh(false, true);
- }
- return results.toArray(new GenerationItem[results.size()]);
- }
-
- @Override
- @NotNull
- public String getDescription() {
- return FileUtil.getNameWithoutExtension(SdkConstants.FN_AAPT);
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput is) throws IOException {
- return new MyValidityState(is);
- }
-
- @Nullable
- public static VirtualFile getResourceDirForApkCompiler(@NotNull AndroidFacet facet) {
- return facet.getProperties().USE_CUSTOM_APK_RESOURCE_FOLDER
- ? getCustomResourceDirForApt(facet)
- : AndroidRootUtil.getResourceDir(facet);
- }
-
- final static class AptGenerationItem implements GenerationItem {
- final Module myModule;
- final VirtualFile myManifestFile;
- final String[] myResourcesPaths;
- final IAndroidTarget myAndroidTarget;
-
- final String myPackage;
- final String[] myLibraryPackages;
- final boolean myNonConstantFields;
-
- final int myPlatformToolsRevision;
- private final MyValidityState myValidityState;
- private final String myProguardCfgOutputFileOsPath;
-
- private AptGenerationItem(@NotNull Module module,
- @NotNull VirtualFile manifestFile,
- @NotNull String[] resourcesPaths,
- @NotNull IAndroidTarget target,
- int platformToolsRevision,
- @NotNull String aPackage,
- @NotNull String[] libPackages,
- boolean nonConstantFields,
- @Nullable String proguardCfgOutputFileOsPath) {
- myModule = module;
- myManifestFile = manifestFile;
- myResourcesPaths = resourcesPaths;
- myAndroidTarget = target;
- myPackage = aPackage;
- myLibraryPackages = libPackages;
- myNonConstantFields = nonConstantFields;
- myPlatformToolsRevision = platformToolsRevision;
- myProguardCfgOutputFileOsPath = proguardCfgOutputFileOsPath;
- myValidityState = new MyValidityState(myModule, Collections.<String>emptySet(), myPlatformToolsRevision, myNonConstantFields,
- proguardCfgOutputFileOsPath != null ? proguardCfgOutputFileOsPath : "");
- }
-
- @Override
- public String getPath() {
- return "FAKE";
- }
-
- @Override
- public ValidityState getValidityState() {
- return myValidityState;
- }
-
- @Override
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
- }
-
- @Nullable
- public static VirtualFile getCustomResourceDirForApt(@NotNull AndroidFacet facet) {
- return AndroidRootUtil.getFileByRelativeModulePath(facet.getModule(), facet.getProperties().CUSTOM_APK_RESOURCE_FOLDER, false);
- }
-
- private static final class PrepareAction implements Computable<GenerationItem[]> {
- private final CompileContext myContext;
-
- public PrepareAction(CompileContext context) {
- myContext = context;
- }
-
- @Override
- public GenerationItem[] compute() {
- if (myContext.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- Module[] modules = ModuleManager.getInstance(myContext.getProject()).getModules();
- List<GenerationItem> items = new ArrayList<GenerationItem>();
- for (Module module : modules) {
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet != null) {
- AndroidFacetConfiguration configuration = facet.getConfiguration();
- if (!isToCompileModule(module, configuration) ||
- AndroidCompileUtil.isLibraryWithBadCircularDependency(facet)) {
- continue;
- }
-
- final AndroidPlatform platform = configuration.getAndroidPlatform();
- if (platform == null) {
- myContext.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.specify.platform", module.getName()), null, -1, -1);
- continue;
- }
-
- final IAndroidTarget target = platform.getTarget();
- final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
-
- String[] resPaths = AndroidCompileUtil.collectResourceDirs(facet, false, myContext);
- if (resPaths.length <= 0) {
- continue;
- }
-
- VirtualFile manifestFile = AndroidRootUtil.getManifestFileForCompiler(facet);
- if (manifestFile == null) {
- myContext.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.manifest.not.found", module.getName()), null, -1, -1);
- continue;
- }
-
- Manifest manifest = AndroidUtils.loadDomElement(module, manifestFile, Manifest.class);
- if (manifest == null) {
- myContext.addMessage(CompilerMessageCategory.ERROR, "Cannot parse file", manifestFile.getUrl(), -1, -1);
- continue;
- }
-
- String packageName = manifest.getPackage().getValue();
- if (packageName != null) {
- packageName = packageName.trim();
- }
- if (packageName == null || packageName.length() <= 0) {
- myContext.addMessage(CompilerMessageCategory.ERROR, AndroidBundle.message("package.not.found.error"), manifestFile.getUrl(),
- -1, -1);
- continue;
- }
-
- if (!AndroidCommonUtils.contains2Identifiers(packageName)) {
- final String message = "[" + module.getName() + "] Package name must contain at least 2 segments";
- myContext.addMessage(facet.isLibraryProject() ? CompilerMessageCategory.WARNING : CompilerMessageCategory.ERROR,
- message, manifestFile.getUrl(), -1, -1);
- continue;
- }
- final String[] libPackages = AndroidCompileUtil.getLibPackages(module, packageName);
-
- final Module circularDepLibWithSamePackage = AndroidCompileUtil.findCircularDependencyOnLibraryWithSamePackage(facet);
- if (circularDepLibWithSamePackage != null && !facet.isLibraryProject()) {
- myContext.addMessage(CompilerMessageCategory.WARNING,
- AndroidBundle.message("android.compilation.warning.circular.app.dependency",
- packageName, module.getName(),
- circularDepLibWithSamePackage.getName()), null, -1, -1);
- }
- final boolean generateNonFinalFields = facet.isLibraryProject() || circularDepLibWithSamePackage != null;
-
- final VirtualFile outputDirForDex = AndroidDexCompiler.getOutputDirectoryForDex(module);
- final String proguardCfgOutputFileOsPath =
- AndroidCompileUtil.getProguardConfigFilePathIfShouldRun(facet, myContext) != null
- ? FileUtil.toSystemDependentName(outputDirForDex.getPath() + '/' + AndroidCommonUtils.PROGUARD_CFG_OUTPUT_FILE_NAME)
- : null;
-
- items.add(new AptGenerationItem(module, manifestFile, resPaths, target, platformToolsRevision, packageName, libPackages,
- generateNonFinalFields, proguardCfgOutputFileOsPath));
- }
- }
- return items.toArray(new GenerationItem[items.size()]);
- }
- }
-
- private static class MyValidityState extends ResourceNamesValidityState {
- private final String myCustomGenPathR;
- private final Set<String> myNonExistingFiles;
- private final int myPlatformToolsRevision;
- private final boolean myNonConstantFields;
- private final String myProguardCfgOutputFileOsPath;
-
- MyValidityState(@NotNull Module module,
- @NotNull Set<String> nonExistingFiles,
- int platformToolsRevision,
- boolean nonConstantFields,
- @NotNull String proguardCfgOutputFileOsPath) {
- super(module);
- myNonExistingFiles = nonExistingFiles;
- myPlatformToolsRevision = platformToolsRevision;
- myNonConstantFields = nonConstantFields;
- myProguardCfgOutputFileOsPath = proguardCfgOutputFileOsPath;
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null) {
- myCustomGenPathR = "";
- return;
- }
- AndroidFacetConfiguration configuration = facet.getConfiguration();
- myCustomGenPathR = configuration.getState().GEN_FOLDER_RELATIVE_PATH_APT;
- }
-
- public MyValidityState(DataInput is) throws IOException {
- super(is);
- String path = is.readUTF();
- myCustomGenPathR = path != null ? path : "";
-
- myNonExistingFiles = Collections.emptySet();
- myPlatformToolsRevision = is.readInt();
- myNonConstantFields = is.readBoolean();
- myProguardCfgOutputFileOsPath = is.readUTF();
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
-
- final MyValidityState otherState1 = (MyValidityState)otherState;
- if (!otherState1.myNonExistingFiles.equals(myNonExistingFiles)) {
- return false;
- }
- if (myPlatformToolsRevision != otherState1.myPlatformToolsRevision) {
- return false;
- }
- if (myNonConstantFields != otherState1.myNonConstantFields) {
- return false;
- }
- if (!Comparing.equal(myProguardCfgOutputFileOsPath, otherState1.myProguardCfgOutputFileOsPath)) {
- return false;
- }
- if (!super.equalsTo(otherState)) {
- return false;
- }
- return Comparing.equal(myCustomGenPathR, otherState1.myCustomGenPathR);
- }
-
- @Override
- public void save(DataOutput os) throws IOException {
- super.save(os);
- os.writeUTF(myCustomGenPathR);
- os.writeInt(myPlatformToolsRevision);
- os.writeBoolean(myNonConstantFields);
- os.writeUTF(myProguardCfgOutputFileOsPath);
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java b/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java
index d022de3..ba84ba0 100644
--- a/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java
+++ b/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java
@@ -15,13 +15,11 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.ReadonlyStatusHandler;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.*;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.HashSet;
@@ -62,7 +60,6 @@
}
switch (mode) {
case AAPT:
- return AndroidAptCompiler.isToCompileModule(facet.getModule(), facet.getConfiguration());
case AIDL:
case RENDERSCRIPT:
case BUILDCONFIG:
@@ -487,7 +484,7 @@
return null;
}
- final VirtualFile[] sourceRoots = AndroidPackagingCompiler.getSourceRootsForModuleAndDependencies(module, false);
+ final VirtualFile[] sourceRoots = getSourceRootsForModuleAndDependencies(module, false);
final String[] sourceRootOsPaths = AndroidCompileUtil.toOsPaths(sourceRoots);
final String outFileOsPath = FileUtil.toSystemDependentName(
@@ -618,7 +615,7 @@
final VirtualFile vTempOutDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempOutDir);
final String depFolderPath =
- vTempOutDir != null ? AndroidRenderscriptCompiler.getDependencyFolder(context.getProject(), file, vTempOutDir) : null;
+ vTempOutDir != null ? getDependencyFolder(context.getProject(), file, vTempOutDir) : null;
final Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
AndroidRenderscript
@@ -693,13 +690,8 @@
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- run[0] = !project.isDisposed() &&
- ReadonlyStatusHandler.ensureFilesWritable(project, filesToCheck.toArray(new VirtualFile[filesToCheck.size()]));
- }
- });
+ run[0] = !project.isDisposed() &&
+ ReadonlyStatusHandler.ensureFilesWritable(project, filesToCheck.toArray(new VirtualFile[filesToCheck.size()]));
}
}, ModalityState.defaultModalityState());
@@ -724,6 +716,61 @@
}
}
+ private static void fillSourceRoots(@NotNull Module module,
+ @NotNull Set<Module> visited,
+ @NotNull Set<VirtualFile> result,
+ boolean includingTests) {
+ visited.add(module);
+ final AndroidFacet facet = AndroidFacet.getInstance(module);
+ VirtualFile resDir = facet != null ? AndroidRootUtil.getResourceDir(facet) : null;
+ ModuleRootManager manager = ModuleRootManager.getInstance(module);
+ for (VirtualFile sourceRoot : manager.getSourceRoots(includingTests)) {
+ if (!Comparing.equal(resDir, sourceRoot)) {
+ result.add(sourceRoot);
+ }
+ }
+ for (OrderEntry entry : manager.getOrderEntries()) {
+ if (entry instanceof ModuleOrderEntry) {
+ ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)entry;
+ DependencyScope scope = moduleOrderEntry.getScope();
+ if (scope == DependencyScope.COMPILE) {
+ Module depModule = moduleOrderEntry.getModule();
+ if (depModule != null && !visited.contains(depModule)) {
+ fillSourceRoots(depModule, visited, result, false);
+ }
+ }
+ }
+ }
+ }
+
+ @NotNull
+ public static VirtualFile[] getSourceRootsForModuleAndDependencies(@NotNull Module module, boolean includingTests) {
+ Set<VirtualFile> result = new HashSet<VirtualFile>();
+ fillSourceRoots(module, new HashSet<Module>(), result, includingTests);
+ return VfsUtil.toVirtualFileArray(result);
+ }
+
+ @Nullable
+ static String getDependencyFolder(@NotNull final Project project,
+ @NotNull final VirtualFile sourceFile,
+ @NotNull final VirtualFile genFolder) {
+ final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
+
+ final VirtualFile sourceRoot = index.getSourceRootForFile(sourceFile);
+ if (sourceRoot == null) {
+ return null;
+ }
+
+ final VirtualFile parent = sourceFile.getParent();
+ if (Comparing.equal(parent, sourceRoot)) {
+ return genFolder.getPath();
+ }
+
+ final String relativePath = VfsUtilCore.getRelativePath(sourceFile.getParent(), sourceRoot, '/');
+ assert relativePath != null;
+ return genFolder.getPath() + '/' + relativePath;
+ }
+
private static class AptAutogenerationItem {
final String myPackage;
final String myOutputDirOsPath;
diff --git a/android/src/org/jetbrains/android/compiler/AndroidBuildConfigGeneratingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidBuildConfigGeneratingCompiler.java
deleted file mode 100644
index 3614248..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidBuildConfigGeneratingCompiler.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.jetbrains.android.compiler;
-
-import com.android.sdklib.internal.build.BuildConfigGenerator;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.xml.NanoXmlUtil;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidBuildConfigGeneratingCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidBuildConfigGeneratingCompiler");
- private static final String MANIFEST_LOCATION = NanoXmlUtil.createLocation("manifest");
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<GenerationItem[]>() {
- @Override
- public GenerationItem[] compute() {
- final List<GenerationItem> result = new ArrayList<GenerationItem>();
-
- for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
- final AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null || AndroidCompileUtil.isLibraryWithBadCircularDependency(facet)) {
- continue;
- }
-
- final VirtualFile manifestFile = AndroidRootUtil.getManifestFileForCompiler(facet);
- if (manifestFile == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.manifest.not.found", module.getName()), null, -1, -1);
- continue;
- }
-
- String packageName;
- try {
- // we cannot use DOM here because custom manifest file can be excluded (ex. it can be located in /target/ folder)
- packageName = parsePackageName(manifestFile);
- }
- catch (IOException e) {
- context.addMessage(CompilerMessageCategory.ERROR, "I/O error: " + e.getMessage(), null, -1, -1);
- continue;
- }
-
- if (packageName != null) {
- packageName = packageName.trim();
- }
- if (packageName == null || packageName.length() <= 0) {
- context.addMessage(CompilerMessageCategory.ERROR, AndroidBundle.message("package.not.found.error"), manifestFile.getUrl(),
- -1, -1);
- continue;
- }
- final boolean debug = !AndroidCompileUtil.isReleaseBuild(context);
- result.add(new MyGenerationItem(module, packageName, debug));
-
- for (String libPackage : AndroidCompileUtil.getLibPackages(module, packageName)) {
- result.add(new MyGenerationItem(module, libPackage, debug));
- }
- }
- return result.toArray(new GenerationItem[result.size()]);
- }
- });
- }
-
- @Override
- public GenerationItem[] generate(CompileContext context,
- GenerationItem[] items,
- VirtualFile outputRootDirectory) {
- if (items == null || items.length == 0) {
- return new GenerationItem[0];
- }
- context.getProgressIndicator().setText("Generating BuildConfig.java...");
-
- final String genFolderOsPath = FileUtil.toSystemDependentName(outputRootDirectory.getPath());
- final List<GenerationItem> result = new ArrayList<GenerationItem>();
-
- for (GenerationItem item : items) {
- final MyGenerationItem genItem = (MyGenerationItem)item;
- final BuildConfigGenerator generator = new BuildConfigGenerator(genFolderOsPath, genItem.myPackage, genItem.myDebug);
- try {
- generator.generate();
- result.add(genItem);
- }
- catch (IOException e) {
- context.addMessage(CompilerMessageCategory.ERROR, "I/O error: " + e.getMessage(), null, -1, -1);
- LOG.info(e);
- }
- }
-
- if (result.size() > 0) {
- AndroidCompileUtil.markDirtyAndRefresh(outputRootDirectory, true);
- }
- return result.toArray(new GenerationItem[result.size()]);
- }
-
- @Nullable
- private static String parsePackageName(@NotNull VirtualFile manifestFile) throws IOException {
- final Ref<String> packageNameRef = Ref.create(null);
-
- NanoXmlUtil.parse(manifestFile.getInputStream(), new NanoXmlUtil.BaseXmlBuilder() {
- @Override
- public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type)
- throws Exception {
- super.addAttribute(key, nsPrefix, nsURI, value, type);
-
- if (AndroidCommonUtils.PACKAGE_MANIFEST_ATTRIBUTE.equals(key) &&
- MANIFEST_LOCATION.equals(getLocation())) {
- packageNameRef.set(value);
- stop();
- }
- }
-
- @Override
- public void elementAttributesProcessed(String name, String nsPrefix, String nsURI) throws Exception {
- super.elementAttributesProcessed(name, nsPrefix, nsURI);
- stop();
- }
- });
- return packageNameRef.get();
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android BuildConfig Generator";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return new MyValidityState(in);
- }
-
- private static class MyGenerationItem implements GenerationItem {
- final Module myModule;
- final String myPackage;
- final boolean myDebug;
-
- private MyGenerationItem(@NotNull Module module, @NotNull String aPackage, boolean debug) {
- myModule = module;
- myPackage = aPackage;
- myDebug = debug;
- }
-
- @Override
- public String getPath() {
- return myPackage.replace('.', '/') + '/' + BuildConfigGenerator.BUILD_CONFIG_NAME;
- }
-
- @Override
- public ValidityState getValidityState() {
- return new MyValidityState(myPackage, myDebug);
- }
-
- @Override
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
- }
-
- private static class MyValidityState implements ValidityState {
- private final String myPackage;
- private boolean myDebug;
-
- private MyValidityState(DataInput in) throws IOException {
- myPackage = in.readUTF();
- myDebug = in.readBoolean();
- }
-
- private MyValidityState(@NotNull String aPackage, boolean debug) {
- myPackage = aPackage;
- myDebug = debug;
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
- final MyValidityState otherState1 = (MyValidityState)otherState;
- return otherState1.myPackage.equals(myPackage) && otherState1.myDebug == myDebug;
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeUTF(myPackage);
- out.writeBoolean(myDebug);
- }
- }
-}
\ No newline at end of file
diff --git a/android/src/org/jetbrains/android/compiler/AndroidBuildTargetScopeProvider.java b/android/src/org/jetbrains/android/compiler/AndroidBuildTargetScopeProvider.java
index 7ec9b17..e786b8c 100644
--- a/android/src/org/jetbrains/android/compiler/AndroidBuildTargetScopeProvider.java
+++ b/android/src/org/jetbrains/android/compiler/AndroidBuildTargetScopeProvider.java
@@ -35,7 +35,7 @@
return true;
}
}
- final String proguardCfgPathsStr = scope.getUserData(AndroidProguardCompiler.PROGUARD_CFG_PATHS_KEY);
+ final String proguardCfgPathsStr = scope.getUserData(AndroidCompileUtil.PROGUARD_CFG_PATHS_KEY);
if (proguardCfgPathsStr != null && proguardCfgPathsStr.length() > 0) {
return true;
}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java b/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
index 19ea7f9..4a082e4 100644
--- a/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
+++ b/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
@@ -30,12 +30,13 @@
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.Compiler;
+import com.intellij.openapi.compiler.CompileContext;
+import com.intellij.openapi.compiler.CompileScope;
+import com.intellij.openapi.compiler.CompilerManager;
+import com.intellij.openapi.compiler.CompilerMessageCategory;
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
-import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
+import com.intellij.openapi.compiler.options.ExcludesConfiguration;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
@@ -52,7 +53,6 @@
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.*;
-import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactProperties;
import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
@@ -99,6 +99,7 @@
@NonNls public static final String OLD_PROGUARD_CFG_FILE_NAME = "proguard.cfg";
public static final String UNSIGNED_SUFFIX = ".unsigned";
+ public static Key<String> PROGUARD_CFG_PATHS_KEY = Key.create(AndroidCommonUtils.PROGUARD_CFG_PATHS_OPTION);
private AndroidCompileUtil() {
}
@@ -320,7 +321,7 @@
private static void excludeFromCompilation(@NotNull Project project, @NotNull VirtualFile sourceRoot, @NotNull String aPackage) {
final String buildConfigPath = sourceRoot.getPath() + '/' + aPackage.replace('.', '/') + "/BuildConfig.java";
String url = VfsUtilCore.pathToUrl(buildConfigPath);
- final ExcludedEntriesConfiguration configuration =
+ final ExcludesConfiguration configuration =
CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration();
for (ExcludeEntryDescription description : configuration.getExcludeEntryDescriptions()) {
@@ -332,7 +333,7 @@
}
private static void excludeFromCompilation(@NotNull Project project, @NotNull VirtualFile dir) {
- final ExcludedEntriesConfiguration configuration =
+ final ExcludesConfiguration configuration =
CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration();
for (ExcludeEntryDescription description : configuration.getExcludeEntryDescriptions()) {
@@ -459,7 +460,7 @@
if (project.isDisposed()) return;
CompilerTask task = new CompilerTask(project, "Android auto-generation", true, false, true, true);
CompileScope scope = new ModuleCompileScope(module, false);
- contextWrapper[0] = new CompileContextImpl(project, task, scope, null, false, false);
+ contextWrapper[0] = new CompileContextImpl(project, task, scope, false, false);
}
});
CompileContext context = contextWrapper[0];
@@ -526,51 +527,6 @@
}
}
- @NotNull
- public static String[] collectResourceDirs(AndroidFacet facet, boolean collectResCacheDirs, @Nullable CompileContext context) {
- final Project project = facet.getModule().getProject();
- final IntermediateOutputCompiler pngFilesCachingCompiler =
- collectResCacheDirs ? Extensions.findExtension(Compiler.EP_NAME, project, AndroidPngFilesCachingCompiler.class) : null;
-
- if (collectResCacheDirs) {
- assert pngFilesCachingCompiler != null;
- }
-
- final List<String> result = new ArrayList<String>();
-
- doCollectResourceDirs(facet, collectResCacheDirs, result, context);
-
- for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(facet.getModule(), true)) {
- doCollectResourceDirs(depFacet, collectResCacheDirs, result, context);
- }
- return ArrayUtil.toStringArray(result);
- }
-
- private static void doCollectResourceDirs(AndroidFacet facet, boolean collectResCacheDirs, List<String> result, CompileContext context) {
- final Module module = facet.getModule();
-
- if (collectResCacheDirs) {
- final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
- final int platformToolsRevision = platform != null ? platform.getSdkData().getPlatformToolsRevision() : -1;
-
- if (platformToolsRevision < 0 || platformToolsRevision > 7) {
- // png cache is supported since platform-tools-r8
- final String resCacheDirOsPath = findResourcesCacheDirectory(module, false, context);
- if (resCacheDirOsPath != null) {
- result.add(resCacheDirOsPath);
- }
- else {
- LOG.info("PNG cache not found for module " + module.getName());
- }
- }
- }
-
- final VirtualFile resourcesDir = AndroidAptCompiler.getResourceDirForApkCompiler(facet);
- if (resourcesDir != null) {
- result.add(resourcesDir.getPath());
- }
- }
-
@Nullable
public static String findResourcesCacheDirectory(@NotNull Module module, boolean createIfNotFound, @Nullable CompileContext context) {
final Project project = module.getProject();
@@ -685,22 +641,10 @@
(createIfNotExist ? genRootsToCreate : genRootsToInit).add(renderscriptGenRootPath);
}
- if (AndroidAptCompiler.isToCompileModule(module, facet.getConfiguration())) {
- final String aptGenRootPath = AndroidRootUtil.getAptGenSourceRootPath(facet);
+ final String aptGenRootPath = AndroidRootUtil.getAptGenSourceRootPath(facet);
- if (aptGenRootPath != null) {
- genRootsToCreate.add(aptGenRootPath);
- }
- }
- else {
- // we need to include generated-sources/r to compilation, because it contains R.java generated by Maven,
- // which should be used in Maven-based resource processing mode
- final VirtualFile aptSourceRoot = initializeGenSourceRoot(model, AndroidRootUtil.getAptGenSourceRootPath(facet),
- true, false, modelChangedFlag);
- if (aptSourceRoot != null) {
- excludeAllBuildConfigsFromCompilation(facet, aptSourceRoot);
- }
- includeAaptGenSourceRootToCompilation(facet);
+ if (aptGenRootPath != null) {
+ genRootsToCreate.add(aptGenRootPath);
}
final String aidlGenRootPath = AndroidRootUtil.getAidlGenSourceRootPath(facet);
@@ -736,7 +680,7 @@
private static void includeAaptGenSourceRootToCompilation(AndroidFacet facet) {
final Project project = facet.getModule().getProject();
- final ExcludedEntriesConfiguration configuration =
+ final ExcludesConfiguration configuration =
((CompilerConfigurationImpl)CompilerConfiguration.getInstance(project)).getExcludedEntriesConfiguration();
final ExcludeEntryDescription[] descriptions = configuration.getExcludeEntryDescriptions();
@@ -773,12 +717,6 @@
if (sourceRoot != null && excludeInNonExternalMode) {
final Module module = model.getModule();
final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(module.getProject());
-
- // In JPS generated roots are excluded by AndroidExcludeJavaSourceRootProvider,
- // so we don't need to mark them in the project model
- if (!config.useOutOfProcessBuild()) {
- excludeFromCompilation(module.getProject(), sourceRoot);
- }
}
return sourceRoot;
}
@@ -850,7 +788,7 @@
@Nullable
public static ProguardRunningOptions getProguardConfigFilePathIfShouldRun(@NotNull AndroidFacet facet, CompileContext context) {
// wizard
- String pathsStr = context.getCompileScope().getUserData(AndroidProguardCompiler.PROGUARD_CFG_PATHS_KEY);
+ String pathsStr = context.getCompileScope().getUserData(PROGUARD_CFG_PATHS_KEY);
if (pathsStr != null) {
final String[] paths = pathsStr.split(File.pathSeparator);
@@ -965,48 +903,13 @@
@Nullable
public static String getUnsignedApkPath(@NotNull AndroidFacet facet) {
- final boolean useCompileServer = CompilerWorkspaceConfiguration.getInstance(
- facet.getModule().getProject()).useOutOfProcessBuild();
- final String apkPath = AndroidRootUtil.getApkPath(facet);
-
- if (apkPath != null) {
- return useCompileServer
- ? apkPath
- : AndroidCommonUtils.addSuffixToFileName(apkPath, UNSIGNED_SUFFIX);
- }
- return null;
- }
-
- @Nullable
- public static <T> T handleExceptionError(@NotNull CompileContext context,
- @NotNull String messagePrefix,
- @NotNull Exception e) {
- reportException(context, messagePrefix, e);
- return null;
+ return AndroidRootUtil.getApkPath(facet);
}
public static void reportException(@NotNull CompileContext context, @NotNull String messagePrefix, @NotNull Exception e) {
context.addMessage(CompilerMessageCategory.ERROR, messagePrefix + e.getClass().getSimpleName() + ": " + e.getMessage(), null, -1, -1);
}
- public static void markDirtyAndRefresh(VirtualFile f, boolean recursively) {
- markDirty(f, recursively);
- f.refresh(false, recursively);
- }
-
- public static void markDirty(VirtualFile f, boolean recursively) {
- if (f instanceof NewVirtualFile) {
- final NewVirtualFile newF = (NewVirtualFile)f;
-
- if (recursively) {
- newF.markDirtyRecursively();
- }
- else {
- newF.markDirty();
- }
- }
- }
-
@Nullable
public static String getAaptManifestPackage(@NotNull AndroidFacet facet) {
if (facet.getProperties().USE_CUSTOM_MANIFEST_PACKAGE) {
diff --git a/android/src/org/jetbrains/android/compiler/AndroidDependencyProcessor.java b/android/src/org/jetbrains/android/compiler/AndroidDependencyProcessor.java
deleted file mode 100644
index 024e099..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidDependencyProcessor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.jetbrains.android.compiler;
-
-import com.intellij.compiler.DependencyProcessor;
-import com.intellij.compiler.make.*;
-import com.intellij.facet.ProjectFacetManager;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.containers.HashSet;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidDependencyProcessor implements DependencyProcessor {
- @Override
- public void processDependencies(final CompileContext context, int classQualifiedName, final CachingSearcher searcher)
- throws CacheCorruptedException {
- if (!(context instanceof CompileContextEx)) {
- return;
- }
- final Project project = context.getProject();
-
- if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
- return;
- }
- final DependencyCache depCache = ((CompileContextEx)context).getDependencyCache();
- final Cache cache = depCache.getCache();
- final String path = cache.getPath(classQualifiedName);
- final String classFileName = new File(path).getName();
-
- if (!AndroidCommonUtils.R_PATTERN.matcher(classFileName).matches()) {
- return;
- }
- final String qName = depCache.resolve(classQualifiedName);
- final int idx = qName.indexOf('$');
- final String topLevelClassName = idx < 0 ? qName : qName.substring(0, idx);
- final Set<String> qNamesToMark = new HashSet<String>();
-
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- final PsiClass[] classes =
- JavaPsiFacade.getInstance(project).findClasses(topLevelClassName, GlobalSearchScope.projectScope(project));
-
- for (PsiClass aClass : classes) {
- final Collection<PsiReference> references = searcher.findReferences(aClass, true);
-
- for (PsiReference reference : references) {
- final PsiClass ownerClass = getOwnerClass(reference.getElement());
- if (ownerClass != null && !ownerClass.equals(aClass)) {
- final String ownerClassQName = ownerClass.getQualifiedName();
-
- if (ownerClassQName != null) {
- qNamesToMark.add(ownerClassQName);
- }
- }
- }
- }
- }
- });
-
- for (String toMark : qNamesToMark) {
- final int qualifiedName = depCache.getSymbolTable().getId(toMark);
- depCache.markClass(qualifiedName);
- }
- }
-
- @Nullable
- private static PsiClass getOwnerClass(PsiElement element) {
- while (!(element instanceof PsiFile) && element != null) {
- if (element instanceof PsiClass && element.getParent() instanceof PsiJavaFile) {
- return (PsiClass)element;
- }
- element = element.getParent();
- }
- return null;
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidExternalApklibExtractingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidExternalApklibExtractingCompiler.java
deleted file mode 100644
index c6235be..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidExternalApklibExtractingCompiler.java
+++ /dev/null
@@ -1,249 +0,0 @@
-package org.jetbrains.android.compiler;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.HashSet;
-import com.intellij.util.io.ZipUtil;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.maven.AndroidExternalApklibDependenciesManager;
-import org.jetbrains.android.maven.AndroidMavenUtil;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidExternalApklibExtractingCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidExternalApklibExtractingCompiler");
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<GenerationItem[]>() {
- @Override
- public GenerationItem[] compute() {
- final List<GenerationItem> result = new ArrayList<GenerationItem>();
-
- for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
- final AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null || !facet.isLibraryProject()) {
- continue;
- }
-
- final String mavenIdStr = AndroidMavenUtil.getMavenIdStringByExtApklibModule(facet.getModule());
- if (mavenIdStr == null) {
- continue;
- }
-
- final AndroidExternalApklibDependenciesManager manager =
- AndroidExternalApklibDependenciesManager.getInstance(context.getProject());
- final String artifactFilePath = manager.getArtifactFilePath(mavenIdStr);
-
- if (artifactFilePath == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- "Cannot find artifact file for generated module " + module.getName() + ". Try to force reimport Maven model",
- null, -1, -1);
- continue;
- }
-
- final VirtualFile root = AndroidRootUtil.getMainContentRoot(facet);
- if (root == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot find main root in generated module containing AndroidManifest.xml" +
- module.getName() +
- ". Try to force reimport Maven model", null, -1, -1);
- continue;
- }
-
- result.add(new MyGenerationItem(module, FileUtil.toSystemDependentName(root.getPath()),
- FileUtil.toSystemDependentName(artifactFilePath)));
- }
-
- return result.toArray(new GenerationItem[result.size()]);
- }
- });
- }
-
- @Override
- public GenerationItem[] generate(CompileContext context,
- GenerationItem[] items,
- VirtualFile outputRootDirectory) {
- if (items == null || items.length == 0) {
- return new GenerationItem[0];
- }
-
- context.getProgressIndicator().setText(AndroidBundle.message("android.compile.messages.processing.external.apklib.dependencies"));
-
- final GenerationItem[] generatedItems = doGenerate(context, items);
- final Set<VirtualFile> generatedVFiles = new HashSet<VirtualFile>();
- final HashSet<VirtualFile> visited = new HashSet<VirtualFile>();
-
- for (GenerationItem item : generatedItems) {
- final MyGenerationItem genItem = (MyGenerationItem)item;
- final File contentRoot = new File(genItem.getGenContentRootPath());
- final VirtualFile vContentRoot = LocalFileSystem.getInstance().findFileByIoFile(contentRoot);
-
- if (vContentRoot != null) {
- vContentRoot.refresh(false, true);
- final VirtualFile vSrcRoot = vContentRoot.findChild(AndroidMavenUtil.APK_LIB_ARTIFACT_SOURCE_ROOT);
-
- if (vSrcRoot != null) {
- AndroidCompileUtil.markDirty(vSrcRoot, true);
- AndroidUtils.collectFiles(vSrcRoot, visited, generatedVFiles);
- }
- }
- }
-
- if (context instanceof CompileContextEx) {
- ((CompileContextEx)context).markGenerated(generatedVFiles);
- }
-
- return generatedItems;
- }
-
- private static GenerationItem[] doGenerate(CompileContext context, GenerationItem[] items) {
- final List<GenerationItem> result = new ArrayList<GenerationItem>();
-
- for (GenerationItem item : items) {
- final Module module = item.getModule();
-
- if (!AndroidCompileUtil.isModuleAffected(context, module)) {
- continue;
- }
-
- final MyGenerationItem genItem = (MyGenerationItem)item;
-
- final String artifactPath = genItem.getArtifactPath();
- final File artifactFile = new File(artifactPath);
-
- if (!artifactFile.exists()) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot find file " + artifactPath, null, -1, -1);
- continue;
- }
-
- if (!artifactFile.isFile()) {
- context.addMessage(CompilerMessageCategory.ERROR, artifactPath + " is not file", null, -1, -1);
- continue;
- }
-
- final String genContentRootPath = ((MyGenerationItem)item).getGenContentRootPath();
- final File genContentRootFile = new File(genContentRootPath);
-
- if (genContentRootFile.exists()) {
- if (!FileUtil.delete(genContentRootFile)) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot delete old directory: " + genContentRootPath, null, -1, -1);
- continue;
- }
- }
-
- if (!genContentRootFile.mkdir()) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot create directory " + genContentRootPath, null, -1, -1);
- continue;
- }
-
- try {
- ZipUtil.extract(artifactFile, genContentRootFile, null);
- }
- catch (IOException e) {
- final String message = e.getMessage();
- if (message == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Unknown I/O error", null, -1, -1);
- LOG.error(e);
- }
- else {
- context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
- LOG.info(e);
- }
- continue;
- }
-
- result.add(genItem);
- }
-
- return result.toArray(new GenerationItem[result.size()]);
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android External Apklib Extracting Compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return TimestampValidityState.load(in);
- }
-
- private static class MyGenerationItem implements GenerationItem {
- private final Module myModule;
- private final String myGenContentRootPath;
- private final String myArtifactPath;
- private final TimestampValidityState myValidityState;
-
- private MyGenerationItem(@NotNull Module module, @NotNull String genContentRootPath, @NotNull String artifactPath) {
- myModule = module;
- myGenContentRootPath = genContentRootPath;
- myArtifactPath = artifactPath;
- myValidityState = new TimestampValidityState(new File(myArtifactPath).lastModified());
- }
-
- @Nullable
- @Override
- public String getPath() {
- return myGenContentRootPath;
- }
-
- @Override
- public ValidityState getValidityState() {
- return myValidityState;
- }
-
- @Override
- @NotNull
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
-
- @NotNull
- public String getGenContentRootPath() {
- return myGenContentRootPath;
- }
-
- @NotNull
- public String getArtifactPath() {
- return myArtifactPath;
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidIdlCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidIdlCompiler.java
deleted file mode 100644
index 90d7e5c..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidIdlCompiler.java
+++ /dev/null
@@ -1,261 +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.compiler;
-
-import com.android.sdklib.IAndroidTarget;
-import com.android.SdkConstants;
-import com.intellij.facet.FacetManager;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.android.compiler.tools.AndroidIdl;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.fileTypes.AndroidIdlFileType;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Android IDL compiler.
- *
- * @author Alexey Efimov
- */
-public class AndroidIdlCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidIdlCompiler");
-
- private static final GenerationItem[] EMPTY_GENERATION_ITEM_ARRAY = {};
-
- private final Project myProject;
-
- public AndroidIdlCompiler(Project project) {
- myProject = project;
- }
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new PrepareAction(context));
- }
-
- @Override
- public GenerationItem[] generate(CompileContext context, GenerationItem[] items, VirtualFile outputRootDirectory) {
- if (items != null && items.length > 0) {
- context.getProgressIndicator().setText("Generating AIDL files...");
- return doGenerate(context, items, outputRootDirectory);
- }
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- @Override
- @NotNull
- public String getDescription() {
- return FileUtil.getNameWithoutExtension(SdkConstants.FN_AIDL);
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- @Nullable
- public ValidityState createValidityState(DataInput is) throws IOException {
- return TimestampValidityState.load(is);
- }
-
- private final static class IdlGenerationItem implements GenerationItem {
- final Module myModule;
- final VirtualFile myFile;
- final boolean myTestSource;
- final IAndroidTarget myAndroidTarget;
- final String myPackageName;
- private final TimestampValidityState myValidityState;
-
- public IdlGenerationItem(@NotNull Module module,
- @NotNull VirtualFile file,
- boolean testSource,
- @NotNull IAndroidTarget androidTarget,
- @NotNull String packageName) {
- myModule = module;
- myFile = file;
- myTestSource = testSource;
- myAndroidTarget = androidTarget;
- myPackageName = packageName;
- myValidityState = new TimestampValidityState(myFile.getTimeStamp());
- }
-
- @Override
- @Nullable
- public String getPath() {
- return myPackageName.replace('.', '/') + '/' + myFile.getNameWithoutExtension() + ".java";
- }
-
- @Override
- @Nullable
- public ValidityState getValidityState() {
- return myValidityState;
- }
-
- @Override
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return myTestSource;
- }
- }
-
- private final class PrepareAction implements Computable<GenerationItem[]> {
- private final CompileContext myContext;
-
- public PrepareAction(CompileContext context) {
- myContext = context;
- }
-
- @Override
- public GenerationItem[] compute() {
- if (myContext.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- VirtualFile[] files = myContext.getProjectCompileScope().getFiles(AndroidIdlFileType.ourFileType, true);
- List<GenerationItem> items = new ArrayList<GenerationItem>(files.length);
- for (VirtualFile file : files) {
- Module module = myContext.getModuleByFile(file);
- AndroidFacet facet = FacetManager.getInstance(module).getFacetByType(AndroidFacet.ID);
- if (facet != null) {
- IAndroidTarget target = facet.getConfiguration().getAndroidTarget();
- if (target == null) {
- myContext.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.specify.platform", module.getName()), null, -1, -1);
- continue;
- }
- String packageName = AndroidUtils.computePackageName(module, file);
- if (packageName == null) {
- myContext.addMessage(CompilerMessageCategory.ERROR, "Cannot compute package for file", file.getUrl(), -1, -1);
- continue;
- }
-
- addItem(file, facet, target, packageName, items);
- }
- }
- return items.toArray(new GenerationItem[items.size()]);
- }
-
- private void addItem(VirtualFile file,
- AndroidFacet facet,
- IAndroidTarget target,
- String packageName,
- List<GenerationItem> items) {
- Module module = facet.getModule();
- String sourceRootPath = AndroidRootUtil.getAidlGenSourceRootPath(facet);
- if (sourceRootPath == null) {
- myContext.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.apt.gen.not.specified", module.getName()), null, -1, -1);
- return;
- }
- ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- items.add(new IdlGenerationItem(module, file, fileIndex.isInTestSourceContent(file), target, packageName));
- }
- }
-
- private static GenerationItem[] doGenerate(final CompileContext context, GenerationItem[] items, VirtualFile outputRootDirectory) {
- if (context.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- List<GenerationItem> results = new ArrayList<GenerationItem>(items.length);
- boolean toRefresh = false;
-
- for (GenerationItem item : items) {
- if (item instanceof IdlGenerationItem) {
- final IdlGenerationItem idlItem = (IdlGenerationItem)item;
-
- if (!AndroidCompileUtil.isModuleAffected(context, idlItem.myModule)) {
- continue;
- }
-
- try {
- VirtualFile[] sourceRoots = AndroidPackagingCompiler.getSourceRootsForModuleAndDependencies(idlItem.myModule, false);
- final String[] sourceRootPaths = AndroidCompileUtil.toOsPaths(sourceRoots);
-
- final String outFilePath = FileUtil.toSystemDependentName(
- outputRootDirectory.getPath() + '/' + idlItem.myPackageName.replace('.', '/') + '/' +
- idlItem.myFile.getNameWithoutExtension() + ".java");
-
- final Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
- AndroidIdl.execute(idlItem.myAndroidTarget, idlItem.myFile.getPath(), outFilePath, sourceRootPaths));
-
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) return;
- addMessages(context, messages, idlItem.myFile.getUrl());
- }
- });
- if (messages.get(CompilerMessageCategory.ERROR).isEmpty()) {
- toRefresh = true;
- results.add(idlItem);
- }
- }
- catch (final IOException e) {
- LOG.info(e);
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) return;
- context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), idlItem.myFile.getUrl(), -1, -1);
- }
- });
- }
- }
- }
-
- if (toRefresh) {
- AndroidCompileUtil.markDirtyAndRefresh(outputRootDirectory, true);
- }
- return results.toArray(new GenerationItem[results.size()]);
- }
-
- private static void addMessages(CompileContext context, Map<CompilerMessageCategory, List<String>> messages, String url) {
- for (CompilerMessageCategory category : messages.keySet()) {
- List<String> messageList = messages.get(category);
- for (String message : messageList) {
- context.addMessage(category, message, url, -1, -1);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/android/src/org/jetbrains/android/compiler/AndroidIncludingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidIncludingCompiler.java
deleted file mode 100644
index 2d41738..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidIncludingCompiler.java
+++ /dev/null
@@ -1,245 +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.compiler;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.roots.ContentIterator;
-import com.intellij.openapi.roots.ModuleFileIndex;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.HashMap;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidIncludingCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidIncludingCompiler");
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- String generatedFileRelativePath = VfsUtilCore.getRelativePath(generatedFile, outputRoot, '/');
- if (generatedFileRelativePath == null) {
- return null;
- }
-
- for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, true)) {
- String genSrcRootPath = AndroidRootUtil.getAptGenSourceRootPath(depFacet);
- VirtualFile genSrcRoot = genSrcRootPath != null ? LocalFileSystem.getInstance().findFileByPath(genSrcRootPath) : null;
- VirtualFile[] srcRoots = ModuleRootManager.getInstance(depFacet.getModule()).getSourceRoots();
-
- for (VirtualFile depSourceRoot : srcRoots) {
- if (!Comparing.equal(depSourceRoot, genSrcRoot)) {
- VirtualFile file = depSourceRoot.findFileByRelativePath(generatedFileRelativePath);
- if (file != null) {
- return file;
- }
- }
- }
- }
-
- return null;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<GenerationItem[]>() {
- @Override
- public GenerationItem[] compute() {
- List<MyItem> result = new ArrayList<MyItem>();
-
- for (Module module : context.getProjectCompileScope().getAffectedModules()) {
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet != null && facet.isLibraryProject()) {
- continue;
- }
-
- Map<String, MyItem> qName2Item = new HashMap<String, MyItem>();
- for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, true)) {
- final AndroidPlatform platform = depFacet.getConfiguration().getAndroidPlatform();
-
- 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;
- }
-
- final String aptGenSrcRootPath = AndroidRootUtil.getAptGenSourceRootPath(depFacet);
- final VirtualFile aptGenSrcRoot = aptGenSrcRootPath != null
- ? LocalFileSystem.getInstance().findFileByPath(aptGenSrcRootPath)
- : null;
-
- final String aidlGenSrcRootPath = AndroidRootUtil.getAidlGenSourceRootPath(depFacet);
- final VirtualFile aidlGenSrcRoot = aidlGenSrcRootPath != null
- ? LocalFileSystem.getInstance().findFileByPath(aidlGenSrcRootPath)
- : null;
-
- VirtualFile[] srcRoots = ModuleRootManager.getInstance(depFacet.getModule()).getSourceRoots();
-
- for (VirtualFile depSourceRoot : srcRoots) {
- if (!Comparing.equal(depSourceRoot, aptGenSrcRoot) && !Comparing.equal(depSourceRoot, aidlGenSrcRoot)) {
- collectCompilableFiles(module, depFacet.getModule(), context, depSourceRoot, qName2Item);
- }
- }
- }
- result.addAll(qName2Item.values());
- }
- return result.toArray(new MyItem[result.size()]);
- }
- });
- }
-
- private static void collectCompilableFiles(final Module module,
- final Module depModule,
- final CompileContext context,
- @NotNull final VirtualFile sourceRoot,
- final Map<String, MyItem> relativePath2GenItem) {
-
- ModuleFileIndex fileIndex = ModuleRootManager.getInstance(depModule).getFileIndex();
-
- fileIndex.iterateContentUnderDirectory(sourceRoot, new ContentIterator() {
- @Override
- public boolean processFile(VirtualFile fileOrDir) {
- if (fileOrDir.isDirectory()) {
- return true;
- }
- if (fileOrDir.getFileType() == StdFileTypes.JAVA) {
- String relativePath = VfsUtilCore.getRelativePath(fileOrDir, sourceRoot, '/');
- LOG.assertTrue(relativePath != null);
- MyItem existingItem = relativePath2GenItem.get(relativePath);
- if (existingItem != null) {
- String path1 = FileUtil.toSystemDependentName(existingItem.mySourceFile.getPath());
- String path2 = FileUtil.toSystemDependentName(fileOrDir.getPath());
- context.addMessage(CompilerMessageCategory.ERROR, "Duplicate file for " + relativePath +
- "\nOrigin 1: " + path1 +
- "\nOrigin 2: " + path2, null, -1, -1);
- return false;
- }
- relativePath2GenItem.put(relativePath, new MyItem(module, fileOrDir, relativePath));
- }
- return true;
- }
- });
- }
-
- @Override
- public GenerationItem[] generate(CompileContext context, GenerationItem[] items, VirtualFile outputRootDirectory) {
- if (items.length > 0) {
- context.getProgressIndicator().setText(AndroidBundle.message("android.compile.messages.copying.sources.from.libraries"));
- }
- List<GenerationItem> result = new ArrayList<GenerationItem>();
- boolean toRefresh = false;
- for (GenerationItem item : items) {
-
- if (!AndroidCompileUtil.isModuleAffected(context, ((MyItem)item).myModule)) {
- continue;
- }
- toRefresh = true;
- String fromPath = ((MyItem)item).mySourceFile.getPath();
- File from = new File(fromPath);
- File to = new File(outputRootDirectory.getPath() + '/' + item.getPath());
- try {
- FileUtil.copy(from, to);
- result.add(item);
- }
- catch (IOException e) {
- LOG.info(e);
- String message = "Cannot copy file " + from.getPath() + " to " + to.getPath() + "\nI/O error" +
- (e.getMessage() != null ? ": " + e.getMessage() : "");
- context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
- }
- }
-
- if (toRefresh) {
- AndroidCompileUtil.markDirtyAndRefresh(outputRootDirectory, true);
- }
- return result.toArray(new GenerationItem[result.size()]);
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android Including Compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return TimestampValidityState.load(in);
- }
-
- private static class MyItem implements GenerationItem {
- final Module myModule;
- final VirtualFile mySourceFile;
- final String mySourceRelativePath;
- private final TimestampValidityState myValidityState;
-
- private MyItem(Module module, VirtualFile sourceFile, String sourceRelativePath) {
- myModule = module;
- mySourceFile = sourceFile;
- mySourceRelativePath = sourceRelativePath;
- myValidityState = new TimestampValidityState(mySourceFile.getTimeStamp());
- }
-
- @Override
- public String getPath() {
- return mySourceRelativePath;
- }
-
- @Nullable
- @Override
- public ValidityState getValidityState() {
- return myValidityState;
- }
-
- @Override
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidLibraryPackagingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidLibraryPackagingCompiler.java
deleted file mode 100644
index 85a113a..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidLibraryPackagingCompiler.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.jetbrains.android.compiler;
-
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.containers.HashSet;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.DataInput;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidLibraryPackagingCompiler implements ClassPostProcessingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidLibraryPackagingCompiler");
-
- @NotNull
- @Override
- public ProcessingItem[] getProcessingItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<ProcessingItem[]>() {
- @Override
- public ProcessingItem[] compute() {
- final List<ProcessingItem> result = new ArrayList<ProcessingItem>();
-
- for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
- final AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null || !facet.isLibraryProject()) {
- continue;
- }
-
- final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
- LOG.assertTrue(extension != null);
-
- final VirtualFile classesDir = extension.getCompilerOutputPath();
- if (classesDir == null) {
- continue;
- }
- final HashSet<VirtualFile> firstPackageDirs = new HashSet<VirtualFile>();
- AndroidDexCompiler.addModuleOutputDir(firstPackageDirs, classesDir);
-
- if (firstPackageDirs.size() == 0) {
- continue;
- }
-
- final VirtualFile outputDirectory = AndroidDexCompiler.getOutputDirectoryForDex(module);
- if (outputDirectory == null) {
- LOG.error("Cannot find output directory for dex");
- continue;
- }
- result.add(new MyProcessingItem(module, firstPackageDirs.toArray(new VirtualFile[firstPackageDirs.size()]), outputDirectory));
- }
- return result.toArray(new ProcessingItem[result.size()]);
- }
- });
- }
-
- @Override
- public ProcessingItem[] process(CompileContext context, ProcessingItem[] items) {
- if (!AndroidCompileUtil.isFullBuild(context) || items == null || items.length == 0) {
- return ProcessingItem.EMPTY_ARRAY;
- }
-
- context.getProgressIndicator().setText("Packaging library modules...");
- final List<MyProcessingItem> result = new ArrayList<MyProcessingItem>();
-
- for (ProcessingItem item : items) {
- final MyProcessingItem processingItem = (MyProcessingItem)item;
-
- if (!AndroidCompileUtil.isModuleAffected(context, processingItem.getModule())) {
- continue;
- }
-
- final String[] classesDirOsPaths = AndroidCompileUtil.toOsPaths(processingItem.getClassDirectories());
- final String outputJarOsPath = FileUtil.toSystemDependentName(processingItem.getOutputDirectory().getPath() + '/' +
- AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
-
- final File outputJarFile = new File(outputJarOsPath);
- try {
- AndroidCommonUtils.packClassFilesIntoJar(ArrayUtil.EMPTY_STRING_ARRAY, classesDirOsPaths, outputJarFile);
- CompilerUtil.refreshIOFile(outputJarFile);
- result.add(processingItem);
- }
- catch (IOException e) {
- if (e.getMessage() == null) {
- LOG.error(e);
- }
- else {
- LOG.info(e);
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot pack sources of module " +
- processingItem.getModule().getName() +
- " to " +
- outputJarFile.getName() +
- ": " +
- e.getMessage(), null, -1, -1);
- }
- }
- }
- return result.toArray(new MyProcessingItem[result.size()]);
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android Library Packaging Compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return new ClassesAndJarsValidityState(in);
- }
-
- private static class MyProcessingItem implements ProcessingItem {
- private final Module myModule;
- private final VirtualFile[] myClassDirectories;
- private final VirtualFile myOutputDirectory;
-
- private MyProcessingItem(@NotNull Module module, @NotNull VirtualFile[] classDirectories, @NotNull VirtualFile directory) {
- assert classDirectories.length > 0;
- myOutputDirectory = directory;
- myClassDirectories = classDirectories;
- myModule = module;
- }
-
- @NotNull
- @Override
- public VirtualFile getFile() {
- return myClassDirectories[0].getParent();
- }
-
- @Override
- public ValidityState getValidityState() {
- return new ClassesAndJarsValidityState(Arrays.asList(myClassDirectories));
- }
-
- @NotNull
- public Module getModule() {
- return myModule;
- }
-
- @NotNull
- public VirtualFile[] getClassDirectories() {
- return myClassDirectories;
- }
-
- @NotNull
- public VirtualFile getOutputDirectory() {
- return myOutputDirectory;
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidMavenResourcesCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidMavenResourcesCompiler.java
deleted file mode 100644
index d8f6b86..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidMavenResourcesCompiler.java
+++ /dev/null
@@ -1,263 +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.compiler;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.android.compiler.tools.AndroidMavenExecutor;
-import org.jetbrains.android.dom.manifest.Manifest;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.maven.AndroidMavenProvider;
-import org.jetbrains.android.maven.AndroidMavenUtil;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.idea.maven.project.MavenProject;
-import org.jetbrains.idea.maven.project.MavenProjectsManager;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidMavenResourcesCompiler implements SourceGeneratingCompiler {
- private static final GenerationItem[] EMPTY_GENERATION_ITEM_ARRAY = {};
-
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new PrepareAction(context));
- }
-
- @Override
- public GenerationItem[] generate(final CompileContext context, final GenerationItem[] items, VirtualFile outputRootDirectory) {
- if (items != null && items.length > 0) {
- context.getProgressIndicator().setText("Processing resources by Maven...");
- Computable<GenerationItem[]> computation = new Computable<GenerationItem[]>() {
- @Override
- public GenerationItem[] compute() {
- if (context.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- return doGenerate(context, items);
- }
- };
- GenerationItem[] generationItems = computation.compute();
- List<VirtualFile> generatedVFiles = new ArrayList<VirtualFile>();
- for (GenerationItem item : generationItems) {
- File generatedFile = ((MyGenerationItem)item).myGeneratedFile;
- if (generatedFile != null) {
- final VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(generatedFile);
- if (vFile != null) {
- AndroidCompileUtil.markDirtyAndRefresh(vFile, false);
- generatedVFiles.add(vFile);
- }
- }
- }
- if (context instanceof CompileContextEx) {
- ((CompileContextEx)context).markGenerated(generatedVFiles);
- }
- return generationItems;
- }
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- private static GenerationItem[] doGenerate(final CompileContext context, GenerationItem[] items) {
- List<GenerationItem> results = new ArrayList<GenerationItem>(items.length);
- for (GenerationItem item : items) {
- if (item instanceof MyGenerationItem) {
- final MyGenerationItem genItem = (MyGenerationItem)item;
-
- if (!AndroidCompileUtil.isModuleAffected(context, genItem.myModule)) {
- continue;
- }
-
- Map<CompilerMessageCategory, List<String>> messages = AndroidMavenExecutor.generateResources(genItem.myModule);
- AndroidCompileUtil.addMessages(context, messages, genItem.myModule);
- if (messages.get(CompilerMessageCategory.ERROR).isEmpty()) {
- results.add(genItem);
- }
- if (genItem.myGeneratedFile.exists()) {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- String className = FileUtil.getNameWithoutExtension(genItem.myGeneratedFile);
- AndroidCompileUtil.removeDuplicatingClasses(genItem.myModule, genItem.myPackage, className, genItem.myGeneratedFile,
- genItem.mySourceRootPath);
- }
- });
- }
- }
- }
- return results.toArray(new GenerationItem[results.size()]);
- }
-
- @Override
- @NotNull
- public String getDescription() {
- return "Android Maven Resources Compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput is) throws IOException {
- return new MyValidityState(is);
- }
-
- private final static class MyGenerationItem implements GenerationItem {
- final Module myModule;
- final String myPackage;
- final File myGeneratedFile;
- final String mySourceRootPath;
- private final MyValidityState myValidityState;
-
- private MyGenerationItem(@NotNull Module module, @NotNull String aPackage, @NotNull String sourceRootPath) {
- myModule = module;
- myPackage = aPackage;
- myGeneratedFile =
- new File(sourceRootPath, aPackage.replace('.', File.separatorChar) + File.separator + AndroidCommonUtils.R_JAVA_FILENAME);
- mySourceRootPath = sourceRootPath;
- myValidityState = new MyValidityState(myModule);
- }
-
- @Override
- @Nullable
- public String getPath() {
- return myPackage.replace('.', '/') + '/' + AndroidCommonUtils.R_JAVA_FILENAME;
- }
-
- @Override
- public ValidityState getValidityState() {
- return myValidityState;
- }
-
- @Override
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
- }
-
- private static class MyValidityState extends ResourceNamesValidityState {
- private final long[] myMavenArtifactsTimespamps;
-
- private MyValidityState(Module module) {
- super(module);
- AndroidMavenProvider mavenProvider = AndroidMavenUtil.getMavenProvider();
- assert mavenProvider != null;
- List<File> files = mavenProvider.getMavenDependencyArtifactFiles(module);
- myMavenArtifactsTimespamps = new long[files.size()];
- for (int i = 0, filesSize = files.size(); i < filesSize; i++) {
- myMavenArtifactsTimespamps[i] = files.get(i).lastModified();
- }
- }
-
- public MyValidityState(DataInput is) throws IOException {
- super(is);
- int c = is.readInt();
- myMavenArtifactsTimespamps = new long[c];
- for (int i = 0; i < c; i++) {
- myMavenArtifactsTimespamps[i] = is.readLong();
- }
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!super.equalsTo(otherState)) {
- return false;
- }
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
- return Arrays.equals(myMavenArtifactsTimespamps, ((MyValidityState)otherState).myMavenArtifactsTimespamps);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- super.save(out);
- out.writeInt(myMavenArtifactsTimespamps.length);
- for (long timespamp : myMavenArtifactsTimespamps) {
- out.writeLong(timespamp);
- }
- }
- }
-
- private static final class PrepareAction implements Computable<GenerationItem[]> {
- private final CompileContext myContext;
-
- public PrepareAction(CompileContext context) {
- myContext = context;
- }
-
- @Override
- public GenerationItem[] compute() {
- if (myContext.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- Module[] modules = ModuleManager.getInstance(myContext.getProject()).getModules();
- List<GenerationItem> items = new ArrayList<GenerationItem>();
- for (Module module : modules) {
- MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(myContext.getProject());
- if (mavenProjectsManager != null && mavenProjectsManager.isMavenizedModule(module)) {
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet != null && facet.getProperties().RUN_PROCESS_RESOURCES_MAVEN_TASK) {
- MavenProject mavenProject = mavenProjectsManager.findProject(module);
- if (mavenProject != null) {
- Manifest manifest = facet.getManifest();
- String aPackage = manifest != null ? manifest.getPackage().getValue() : null;
- if (aPackage == null) {
- VirtualFile manifestFile = AndroidRootUtil.getManifestFile(facet);
- myContext.addMessage(CompilerMessageCategory.ERROR,
- "Cannot find package value in AndroidManifest.xml for module " + module.getName(),
- manifestFile != null ? manifestFile.getUrl() : null, -1, -1);
- continue;
- }
- items.add(new MyGenerationItem(module, aPackage, mavenProject.getGeneratedSourcesDirectory(false) + "/r"));
- }
- }
- }
- }
- return items.toArray(new GenerationItem[items.size()]);
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidPackagingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidPackagingCompiler.java
deleted file mode 100644
index 1ef02af..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidPackagingCompiler.java
+++ /dev/null
@@ -1,532 +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.compiler;
-
-import com.intellij.compiler.CompilerIOUtil;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.DependencyScope;
-import com.intellij.openapi.roots.ModuleOrderEntry;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderEntry;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.HashSet;
-import org.jetbrains.android.compiler.tools.AndroidApkBuilder;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidFacetConfiguration;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.android.util.AndroidNativeLibData;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @author yole
- */
-public class AndroidPackagingCompiler implements PackagingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidPackagingCompiler");
-
- @Override
- public void processOutdatedItem(CompileContext context, String url, @Nullable ValidityState state) {
- }
-
- @NotNull
- private static VirtualFile[] getExternalJars(@NotNull Module module,
- @NotNull AndroidFacetConfiguration configuration) {
- AndroidPlatform platform = configuration.getAndroidPlatform();
- if (platform != null) {
- List<VirtualFile> externalLibsAndModules = AndroidRootUtil.getExternalLibraries(module);
- return externalLibsAndModules.toArray(new VirtualFile[externalLibsAndModules.size()]);
- }
- return VirtualFile.EMPTY_ARRAY;
- }
-
- private static void fillSourceRoots(@NotNull Module module,
- @NotNull Set<Module> visited,
- @NotNull Set<VirtualFile> result,
- boolean includingTests) {
- visited.add(module);
- final AndroidFacet facet = AndroidFacet.getInstance(module);
- VirtualFile resDir = facet != null ? AndroidRootUtil.getResourceDir(facet) : null;
- ModuleRootManager manager = ModuleRootManager.getInstance(module);
- for (VirtualFile sourceRoot : manager.getSourceRoots(includingTests)) {
- if (!Comparing.equal(resDir, sourceRoot)) {
- result.add(sourceRoot);
- }
- }
- for (OrderEntry entry : manager.getOrderEntries()) {
- if (entry instanceof ModuleOrderEntry) {
- ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)entry;
- DependencyScope scope = moduleOrderEntry.getScope();
- if (scope == DependencyScope.COMPILE) {
- Module depModule = moduleOrderEntry.getModule();
- if (depModule != null && !visited.contains(depModule)) {
- fillSourceRoots(depModule, visited, result, false);
- }
- }
- }
- }
- }
-
- @NotNull
- public static VirtualFile[] getSourceRootsForModuleAndDependencies(@NotNull Module module, boolean includingTests) {
- Set<VirtualFile> result = new HashSet<VirtualFile>();
- fillSourceRoots(module, new HashSet<Module>(), result, includingTests);
- return VfsUtil.toVirtualFileArray(result);
- }
-
- @Override
- @NotNull
- public ProcessingItem[] getProcessingItems(CompileContext context) {
- final List<ProcessingItem> items = new ArrayList<ProcessingItem>();
- for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet != null && !facet.isLibraryProject()) {
- VirtualFile manifestFile = AndroidRootUtil.getManifestFileForCompiler(facet);
- VirtualFile[] sourceRoots = getSourceRootsForModuleAndDependencies(module, facet.getProperties().PACK_TEST_CODE);
- if (manifestFile != null) {
- AndroidFacetConfiguration configuration = facet.getConfiguration();
- VirtualFile outputDir = AndroidDexCompiler.getOutputDirectoryForDex(module);
- if (outputDir != null) {
- VirtualFile[] externalJars = getExternalJars(module, configuration);
-
- File resPackage = AndroidResourcesPackagingCompiler.getOutputFile(module, outputDir);
- String resPackagePath = FileUtil.toSystemDependentName(resPackage.getPath());
-
- File classesDexFile = new File(outputDir.getPath(), AndroidCommonUtils.CLASSES_FILE_NAME);
- String classesDexPath = FileUtil.toSystemDependentName(classesDexFile.getPath());
-
- AndroidPlatform platform = configuration.getAndroidPlatform();
- if (platform == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.specify.platform", module.getName()), null, -1, -1);
- continue;
- }
- String sdkPath = platform.getSdkData().getPath();
- String outputPath = AndroidRootUtil.getApkPath(facet);
- if (outputPath == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.apk.path.not.specified", module.getName()), null, -1, -1);
- continue;
- }
- final String keystorePath = FileUtil.toSystemDependentName(VfsUtil.urlToPath(configuration.getState().CUSTOM_DEBUG_KEYSTORE_PATH));
- items.add(
- createItem(module, facet, manifestFile, sourceRoots, externalJars, resPackagePath, classesDexPath, sdkPath, outputPath,
- false, AndroidCompileUtil.isReleaseBuild(context), keystorePath));
- }
- }
- }
- }
- return items.toArray(new ProcessingItem[items.size()]);
- }
-
- private static AptPackagingItem createItem(Module module,
- AndroidFacet facet,
- VirtualFile manifestFile,
- VirtualFile[] sourceRoots,
- VirtualFile[] externalJars,
- String resPackagePath,
- String classesDexPath,
- String sdkPath,
- String outputPath,
- boolean generateSignedApk,
- boolean releaseBuild,
- String customKeystorePath) {
- final AptPackagingItem item =
- new AptPackagingItem(sdkPath, manifestFile, resPackagePath, outputPath, generateSignedApk, releaseBuild, module, customKeystorePath,
- facet.getConfiguration().getAdditionalNativeLibraries());
- item.setNativeLibsFolders(collectNativeLibsFolders(facet));
- item.setClassesDexPath(classesDexPath);
- item.setSourceRoots(sourceRoots);
- item.setExternalLibraries(externalJars);
- return item;
- }
-
- @NotNull
- private static VirtualFile[] collectNativeLibsFolders(AndroidFacet facet) {
- List<VirtualFile> result = new ArrayList<VirtualFile>();
- VirtualFile libsDir = AndroidRootUtil.getLibsDir(facet);
- if (libsDir != null) {
- result.add(libsDir);
- }
- for (AndroidFacet depFacet : AndroidUtils.getAndroidLibraryDependencies(facet.getModule())) {
- VirtualFile depLibsDir = AndroidRootUtil.getLibsDir(depFacet);
- if (depLibsDir != null) {
- result.add(depLibsDir);
- }
- }
- return result.toArray(new VirtualFile[result.size()]);
- }
-
- private static String[] getPaths(@NotNull VirtualFile[] vFiles) {
- String[] result = new String[vFiles.length];
- for (int i = 0; i < vFiles.length; i++) {
- VirtualFile vFile = vFiles[i];
- result[i] = FileUtil.toSystemDependentName(vFile.getPath());
- }
- return result;
- }
-
- @Override
- public ProcessingItem[] process(final CompileContext context, ProcessingItem[] items) {
- if (!AndroidCompileUtil.isFullBuild(context)) {
- return ProcessingItem.EMPTY_ARRAY;
- }
-
- context.getProgressIndicator().setText("Building Android package...");
- final List<ProcessingItem> result = new ArrayList<ProcessingItem>();
- for (ProcessingItem processingItem : items) {
- AptPackagingItem item = (AptPackagingItem)processingItem;
-
- if (!AndroidCompileUtil.isModuleAffected(context, item.myModule)) {
- continue;
- }
-
- doProcess(context, item, false);
-
- if (context.getMessages(CompilerMessageCategory.ERROR).length == 0) {
- doProcess(context, item, true);
- }
-
- if (context.getMessages(CompilerMessageCategory.ERROR).length == 0) {
- result.add(item);
- }
- }
- return result.toArray(new ProcessingItem[result.size()]);
- }
-
- private static void doProcess(final CompileContext context, AptPackagingItem item, boolean unsigned) {
- if (!shouldGenerateApk(item.myModule, context, unsigned)) {
- return;
- }
-
- try {
- final String[] externalLibPaths = getPaths(item.getExternalLibraries());
-
- final String resPackagePath = unsigned
- ? item.getResPackagePath() + AndroidResourcesPackagingCompiler.RELEASE_SUFFIX
- : item.getResPackagePath();
-
- final String finalPath = unsigned
- ? AndroidCommonUtils.addSuffixToFileName(item.getFinalPath(), AndroidCompileUtil.UNSIGNED_SUFFIX)
- : item.getFinalPath();
-
- final String[] sourceRoots = AndroidCompileUtil.toOsPaths(item.getSourceRoots());
- final String[] nativeLibsFolders = AndroidCompileUtil.toOsPaths(item.getNativeLibsFolders());
- final Project project = context.getProject();
-
- final Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
- AndroidApkBuilder.execute(resPackagePath, item.getClassesDexPath(), sourceRoots, externalLibPaths, nativeLibsFolders,
- item.getAdditionalNativeLibs(), finalPath, unsigned, item.mySdkPath, item.getCustomKeystorePath(),
- new ExcludedSourcesFilter(project)));
-
- if (messages.get(CompilerMessageCategory.ERROR).size() == 0) {
- if (item.myReleaseBuild == unsigned) {
- final File dst = new File(
- AndroidCommonUtils.addSuffixToFileName(item.getFinalPath(), AndroidCommonUtils.ANDROID_FINAL_PACKAGE_FOR_ARTIFACT_SUFFIX));
- FileUtil.copy(new File(finalPath), dst);
- CompilerUtil.refreshIOFile(dst);
- final VirtualFile jar = JarFileSystem.getInstance().refreshAndFindFileByPath(dst.getPath() + "!/");
- if (jar != null) {
- jar.refresh(false, true);
- }
- }
- }
- AndroidCompileUtil.addMessages(context, messages, item.myModule);
- }
- catch (final IOException e) {
- LOG.info(e);
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) return;
- context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
- }
- });
- }
- }
-
- public static boolean shouldGenerateApk(Module module, CompileContext context, boolean unsigned) {
- final boolean releaseBuild = AndroidCompileUtil.isReleaseBuild(context);
-
- if (!unsigned) {
- return !releaseBuild;
- }
-
- final AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null) {
- return true;
- }
-
- if (releaseBuild) {
- return true;
- }
- return false;
- }
-
- @Override
- @NotNull
- public String getDescription() {
- return "Android Packaging Compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput is) throws IOException {
- return new MyValidityState(is);
- }
-
- private static class AptPackagingItem implements ProcessingItem {
- private final String mySdkPath;
- private final VirtualFile myManifestFile;
- private final String myResPackagePath;
- private final String myFinalPath;
- private String myClassesDexPath;
- private VirtualFile[] myNativeLibsFolders;
- private final List<AndroidNativeLibData> myAdditionalNativeLibs;
- private VirtualFile[] mySourceRoots;
- private VirtualFile[] myExternalLibraries;
- private final boolean myGenerateUnsigendApk;
- private final Module myModule;
- private boolean myReleaseBuild;
-
- private final String myCustomKeystorePath;
-
- private AptPackagingItem(String sdkPath,
- @NotNull VirtualFile manifestFile,
- @NotNull String resPackagePath,
- @NotNull String finalPath,
- boolean generateUnsigendApk,
- boolean releaseBuild,
- @NotNull Module module,
- @Nullable String customKeystorePath,
- @NotNull List<AndroidNativeLibData> additionalNativeLibs) {
- mySdkPath = sdkPath;
- myManifestFile = manifestFile;
- myResPackagePath = resPackagePath;
- myFinalPath = finalPath;
- myGenerateUnsigendApk = generateUnsigendApk;
- myReleaseBuild = releaseBuild;
- myModule = module;
- myCustomKeystorePath = customKeystorePath;
- myAdditionalNativeLibs = additionalNativeLibs;
- }
-
- @NotNull
- public String getResPackagePath() {
- return myResPackagePath;
- }
-
- @NotNull
- public String getFinalPath() {
- return myFinalPath;
- }
-
- @NotNull
- public String getClassesDexPath() {
- return myClassesDexPath;
- }
-
- @Nullable
- public String getCustomKeystorePath() {
- return myCustomKeystorePath;
- }
-
- @NotNull
- public VirtualFile[] getNativeLibsFolders() {
- return myNativeLibsFolders;
- }
-
- @NotNull
- public List<AndroidNativeLibData> getAdditionalNativeLibs() {
- return myAdditionalNativeLibs;
- }
-
- @NotNull
- public VirtualFile[] getSourceRoots() {
- return mySourceRoots;
- }
-
- @NotNull
- public VirtualFile[] getExternalLibraries() {
- return myExternalLibraries;
- }
-
- public void setSourceRoots(@NotNull VirtualFile[] sourceRoots) {
- this.mySourceRoots = sourceRoots;
- }
-
- public void setExternalLibraries(@NotNull VirtualFile[] externalLibraries) {
- this.myExternalLibraries = externalLibraries;
- }
-
- public void setClassesDexPath(@NotNull String classesDexPath) {
- myClassesDexPath = classesDexPath;
- }
-
- public void setNativeLibsFolders(@NotNull VirtualFile[] nativeLibsFolders) {
- myNativeLibsFolders = nativeLibsFolders;
- }
-
- @Override
- @NotNull
- public VirtualFile getFile() {
- return myManifestFile;
- }
-
- @Override
- @Nullable
- public ValidityState getValidityState() {
- return new MyValidityState(myModule.getProject(), myResPackagePath, myClassesDexPath, myFinalPath, myGenerateUnsigendApk,
- myReleaseBuild, mySourceRoots, myExternalLibraries, myNativeLibsFolders, myCustomKeystorePath,
- myAdditionalNativeLibs);
- }
- }
-
- private static class MyValidityState implements ValidityState {
- private final Map<String, Long> myResourceTimestamps = new HashMap<String, Long>();
- private final Map<AndroidNativeLibData, Long> myAdditionalNativeLibs = new HashMap<AndroidNativeLibData, Long>();
- private final String myApkPath;
- private final boolean myGenerateUnsignedApk;
- private final boolean myReleaseBuild;
- private final String myCustomKeystorePath;
-
- MyValidityState(DataInput is) throws IOException {
- int size = is.readInt();
- for (int i = 0; i < size; i++) {
- String key = is.readUTF();
- long value = is.readLong();
- myResourceTimestamps.put(key, value);
- }
- myGenerateUnsignedApk = is.readBoolean();
- myReleaseBuild = is.readBoolean();
- myApkPath = is.readUTF();
- myCustomKeystorePath = CompilerIOUtil.readString(is);
-
- size = is.readInt();
- for (int i = 0; i < size; i++) {
- final String architecture = is.readUTF();
- final String path = is.readUTF();
- final String targetFileName = is.readUTF();
- final long timestamp = is.readLong();
- myAdditionalNativeLibs.put(new AndroidNativeLibData(architecture, path, targetFileName), timestamp);
- }
- }
-
- MyValidityState(Project project,
- String resPackagePath,
- String classesDexPath,
- String apkPath,
- boolean generateUnsignedApk,
- boolean releaseBuild,
- VirtualFile[] sourceRoots,
- VirtualFile[] externalLibs,
- VirtualFile[] nativeLibFolders,
- String customKeystorePath,
- List<AndroidNativeLibData> additionalNativeLibs) {
- myResourceTimestamps.put(FileUtil.toSystemIndependentName(resPackagePath), new File(resPackagePath).lastModified());
- myResourceTimestamps.put(FileUtil.toSystemIndependentName(classesDexPath), new File(classesDexPath).lastModified());
- myApkPath = apkPath;
- myGenerateUnsignedApk = generateUnsignedApk;
- myReleaseBuild = releaseBuild;
- myCustomKeystorePath = customKeystorePath != null ? customKeystorePath : "";
-
- final HashSet<File> resourcesFromSourceRoot = new HashSet<File>();
- for (VirtualFile sourceRoot : sourceRoots) {
- AndroidApkBuilder.collectStandardJavaResources(new File(sourceRoot.getPath()), resourcesFromSourceRoot,
- new ExcludedSourcesFilter(project));
- }
- for (File resource : resourcesFromSourceRoot) {
- myResourceTimestamps.put(FileUtil.toSystemIndependentName(resource.getPath()), resource.lastModified());
- }
-
- for (VirtualFile externalLib : externalLibs) {
- myResourceTimestamps.put(externalLib.getPath(), externalLib.getTimeStamp());
- }
- ArrayList<File> nativeLibs = new ArrayList<File>();
- for (VirtualFile nativeLibFolder : nativeLibFolders) {
- for (VirtualFile child : nativeLibFolder.getChildren()) {
- AndroidApkBuilder.collectNativeLibraries(new File(child.getPath()), nativeLibs, !releaseBuild);
- }
- }
- for (File nativeLib : nativeLibs) {
- myResourceTimestamps.put(FileUtil.toSystemIndependentName(nativeLib.getPath()), nativeLib.lastModified());
- }
- for (AndroidNativeLibData lib : additionalNativeLibs) {
- final String path = lib.getPath();
- myAdditionalNativeLibs.put(lib, new File(path).lastModified());
- }
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
- MyValidityState mvs = (MyValidityState)otherState;
- return mvs.myGenerateUnsignedApk == myGenerateUnsignedApk &&
- mvs.myReleaseBuild == myReleaseBuild &&
- mvs.myResourceTimestamps.equals(myResourceTimestamps) &&
- mvs.myApkPath.equals(myApkPath) &&
- mvs.myCustomKeystorePath.equals(myCustomKeystorePath) &&
- mvs.myAdditionalNativeLibs.equals(myAdditionalNativeLibs);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeInt(myResourceTimestamps.size());
- for (Map.Entry<String, Long> entry : myResourceTimestamps.entrySet()) {
- out.writeUTF(entry.getKey());
- out.writeLong(entry.getValue());
- }
- out.writeBoolean(myGenerateUnsignedApk);
- out.writeBoolean(myReleaseBuild);
- out.writeUTF(myApkPath);
- CompilerIOUtil.writeString(myCustomKeystorePath, out);
-
- out.writeInt(myAdditionalNativeLibs.size());
- for (Map.Entry<AndroidNativeLibData, Long> entry : myAdditionalNativeLibs.entrySet()) {
- final AndroidNativeLibData lib = entry.getKey();
- out.writeUTF(lib.getArchitecture());
- out.writeUTF(lib.getPath());
- out.writeUTF(lib.getTargetFileName());
- out.writeLong(entry.getValue());
- }
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidPngFilesCachingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidPngFilesCachingCompiler.java
deleted file mode 100644
index 16b40ce..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidPngFilesCachingCompiler.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package org.jetbrains.android.compiler;
-
-import com.android.sdklib.IAndroidTarget;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.HashMap;
-import com.intellij.util.containers.hash.HashSet;
-import org.jetbrains.android.compiler.tools.AndroidApt;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidPngFilesCachingCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidPngFilesCachingCompiler");
-
- @NotNull
- @Override
- public GenerationItem[] getGenerationItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<GenerationItem[]>() {
- @Override
- public GenerationItem[] compute() {
- final List<GenerationItem> items = new ArrayList<GenerationItem>();
- final Module[] modules = ModuleManager.getInstance(context.getProject()).getModules();
-
- for (Module module : modules) {
- final AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null) {
- continue;
- }
-
- final VirtualFile resourcesDir = AndroidAptCompiler.getResourceDirForApkCompiler(facet);
- if (resourcesDir == null) {
- continue;
- }
-
- final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
- if (platform == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.specify.platform", module.getName()), null, -1, -1);
- continue;
- }
-
- final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
- if (platformToolsRevision > 0 && platformToolsRevision <= 7) {
- // png files cache is supported since platform-tools-r8
- continue;
- }
-
- items.add(new MyItem(module, platform.getTarget(), resourcesDir));
- }
- return items.toArray(new GenerationItem[items.size()]);
- }
- });
- }
-
- @Override
- public GenerationItem[] generate(CompileContext context,
- GenerationItem[] items,
- VirtualFile outputRootDirectory) {
- if (items == null || items.length == 0 || !AndroidCompileUtil.isFullBuild(context)) {
- return new GenerationItem[0];
- }
-
- context.getProgressIndicator().setText("Processing PNG files...");
-
- final List<GenerationItem> processedItems = new ArrayList<GenerationItem>();
-
- for (GenerationItem GenerationItem : items) {
- final MyItem item = (MyItem)GenerationItem;
- final Module module = item.getModule();
-
- if (!AndroidCompileUtil.isModuleAffected(context, module)) {
- continue;
- }
-
- final String resDirOsPath = FileUtil.toSystemDependentName(item.getResourceDir().getPath());
-
- try {
- final String resCacheDirOsPath = AndroidCompileUtil.findResourcesCacheDirectory(module, true, context);
- if (resCacheDirOsPath == null) {
- continue;
- }
-
- final Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
- AndroidApt.crunch(item.getTarget(), Collections.singletonList(resDirOsPath), resCacheDirOsPath));
- AndroidCompileUtil.addMessages(context, messages, module);
- if (context.getMessages(CompilerMessageCategory.ERROR).length == 0) {
- processedItems.add(item);
- }
- }
- catch (IOException e) {
- final String message = e.getMessage();
- if (message != null) {
- LOG.info(e);
- context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
- }
- else {
- LOG.error(e);
- }
- }
- }
-
- return processedItems.toArray(new GenerationItem[processedItems.size()]);
- }
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android PNG files caching compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return new MyValidityState(in);
- }
-
- private static class MyItem implements GenerationItem {
- private final Module myModule;
- private final IAndroidTarget myTarget;
- private final VirtualFile myResourceDir;
- private final MyValidityState myValidityState;
-
- private MyItem(@NotNull Module module,
- @NotNull IAndroidTarget target,
- @NotNull VirtualFile resourceDir) {
- myModule = module;
- myTarget = target;
- myResourceDir = resourceDir;
- myValidityState = new MyValidityState(myTarget, myResourceDir);
- }
-
- @NotNull
- public IAndroidTarget getTarget() {
- return myTarget;
- }
-
- @NotNull
- public VirtualFile getResourceDir() {
- return myResourceDir;
- }
-
- @Override
- @NotNull
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
-
- @Nullable
- @Override
- public String getPath() {
- return null;
- }
-
- @Override
- public ValidityState getValidityState() {
- return myValidityState;
- }
- }
-
- private static class MyValidityState implements ValidityState {
- private final String myTargetHashString;
- private final Map<String, Long> myTimestamps = new HashMap<String, Long>();
-
- private MyValidityState(@NotNull IAndroidTarget target, @NotNull VirtualFile resourceDir) {
- myTargetHashString = target.hashString();
- collectPngFiles(resourceDir, new HashSet<VirtualFile>());
- }
-
- public MyValidityState(@NotNull DataInput in) throws IOException {
- myTargetHashString = in.readUTF();
-
- final int pairsCount = in.readInt();
- for (int i = 0; i < pairsCount; i++) {
- final String path = in.readUTF();
- final long timestamp = in.readLong();
- myTimestamps.put(path, timestamp);
- }
- }
-
- private void collectPngFiles(@NotNull VirtualFile file, @NotNull Set<VirtualFile> visited) {
- if (!visited.add(file)) {
- return;
- }
-
- if (file.isDirectory()) {
- for (VirtualFile child : file.getChildren()) {
- collectPngFiles(child, visited);
- }
- }
- else if (AndroidCommonUtils.PNG_EXTENSION.equals(file.getExtension())) {
- myTimestamps.put(file.getPath(), file.getTimeStamp());
- }
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
-
- final MyValidityState other = (MyValidityState)otherState;
-
- if (!Comparing.equal(myTargetHashString, other.myTargetHashString)) {
- return false;
- }
-
- return myTimestamps.equals(other.myTimestamps);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeUTF(myTargetHashString);
-
- out.writeInt(myTimestamps.size());
- for (Map.Entry<String, Long> e : myTimestamps.entrySet()) {
- out.writeUTF(e.getKey());
- out.writeLong(e.getValue());
- }
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java b/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java
index 6ada779..1130a8f 100644
--- a/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java
+++ b/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java
@@ -17,7 +17,6 @@
import com.intellij.compiler.CompilerConfiguration;
import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.compiler.server.BuildManager;
import com.intellij.facet.ProjectFacetManager;
@@ -25,7 +24,7 @@
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.compiler.*;
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
-import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
+import com.intellij.openapi.compiler.options.ExcludesConfiguration;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
@@ -82,9 +81,6 @@
// we do it here for internal mode and also to make there roots 'visibly excluded' in IDE settings
createGenModulesAndSourceRoots(project);
- if (!CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
- return prepareForCompilation(context);
- }
return true;
}
@@ -96,7 +92,7 @@
}
checkAndroidDependencies(context);
- ExcludedEntriesConfiguration configuration =
+ ExcludesConfiguration configuration =
CompilerConfiguration.getInstance(project).getExcludedEntriesConfiguration();
Set<ExcludeEntryDescription> addedEntries = new HashSet<ExcludeEntryDescription>();
@@ -329,7 +325,7 @@
}
private static void unexcludeAllSourceRoots(AndroidFacet facet,
- ExcludedEntriesConfiguration configuration) {
+ ExcludesConfiguration configuration) {
final VirtualFile[] sourceRoots = ModuleRootManager.getInstance(facet.getModule()).getSourceRoots();
final Set<VirtualFile> sourceRootSet = new HashSet<VirtualFile>();
sourceRootSet.addAll(Arrays.asList(sourceRoots));
@@ -375,7 +371,7 @@
}
private static void excludeAllSourceRoots(Module module,
- ExcludedEntriesConfiguration configuration,
+ ExcludesConfiguration configuration,
Collection<ExcludeEntryDescription> addedEntries) {
Project project = module.getProject();
VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
@@ -403,7 +399,7 @@
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
CompilerManager.getInstance(myProject).removeCompilationStatusListener(this);
- ExcludedEntriesConfiguration configuration =
+ ExcludesConfiguration configuration =
((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject)).getExcludedEntriesConfiguration();
ExcludeEntryDescription[] descriptions = configuration.getExcludeEntryDescriptions();
diff --git a/android/src/org/jetbrains/android/compiler/AndroidProguardCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidProguardCompiler.java
deleted file mode 100644
index ab13cab..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidProguardCompiler.java
+++ /dev/null
@@ -1,493 +0,0 @@
-package org.jetbrains.android.compiler;
-
-import com.android.sdklib.IAndroidTarget;
-import com.intellij.compiler.CompilerIOUtil;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.projectRoots.JavaSdkType;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.projectRoots.SdkTypeId;
-import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.HashMap;
-import com.intellij.util.containers.HashSet;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidProguardCompiler implements ClassPostProcessingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidProguardCompiler");
- public static Key<String> PROGUARD_CFG_PATHS_KEY = Key.create(AndroidCommonUtils.PROGUARD_CFG_PATHS_OPTION);
-
- @NotNull
- @Override
- public ProcessingItem[] getProcessingItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<ProcessingItem[]>() {
- @Override
- public ProcessingItem[] compute() {
- final Module[] modules = ModuleManager.getInstance(context.getProject()).getModules();
- final List<ProcessingItem> items = new ArrayList<ProcessingItem>();
-
- for (final Module module : modules) {
- final AndroidFacet facet = AndroidFacet.getInstance(module);
-
- if (facet == null || facet.isLibraryProject()) {
- continue;
- }
-
- final ProguardRunningOptions proguardRunningOptions = AndroidCompileUtil.getProguardConfigFilePathIfShouldRun(facet, context);
- if (proguardRunningOptions == null) {
- continue;
- }
- final List<String> proguardCfgPaths = proguardRunningOptions.getProguardCfgFiles();
-
- if (proguardCfgPaths.size() == 0) {
- context
- .addMessage(CompilerMessageCategory.ERROR, "Proguard config file path is not specified for module " + module.getName(), null,
- -1, -1);
- continue;
- }
- final List<VirtualFile> proguardConfigFiles = new ArrayList<VirtualFile>();
- boolean proguardCfgNotFound = false;
-
- for (String proguardCfgPath : proguardCfgPaths) {
- final VirtualFile proguardConfigFile =
- LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(proguardCfgPath));
-
- if (proguardConfigFile == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot find file " + proguardCfgPath, null, -1, -1);
- proguardCfgNotFound = true;
- break;
- }
- proguardConfigFiles.add(proguardConfigFile);
- }
-
- if (proguardCfgNotFound) {
- continue;
- }
- final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
- if (extension == null) {
- LOG.error("Cannot find compiler module extension for module " + module.getName());
- continue;
- }
-
- final VirtualFile classFilesDir = extension.getCompilerOutputPath();
- if (classFilesDir == null) {
- context
- .addMessage(CompilerMessageCategory.INFORMATION, "Output directory is not specified for module " + module.getName(), null,
- -1, -1);
- continue;
- }
-
- final VirtualFile mainContentRoot = AndroidRootUtil.getMainContentRoot(facet);
- if (mainContentRoot == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot find main content root for module " + module.getName(), null, -1, -1);
- continue;
- }
-
- final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
- if (platform == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.proguardCfgNotFound.specify.platform", module.getName()), null, -1, -1);
- continue;
- }
-
- final String logsDirOsPath = FileUtil.toSystemDependentName(mainContentRoot.getPath() + '/' + AndroidCommonUtils.DIRECTORY_FOR_LOGS_NAME);
-
- final File logsDir = new File(logsDirOsPath);
- if (!logsDir.exists()) {
- if (!logsDir.mkdirs()) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot find directory " + logsDirOsPath, null, -1, -1);
- continue;
- }
- }
-
- final List<VirtualFile> externalJars = AndroidRootUtil.getExternalLibraries(module);
- final Set<VirtualFile> classFilesDirs = new HashSet<VirtualFile>();
- final Set<VirtualFile> libClassFilesDirs = new HashSet<VirtualFile>();
-
- AndroidDexCompiler.addModuleOutputDir(classFilesDirs, classFilesDir);
-
- for (VirtualFile file : AndroidRootUtil.getDependentModules(module, classFilesDir)) {
- if (file.isDirectory()) {
- AndroidDexCompiler.addModuleOutputDir(classFilesDirs, file);
- }
- else {
- AndroidDexCompiler.addModuleOutputDir(libClassFilesDirs, file.getParent());
- }
- }
-
- final String sdkPath = platform.getSdkData().getPath();
-
- final VirtualFile outputDir = AndroidDexCompiler.getOutputDirectoryForDex(module);
- final String outputJarOsPath = FileUtil.toSystemDependentName(outputDir.getPath() + '/' + AndroidCommonUtils.PROGUARD_OUTPUT_JAR_NAME);
-
- final VirtualFile proguardCfgGeneratedByAapt = outputDir.findChild(AndroidCommonUtils.PROGUARD_CFG_OUTPUT_FILE_NAME);
- if (proguardCfgGeneratedByAapt != null) {
- proguardConfigFiles.add(proguardCfgGeneratedByAapt);
- }
-
- items.add(new MyProcessingItem(module, sdkPath, platform.getTarget(), platform.getSdkData().getSdkToolsRevision(),
- proguardConfigFiles, false, outputJarOsPath,
- classFilesDir, classFilesDirs.toArray(new VirtualFile[classFilesDirs.size()]),
- libClassFilesDirs.toArray(new VirtualFile[libClassFilesDirs.size()]),
- externalJars.toArray(new VirtualFile[externalJars.size()]), logsDirOsPath));
- }
- return items.toArray(new ProcessingItem[items.size()]);
- }
- });
- }
-
- @Nullable
- private static String getJavaExecutablePath(@NotNull Module module) {
- final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
-
- if (sdk == null) {
- return null;
- }
- final SdkTypeId sdkType = sdk.getSdkType();
-
- if (!(sdkType instanceof JavaSdkType)) {
- return null;
- }
- return ((JavaSdkType)sdkType).getVMExecutablePath(sdk);
- }
-
- @Override
- public ProcessingItem[] process(CompileContext context, ProcessingItem[] items) {
- final List<ProcessingItem> processedItems = new ArrayList<ProcessingItem>();
-
- for (ProcessingItem item : items) {
- final MyProcessingItem processingItem = (MyProcessingItem)item;
-
- if (!AndroidCompileUtil.isModuleAffected(context, processingItem.myModule)) {
- continue;
- }
- final Module module = ((MyProcessingItem)item).getModule();
- final String javaExecutablePath = getJavaExecutablePath(module);
-
- if (javaExecutablePath == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot find Java SDK for module " + module.getName(), null, -1, -1);
- continue;
- }
- final List<VirtualFile> cfgFiles = processingItem.getProguardConfigFiles();
- final String[] proguardCfgOsPaths = AndroidCompileUtil.toOsPaths(cfgFiles.toArray(new VirtualFile[cfgFiles.size()]));
-
- final String[] classFilesDirOsPaths = AndroidCompileUtil.toOsPaths(processingItem.getClassFilesDirs());
- final String[] libClassFilesDirOsPaths = AndroidCompileUtil.toOsPaths(processingItem.getLibClassFilesDirs());
- final String[] externalJarOsPaths = AndroidCompileUtil.toOsPaths(processingItem.getExternalJars());
-
- try {
- final String inputJarOsPath = AndroidCommonUtils.buildTempInputJar(classFilesDirOsPaths, libClassFilesDirOsPaths);
- final String logsDirOsPath = processingItem.getLogsDirectoryOsPath();
-
- final Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
- AndroidCommonUtils.launchProguard(processingItem.getTarget(), processingItem.getSdkToolsRevision(),
- processingItem.getSdkOsPath(), javaExecutablePath, "", proguardCfgOsPaths,
- inputJarOsPath, externalJarOsPaths, processingItem.getOutputJarOsPath(), logsDirOsPath));
-
- CompilerUtil.refreshIOFile(new File(processingItem.getOutputJarOsPath()));
-
- AndroidCompileUtil.addMessages(context, messages, processingItem.myModule);
-
- if (messages.get(CompilerMessageCategory.ERROR).isEmpty()) {
- processedItems.add(item);
- }
- }
- catch (IOException e) {
- if (e.getMessage() == null) {
- LOG.error(e);
- }
- else {
- LOG.info(e);
- context.addMessage(CompilerMessageCategory.ERROR, "I/O error: " + e.getMessage(), null, -1, -1);
- }
- }
- }
-
- return processedItems.toArray(new ProcessingItem[processedItems.size()]);
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android Proguard Runner";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return new MyValidityState(in);
- }
-
- private static class MyProcessingItem implements ProcessingItem {
- private final Module myModule;
- private final IAndroidTarget myTarget;
- private final int mySdkToolsRevision;
- private final String myOutputJarOsPath;
- private final VirtualFile myMainClassFilesDir;
- private final VirtualFile[] myClassFilesDirs;
- private final VirtualFile[] myLibClassFilesDirs;
- private final VirtualFile[] myExternalJars;
- private final String myLogsDirectoryOsPath;
- private final List<VirtualFile> myProguardConfigFiles;
- private final boolean myIncludeSystemProguardFile;
- private final String mySdkOsPath;
-
- private MyProcessingItem(@NotNull Module module,
- @NotNull String sdkOsPath,
- @NotNull IAndroidTarget target,
- int sdkToolsRevision,
- @NotNull List<VirtualFile> proguardConfigFiles,
- boolean includeSystemProguardFile,
- @NotNull String outputJarOsPath,
- @NotNull VirtualFile mainClassFilesDir,
- @NotNull VirtualFile[] classFilesDirs,
- @NotNull VirtualFile[] libCLassFilesDirs,
- @NotNull VirtualFile[] externalJars,
- @Nullable String logsDirectoryOsPath) {
- myModule = module;
- myTarget = target;
- mySdkToolsRevision = sdkToolsRevision;
- myProguardConfigFiles = proguardConfigFiles;
- myIncludeSystemProguardFile = includeSystemProguardFile;
- myOutputJarOsPath = outputJarOsPath;
- myMainClassFilesDir = mainClassFilesDir;
- mySdkOsPath = sdkOsPath;
- myClassFilesDirs = classFilesDirs;
- myLibClassFilesDirs = libCLassFilesDirs;
- myExternalJars = externalJars;
- myLogsDirectoryOsPath = logsDirectoryOsPath;
- }
-
- @NotNull
- public String getOutputJarOsPath() {
- return myOutputJarOsPath;
- }
-
- @NotNull
- public String getSdkOsPath() {
- return mySdkOsPath;
- }
-
- @NotNull
- public VirtualFile[] getClassFilesDirs() {
- return myClassFilesDirs;
- }
-
- @NotNull
- public VirtualFile[] getLibClassFilesDirs() {
- return myLibClassFilesDirs;
- }
-
- @NotNull
- @Override
- public VirtualFile getFile() {
- return myMainClassFilesDir;
- }
-
- public List<VirtualFile> getProguardConfigFiles() {
- return myProguardConfigFiles;
- }
-
- public boolean isIncludeSystemProguardFile() {
- return myIncludeSystemProguardFile;
- }
-
- @NotNull
- public VirtualFile[] getExternalJars() {
- return myExternalJars;
- }
-
- @NotNull
- public IAndroidTarget getTarget() {
- return myTarget;
- }
-
- public int getSdkToolsRevision() {
- return mySdkToolsRevision;
- }
-
- @Nullable
- public String getLogsDirectoryOsPath() {
- return myLogsDirectoryOsPath;
- }
-
- @Override
- public ValidityState getValidityState() {
- return new MyValidityState(myTarget, mySdkOsPath, myOutputJarOsPath, myClassFilesDirs, myExternalJars,
- myProguardConfigFiles, myIncludeSystemProguardFile, myLogsDirectoryOsPath);
- }
-
- @NotNull
- public Module getModule() {
- return myModule;
- }
- }
-
- private static class MyValidityState implements ValidityState {
- private final String myTargetHashString;
- private final String mySdkPath;
- private final String myOutputDirPath;
- private final String myLogsDirectoryPath;
- private final Map<String, Long> myClassFilesMap;
- private final Map<String, Long> myExternalJarsMap;
- private final Map<String, Long> myConfigFileTimestamps;
- private final boolean myIncludeSystemProguardCfg;
-
- public MyValidityState(@NotNull IAndroidTarget target,
- @NotNull String sdkOsPath,
- @NotNull String outputJarOsPath,
- @NotNull VirtualFile[] classFilesDirs,
- @NotNull VirtualFile[] externalJars,
- @NotNull List<VirtualFile> proguardConfigFiles,
- boolean includeSystemProguardCfg,
- @Nullable String logsDirectoryOsPath) {
- myTargetHashString = target.hashString();
- mySdkPath = sdkOsPath;
- myOutputDirPath = outputJarOsPath;
- myIncludeSystemProguardCfg = includeSystemProguardCfg;
-
- myClassFilesMap = new HashMap<String, Long>();
- final HashSet<VirtualFile> visited = new HashSet<VirtualFile>();
- for (VirtualFile dir : classFilesDirs) {
- fillClassFilesMap(dir, visited);
- }
-
- myExternalJarsMap = new HashMap<String, Long>();
- for (VirtualFile jar : externalJars) {
- myExternalJarsMap.put(jar.getPath(), jar.getTimeStamp());
- }
-
- myConfigFileTimestamps = new HashMap<String, Long>();
- for (VirtualFile file : proguardConfigFiles) {
- myConfigFileTimestamps.put(file.getPath(), file.getTimeStamp());
- }
- myLogsDirectoryPath = logsDirectoryOsPath != null ? logsDirectoryOsPath : "";
- }
-
- private void fillClassFilesMap(VirtualFile file, Set<VirtualFile> visited) {
- if (file.isDirectory() && visited.add(file)) {
- for (VirtualFile child : file.getChildren()) {
- fillClassFilesMap(child, visited);
- }
- }
- else if (StdFileTypes.CLASS.equals(file.getFileType())) {
- myClassFilesMap.put(file.getPath(), file.getTimeStamp());
- }
- }
-
- public MyValidityState(@NotNull DataInput in) throws IOException {
- myTargetHashString = in.readUTF();
-
- mySdkPath = CompilerIOUtil.readString(in);
- myOutputDirPath = CompilerIOUtil.readString(in);
-
- myClassFilesMap = new HashMap<String, Long>();
- final int classFilesCount = in.readInt();
-
- for (int i = 0; i < classFilesCount; i++) {
- final String path = CompilerIOUtil.readString(in);
- final long timestamp = in.readLong();
-
- myClassFilesMap.put(path, timestamp);
- }
-
- myExternalJarsMap = new HashMap<String, Long>();
- final int externalJarsCount = in.readInt();
-
- for (int i = 0; i < externalJarsCount; i++) {
- final String path = CompilerIOUtil.readString(in);
- final long timestamp = in.readLong();
-
- myExternalJarsMap.put(path, timestamp);
- }
-
- myConfigFileTimestamps = new HashMap<String, Long>();
- final int configFileCounts = in.readInt();
-
- for (int i = 0; i < configFileCounts; i++) {
- final String path = CompilerIOUtil.readString(in);
- final long timestamp = in.readLong();
- myConfigFileTimestamps.put(path, timestamp);
- }
- myIncludeSystemProguardCfg = in.readBoolean();
- myLogsDirectoryPath = CompilerIOUtil.readString(in);
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
-
- final MyValidityState other = (MyValidityState)otherState;
-
- return myTargetHashString.equals(other.myTargetHashString) &&
- mySdkPath.equals(other.mySdkPath) &&
- myOutputDirPath.equals(other.myOutputDirPath) &&
- myClassFilesMap.equals(other.myClassFilesMap) &&
- myExternalJarsMap.equals(other.myExternalJarsMap) &&
- myConfigFileTimestamps.equals(other.myConfigFileTimestamps) &&
- myIncludeSystemProguardCfg == other.myIncludeSystemProguardCfg &&
- myLogsDirectoryPath.equals(other.myLogsDirectoryPath);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeUTF(myTargetHashString);
- CompilerIOUtil.writeString(mySdkPath, out);
- CompilerIOUtil.writeString(myOutputDirPath, out);
-
- out.writeInt(myClassFilesMap.size());
- for (String path : myClassFilesMap.keySet()) {
- CompilerIOUtil.writeString(path, out);
- out.writeLong(myClassFilesMap.get(path));
- }
-
- out.writeInt(myExternalJarsMap.size());
- for (String path : myExternalJarsMap.keySet()) {
- CompilerIOUtil.writeString(path, out);
- out.writeLong(myExternalJarsMap.get(path));
- }
-
- out.writeInt(myConfigFileTimestamps.size());
- for (String path : myConfigFileTimestamps.keySet()) {
- CompilerIOUtil.writeString(path, out);
- out.writeLong(myConfigFileTimestamps.get(path));
- }
- out.writeBoolean(myIncludeSystemProguardCfg);
- CompilerIOUtil.writeString(myLogsDirectoryPath, out);
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidRenderscriptCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidRenderscriptCompiler.java
deleted file mode 100644
index 8ace258..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidRenderscriptCompiler.java
+++ /dev/null
@@ -1,353 +0,0 @@
-package org.jetbrains.android.compiler;
-
-
-import com.android.SdkConstants;
-import com.android.sdklib.IAndroidTarget;
-import com.intellij.facet.FacetManager;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.HashMap;
-import com.intellij.util.containers.HashSet;
-import org.jetbrains.android.compiler.tools.AndroidRenderscript;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import com.android.tools.idea.fileTypes.AndroidRenderscriptFileType;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidRenderscriptCompiler implements SourceGeneratingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidRenderscriptCompiler");
-
- private static final GenerationItem[] EMPTY_GENERATION_ITEM_ARRAY = {};
-
- @Nullable
- @Override
- public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
- return null;
- }
-
- @Override
- public GenerationItem[] getGenerationItems(final CompileContext context) {
- return ApplicationManager.getApplication().runReadAction(new Computable<GenerationItem[]>() {
- @Override
- public GenerationItem[] compute() {
- if (context.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- final VirtualFile[] files = context.getProjectCompileScope().getFiles(AndroidRenderscriptFileType.INSTANCE, true);
- final Map<Module, Collection<VirtualFile>> module2files = new HashMap<Module, Collection<VirtualFile>>();
-
- for (VirtualFile file : files) {
- final Module module = context.getModuleByFile(file);
-
- if (module != null) {
- Collection<VirtualFile> filesForModule = module2files.get(module);
-
- if (filesForModule == null) {
- filesForModule = new ArrayList<VirtualFile>();
- module2files.put(module, filesForModule);
- }
-
- filesForModule.add(file);
- }
- }
- final List<GenerationItem> items = new ArrayList<GenerationItem>(files.length);
-
- for (Map.Entry<Module, Collection<VirtualFile>> entry : module2files.entrySet()) {
- final Module module = entry.getKey();
- final AndroidFacet facet = FacetManager.getInstance(module).getFacetByType(AndroidFacet.ID);
- if (facet == null) {
- continue;
- }
-
- final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
- if (platform == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.specify.platform", module.getName()), null, -1, -1);
- continue;
- }
-
- final IAndroidTarget target = platform.getTarget();
- final String sdkLocation = platform.getSdkData().getPath();
-
- final String resourceDirPath = AndroidRootUtil.getResourceDirPath(facet);
- assert resourceDirPath != null;
-
- addItem(entry.getValue(), facet, resourceDirPath, sdkLocation, target, items);
- }
- return items.toArray(new GenerationItem[items.size()]);
- }
- });
- }
-
- private static void addItem(@NotNull final Collection<VirtualFile> sourceFiles,
- @NotNull final AndroidFacet facet,
- @NotNull final String resourceDirPath,
- @NotNull String sdkLocation,
- @NotNull final IAndroidTarget target,
- @NotNull final List<GenerationItem> items) {
- final String sourceRootPath = AndroidRootUtil.getRenderscriptGenSourceRootPath(facet);
- if (sourceRootPath == null) {
- return;
- }
- final String rawDirPath = resourceDirPath + '/' + SdkConstants.FD_RES_RAW;
- items.add(new MyGenerationItem(facet.getModule(), sourceFiles, rawDirPath, sdkLocation, target));
- }
-
- @Override
- public GenerationItem[] generate(final CompileContext context,
- final GenerationItem[] items,
- final VirtualFile outputRootDirectory) {
- if (items == null || items.length <= 0) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- context.getProgressIndicator().setText("Compiling RenderScript files...");
- final GenerationItem[] generationItems = doGenerate(context, items, outputRootDirectory);
- final Set<VirtualFile> generatedVFiles = new HashSet<VirtualFile>();
- final HashSet<VirtualFile> visited = new HashSet<VirtualFile>();
-
- outputRootDirectory.refresh(false, true);
- AndroidUtils.collectFiles(outputRootDirectory, visited, generatedVFiles);
-
- if (context instanceof CompileContextEx) {
- ((CompileContextEx)context).markGenerated(generatedVFiles);
- }
- return generationItems;
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return AndroidBundle.message("android.renderscript.compiler.description");
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Nullable
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return new MyValidityState(in);
- }
-
- private static GenerationItem[] doGenerate(@NotNull final CompileContext context,
- @NotNull final GenerationItem[] items,
- VirtualFile outputRootDirectory) {
- if (context.getProject().isDisposed()) {
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
-
- // we have one item per module there, so clear output directory
- final String genRootPath = FileUtil.toSystemDependentName(outputRootDirectory.getPath());
- final File genRootDir = new File(genRootPath);
- if (genRootDir.exists()) {
- if (!FileUtil.delete(genRootDir)) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot delete directory " + genRootPath, null, -1, -1);
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- if (!genRootDir.mkdir()) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot create directory " + genRootPath, null, -1, -1);
- return EMPTY_GENERATION_ITEM_ARRAY;
- }
- }
-
- final List<GenerationItem> results = new ArrayList<GenerationItem>(items.length);
- for (final GenerationItem item : items) {
- if (item instanceof MyGenerationItem) {
- final MyGenerationItem genItem = (MyGenerationItem)item;
-
- if (!AndroidCompileUtil.isModuleAffected(context, genItem.myModule)) {
- continue;
- }
-
- boolean success = true;
-
- for (final VirtualFile sourceFile : genItem.myFiles) {
- final String depFolderOsPath = getDependencyFolder(context.getProject(), sourceFile, outputRootDirectory);
-
- try {
- final Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
- AndroidRenderscript
- .execute(genItem.mySdkLocation, genItem.myAndroidTarget, sourceFile.getPath(), genRootPath,
- depFolderOsPath,
- genItem.myRawDirPath));
- AndroidCompileUtil.markDirty(outputRootDirectory, true);
-
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) {
- return;
- }
- addMessages(context, messages, sourceFile.getUrl());
- }
- });
-
- if (messages.get(CompilerMessageCategory.ERROR).size() > 0) {
- success = false;
- }
- }
- catch (final IOException e) {
- LOG.info(e);
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) return;
- context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), sourceFile.getUrl(), -1, -1);
- }
- });
- success = false;
- }
- }
-
- if (success) {
- results.add(genItem);
- }
- }
- }
- outputRootDirectory.refresh(false, true);
- return results.toArray(new GenerationItem[results.size()]);
- }
-
- private static void addMessages(@NotNull final CompileContext context,
- @NotNull final Map<CompilerMessageCategory, List<String>> messages,
- @NotNull final String url) {
- for (final CompilerMessageCategory category : messages.keySet()) {
- final List<String> messageList = messages.get(category);
- for (final String message : messageList) {
- context.addMessage(category, message, url, -1, -1);
- }
- }
- }
-
- @Nullable
- static String getDependencyFolder(@NotNull final Project project,
- @NotNull final VirtualFile sourceFile,
- @NotNull final VirtualFile genFolder) {
- final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
-
- final VirtualFile sourceRoot = index.getSourceRootForFile(sourceFile);
- if (sourceRoot == null) {
- return null;
- }
-
- final VirtualFile parent = sourceFile.getParent();
- if (Comparing.equal(parent, sourceRoot)) {
- return genFolder.getPath();
- }
-
- final String relativePath = VfsUtilCore.getRelativePath(sourceFile.getParent(), sourceRoot, '/');
- assert relativePath != null;
- return genFolder.getPath() + '/' + relativePath;
- }
-
- private static class MyGenerationItem implements GenerationItem {
- final Module myModule;
- final String mySdkLocation;
- final Collection<VirtualFile> myFiles;
- final IAndroidTarget myAndroidTarget;
- final String myRawDirPath;
- private final MyValidityState myValidityState;
-
- public MyGenerationItem(@NotNull Module module,
- @NotNull Collection<VirtualFile> files,
- @NotNull String rawDirPath,
- @NotNull String sdkLocation,
- @NotNull IAndroidTarget target) {
- myModule = module;
- myFiles = files;
- myRawDirPath = rawDirPath;
- mySdkLocation = sdkLocation;
- myAndroidTarget = target;
- myValidityState = new MyValidityState(myFiles);
- }
-
- @Override
- @Nullable
- public String getPath() {
- return "";
- }
-
- @Override
- @Nullable
- public ValidityState getValidityState() {
- return myValidityState;
- }
-
- @Override
- public Module getModule() {
- return myModule;
- }
-
- @Override
- public boolean isTestSource() {
- return false;
- }
- }
-
- private static class MyValidityState implements ValidityState {
- private final Map<String, Long> myTimestamps = new HashMap<String, Long>();
-
- MyValidityState(DataInput in) throws IOException {
- final int size = in.readInt();
-
- for (int i = 0; i < size; i++) {
- final String path = in.readUTF();
- final long timestamp = in.readLong();
-
- myTimestamps.put(path, timestamp);
- }
- }
-
- MyValidityState(@NotNull Collection<VirtualFile> files) {
- for (VirtualFile file : files) {
- myTimestamps.put(file.getPath(), file.getTimeStamp());
- }
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
- return ((MyValidityState)otherState).myTimestamps.equals(myTimestamps);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeInt(myTimestamps.size());
-
- for (Map.Entry<String, Long> entry : myTimestamps.entrySet()) {
- out.writeUTF(entry.getKey());
- out.writeLong(entry.getValue());
- }
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/AndroidResourcesPackagingCompiler.java b/android/src/org/jetbrains/android/compiler/AndroidResourcesPackagingCompiler.java
deleted file mode 100644
index 6f63ee8..0000000
--- a/android/src/org/jetbrains/android/compiler/AndroidResourcesPackagingCompiler.java
+++ /dev/null
@@ -1,392 +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.compiler;
-
-import com.android.sdklib.IAndroidTarget;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.encoding.EncodingManager;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.android.compiler.tools.AndroidApt;
-import org.jetbrains.android.dom.manifest.Application;
-import org.jetbrains.android.dom.manifest.Manifest;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidFacetConfiguration;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCompiler {
- private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.AndroidResourcesPackagingCompiler");
-
- public static final String RELEASE_SUFFIX = ".release";
-
- @NotNull
- @Override
- public ProcessingItem[] getProcessingItems(CompileContext context) {
- final List<ProcessingItem> items = new ArrayList<ProcessingItem>();
- for (Module module : ModuleManager.getInstance(context.getProject()).getModules()) {
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet != null && !facet.isLibraryProject()) {
- VirtualFile manifestFile = AndroidRootUtil.getManifestFileForCompiler(facet);
-
- final ArrayList<String> assetDirPathsList = new ArrayList<String>();
- collectAssetDirs(facet, assetDirPathsList);
- final String[] assetDirPaths = ArrayUtil.toStringArray(assetDirPathsList);
-
- if (manifestFile == null) {
- context.addMessage(CompilerMessageCategory.ERROR,
- AndroidBundle.message("android.compilation.error.manifest.not.found", module.getName()), null, -1, -1);
- continue;
- }
- AndroidFacetConfiguration configuration = facet.getConfiguration();
- VirtualFile outputDir = AndroidDexCompiler.getOutputDirectoryForDex(module);
- if (outputDir != null) {
- String outputPath = getOutputFile(module, outputDir).getPath();
-
- final AndroidPlatform platform = configuration.getAndroidPlatform();
-
- if (platform != null) {
- String[] resourcesDirPaths = AndroidCompileUtil.collectResourceDirs(facet, true, context);
- final IAndroidTarget target = platform.getTarget();
- final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
-
- if (resourcesDirPaths.length == 0) {
- context.addMessage(CompilerMessageCategory.WARNING, "Resource directory not found for module " + module.getName(),
- null, -1, -1);
- }
-
- items.add(new MyItem(module, target, platformToolsRevision, manifestFile, resourcesDirPaths, assetDirPaths, outputPath,
- false, AndroidCompileUtil.isReleaseBuild(context)));
- //items.add(new MyItem(module, target, manifestFile, resourcesDirPaths, assetsDirPath, outputPath + RELEASE_SUFFIX, true));
- }
- }
- }
- }
- return items.toArray(new ProcessingItem[items.size()]);
- }
-
- private static void collectAssetDirs(@NotNull AndroidFacet facet, @NotNull List<String> result) {
- final VirtualFile assetsDir = AndroidRootUtil.getAssetsDir(facet);
- if (assetsDir != null) {
- result.add(FileUtil.toSystemDependentName(assetsDir.getPath()));
- }
- if (facet.getConfiguration().isIncludeAssetsFromLibraries()) {
- for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(facet.getModule(), true)) {
- final VirtualFile depAssetsDir = AndroidRootUtil.getAssetsDir(depFacet);
-
- if (depAssetsDir != null) {
- result.add(FileUtil.toSystemDependentName(depAssetsDir.getPath()));
- }
- }
- }
- }
-
- static File getOutputFile(Module module, VirtualFile outputDir) {
- return new File(outputDir.getPath(), module.getName() + ".apk.res");
- }
-
- @Override
- public ProcessingItem[] process(final CompileContext context, ProcessingItem[] items) {
- if (!AndroidCompileUtil.isFullBuild(context)) {
- return ProcessingItem.EMPTY_ARRAY;
- }
-
- context.getProgressIndicator().setText("Packaging Android resources...");
- final List<ProcessingItem> result = new ArrayList<ProcessingItem>();
- for (ProcessingItem processingItem : items) {
- MyItem item = (MyItem)processingItem;
-
- if (!AndroidCompileUtil.isModuleAffected(context, item.myModule)) {
- continue;
- }
-
- doProcess(context, item, false);
-
- if (context.getMessages(CompilerMessageCategory.ERROR).length == 0) {
- doProcess(context, item, true);
- }
-
- if (context.getMessages(CompilerMessageCategory.ERROR).length == 0) {
- result.add(item);
- }
- }
- return result.toArray(new ProcessingItem[result.size()]);
- }
-
- private static void doProcess(final CompileContext context, MyItem item, boolean releasePackage) {
- if (!AndroidPackagingCompiler.shouldGenerateApk(item.myModule, context, releasePackage)) {
- return;
- }
-
- final VirtualFile preprocessedManifestFile;
- File manifestTmpDir = null;
-
- try {
- if (releasePackage) {
- preprocessedManifestFile = item.myManifestFile;
- }
- else {
- final Pair<VirtualFile, File> pair = copyManifestAndSetDebuggableToTrue(item.myModule, item.myManifestFile);
- preprocessedManifestFile = pair.getFirst();
- manifestTmpDir = pair.getSecond();
- }
- }
- catch (IOException e) {
- LOG.info(e);
- context.addMessage(CompilerMessageCategory.ERROR,
- '[' + item.myModule.getName() + "] Cannot preprocess AndroidManifest.xml for debug build",
- item.myManifestFile.getUrl(), -1, -1);
- return;
- }
-
- final Map<VirtualFile, VirtualFile> presentableFilesMap = Collections.singletonMap(item.myManifestFile, preprocessedManifestFile);
-
- try {
- final String outputPath = releasePackage
- ? item.myOutputPath + RELEASE_SUFFIX
- : item.myOutputPath;
-
- Map<CompilerMessageCategory, List<String>> messages = AndroidCompileUtil.toCompilerMessageCategoryKeys(
- AndroidApt.packageResources(item.myAndroidTarget,
- item.myPlatformToolsRevision,
- preprocessedManifestFile.getPath(),
- item.myResourceDirPaths,
- item.myAssetsDirPaths,
- outputPath, null, !releasePackage, 0, null, "", new FileFilter() {
- @Override
- public boolean accept(File file) {
- final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
- return vFile != null && !ProjectRootManager.getInstance(context.getProject()).getFileIndex().isIgnored(vFile);
- }
- }));
-
- AndroidCompileUtil.addMessages(context, messages, presentableFilesMap, item.myModule);
- }
- catch (final IOException e) {
- LOG.info(e);
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- if (context.getProject().isDisposed()) return;
- context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
- }
- });
- }
- finally {
- if (manifestTmpDir != null) {
- FileUtil.delete(manifestTmpDir);
- }
- }
- }
-
- @NotNull
- private static Pair<VirtualFile, File> copyManifestAndSetDebuggableToTrue(@NotNull final Module module, @NotNull final VirtualFile manifestFile)
- throws IOException {
-
- final File dir = FileUtil.createTempDirectory("android_manifest_copy", "tmp");
- final VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir);
- if (vDir == null) {
- throw new IOException("Cannot create temp directory for manifest copy");
- }
-
- final VirtualFile[] manifestFileCopy = new VirtualFile[1];
-
- ApplicationManager.getApplication().invokeAndWait(new Runnable() {
- @Override
- public void run() {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- @Override
- public void run() {
- try {
- manifestFileCopy[0] = manifestFile.copy(module.getProject(), vDir, manifestFile.getName());
- }
- catch (IOException e) {
- LOG.info(e);
- return;
- }
-
- if (manifestFileCopy[0] == null) {
- return;
- }
-
- final Manifest manifestInCopy = AndroidUtils.loadDomElement(module, manifestFileCopy[0], Manifest.class);
- if (manifestInCopy == null) {
- return;
- }
-
- final Application applicationInCopy = manifestInCopy.getApplication();
- if (applicationInCopy == null) {
- return;
- }
- applicationInCopy.getDebuggable().setValue(Boolean.TRUE.toString());
- }
- });
-
- if (manifestFileCopy[0] != null) {
- EncodingManager.getInstance().setEncoding(manifestFileCopy[0], null);
- }
-
- ApplicationManager.getApplication().saveAll();
- }
- }, ModalityState.defaultModalityState());
-
- if (manifestFileCopy[0] == null) {
- FileUtil.delete(dir);
- throw new IOException("Cannot copy manifest file to " + vDir.getPath());
- }
- return Pair.create(manifestFileCopy[0], dir);
- }
-
- @NotNull
- @Override
- public String getDescription() {
- return "Android Resources Packaging Compiler";
- }
-
- @Override
- public boolean validateConfiguration(CompileScope scope) {
- return true;
- }
-
- @Override
- public ValidityState createValidityState(DataInput in) throws IOException {
- return new MyValidityState(in);
- }
-
- private static class MyItem implements ProcessingItem {
- final Module myModule;
- final VirtualFile myManifestFile;
- final IAndroidTarget myAndroidTarget;
- final String[] myResourceDirPaths;
- final String[] myAssetsDirPaths;
- final String myOutputPath;
-
- private final boolean myFileExists;
- private final boolean myGenerateUnsignedApk;
- private boolean myReleaseBuild;
- final int myPlatformToolsRevision;
-
- private MyItem(Module module,
- IAndroidTarget androidTarget,
- int platformToolsRevision,
- VirtualFile manifestFile,
- String[] resourceDirPaths,
- String[] assetsDirPath,
- String outputPath,
- boolean generateUnsignedApk,
- boolean releaseBuild) {
- myModule = module;
- myAndroidTarget = androidTarget;
- myPlatformToolsRevision = platformToolsRevision;
- myManifestFile = manifestFile;
- myResourceDirPaths = resourceDirPaths;
- myAssetsDirPaths = assetsDirPath;
- myOutputPath = outputPath;
- myFileExists = new File(outputPath).exists();
- myGenerateUnsignedApk = generateUnsignedApk;
- myReleaseBuild = releaseBuild;
- }
-
- @NotNull
- @Override
- public VirtualFile getFile() {
- VirtualFile moduleFile = myModule.getModuleFile();
- return moduleFile != null ? moduleFile : myManifestFile;
- }
-
- @Override
- public ValidityState getValidityState() {
- return new MyValidityState(myModule, myFileExists, myGenerateUnsignedApk, myReleaseBuild, myPlatformToolsRevision);
- }
- }
-
- private static class MyValidityState extends ResourcesValidityState {
- private final boolean myOutputFileExists;
- private final boolean myGenerateUnsignedApk;
- private final boolean myReleaseBuild;
- private final int myPlatformToolsRevision;
-
- public MyValidityState(Module module,
- boolean outputFileExists,
- boolean generateUnsignedApk,
- boolean releaseBuild,
- int platformToolsRevision) {
- super(module);
- myOutputFileExists = outputFileExists;
- myGenerateUnsignedApk = generateUnsignedApk;
- myReleaseBuild = releaseBuild;
- myPlatformToolsRevision = platformToolsRevision;
- }
-
- public MyValidityState(DataInput is) throws IOException {
- super(is);
- myGenerateUnsignedApk = is.readBoolean();
- myReleaseBuild = is.readBoolean();
- myOutputFileExists = true;
- myPlatformToolsRevision = is.readInt();
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof MyValidityState)) {
- return false;
- }
- final MyValidityState otherState1 = (MyValidityState)otherState;
- if (myOutputFileExists != otherState1.myOutputFileExists) {
- return false;
- }
- if (myGenerateUnsignedApk != otherState1.myGenerateUnsignedApk) {
- return false;
- }
- if (myReleaseBuild != otherState1.myReleaseBuild) {
- return false;
- }
- if (myPlatformToolsRevision != otherState1.myPlatformToolsRevision) {
- return false;
- }
- return super.equalsTo(otherState);
- }
-
- @Override
- public void save(DataOutput os) throws IOException {
- super.save(os);
- os.writeBoolean(myGenerateUnsignedApk);
- os.writeBoolean(myReleaseBuild);
- os.writeInt(myPlatformToolsRevision);
- }
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/ResourcesValidityState.java b/android/src/org/jetbrains/android/compiler/ResourcesValidityState.java
deleted file mode 100644
index 30f7923..0000000
--- a/android/src/org/jetbrains/android/compiler/ResourcesValidityState.java
+++ /dev/null
@@ -1,147 +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.compiler;
-
-import com.android.sdklib.IAndroidTarget;
-import com.intellij.openapi.compiler.ValidityState;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.android.facet.AndroidFacet;
-import org.jetbrains.android.facet.AndroidFacetConfiguration;
-import org.jetbrains.android.facet.AndroidRootUtil;
-import org.jetbrains.android.sdk.AndroidPlatform;
-import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author yole
- */
-public class ResourcesValidityState implements ValidityState {
- private final Map<String, Long> myResourceTimestamps = new HashMap<String, Long>();
- private final String myAndroidTargetName;
-
- public ResourcesValidityState(Module module) {
- AndroidFacet facet = AndroidFacet.getInstance(module);
- if (facet == null) {
- myAndroidTargetName = "";
- return;
- }
-
- final AndroidFacetConfiguration configuration = facet.getConfiguration();
- AndroidPlatform platform = configuration.getAndroidPlatform();
- IAndroidTarget target = platform != null ? platform.getTarget() : null;
- myAndroidTargetName = target != null ? target.getFullName() : "";
-
- // we need to use getManifestFile, not getManifestFileForCompiler, because MavenResourceCompiler spoils filtered manifest and it
- // becomes dirty in the next session. Actually we can pass filtered manifest to compiler ONLY after AndroidMavenResourcesCompiler
- // performed task, but MavenResourceCompiler not yet
-
- VirtualFile manifestFile = AndroidRootUtil.getManifestFile(facet);
- if (manifestFile != null) {
- myResourceTimestamps.put(manifestFile.getPath(), manifestFile.getTimeStamp());
- }
- VirtualFile resourcesDir = getResourcesDir(facet);
- if (resourcesDir != null) {
- collectFiles(resourcesDir);
- }
- VirtualFile assetsDir = AndroidRootUtil.getAssetsDir(facet);
- if (assetsDir != null) {
- collectFiles(assetsDir);
- }
- for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, true)) {
- VirtualFile depManifest = AndroidRootUtil.getManifestFile(depFacet);
- if (depManifest != null) {
- myResourceTimestamps.put(depManifest.getPath(), depManifest.getTimeStamp());
- }
- VirtualFile depResDir = getResourcesDir(depFacet);
- if (depResDir != null) {
- collectFiles(depResDir);
- }
- if (configuration.isIncludeAssetsFromLibraries()) {
- final VirtualFile depAssetDir = AndroidRootUtil.getAssetsDir(depFacet);
- if (depAssetDir != null) {
- collectFiles(depAssetDir);
- }
- }
- }
- }
-
- @Nullable
- private static VirtualFile getResourcesDir(@NotNull AndroidFacet facet) {
- // same as with manifest file we check timestamps of NOT filtered resources, because MavenResourceCompiler spoils
- // filtered ones and it and they becomes dirty in the next session. Actually we can pass filtered resources to compiler ONLY after
- // AndroidMavenResourcesCompiler performed task, but MavenResourceCompiler not yet
-
- VirtualFile dir = AndroidAptCompiler.getResourceDirForApkCompiler(facet);
- if (dir != null) {
- VirtualFile parent = dir.getParent();
- if ("combined-resources".equals(parent.getName())) {
- return dir;
- }
- }
- return AndroidRootUtil.getResourceDir(facet);
- }
-
- private void collectFiles(VirtualFile resourcesDir) {
- for (VirtualFile child : resourcesDir.getChildren()) {
- if (child.isDirectory()) {
- collectFiles(child);
- }
- else {
- myResourceTimestamps.put(child.getPath(), child.getTimeStamp());
- }
- }
- }
-
- public ResourcesValidityState(DataInput is) throws IOException {
- int count = is.readInt();
- for (int i = 0; i < count; i++) {
- String path = is.readUTF();
- long timestamp = is.readLong();
- myResourceTimestamps.put(path, timestamp);
- }
- myAndroidTargetName = is.readUTF();
- }
-
- @Override
- public boolean equalsTo(ValidityState otherState) {
- if (!(otherState instanceof ResourcesValidityState)) {
- return false;
- }
- ResourcesValidityState rhs = (ResourcesValidityState)otherState;
- if (!myResourceTimestamps.equals(rhs.myResourceTimestamps)) {
- return false;
- }
- return true;
- }
-
- @Override
- public void save(DataOutput os) throws IOException {
- os.writeInt(myResourceTimestamps.size());
- for (Map.Entry<String, Long> e : myResourceTimestamps.entrySet()) {
- os.writeUTF(e.getKey());
- os.writeLong(e.getValue());
- }
- os.writeUTF(myAndroidTargetName);
- }
-}
diff --git a/android/src/org/jetbrains/android/compiler/artifact/AndroidApplicationArtifactProperties.java b/android/src/org/jetbrains/android/compiler/artifact/AndroidApplicationArtifactProperties.java
index d3a7770..15ac6f1 100644
--- a/android/src/org/jetbrains/android/compiler/artifact/AndroidApplicationArtifactProperties.java
+++ b/android/src/org/jetbrains/android/compiler/artifact/AndroidApplicationArtifactProperties.java
@@ -4,14 +4,15 @@
import com.intellij.openapi.compiler.CompilerMessageCategory;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactProperties;
import com.intellij.packaging.ui.ArtifactEditorContext;
import com.intellij.packaging.ui.ArtifactPropertiesEditor;
+import com.intellij.util.Base64;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.intellij.util.xmlb.annotations.Transient;
-import org.apache.commons.codec.binary.Base64;
import org.jetbrains.android.compiler.AndroidCompileUtil;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.sdk.AndroidPlatform;
@@ -78,7 +79,7 @@
? getPlainKeyPassword() : null;
try {
final Map<AndroidCompilerMessageKind,List<String>> messages =
- AndroidCommonUtils.buildArtifact(artifactName, messagePrefix, sdkLocation, artifactFilePath,
+ AndroidCommonUtils.buildArtifact(artifactName, messagePrefix, sdkLocation, platform.getTarget(), artifactFilePath,
keyStorePath, myKeyAlias, keyStorePassword, keyPassword);
AndroidCompileUtil.addMessages(context, AndroidCompileUtil.toCompilerMessageCategoryKeys(messages), null);
}
@@ -148,23 +149,23 @@
@Transient
@NotNull
public String getPlainKeystorePassword() {
- return new String(new Base64().decode(myKeyStorePassword.getBytes()));
+ return new String(Base64.decode(myKeyStorePassword));
}
@Transient
public void setPlainKeystorePassword(@NotNull String password) {
- myKeyStorePassword = new String(new Base64().encode(password.getBytes()));
+ myKeyStorePassword = Base64.encode(password.getBytes(CharsetToolkit.UTF8_CHARSET));
}
@Transient
@NotNull
public String getPlainKeyPassword() {
- return new String(new Base64().decode(myKeyPassword.getBytes()));
+ return new String(Base64.decode(myKeyPassword), CharsetToolkit.UTF8_CHARSET);
}
@Transient
public void setPlainKeyPassword(@NotNull String password) {
- myKeyPassword = new String(new Base64().encode(password.getBytes()));
+ myKeyPassword = Base64.encode(password.getBytes(CharsetToolkit.UTF8_CHARSET));
}
public boolean isRunProGuard() {
diff --git a/android/src/org/jetbrains/android/compiler/artifact/AndroidFinalPackageElement.java b/android/src/org/jetbrains/android/compiler/artifact/AndroidFinalPackageElement.java
index d22ed96..31a85e5 100644
--- a/android/src/org/jetbrains/android/compiler/artifact/AndroidFinalPackageElement.java
+++ b/android/src/org/jetbrains/android/compiler/artifact/AndroidFinalPackageElement.java
@@ -6,10 +6,12 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.elements.*;
+import com.intellij.packaging.elements.AntCopyInstructionCreator;
+import com.intellij.packaging.elements.ArtifactAntGenerationContext;
+import com.intellij.packaging.elements.PackagingElement;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
import com.intellij.packaging.impl.elements.FacetBasedPackagingElement;
import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement;
import com.intellij.packaging.impl.ui.DelegatedPackagingElementPresentation;
@@ -81,20 +83,6 @@
return Collections.emptyList();
}
- @Override
- public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
- @NotNull PackagingElementResolvingContext resolvingContext,
- @NotNull ArtifactIncrementalCompilerContext compilerContext,
- @NotNull ArtifactType artifactType) {
- final String apkPath = getApkPath();
- if (apkPath != null) {
- final VirtualFile apk = JarFileSystem.getInstance().findFileByPath(apkPath);
- if (apk != null && apk.isValid() && apk.isDirectory()) {
- creator.addDirectoryCopyInstructions(apk);
- }
- }
- }
-
@Nullable
public AndroidFacet getFacet() {
return myFacetPointer != null ? myFacetPointer.getFacet() : null;
diff --git a/android/src/org/jetbrains/android/diagnostics/error/IdeaITNProxy.java b/android/src/org/jetbrains/android/diagnostics/error/IdeaITNProxy.java
index b556596..3596ef2 100644
--- a/android/src/org/jetbrains/android/diagnostics/error/IdeaITNProxy.java
+++ b/android/src/org/jetbrains/android/diagnostics/error/IdeaITNProxy.java
@@ -16,109 +16,33 @@
package org.jetbrains.android.diagnostics.error;
import com.android.tools.idea.gradle.util.Projects;
-import com.intellij.diagnostic.DiagnosticBundle;
-import com.intellij.openapi.diagnostic.Attachment;
import com.intellij.errorreport.bean.ErrorBean;
-import com.intellij.errorreport.error.InternalEAPException;
-import com.intellij.errorreport.error.NoSuchEAPUserException;
-import com.intellij.errorreport.error.UpdateAvailableException;
import com.intellij.openapi.application.Application;
-import com.intellij.openapi.application.ApplicationInfo;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
+import com.intellij.openapi.diagnostic.Attachment;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SystemProperties;
-import com.intellij.util.net.HttpConfigurable;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Iterator;
import java.util.List;
-/**
- * Created by IntelliJ IDEA.
- * User: stathik
- * Date: Aug 4, 2003
- * Time: 8:12:00 PM
- * To change this template use Options | File Templates.
- * This is a copy of {@link com.intellij.errorreport.itn.ITNProxy}
- */
public class IdeaITNProxy {
- @NonNls public static final String ENCODING = "UTF8";
- public static final String POST_DELIMITER = "&";
-
- @NonNls public static final String NEW_THREAD_URL = "http://www.intellij.net/trackerRpc/idea/createScr";
-
- @NonNls private static final String HTTP_CONTENT_LENGTH = "Content-Length";
- @NonNls private static final String HTTP_CONTENT_TYPE = "Content-Type";
- @NonNls private static final String HTTP_WWW_FORM = "application/x-www-form-urlencoded";
- @NonNls private static final String HTTP_POST = "POST";
-
- public static int postNewThread (String login, String password, ErrorBean error, String compilationTimestamp)
- throws IOException, NoSuchEAPUserException, InternalEAPException, UpdateAvailableException {
-
- @NonNls List<Pair<String, String>> params =
- getKeyValuePairs(login, password, error, compilationTimestamp,
- ApplicationManager.getApplication(),
- (ApplicationInfoEx)ApplicationInfo.getInstance(),
- ApplicationNamesInfo.getInstance(), UpdateSettings.getInstance());
-
- HttpURLConnection connection = post(new URL(NEW_THREAD_URL), join(params));
- int responseCode = connection.getResponseCode();
-
- if (responseCode != HttpURLConnection.HTTP_OK) {
- throw new InternalEAPException(DiagnosticBundle.message("error.http.result.code", responseCode));
- }
-
- String reply;
-
- InputStream is = new BufferedInputStream(connection.getInputStream());
- try {
- reply = readFrom(is);
- } finally {
- is.close();
- }
-
- if ("unauthorized".equals(reply)) {
- throw new NoSuchEAPUserException(login);
- }
-
- if (reply.startsWith("update ")) {
- throw new UpdateAvailableException(reply.substring(7));
- }
-
- if (reply.startsWith("message ")) {
- throw new InternalEAPException(reply.substring(8));
- }
-
- try {
- return Integer.valueOf(reply.trim()).intValue();
- } catch (NumberFormatException ex) {
- // Tibor!!!! :-E
- throw new InternalEAPException(DiagnosticBundle.message("error.itn.returns.wrong.data"));
- }
- }
-
public static List<Pair<String, String>> getKeyValuePairs(@Nullable String login,
- @Nullable String password,
- ErrorBean error,
- String compilationTimestamp,
- Application application,
- ApplicationInfoEx appInfo,
- ApplicationNamesInfo namesInfo,
- UpdateSettings updateSettings) {
- @NonNls List<Pair<String,String>> params = new ArrayList<Pair<String, String>>();
+ @Nullable String password,
+ ErrorBean error,
+ String compilationTimestamp,
+ Application application,
+ ApplicationInfoEx appInfo,
+ ApplicationNamesInfo namesInfo,
+ UpdateSettings updateSettings) {
+ List<Pair<String, String>> params = new ArrayList<Pair<String, String>>();
params.add(Pair.create("protocol.version", "1"));
@@ -128,7 +52,6 @@
}
params.add(Pair.create("os.name", SystemProperties.getOsName()));
-
params.add(Pair.create("java.version", SystemProperties.getJavaVersion()));
params.add(Pair.create("java.vm.vendor", SystemProperties.getJavaVmVendor()));
@@ -156,7 +79,6 @@
params.add(Pair.create("error.message", error.getMessage()));
params.add(Pair.create("error.stacktrace", error.getStackTrace()));
-
params.add(Pair.create("error.description", error.getDescription()));
params.add(Pair.create("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId())));
@@ -174,61 +96,7 @@
return params;
}
- private static String readFrom(InputStream is) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- int c;
- while ((c = is.read()) != -1) {
- out.write(c);
- }
- String s = out.toString();
- out.close();
- return s;
- }
-
private static String format(Calendar calendar) {
- return calendar == null ? "" : Long.toString(calendar.getTime().getTime());
- }
-
- private static HttpURLConnection post(URL url, byte[] bytes) throws IOException {
- HttpURLConnection connection = (HttpURLConnection)HttpConfigurable.getInstance().openConnection(url.toString());
-
- connection.setReadTimeout(10 * 1000);
- connection.setConnectTimeout(10 * 1000);
- connection.setRequestMethod(HTTP_POST);
- connection.setDoInput(true);
- connection.setDoOutput(true);
- connection.setRequestProperty(HTTP_CONTENT_TYPE, String.format("%s; charset=%s", HTTP_WWW_FORM, ENCODING));
- connection.setRequestProperty(HTTP_CONTENT_LENGTH, Integer.toString(bytes.length));
-
- OutputStream out = new BufferedOutputStream(connection.getOutputStream());
- try {
- out.write(bytes);
- out.flush();
- } finally {
- out.close();
- }
-
- return connection;
- }
-
- private static byte[] join(List<Pair<String, String>> params) throws UnsupportedEncodingException {
- StringBuilder builder = new StringBuilder();
-
- Iterator<Pair<String, String>> it = params.iterator();
-
- while (it.hasNext()) {
- Pair<String, String> param = it.next();
-
- if (StringUtil.isEmpty(param.first))
- throw new IllegalArgumentException(param.toString());
-
- if (StringUtil.isNotEmpty(param.second))
- builder.append(param.first).append("=").append(URLEncoder.encode(param.second, ENCODING));
-
- if (it.hasNext())
- builder.append(POST_DELIMITER);
- }
-
- return builder.toString().getBytes();
+ return calendar == null ? "" : Long.toString(calendar.getTime().getTime());
}
}
diff --git a/android/src/org/jetbrains/android/dom/AndroidXmlExtension.java b/android/src/org/jetbrains/android/dom/AndroidXmlExtension.java
index b52184b..216259c 100644
--- a/android/src/org/jetbrains/android/dom/AndroidXmlExtension.java
+++ b/android/src/org/jetbrains/android/dom/AndroidXmlExtension.java
@@ -19,7 +19,6 @@
import com.intellij.lang.ASTNode;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.impl.DirectoryIndex;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiFile;
@@ -49,10 +48,6 @@
public boolean isAvailable(final PsiFile file) {
if (file instanceof XmlFile) {
Project project = file.getProject();
- if (!project.isDefault() && !DirectoryIndex.getInstance(project).isInitialized()) {
- return false;
- }
-
if (AndroidFacet.getInstance(file) == null) {
return false;
}
diff --git a/android/src/org/jetbrains/android/dom/animation/AndroidAnimationUtils.java b/android/src/org/jetbrains/android/dom/animation/AndroidAnimationUtils.java
index c430e56..d5275d3 100644
--- a/android/src/org/jetbrains/android/dom/animation/AndroidAnimationUtils.java
+++ b/android/src/org/jetbrains/android/dom/animation/AndroidAnimationUtils.java
@@ -42,7 +42,8 @@
private AndroidAnimationUtils() {
}
- private static final String[] TAG_NAMES = {"set", "alpha", "scale", "translate", "rotate", "layoutAnimation", "gridLayoutAnimation"};
+ private static final String[] TAG_NAMES = {"set", "alpha", "scale", "translate",
+ "rotate", "layoutAnimation","gridLayoutAnimation", "animation-list"};
public static String getStyleableNameByTagName(@NotNull String tagName) {
if (tagName.equals("set")) {
diff --git a/android/src/org/jetbrains/android/dom/converters/AndroidPackageConverter.java b/android/src/org/jetbrains/android/dom/converters/AndroidPackageConverter.java
index e657ea1..084b5ba 100644
--- a/android/src/org/jetbrains/android/dom/converters/AndroidPackageConverter.java
+++ b/android/src/org/jetbrains/android/dom/converters/AndroidPackageConverter.java
@@ -100,7 +100,7 @@
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
- return PsiElementResolveResult.createResults(new PsiElement[]{myElement});
+ return PsiElementResolveResult.createResults(myElement);
}
@Override
diff --git a/android/src/org/jetbrains/android/dom/converters/FlagConverter.java b/android/src/org/jetbrains/android/dom/converters/FlagConverter.java
index c5338c7..389c38e 100644
--- a/android/src/org/jetbrains/android/dom/converters/FlagConverter.java
+++ b/android/src/org/jetbrains/android/dom/converters/FlagConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,16 +15,12 @@
*/
package org.jetbrains.android.dom.converters;
-import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
import com.intellij.util.ArrayUtil;
import com.intellij.util.xml.ConvertContext;
-import com.intellij.util.xml.GenericAttributeValue;
import com.intellij.util.xml.GenericDomValue;
import com.intellij.util.xml.ResolvingConverter;
import com.intellij.util.xml.converters.DelimitedListConverter;
-import com.intellij.xml.util.XmlTagUtil;
import org.jetbrains.android.util.AndroidBundle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -77,25 +73,6 @@
return ArrayUtil.toStringArray(variants);
}
- @NotNull
- @Override
- protected PsiReference createPsiReference(PsiElement element,
- int start,
- int end,
- ConvertContext context,
- GenericDomValue<List<String>> value,
- boolean delimitersOnly) {
- return new MyPsiReference(element, getTextRange(value, start, end), context, value, delimitersOnly);
- }
-
- protected static TextRange getTextRange(GenericDomValue value, int start, int end) {
- if (value instanceof GenericAttributeValue) {
- return new TextRange(start, end);
- }
- TextRange tagRange = XmlTagUtil.getTrimmedValueRange(value.getXmlTag());
- return new TextRange(tagRange.getStartOffset() + start - 1, tagRange.getStartOffset() + end - 1);
- }
-
@Override
protected PsiElement resolveReference(@Nullable final String s, final ConvertContext context) {
return s == null ? null : context.getReferenceXmlElement();
diff --git a/android/src/org/jetbrains/android/dom/drawable/AnimationListDomFileDescription.java b/android/src/org/jetbrains/android/dom/drawable/AnimationListDomFileDescription.java
index 17c0578..23e351f 100644
--- a/android/src/org/jetbrains/android/dom/drawable/AnimationListDomFileDescription.java
+++ b/android/src/org/jetbrains/android/dom/drawable/AnimationListDomFileDescription.java
@@ -16,7 +16,7 @@
@NonNls static final String ANIMATION_LIST_TAG = "animation-list";
public AnimationListDomFileDescription() {
- super(AnimationList.class, ANIMATION_LIST_TAG, ResourceType.DRAWABLE.getName());
+ super(AnimationList.class, ANIMATION_LIST_TAG, ResourceType.DRAWABLE.getName(), ResourceType.ANIM.getName());
}
@Override
diff --git a/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java b/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java
index 4254308..4477e1e 100644
--- a/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java
+++ b/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java
@@ -29,7 +29,6 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import org.jetbrains.android.compiler.AndroidCompileUtil;
-import org.jetbrains.android.compiler.AndroidProguardCompiler;
import org.jetbrains.android.compiler.artifact.ProGuardConfigFilesPanel;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.facet.AndroidFacetConfiguration;
@@ -253,7 +252,7 @@
throw new CommitStepException("Cannot find file " + path);
}
}
- compileScope.putUserData(AndroidProguardCompiler.PROGUARD_CFG_PATHS_KEY, proguardPathsStr);
+ compileScope.putUserData(AndroidCompileUtil.PROGUARD_CFG_PATHS_KEY, proguardPathsStr);
}
myWizard.setCompileScope(compileScope);
myWizard.setApkPath(apkPath);
diff --git a/android/src/org/jetbrains/android/exportSignedPackage/ExportSignedPackageWizard.java b/android/src/org/jetbrains/android/exportSignedPackage/ExportSignedPackageWizard.java
index 04d4378..437b28c 100644
--- a/android/src/org/jetbrains/android/exportSignedPackage/ExportSignedPackageWizard.java
+++ b/android/src/org/jetbrains/android/exportSignedPackage/ExportSignedPackageWizard.java
@@ -16,7 +16,6 @@
package org.jetbrains.android.exportSignedPackage;
-import com.android.SdkConstants;
import com.android.annotations.VisibleForTesting;
import com.android.builder.model.AndroidProject;
import com.android.builder.model.Variant;
@@ -387,8 +386,8 @@
private void createAndAlignApk(final String apkPath) {
AndroidPlatform platform = getFacet().getConfiguration().getAndroidPlatform();
assert platform != null;
- String sdkPath = platform.getSdkData().getPath();
- String zipAlignPath = sdkPath + File.separatorChar + AndroidCommonUtils.toolPath(SdkConstants.FN_ZIPALIGN);
+ final String sdkPath = platform.getSdkData().getPath();
+ String zipAlignPath = AndroidCommonUtils.getZipAlign(sdkPath, platform.getTarget());
File zipalign = new File(zipAlignPath);
if (!zipalign.isFile()) {
BuildToolInfo buildTool = platform.getTarget().getBuildToolInfo();
diff --git a/android/src/org/jetbrains/android/exportSignedPackage/GradleSignStep.java b/android/src/org/jetbrains/android/exportSignedPackage/GradleSignStep.java
index 2b26e9c..de0c977 100644
--- a/android/src/org/jetbrains/android/exportSignedPackage/GradleSignStep.java
+++ b/android/src/org/jetbrains/android/exportSignedPackage/GradleSignStep.java
@@ -21,6 +21,7 @@
import com.google.common.collect.Sets;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.ide.wizard.CommitStepException;
+import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -124,8 +125,8 @@
}
}
myApkPathField.setText(lastApkFolder.getAbsolutePath());
- myApkPathField.addBrowseFolderListener("Select APK destination folder", null, myWizard.getProject(),
- FileChooserDescriptorFactory.getDirectoryChooserDescriptor("destination folder"));
+ FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
+ myApkPathField.addBrowseFolderListener("Select APK Destination Folder", null, myWizard.getProject(), descriptor);
}
@Override
diff --git a/android/src/org/jetbrains/android/facet/AndroidFacet.java b/android/src/org/jetbrains/android/facet/AndroidFacet.java
index c000103..5cc2758 100644
--- a/android/src/org/jetbrains/android/facet/AndroidFacet.java
+++ b/android/src/org/jetbrains/android/facet/AndroidFacet.java
@@ -33,6 +33,7 @@
import com.android.tools.idea.model.AndroidModuleInfo;
import com.android.tools.idea.rendering.*;
import com.android.tools.idea.run.LaunchCompatibility;
+import com.android.tools.idea.templates.TemplateManager;
import com.android.tools.idea.sdk.DefaultSdks;
import com.android.tools.idea.startup.AndroidStudioSpecificInitializer;
import com.android.utils.ILogger;
@@ -49,6 +50,7 @@
import com.intellij.facet.FacetManager;
import com.intellij.facet.FacetTypeId;
import com.intellij.facet.FacetTypeRegistry;
+import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
@@ -83,7 +85,6 @@
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.xml.ConvertContext;
import com.intellij.util.xml.DomElement;
-import org.jetbrains.android.compiler.AndroidAptCompiler;
import org.jetbrains.android.compiler.AndroidAutogeneratorMode;
import org.jetbrains.android.compiler.AndroidCompileUtil;
import org.jetbrains.android.dom.manifest.Manifest;
@@ -114,6 +115,7 @@
private static final Object APP_RESOURCES_LOCK = new Object();
private static final Object PROJECT_RESOURCES_LOCK = new Object();
private static final Object MODULE_RESOURCES_LOCK = new Object();
+ private static boolean ourDynamicTemplateMenuCreated;
private AvdManager myAvdManager = null;
private AndroidSdkData mySdkData;
@@ -648,6 +650,20 @@
}
}
+ public static void createDynamicTemplateMenu() {
+ if (ourDynamicTemplateMenuCreated) {
+ return;
+ }
+ ourDynamicTemplateMenuCreated = true;
+ DefaultActionGroup newGroup = (DefaultActionGroup)ActionManager.getInstance().getAction("NewGroup");
+ newGroup.addSeparator();
+ final ActionGroup menu = TemplateManager.getInstance().getTemplateCreationMenu(null);
+
+ if (menu != null) {
+ newGroup.add(menu, new Constraints(Anchor.AFTER, "NewFromTemplate"));
+ }
+ }
+
@Override
public void initFacet() {
StartupManager.getInstance(getModule().getProject()).runWhenProjectIsInitialized(new Runnable() {
@@ -669,7 +685,7 @@
return;
}
- if (AndroidAptCompiler.isToCompileModule(module, getConfiguration())) {
+ if (true) {
AndroidCompileUtil.generate(module, AndroidAutogeneratorMode.AAPT);
}
AndroidCompileUtil.generate(module, AndroidAutogeneratorMode.AIDL);
@@ -708,6 +724,7 @@
});
}
});
+ createDynamicTemplateMenu();
}
private void addResourceFolderToSdkRootsIfNecessary() {
diff --git a/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java b/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java
index a2fa362..a834aa1 100644
--- a/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java
+++ b/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java
@@ -44,7 +44,6 @@
import com.intellij.util.Function;
import com.intellij.util.PathUtil;
import com.intellij.util.ui.UIUtil;
-import org.jetbrains.android.compiler.AndroidAptCompiler;
import org.jetbrains.android.compiler.AndroidAutogeneratorMode;
import org.jetbrains.android.compiler.AndroidCompileUtil;
import org.jetbrains.android.compiler.artifact.ProGuardConfigFilesPanel;
@@ -153,9 +152,7 @@
myNativeLibsFolder.getButton().addActionListener(new MyFolderFieldListener(myNativeLibsFolder,
AndroidRootUtil.getLibsDir(facet), false, null));
- myCustomAptSourceDirField.getButton().addActionListener(new MyFolderFieldListener(myCustomAptSourceDirField,
- AndroidAptCompiler.getCustomResourceDirForApt(facet),
- false, null));
+ myCustomAptSourceDirField.getButton().addActionListener(new MyFolderFieldListener(myCustomAptSourceDirField, getCustomResourceDirForApt(facet), false, null));
myRunProguardCheckBox.addActionListener(new ActionListener() {
@Override
@@ -266,6 +263,11 @@
myProguardLogsDirectoryField.getButton().addActionListener(new MyFolderFieldListener(myProguardLogsDirectoryField, null, false, null));
}
+ @Nullable
+ public static VirtualFile getCustomResourceDirForApt(@NotNull AndroidFacet facet) {
+ return AndroidRootUtil.getFileByRelativeModulePath(facet.getModule(), facet.getProperties().CUSTOM_APK_RESOURCE_FOLDER, false);
+ }
+
private void updateLibAndAppSpecificFields() {
boolean lib = myIsLibraryProjectCheckbox.isSelected();
myAssetsFolderField.setEnabled(!lib);
@@ -332,6 +334,7 @@
return "Android SDK Settings";
}
+ @NotNull
@Override
public JComponent createComponent() {
return myContentPanel;
@@ -583,8 +586,6 @@
myConfiguration.getState().PROGUARD_LOGS_FOLDER_RELATIVE_PATH =
absProguardLogsPath.length() > 0 ? '/' + getAndCheckRelativePath(absProguardLogsPath, false) : "";
- runApt = runApt && AndroidAptCompiler.isToCompileModule(myContext.getModule(), myConfiguration);
-
if (runApt || runIdl) {
final Module module = myContext.getModule();
diff --git a/android/src/org/jetbrains/android/facet/AndroidResourceFilesListener.java b/android/src/org/jetbrains/android/facet/AndroidResourceFilesListener.java
index 5ce021b..0cb4dfa 100644
--- a/android/src/org/jetbrains/android/facet/AndroidResourceFilesListener.java
+++ b/android/src/org/jetbrains/android/facet/AndroidResourceFilesListener.java
@@ -37,7 +37,6 @@
import com.intellij.util.containers.MultiMap;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
-import org.jetbrains.android.compiler.AndroidAptCompiler;
import org.jetbrains.android.compiler.AndroidAutogeneratorMode;
import org.jetbrains.android.compiler.AndroidCompileUtil;
import org.jetbrains.android.dom.manifest.Manifest;
@@ -215,18 +214,16 @@
final List<AndroidAutogeneratorMode> modes = new ArrayList<AndroidAutogeneratorMode>();
if (Comparing.equal(manifestFile, file)) {
- if (AndroidAptCompiler.isToCompileModule(module, facet.getConfiguration())) {
- final Manifest manifest = facet.getManifest();
- final String aPackage = manifest != null ? manifest.getPackage().getValue() : null;
- final String cachedPackage = facet.getUserData(CACHED_PACKAGE_KEY);
+ final Manifest manifest = facet.getManifest();
+ final String aPackage = manifest != null ? manifest.getPackage().getValue() : null;
+ final String cachedPackage = facet.getUserData(CACHED_PACKAGE_KEY);
- if (cachedPackage != null && !cachedPackage.equals(aPackage)) {
- String aptGenDirPath = AndroidRootUtil.getAptGenSourceRootPath(facet);
- AndroidCompileUtil.removeDuplicatingClasses(module, cachedPackage, AndroidUtils.R_CLASS_NAME, null, aptGenDirPath);
- }
- facet.putUserData(CACHED_PACKAGE_KEY, aPackage);
- modes.add(AndroidAutogeneratorMode.AAPT);
+ if (cachedPackage != null && !cachedPackage.equals(aPackage)) {
+ String aptGenDirPath = AndroidRootUtil.getAptGenSourceRootPath(facet);
+ AndroidCompileUtil.removeDuplicatingClasses(module, cachedPackage, AndroidUtils.R_CLASS_NAME, null, aptGenDirPath);
}
+ facet.putUserData(CACHED_PACKAGE_KEY, aPackage);
+ modes.add(AndroidAutogeneratorMode.AAPT);
modes.add(AndroidAutogeneratorMode.BUILDCONFIG);
}
else if (file.getFileType() == AndroidIdlFileType.ourFileType) {
diff --git a/android/src/org/jetbrains/android/facet/AndroidRootUtil.java b/android/src/org/jetbrains/android/facet/AndroidRootUtil.java
index 791593c..11c9695 100644
--- a/android/src/org/jetbrains/android/facet/AndroidRootUtil.java
+++ b/android/src/org/jetbrains/android/facet/AndroidRootUtil.java
@@ -35,7 +35,10 @@
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.util.containers.OrderedSet;
import org.jetbrains.android.compiler.AndroidCompileUtil;
@@ -473,7 +476,7 @@
try {
File file = VfsUtilCore.virtualToIoFile(vFile);
Properties properties = PropertiesUtil.getProperties(file);
- return new Pair<Properties, VirtualFile>(properties, vFile);
+ return Pair.create(properties, vFile);
}
catch (IOException e) {
LOG.info(e);
diff --git a/android/src/org/jetbrains/android/facet/IdeaSourceProvider.java b/android/src/org/jetbrains/android/facet/IdeaSourceProvider.java
index 8e24545..176edd9 100644
--- a/android/src/org/jetbrains/android/facet/IdeaSourceProvider.java
+++ b/android/src/org/jetbrains/android/facet/IdeaSourceProvider.java
@@ -661,13 +661,13 @@
if (facet.isGradleProject()) {
for (IdeaSourceProvider provider : getCurrentSourceProviders(facet)) {
- if (provider.getManifestFile() == candidate) {
+ if (candidate.equals(provider.getManifestFile())) {
return true;
}
}
return false;
} else {
- return candidate == facet.getMainIdeaSourceProvider().getManifestFile();
+ return candidate.equals(facet.getMainIdeaSourceProvider().getManifestFile());
}
}
diff --git a/android/src/org/jetbrains/android/formatter/AndroidCodeStyleNotificationProvider.java b/android/src/org/jetbrains/android/formatter/AndroidCodeStyleNotificationProvider.java
index 47e7ec5..f50fb44 100644
--- a/android/src/org/jetbrains/android/formatter/AndroidCodeStyleNotificationProvider.java
+++ b/android/src/org/jetbrains/android/formatter/AndroidCodeStyleNotificationProvider.java
@@ -1,6 +1,7 @@
package org.jetbrains.android.formatter;
import com.intellij.application.options.XmlCodeStyleSettingsProvider;
+import com.intellij.ide.actions.ShowSettingsUtilImpl;
import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationsConfiguration;
@@ -9,7 +10,6 @@
import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
-import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
@@ -19,6 +19,7 @@
import com.intellij.ui.EditorNotifications;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -37,6 +38,7 @@
myNotifications = notifications;
}
+ @NotNull
@Override
public Key<MyPanel> getKey() {
return KEY;
@@ -44,7 +46,7 @@
@Nullable
@Override
- public MyPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
+ public MyPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (file.getFileType() != XmlFileType.INSTANCE ||
!(fileEditor instanceof TextEditor)) {
return null;
@@ -89,9 +91,9 @@
createActionLabel("Open code style settings", new Runnable() {
@Override
public void run() {
- ShowSettingsUtil.getInstance().showSettingsDialog(
- myProject, XmlCodeStyleSettingsProvider.CONFIGURABLE_DISPLAY_NAME);
- myNotifications.updateAllNotifications();
+ ShowSettingsUtilImpl.showSettingsDialog(
+ myProject, "preferences.sourceCode." + XmlCodeStyleSettingsProvider.CONFIGURABLE_DISPLAY_NAME, "");
+ myNotifications.updateAllNotifications();
}
});
diff --git a/android/src/org/jetbrains/android/formatter/AndroidXmlPredefinedCodeStyle.java b/android/src/org/jetbrains/android/formatter/AndroidXmlPredefinedCodeStyle.java
index 2984bc0..c198af8 100644
--- a/android/src/org/jetbrains/android/formatter/AndroidXmlPredefinedCodeStyle.java
+++ b/android/src/org/jetbrains/android/formatter/AndroidXmlPredefinedCodeStyle.java
@@ -6,9 +6,11 @@
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.psi.codeStyle.PredefinedCodeStyle;
+import com.intellij.psi.codeStyle.arrangement.group.ArrangementGroupingRule;
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule;
-import com.intellij.psi.codeStyle.arrangement.std.StdRulePriorityAwareSettings;
+import com.intellij.psi.codeStyle.arrangement.std.StdArrangementSettings;
import com.intellij.psi.formatter.xml.XmlCodeStyleSettings;
+import com.intellij.util.containers.ContainerUtil;
import java.util.ArrayList;
import java.util.List;
@@ -61,7 +63,8 @@
rules.add(attrArrangementRule(".*", ".*", BY_NAME));
// TODO: Should sort name:"color",namespace:"" to the end (primarily for color state lists)
final CommonCodeStyleSettings xmlCommonSettings = settings.getCommonSettings(XMLLanguage.INSTANCE);
- xmlCommonSettings.setArrangementSettings(new StdRulePriorityAwareSettings(rules));
+ xmlCommonSettings.setArrangementSettings(
+ StdArrangementSettings.createByMatchRules(ContainerUtil.<ArrangementGroupingRule>emptyList(), rules));
xmlCommonSettings.FORCE_REARRANGE_MODE = CommonCodeStyleSettings.REARRANGE_ALWAYS;
}
}
diff --git a/android/src/org/jetbrains/android/inspections/ResourceTypeCompletionContributor.java b/android/src/org/jetbrains/android/inspections/ResourceTypeCompletionContributor.java
index 7866d55..fda0757 100644
--- a/android/src/org/jetbrains/android/inspections/ResourceTypeCompletionContributor.java
+++ b/android/src/org/jetbrains/android/inspections/ResourceTypeCompletionContributor.java
@@ -33,6 +33,7 @@
import gnu.trove.THashSet;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.android.facet.AndroidFacet;
+import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.List;
@@ -72,7 +73,7 @@
private static final int PRIORITY = 100;
@Override
- public void fillCompletionVariants(final CompletionParameters parameters, final CompletionResultSet result) {
+ public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result) {
//if (parameters.getCompletionType() != CompletionType.SMART) return;
PsiElement pos = parameters.getPosition();
diff --git a/android/src/org/jetbrains/android/inspections/lint/AndroidLintInspectionBase.java b/android/src/org/jetbrains/android/inspections/lint/AndroidLintInspectionBase.java
index 04b8953..2cf8f7a 100644
--- a/android/src/org/jetbrains/android/inspections/lint/AndroidLintInspectionBase.java
+++ b/android/src/org/jetbrains/android/inspections/lint/AndroidLintInspectionBase.java
@@ -9,14 +9,11 @@
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.lang.annotation.ProblemGroup;
-import com.intellij.lang.java.JavaLanguage;
-import com.intellij.lang.xml.XMLLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
@@ -42,7 +39,7 @@
/**
* @author Eugene.Kudelevsky
*/
-public abstract class AndroidLintInspectionBase extends GlobalInspectionTool implements BatchSuppressableTool {
+public abstract class AndroidLintInspectionBase extends GlobalInspectionTool {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.inspections.lint.AndroidLintInspectionBase");
private static final Object ISSUE_MAP_LOCK = new Object();
@@ -231,17 +228,6 @@
}
}
- @Override
- public boolean isSuppressedFor(@NotNull PsiElement element) {
- if (element.getLanguage() == JavaLanguage.INSTANCE) {
- return SuppressManager.getInstance().isSuppressedFor(element, getShortName());
- }
- if (element.getLanguage() == XMLLanguage.INSTANCE) {
- return XmlSuppressionProvider.isSuppressed(element, getShortName());
- }
- return false;
- }
-
@TestOnly
public static void invalidateInspectionShortName2IssueMap() {
ourIssue2InspectionShortName = null;
@@ -348,7 +334,7 @@
@NotNull
@Override
public String getShortName() {
- return StringUtil.trimEnd(getClass().getSimpleName(), "Inspection");
+ return InspectionProfileEntry.getShortName(getClass().getSimpleName());
}
@NotNull
diff --git a/android/src/org/jetbrains/android/inspections/lint/AndroidLintUtil.java b/android/src/org/jetbrains/android/inspections/lint/AndroidLintUtil.java
index 6c56a70..9e065bb 100644
--- a/android/src/org/jetbrains/android/inspections/lint/AndroidLintUtil.java
+++ b/android/src/org/jetbrains/android/inspections/lint/AndroidLintUtil.java
@@ -47,7 +47,7 @@
final AndroidLintInspectionBase inspection = (AndroidLintInspectionBase)profile.getUnwrappedTool(inspectionShortName, context);
if (inspection == null) return null;
final HighlightDisplayLevel errorLevel = profile.getErrorLevel(key, context);
- return new Pair<AndroidLintInspectionBase, HighlightDisplayLevel>(inspection,
- errorLevel != null ? errorLevel : HighlightDisplayLevel.WARNING);
+ return Pair.create(inspection,
+ errorLevel != null ? errorLevel : HighlightDisplayLevel.WARNING);
}
}
diff --git a/android/src/org/jetbrains/android/logcat/AndroidToolWindowFactory.java b/android/src/org/jetbrains/android/logcat/AndroidToolWindowFactory.java
index 62492de9..ce1dd15 100644
--- a/android/src/org/jetbrains/android/logcat/AndroidToolWindowFactory.java
+++ b/android/src/org/jetbrains/android/logcat/AndroidToolWindowFactory.java
@@ -80,7 +80,7 @@
public static final Key<DevicePanel> DEVICES_PANEL_KEY = Key.create("DevicePanel");
@Override
- public void createToolWindowContent(final Project project, final ToolWindow toolWindow) {
+ public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
RunnerLayoutUi layoutUi = RunnerLayoutUi.Factory.getInstance(project).create(
"ddms", "ddms", "ddms", project);
diff --git a/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java b/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java
index 2936bd2..8e7521b 100644
--- a/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java
+++ b/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java
@@ -378,6 +378,7 @@
JarFileSystem.JAR_SEPARATOR;
final String resDirUrl = VfsUtilCore.pathToUrl(aarDirPath + "/" + SdkConstants.FD_RES);
final Set<String> urlsToAdd = new HashSet<String>(Arrays.asList(classesJarUrl, resDirUrl));
+ collectJarsInAarLibsFolder(aarDirPath, urlsToAdd);
for (String url : aarLibModel.getUrls(OrderRootType.CLASSES)) {
if (!urlsToAdd.remove(url)) {
@@ -389,6 +390,25 @@
}
}
+ private static void collectJarsInAarLibsFolder(@NotNull String aarDirPath, @NotNull Set<String> urlsToAdd) {
+ final File libsFolder = new File(aarDirPath, SdkConstants.LIBS_FOLDER);
+
+ if (!libsFolder.isDirectory()) {
+ return;
+ }
+ final File[] children = libsFolder.listFiles();
+
+ if (children != null) {
+ for (File child : children) {
+ if (FileUtilRt.extensionEquals(child.getName(), "jar")) {
+ final String url = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, FileUtil.
+ toSystemIndependentName(child.getPath())) + JarFileSystem.JAR_SEPARATOR;
+ urlsToAdd.add(url);
+ }
+ }
+ }
+ }
+
private static String doImportExternalApklibDependency(Project project,
MavenModifiableModelsProvider modelsProvider,
MavenProjectsTree mavenTree,
@@ -888,7 +908,7 @@
final MavenId mavenId = artifact.getMavenId();
adm.setResolvedInfoForArtifact(mavenId, info);
- projectForExternalApklib.read(generalSettings, mavenProjectsManager.getAvailableProfiles(), mavenProjectReader, locator);
+ projectForExternalApklib.read(generalSettings, mavenProjectsManager.getExplicitProfiles(), mavenProjectReader, locator);
projectForExternalApklib.resolve(project, generalSettings, embedder, mavenProjectReader, locator, context);
final String apiLevel = getPlatformFromConfig(projectForExternalApklib);
@@ -909,7 +929,7 @@
if (vFakePomFile != null) {
final MavenProject fakeProject = new MavenProject(vFakePomFile);
- fakeProject.read(generalSettings, mavenProjectsManager.getAvailableProfiles(), mavenProjectReader, locator);
+ fakeProject.read(generalSettings, mavenProjectsManager.getExplicitProfiles(), mavenProjectReader, locator);
fakeProject.resolve(project, generalSettings, embedder, mavenProjectReader, locator, context);
deps = fakeProject.getDependencies();
diff --git a/android/src/org/jetbrains/android/maven/AndroidMavenProviderImpl.java b/android/src/org/jetbrains/android/maven/AndroidMavenProviderImpl.java
index 8040eac..aab941c 100644
--- a/android/src/org/jetbrains/android/maven/AndroidMavenProviderImpl.java
+++ b/android/src/org/jetbrains/android/maven/AndroidMavenProviderImpl.java
@@ -28,7 +28,6 @@
import org.jetbrains.android.facet.AndroidRootUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.idea.maven.compiler.MavenResourceCompiler;
import org.jetbrains.idea.maven.model.MavenArtifact;
import org.jetbrains.idea.maven.model.MavenResource;
import org.jetbrains.idea.maven.project.MavenProject;
@@ -38,6 +37,7 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
@@ -87,8 +87,8 @@
VirtualFile resDir = LocalFileSystem.getInstance().findFileByPath(resource.getDirectory());
if (resDir == null) continue;
- List<Pattern> includes = MavenResourceCompiler.collectPatterns(resource.getIncludes(), "**/*");
- List<Pattern> excludes = MavenResourceCompiler.collectPatterns(resource.getExcludes(), null);
+ List<Pattern> includes = collectPatterns(resource.getIncludes(), "**/*");
+ List<Pattern> excludes = collectPatterns(resource.getExcludes(), null);
final String resourceTargetPath = resource.getTargetPath();
if (resourceTargetPath != null) {
String targetPath = FileUtil.toSystemIndependentName(resourceTargetPath);
@@ -102,6 +102,18 @@
return false;
}
+ private static List<Pattern> collectPatterns(@Nullable List<String> values, @Nullable String defaultValue) {
+ List<Pattern> result = new ArrayList<Pattern>();
+ if (values == null || values.isEmpty()) {
+ if (defaultValue == null) return Collections.emptyList();
+ return MavenUtil.collectPattern(defaultValue, result);
+ }
+ for (String each : values) {
+ MavenUtil.collectPattern(each, result);
+ }
+ return result;
+ }
+
static boolean processResources(Project project,
VirtualFile sourceRoot,
VirtualFile file,
@@ -110,7 +122,7 @@
String resOutputDir,
ResourceProcessor processor) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
- if (!fileIndex.isIgnored(file)) {
+ if (!fileIndex.isExcluded(file)) {
String relPath = VfsUtilCore.getRelativePath(file, sourceRoot, '/');
if (relPath != null && MavenUtil.isIncluded(relPath, includes, excludes)) {
if (processor.process(file, resOutputDir + "/" + relPath)) {
diff --git a/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java b/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
index b514dc3..b74e23a 100644
--- a/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
+++ b/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
@@ -23,7 +23,7 @@
import com.intellij.CommonBundle;
import com.intellij.codeInsight.actions.ReformatCodeProcessor;
import com.intellij.execution.ExecutionException;
-import com.intellij.execution.RunManagerEx;
+import com.intellij.execution.RunManager;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.ui.ConsoleViewContentType;
@@ -42,6 +42,8 @@
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectType;
+import com.intellij.openapi.project.ProjectTypeService;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkTypeId;
import com.intellij.openapi.roots.*;
@@ -96,25 +98,217 @@
* @author Eugene.Kudelevsky
*/
public class AndroidModuleBuilder extends JavaModuleBuilder {
+ public static final ProjectType ANDROID_PROJECT_TYPE = new ProjectType("Android");
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.newProject.AndroidModuleBuilder");
-
+ private final AndroidProjectType myProjectType;
private String myPackageName;
private String myApplicationName;
private String myActivityName;
- private final ProjectType myProjectType;
private Module myTestedModule;
private TargetSelectionMode myTargetSelectionMode;
private String myPreferredAvd;
@SuppressWarnings("UnusedDeclaration")
public AndroidModuleBuilder() {
- this(ProjectType.APPLICATION);
+ this(AndroidProjectType.APPLICATION);
}
- public AndroidModuleBuilder(ProjectType type) {
+ public AndroidModuleBuilder(AndroidProjectType type) {
myProjectType = type;
}
+ @NotNull
+ private static String getAntProjectName(@NotNull String moduleName) {
+ StringBuilder result = new StringBuilder();
+ for (int i = 0; i < moduleName.length(); i++) {
+ char c = moduleName.charAt(i);
+ if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || Character.isDigit(c))) {
+ c = '_';
+ }
+ result.append(c);
+ }
+ return result.toString();
+ }
+
+ private static Sdk getAndroidSdkForModule(@NotNull Module module) {
+ return ModuleRootManager.getInstance(module).getSdk();
+ }
+
+ private static void copyGeneratedAndroidProject(File tempDir, VirtualFile contentRoot, VirtualFile sourceRoot) {
+ final File[] children = tempDir.listFiles();
+ if (children != null) {
+ for (File child : children) {
+ if (SdkConstants.FD_SOURCES.equals(child.getName())) {
+ continue;
+ }
+ final File to = new File(contentRoot.getPath(), child.getName());
+
+ try {
+ if (child.isDirectory()) {
+ FileUtil.copyDir(child, to);
+ }
+ else {
+ FileUtil.copy(child, to);
+ }
+ }
+ catch (IOException e) {
+ LOG.error(e);
+ }
+ }
+ }
+
+ final File tempSourceRoot = new File(tempDir, SdkConstants.FD_SOURCES);
+ if (tempSourceRoot.exists()) {
+ final File to = new File(sourceRoot.getPath());
+
+ try {
+ FileUtil.copyDir(tempSourceRoot, to);
+ }
+ catch (IOException e) {
+ LOG.error(e);
+ }
+ }
+ }
+
+ private static void configureManifest(@NotNull AndroidFacet facet, @NotNull IAndroidTarget target) {
+ final Manifest manifest = facet.getManifest();
+ if (manifest == null) {
+ return;
+ }
+
+ final XmlTag manifestTag = manifest.getXmlTag();
+ if (manifestTag == null) {
+ return;
+ }
+
+ final PsiFile manifestFile = manifestTag.getContainingFile();
+ if (manifestFile == null) {
+ return;
+ }
+
+ final VirtualFile vManifestFile = manifestFile.getVirtualFile();
+ if (vManifestFile == null ||
+ !ReadonlyStatusHandler.ensureFilesWritable(manifestFile.getProject(), vManifestFile)) {
+ return;
+ }
+ XmlTag usesSdkTag = manifestTag.createChildTag("uses-sdk", "", null, false);
+ if (usesSdkTag != null) {
+ usesSdkTag = manifestTag.addSubTag(usesSdkTag, true);
+ usesSdkTag.setAttribute("minSdkVersion", SdkConstants.NS_RESOURCES, target.getVersion().getApiString());
+ }
+ CodeStyleManager.getInstance(manifestFile.getProject()).reformat(manifestFile);
+ }
+
+ private static void createManifestFileAndAntFiles(Project project, VirtualFile contentRoot, Module module) {
+ VirtualFile existingManifestFile = contentRoot.findChild(FN_ANDROID_MANIFEST_XML);
+ if (existingManifestFile != null) {
+ return;
+ }
+ try {
+ AndroidFileTemplateProvider
+ .createFromTemplate(project, contentRoot, AndroidFileTemplateProvider.ANDROID_MANIFEST_TEMPLATE, FN_ANDROID_MANIFEST_XML);
+
+ Sdk sdk = getAndroidSdkForModule(module);
+ if (sdk == null) return;
+ AndroidPlatform platform = AndroidPlatform.parse(sdk);
+
+ if (platform == null) {
+ Messages.showErrorDialog(project, "Cannot parse Android SDK: '" + SdkConstants.FN_PROJECT_PROPERTIES + "' won't be generated",
+ CommonBundle.getErrorTitle());
+ return;
+ }
+
+ Properties properties = FileTemplateManager.getInstance().getDefaultProperties(project);
+ properties.setProperty("TARGET", platform.getTarget().hashString());
+ AndroidFileTemplateProvider.createFromTemplate(project, contentRoot, AndroidFileTemplateProvider.DEFAULT_PROPERTIES_TEMPLATE,
+ SdkConstants.FN_PROJECT_PROPERTIES, properties);
+ }
+ catch (Exception e) {
+ LOG.error(e);
+ }
+ }
+
+ private static void addTestRunConfiguration(final AndroidFacet facet, @NotNull TargetSelectionMode mode, @Nullable String preferredAvd) {
+ Project project = facet.getModule().getProject();
+ RunManager runManager = RunManager.getInstance(project);
+ Module module = facet.getModule();
+ RunnerAndConfigurationSettings settings = runManager
+ .createRunConfiguration(module.getName(), AndroidTestRunConfigurationType.getInstance().getFactory());
+
+ AndroidTestRunConfiguration configuration = (AndroidTestRunConfiguration)settings.getConfiguration();
+ configuration.setModule(module);
+ configuration.setTargetSelectionMode(mode);
+ if (preferredAvd != null) {
+ configuration.PREFERRED_AVD = preferredAvd;
+ }
+
+ runManager.addConfiguration(settings, false);
+ runManager.setSelectedConfiguration(settings);
+ }
+
+ @Nullable
+ private static VirtualFile findSourceRoot(ModifiableRootModel model) {
+ VirtualFile genSourceRoot = AndroidRootUtil.getStandardGenDir(model.getModule());
+ for (VirtualFile root : model.getSourceRoots()) {
+ if (!Comparing.equal(root, genSourceRoot)) {
+ return root;
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ private static PsiDirectory createPackageIfPossible(final PsiDirectory sourceDir, String packageName) {
+ if (sourceDir != null) {
+ final String[] ids = packageName.split("\\.");
+ return ApplicationManager.getApplication().runWriteAction(new Computable<PsiDirectory>() {
+ @Override
+ public PsiDirectory compute() {
+ PsiDirectory dir = sourceDir;
+ for (String id : ids) {
+ PsiDirectory child = dir.findSubdirectory(id);
+ dir = child == null ? dir.createSubdirectory(id) : child;
+ }
+ return dir;
+ }
+ });
+ }
+ return null;
+ }
+
+ private static void createFileFromResource(Project project, VirtualFile drawableDir, String name, String resourceFilePath)
+ throws IOException {
+ if (drawableDir.findChild(name) != null) {
+ return;
+ }
+ VirtualFile resFile = drawableDir.createChildData(project, name);
+ InputStream stream = AndroidModuleBuilder.class.getResourceAsStream(resourceFilePath);
+ try {
+ byte[] bytes = FileUtil.adaptiveLoadBytes(stream);
+ resFile.setBinaryContent(bytes);
+ }
+ finally {
+ stream.close();
+ }
+ }
+
+ private static Pair<String, Boolean> runAndroidTool(@NotNull GeneralCommandLine commandLine) {
+ final StringBuildingOutputProcessor processor = new StringBuildingOutputProcessor();
+ String result;
+ boolean success = false;
+ try {
+ success = AndroidUtils.executeCommand(commandLine, processor, WaitingStrategies.WaitForever.getInstance()) == ExecutionStatus.SUCCESS;
+ result = processor.getMessage();
+ }
+ catch (ExecutionException e) {
+ result = e.getMessage();
+ }
+ if (result != null) {
+ LOG.debug(result);
+ }
+ return Pair.create(result, success);
+ }
+
@Override
public void setupRootModel(final ModifiableRootModel rootModel) throws ConfigurationException {
super.setupRootModel(rootModel);
@@ -137,7 +331,7 @@
VirtualFile[] files = rootModel.getContentRoots();
if (files.length > 0) {
final VirtualFile contentRoot = files[0];
- final AndroidFacet facet = AndroidUtils.addAndroidFacet(rootModel.getModule(), contentRoot, myProjectType == ProjectType.LIBRARY);
+ final AndroidFacet facet = AndroidUtils.addAndroidFacet(rootModel.getModule(), contentRoot, myProjectType == AndroidProjectType.LIBRARY);
if (myProjectType == null) {
ImportDependenciesUtil.importDependencies(rootModel.getModule(), true);
@@ -145,9 +339,10 @@
}
final Project project = rootModel.getProject();
+ ProjectTypeService.setProjectType(project, new ProjectType("Android"));
final VirtualFile sourceRoot = findSourceRoot(rootModel);
- if (myProjectType == ProjectType.TEST) {
+ if (myProjectType == AndroidProjectType.TEST) {
assert myTestedModule != null;
facet.getProperties().PACK_TEST_CODE = true;
ModuleOrderEntry entry = rootModel.addModuleOrderEntry(myTestedModule);
@@ -185,7 +380,7 @@
}
}
- if (myProjectType == ProjectType.APPLICATION) {
+ if (myProjectType == AndroidProjectType.APPLICATION) {
createDirectoryStructure(contentRoot, sourceRoot, facet);
}
else {
@@ -209,19 +404,6 @@
}
}
- @NotNull
- private static String getAntProjectName(@NotNull String moduleName) {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < moduleName.length(); i++) {
- char c = moduleName.charAt(i);
- if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || Character.isDigit(c))) {
- c = '_';
- }
- result.append(c);
- }
- return result.toString();
- }
-
private boolean createProjectByAndroidTool(final VirtualFile contentRoot,
final VirtualFile sourceRoot,
final AndroidFacet facet) {
@@ -282,7 +464,7 @@
final String targetDirectoryPath = tempContentRoot.getPath();
commandLine.addParameter(FileUtil.toSystemDependentName(targetDirectoryPath));
- if (myProjectType == ProjectType.APPLICATION || myProjectType == ProjectType.LIBRARY) {
+ if (myProjectType == AndroidProjectType.APPLICATION || myProjectType == AndroidProjectType.LIBRARY) {
String apiLevel = target.hashString();
commandLine.addParameter("--target");
commandLine.addParameter(apiLevel);
@@ -290,11 +472,11 @@
commandLine.addParameter(myPackageName);
}
- if (myProjectType == ProjectType.APPLICATION) {
+ if (myProjectType == AndroidProjectType.APPLICATION) {
commandLine.addParameter("--activity");
commandLine.addParameter(myActivityName);
}
- else if (myProjectType == ProjectType.TEST) {
+ else if (myProjectType == AndroidProjectType.TEST) {
final AndroidFacet testedFacet = AndroidFacet.getInstance(myTestedModule);
final VirtualFile moduleDir = testedFacet != null
? AndroidRootUtil.getMainContentRoot(testedFacet)
@@ -383,13 +565,13 @@
if (project.isDisposed()) {
return;
}
- if (myProjectType == ProjectType.APPLICATION) {
+ if (myProjectType == AndroidProjectType.APPLICATION) {
assignApplicationName(facet);
configureManifest(facet, target);
createChildDirectoryIfNotExist(project, contentRoot, SdkConstants.FD_ASSETS);
createChildDirectoryIfNotExist(project, contentRoot, SdkConstants.FD_NATIVE_LIBS);
}
- else if (myProjectType == ProjectType.LIBRARY && myPackageName != null) {
+ else if (myProjectType == AndroidProjectType.LIBRARY && myPackageName != null) {
final String[] dirs = myPackageName.split("\\.");
VirtualFile file = sourceRoot;
@@ -418,10 +600,10 @@
}
if (myTargetSelectionMode != null) {
- if (myProjectType == ProjectType.APPLICATION) {
+ if (myProjectType == AndroidProjectType.APPLICATION) {
addRunConfiguration(facet, myTargetSelectionMode, myPreferredAvd);
}
- else if (myProjectType == ProjectType.TEST) {
+ else if (myProjectType == AndroidProjectType.TEST) {
addTestRunConfiguration(facet, myTargetSelectionMode, myPreferredAvd);
}
}
@@ -436,75 +618,6 @@
return true;
}
- private static Sdk getAndroidSdkForModule(@NotNull Module module) {
- return ModuleRootManager.getInstance(module).getSdk();
- }
-
- private static void copyGeneratedAndroidProject(File tempDir, VirtualFile contentRoot, VirtualFile sourceRoot) {
- final File[] children = tempDir.listFiles();
- if (children != null) {
- for (File child : children) {
- if (SdkConstants.FD_SOURCES.equals(child.getName())) {
- continue;
- }
- final File to = new File(contentRoot.getPath(), child.getName());
-
- try {
- if (child.isDirectory()) {
- FileUtil.copyDir(child, to);
- }
- else {
- FileUtil.copy(child, to);
- }
- }
- catch (IOException e) {
- LOG.error(e);
- }
- }
- }
-
- final File tempSourceRoot = new File(tempDir, SdkConstants.FD_SOURCES);
- if (tempSourceRoot.exists()) {
- final File to = new File(sourceRoot.getPath());
-
- try {
- FileUtil.copyDir(tempSourceRoot, to);
- }
- catch (IOException e) {
- LOG.error(e);
- }
- }
- }
-
- private static void configureManifest(@NotNull AndroidFacet facet, @NotNull IAndroidTarget target) {
- final Manifest manifest = facet.getManifest();
- if (manifest == null) {
- return;
- }
-
- final XmlTag manifestTag = manifest.getXmlTag();
- if (manifestTag == null) {
- return;
- }
-
- final PsiFile manifestFile = manifestTag.getContainingFile();
- if (manifestFile == null) {
- return;
- }
-
- final VirtualFile vManifestFile = manifestFile.getVirtualFile();
- if (vManifestFile == null ||
- !ReadonlyStatusHandler.ensureFilesWritable(manifestFile.getProject(), vManifestFile)) {
- return;
- }
- XmlTag usesSdkTag = manifestTag.createChildTag("uses-sdk", "", null, false);
- if (usesSdkTag != null) {
- usesSdkTag = manifestTag.addSubTag(usesSdkTag, true);
- usesSdkTag.setAttribute("minSdkVersion", SdkConstants.NS_RESOURCES, target.getVersion().getApiString());
- }
- CodeStyleManager.getInstance(manifestFile.getProject()).reformat(manifestFile);
- }
-
private void assignApplicationName(AndroidFacet facet) {
if (myApplicationName == null || myApplicationName.length() == 0) {
return;
@@ -539,35 +652,6 @@
}
}
- private static void createManifestFileAndAntFiles(Project project, VirtualFile contentRoot, Module module) {
- VirtualFile existingManifestFile = contentRoot.findChild(FN_ANDROID_MANIFEST_XML);
- if (existingManifestFile != null) {
- return;
- }
- try {
- AndroidFileTemplateProvider
- .createFromTemplate(project, contentRoot, AndroidFileTemplateProvider.ANDROID_MANIFEST_TEMPLATE, FN_ANDROID_MANIFEST_XML);
-
- Sdk sdk = getAndroidSdkForModule(module);
- if (sdk == null) return;
- AndroidPlatform platform = AndroidPlatform.parse(sdk);
-
- if (platform == null) {
- Messages.showErrorDialog(project, "Cannot parse Android SDK: '" + SdkConstants.FN_PROJECT_PROPERTIES + "' won't be generated",
- CommonBundle.getErrorTitle());
- return;
- }
-
- Properties properties = FileTemplateManager.getInstance().getDefaultProperties(project);
- properties.setProperty("TARGET", platform.getTarget().hashString());
- AndroidFileTemplateProvider.createFromTemplate(project, contentRoot, AndroidFileTemplateProvider.DEFAULT_PROPERTIES_TEMPLATE,
- SdkConstants.FN_PROJECT_PROPERTIES, properties);
- }
- catch (Exception e) {
- LOG.error(e);
- }
- }
-
private void addRunConfiguration(@NotNull AndroidFacet facet,
@NotNull TargetSelectionMode targetSelectionMode,
@Nullable String targetAvd) {
@@ -581,58 +665,10 @@
AndroidUtils.addRunConfiguration(facet, activityClass, false, targetSelectionMode, targetAvd);
}
- private static void addTestRunConfiguration(final AndroidFacet facet, @NotNull TargetSelectionMode mode, @Nullable String preferredAvd) {
- Project project = facet.getModule().getProject();
- RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
- Module module = facet.getModule();
- RunnerAndConfigurationSettings settings = runManager
- .createRunConfiguration(module.getName(), AndroidTestRunConfigurationType.getInstance().getFactory());
-
- AndroidTestRunConfiguration configuration = (AndroidTestRunConfiguration)settings.getConfiguration();
- configuration.setModule(module);
- configuration.setTargetSelectionMode(mode);
- if (preferredAvd != null) {
- configuration.PREFERRED_AVD = preferredAvd;
- }
-
- runManager.addConfiguration(settings, false);
- runManager.setActiveConfiguration(settings);
- }
-
private boolean isHelloAndroid() {
return StringUtil.isNotEmpty(myActivityName);
}
- @Nullable
- private static VirtualFile findSourceRoot(ModifiableRootModel model) {
- VirtualFile genSourceRoot = AndroidRootUtil.getStandardGenDir(model.getModule());
- for (VirtualFile root : model.getSourceRoots()) {
- if (!Comparing.equal(root, genSourceRoot)) {
- return root;
- }
- }
- return null;
- }
-
- @Nullable
- private static PsiDirectory createPackageIfPossible(final PsiDirectory sourceDir, String packageName) {
- if (sourceDir != null) {
- final String[] ids = packageName.split("\\.");
- return ApplicationManager.getApplication().runWriteAction(new Computable<PsiDirectory>() {
- @Override
- public PsiDirectory compute() {
- PsiDirectory dir = sourceDir;
- for (String id : ids) {
- PsiDirectory child = dir.findSubdirectory(id);
- dir = child == null ? dir.createSubdirectory(id) : child;
- }
- return dir;
- }
- });
- }
- return null;
- }
-
private void createActivityAndSetupManifest(final AndroidFacet facet, final PsiDirectory sourceDir) {
if (myPackageName != null) {
CommandProcessor.getInstance().executeCommand(facet.getModule().getProject(), new ExternalChangeAction() {
@@ -692,34 +728,18 @@
}
}
- private static void createFileFromResource(Project project, VirtualFile drawableDir, String name, String resourceFilePath)
- throws IOException {
- if (drawableDir.findChild(name) != null) {
- return;
- }
- VirtualFile resFile = drawableDir.createChildData(project, name);
- InputStream stream = AndroidModuleBuilder.class.getResourceAsStream(resourceFilePath);
- try {
- byte[] bytes = FileUtil.adaptiveLoadBytes(stream);
- resFile.setBinaryContent(bytes);
- }
- finally {
- stream.close();
- }
- }
-
public void setActivityName(String activityName) {
myActivityName = activityName;
}
- public void setApplicationName(String applicationName) {
- myApplicationName = applicationName;
- }
-
public String getApplicationName() {
return myApplicationName;
}
+ public void setApplicationName(String applicationName) {
+ myApplicationName = applicationName;
+ }
+
public void setPackageName(String packageName) {
myPackageName = packageName;
}
@@ -729,6 +749,11 @@
return StdModuleTypes.JAVA;
}
+ @Override
+ protected ProjectType getProjectType() {
+ return ANDROID_PROJECT_TYPE;
+ }
+
@Nullable
@Override
public ModuleWizardStep modifySettingsStep(@NotNull final SettingsStep settingsStep) {
@@ -791,23 +816,6 @@
return getClass().getName();
}
- private static Pair<String, Boolean> runAndroidTool(@NotNull GeneralCommandLine commandLine) {
- final StringBuildingOutputProcessor processor = new StringBuildingOutputProcessor();
- String result;
- boolean success = false;
- try {
- success = AndroidUtils.executeCommand(commandLine, processor, WaitingStrategies.WaitForever.getInstance()) == ExecutionStatus.SUCCESS;
- result = processor.getMessage();
- }
- catch (ExecutionException e) {
- result = e.getMessage();
- }
- if (result != null) {
- LOG.debug(result);
- }
- return Pair.create(result, success);
- }
-
@Override
public boolean isSuitableSdkType(SdkTypeId sdkType) {
return AndroidSdkType.getInstance() == sdkType;
@@ -815,7 +823,7 @@
public static class Library extends AndroidModuleBuilder {
public Library() {
- super(ProjectType.LIBRARY);
+ super(AndroidProjectType.LIBRARY);
}
@Override
@@ -832,7 +840,7 @@
public static class Test extends AndroidModuleBuilder {
public Test() {
- super(ProjectType.TEST);
+ super(AndroidProjectType.TEST);
}
@Override
diff --git a/android/src/org/jetbrains/android/newProject/AndroidModuleWizardStep.java b/android/src/org/jetbrains/android/newProject/AndroidModuleWizardStep.java
index f3c4838..ba03d47 100644
--- a/android/src/org/jetbrains/android/newProject/AndroidModuleWizardStep.java
+++ b/android/src/org/jetbrains/android/newProject/AndroidModuleWizardStep.java
@@ -35,19 +35,19 @@
private final AndroidAppPropertiesEditor myAppPropertiesEditor;
private final AndroidModuleBuilder myModuleBuilder;
- private final ProjectType myProjectType;
- private JPanel myPanel;
+ private final AndroidProjectType myProjectType;
private final Alarm myAvdsUpdatingAlarm = new Alarm();
+ private JPanel myPanel;
private boolean myInitialized;
public AndroidModuleWizardStep(@NotNull AndroidModuleBuilder moduleBuilder,
ModulesProvider modulesProvider,
- ProjectType projectType) {
+ AndroidProjectType projectType) {
super();
myProjectType = projectType;
myModuleBuilder = moduleBuilder;
myAppPropertiesEditor = new AndroidAppPropertiesEditor(moduleBuilder.getName(), modulesProvider);
- assert projectType == ProjectType.APPLICATION;
+ assert projectType == AndroidProjectType.APPLICATION;
myPanel = new JPanel();
myPanel.setLayout(new OverlayLayout(myPanel));
myPanel.add(myAppPropertiesEditor.getContentPanel());
@@ -87,7 +87,7 @@
@Override
public boolean validate() throws ConfigurationException {
- myAppPropertiesEditor.validate(myProjectType == ProjectType.LIBRARY);
+ myAppPropertiesEditor.validate(myProjectType == AndroidProjectType.LIBRARY);
return true;
}
diff --git a/android/src/org/jetbrains/android/newProject/ProjectType.java b/android/src/org/jetbrains/android/newProject/AndroidProjectType.java
similarity index 96%
rename from android/src/org/jetbrains/android/newProject/ProjectType.java
rename to android/src/org/jetbrains/android/newProject/AndroidProjectType.java
index 7b2ca2e..e081265 100644
--- a/android/src/org/jetbrains/android/newProject/ProjectType.java
+++ b/android/src/org/jetbrains/android/newProject/AndroidProjectType.java
@@ -18,6 +18,6 @@
/**
* @author Eugene.Kudelevsky
*/
-enum ProjectType {
+enum AndroidProjectType {
APPLICATION, LIBRARY, TEST
}
diff --git a/android/src/org/jetbrains/android/projectView/ResourceQualifierSwitcher.java b/android/src/org/jetbrains/android/projectView/ResourceQualifierSwitcher.java
index ae59e0d..aef245b 100644
--- a/android/src/org/jetbrains/android/projectView/ResourceQualifierSwitcher.java
+++ b/android/src/org/jetbrains/android/projectView/ResourceQualifierSwitcher.java
@@ -8,6 +8,7 @@
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
@@ -19,6 +20,7 @@
import com.intellij.ui.EditorNotifications;
import com.intellij.util.containers.BidirectionalMap;
import org.jetbrains.android.facet.AndroidFacet;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -38,6 +40,7 @@
myProject = project;
}
+ @NotNull
@Override
public Key<ResourceQualifierSwitcherPanel> getKey() {
return KEY;
@@ -45,7 +48,7 @@
@Nullable
@Override
- public ResourceQualifierSwitcherPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
+ public ResourceQualifierSwitcherPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (!ApplicationManager.getApplication().isInternal()) {
return null;
}
@@ -60,7 +63,7 @@
if (parent == null || !parent.getName().equals("res")) {
return null;
}
- Module module = ModuleUtil.findModuleForFile(file, myProject);
+ Module module = ModuleUtilCore.findModuleForFile(file, myProject);
AndroidFacet facet = module == null ? null : AndroidFacet.getInstance(module);
if (facet == null) {
return null;
@@ -95,7 +98,7 @@
private final VirtualFile myFile;
private final BidirectionalMap<String, VirtualFile> myQualifiers;
- public ResourceQualifierSwitcherPanel(final Project project, final VirtualFile file, BidirectionalMap<String, VirtualFile> qualifiers) {
+ public ResourceQualifierSwitcherPanel(final Project project, @NotNull final VirtualFile file, BidirectionalMap<String, VirtualFile> qualifiers) {
super(new BorderLayout());
myProject = project;
myFile = file;
@@ -126,7 +129,7 @@
private void switchToFile(String qualifier) {
VirtualFile newFile = myQualifiers.get(qualifier);
- if (newFile != myFile) {
+ if (!myFile.equals(newFile)) {
FileEditorManager.getInstance(myProject).openFile(newFile, true);
}
}
diff --git a/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.form b/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.form
index 18e5733..5340ab5 100644
--- a/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.form
+++ b/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.form
@@ -52,7 +52,7 @@
<text value="&Module:"/>
</properties>
</component>
- <component id="acdc4" class="javax.swing.JComboBox" binding="myModuleCombo">
+ <component id="acdc4" class="com.intellij.application.options.ModulesComboBox" binding="myModuleCombo">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
diff --git a/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.java b/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.java
index 5fcb51a..05ff6c0 100644
--- a/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.java
+++ b/android/src/org/jetbrains/android/refactoring/ExtractStyleDialog.java
@@ -21,6 +21,7 @@
import com.intellij.openapi.actionSystem.ActionToolbarPosition;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.module.Module;
+import com.intellij.application.options.ModulesComboBox;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.psi.xml.XmlAttribute;
@@ -35,14 +36,15 @@
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.util.AndroidResourceUtil;
import org.jetbrains.android.util.AndroidUtils;
-import org.jetbrains.android.util.ModuleListCellRendererWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
/**
* @author Alexander Lobas
@@ -54,7 +56,7 @@
private JPanel myAttributeListWrapper;
private JBLabel myAttributesLabel;
private JBLabel myModuleLabel;
- private JComboBox myModuleCombo;
+ private ModulesComboBox myModuleCombo;
private JBCheckBox mySearchForStyleApplicationsAfter;
private final Module myModule;
@@ -101,18 +103,8 @@
}
else {
myModule = null;
-
- final Module[] modules = modulesSet.toArray(new Module[modulesSet.size()]);
- Arrays.sort(modules, new Comparator<Module>() {
- @Override
- public int compare(Module m1, Module m2) {
- return m1.getName().compareTo(m2.getName());
- }
- });
-
- myModuleCombo.setModel(new DefaultComboBoxModel(modules));
- myModuleCombo.setSelectedItem(module);
- myModuleCombo.setRenderer(new ModuleListCellRendererWrapper(myModuleCombo.getRenderer()));
+ myModuleCombo.setModules(modulesSet);
+ myModuleCombo.setSelectedModule(module);
}
myRootNode = new CheckedTreeNode(null);
@@ -251,7 +243,7 @@
@Nullable
public Module getChosenModule() {
- return myModule != null ? myModule : (Module)myModuleCombo.getSelectedItem();
+ return myModule != null ? myModule : myModuleCombo.getSelectedModule();
}
public boolean isToSearchStyleApplications() {
diff --git a/android/src/org/jetbrains/android/resourceManagers/ResourceManager.java b/android/src/org/jetbrains/android/resourceManagers/ResourceManager.java
index 4893283..378846a 100644
--- a/android/src/org/jetbrains/android/resourceManagers/ResourceManager.java
+++ b/android/src/org/jetbrains/android/resourceManagers/ResourceManager.java
@@ -179,7 +179,7 @@
if ((files == null || files.contains(file)) && file.isValid()) {
final T element = AndroidUtils.loadDomElement(myProject, file, elementType);
if (element != null) {
- result.add(new Pair<T, VirtualFile>(element, file));
+ result.add(Pair.create(element, file));
}
}
}
diff --git a/android/src/org/jetbrains/android/run/AndroidActivityAliasCompletionContributor.java b/android/src/org/jetbrains/android/run/AndroidActivityAliasCompletionContributor.java
index f9153c9..bab4edc 100644
--- a/android/src/org/jetbrains/android/run/AndroidActivityAliasCompletionContributor.java
+++ b/android/src/org/jetbrains/android/run/AndroidActivityAliasCompletionContributor.java
@@ -25,7 +25,7 @@
public class AndroidActivityAliasCompletionContributor extends CompletionContributor {
@Override
- public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
+ public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
if (parameters.getCompletionType() != CompletionType.BASIC) {
return;
}
diff --git a/android/src/org/jetbrains/android/run/AndroidDebugRunner.java b/android/src/org/jetbrains/android/run/AndroidDebugRunner.java
index a2de5df..b069665 100644
--- a/android/src/org/jetbrains/android/run/AndroidDebugRunner.java
+++ b/android/src/org/jetbrains/android/run/AndroidDebugRunner.java
@@ -15,12 +15,9 @@
*/
package org.jetbrains.android.run;
-import com.android.annotations.concurrency.GuardedBy;
import com.android.ddmlib.IDevice;
import com.intellij.debugger.engine.RemoteDebugProcessHandler;
-import com.intellij.debugger.ui.DebuggerContentInfo;
import com.intellij.debugger.ui.DebuggerPanelsManager;
-import com.intellij.debugger.ui.DebuggerSessionTab;
import com.intellij.execution.*;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.configurations.RemoteState;
@@ -33,20 +30,19 @@
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.DefaultProgramRunner;
import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.runners.ProgramRunner;
-import com.intellij.execution.ui.*;
-import com.intellij.execution.ui.layout.PlaceInGrid;
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.execution.ui.ConsoleView;
+import com.intellij.execution.ui.RunContentDescriptor;
+import com.intellij.execution.ui.RunContentManager;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
-import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
@@ -54,22 +50,15 @@
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.psi.PsiClass;
import com.intellij.ui.content.Content;
-import com.intellij.ui.content.ContentManagerAdapter;
-import com.intellij.ui.content.ContentManagerEvent;
import com.intellij.xdebugger.DefaultDebugProcessHandler;
-import com.intellij.xdebugger.XDebuggerBundle;
-import icons.AndroidIcons;
import org.jetbrains.android.dom.manifest.Instrumentation;
import org.jetbrains.android.dom.manifest.Manifest;
-import org.jetbrains.android.logcat.AndroidLogcatView;
import org.jetbrains.android.logcat.AndroidToolWindowFactory;
import org.jetbrains.android.run.testing.AndroidTestRunConfiguration;
import org.jetbrains.android.util.AndroidBundle;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.util.List;
@@ -83,8 +72,8 @@
public static final Key<AndroidSessionInfo> ANDROID_SESSION_INFO = new Key<AndroidSessionInfo>("ANDROID_SESSION_INFO");
private static final Object myDebugLock = new Object();
- @NonNls private static final String ANDROID_DEBUG_SELECTED_TAB_PROPERTY = "ANDROID_DEBUG_SELECTED_TAB_";
public static final String ANDROID_LOGCAT_CONTENT_ID = "Android Logcat";
+ private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.run.AndroidDebugRunner");
private static NotificationGroup ourNotificationGroup; // created and accessed only in EDT
@@ -111,10 +100,7 @@
}
@Override
- protected RunContentDescriptor doExecute(@NotNull final Project project,
- @NotNull final RunProfileState state,
- final RunContentDescriptor contentToReuse,
- @NotNull final ExecutionEnvironment environment) throws ExecutionException {
+ protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment environment) throws ExecutionException {
assert state instanceof AndroidRunningState;
final AndroidRunningState runningState = (AndroidRunningState)state;
final RunContentDescriptor[] descriptor = {null};
@@ -126,25 +112,22 @@
@Override
public void run() {
if (descriptor[0] != null) {
- showNotification(project, environment.getExecutor(), descriptor[0], "error", false, NotificationType.ERROR);
+ showNotification(environment.getProject(), environment.getExecutor(), descriptor[0], "error", false, NotificationType.ERROR);
}
}
});
}
});
- descriptor[0] = doExec(project, runningState, contentToReuse, environment);
+ descriptor[0] = doExec(runningState, environment);
return descriptor[0];
}
- private RunContentDescriptor doExec(Project project,
- AndroidRunningState state,
- RunContentDescriptor contentToReuse,
- ExecutionEnvironment environment) throws ExecutionException {
+ private RunContentDescriptor doExec(AndroidRunningState state, ExecutionEnvironment environment) throws ExecutionException {
if (DefaultRunExecutor.EXECUTOR_ID.equals(environment.getExecutor().getId())) {
- final RunContentDescriptor descriptor = super.doExecute(project, state, contentToReuse, environment);
+ final RunContentDescriptor descriptor = super.doExecute(state, environment);
if (descriptor != null) {
- setActivateToolWindowWhenAddedProperty(project, environment.getExecutor(), descriptor, "running");
+ setActivateToolWindowWhenAddedProperty(environment.getProject(), environment.getExecutor(), descriptor, "running");
}
return descriptor;
}
@@ -164,11 +147,11 @@
state.setDebugMode(true);
RunContentDescriptor runDescriptor;
synchronized (myDebugLock) {
- MyDebugLauncher launcher = new MyDebugLauncher(project, state, environment);
+ MyDebugLauncher launcher = new MyDebugLauncher(state, environment);
state.setDebugLauncher(launcher);
- final RunContentDescriptor descriptor = embedToExistingSession(project, environment.getExecutor(), state);
- runDescriptor = descriptor != null ? descriptor : super.doExecute(project, state, contentToReuse, environment);
+ final RunContentDescriptor descriptor = embedToExistingSession(environment.getProject(), environment.getExecutor(), state);
+ runDescriptor = descriptor != null ? descriptor : super.doExecute(state, environment);
launcher.setRunDescriptor(runDescriptor);
if (descriptor != null) {
return null;
@@ -177,12 +160,10 @@
if (runDescriptor == null) {
return null;
}
- tryToCloseOldSessions(environment.getExecutor(), project);
+ tryToCloseOldSessions(environment.getExecutor(), environment.getProject());
final ProcessHandler handler = state.getProcessHandler();
- handler.putUserData(ANDROID_SESSION_INFO, new AndroidSessionInfo(
- runDescriptor, state, environment.getExecutor().getId()));
- state.setRestarter(runDescriptor.getRestarter());
- setActivateToolWindowWhenAddedProperty(project, environment.getExecutor(), runDescriptor, "running");
+ handler.putUserData(ANDROID_SESSION_INFO, new AndroidSessionInfo(runDescriptor, state, environment.getExecutor().getId()));
+ setActivateToolWindowWhenAddedProperty(environment.getProject(), environment.getExecutor(), runDescriptor, "running");
return runDescriptor;
}
@@ -221,9 +202,9 @@
}
@Nullable
- private static RunContentDescriptor embedToExistingSession(final Project project,
- final Executor executor,
- final AndroidRunningState state) throws ExecutionException {
+ protected static RunContentDescriptor embedToExistingSession(final Project project,
+ final Executor executor,
+ final AndroidRunningState state) {
final Pair<ProcessHandler, AndroidSessionInfo> pair = findOldSession(project, executor, state.getConfiguration());
final AndroidSessionInfo oldSessionInfo = pair != null ? pair.getSecond() : null;
final ProcessHandler oldProcessHandler = pair != null ? pair.getFirst() : null;
@@ -326,7 +307,7 @@
}
if (ourNotificationGroup == null) {
- ourNotificationGroup = NotificationGroup.toolWindowGroup("Android Session Restarted", executor.getToolWindowId(), true);
+ ourNotificationGroup = NotificationGroup.toolWindowGroup("Android Session Restarted", executor.getToolWindowId());
}
ourNotificationGroup
@@ -391,7 +372,7 @@
RemoteDebugProcessHandler process = new RemoteDebugProcessHandler(myProject);
myState.setProcessHandler(process);
myConsoleView = myState.getConfiguration().attachConsole(myState, executor);
- final MyLogcatExecutionConsole console = new MyLogcatExecutionConsole(myProject, myDevice, process, myConsoleView,
+ final LogcatExecutionConsole console = new LogcatExecutionConsole(myProject, myDevice, myConsoleView,
myState.getConfiguration().getType().getId());
return new DefaultExecutionResult(console, process);
}
@@ -431,111 +412,6 @@
profile instanceof AndroidRunConfigurationBase;
}
- private static class MyLogcatExecutionConsole implements ExecutionConsoleEx, ObservableConsoleView {
- private final Project myProject;
- private final AndroidLogcatView myToolWindowView;
- private final ConsoleView myConsoleView;
- private final String myConfigurationId;
-
- private MyLogcatExecutionConsole(Project project,
- IDevice device,
- RemoteDebugProcessHandler process,
- ConsoleView consoleView,
- String configurationId) {
- myProject = project;
- myConsoleView = consoleView;
- myConfigurationId = configurationId;
- myToolWindowView = new AndroidLogcatView(project, device) {
- @Override
- protected boolean isActive() {
- final DebuggerSessionTab sessionTab = DebuggerPanelsManager.getInstance(myProject).getSessionTab();
- if (sessionTab == null) {
- return false;
- }
- final Content content = sessionTab.getUi().findContent(ANDROID_LOGCAT_CONTENT_ID);
- return content != null && content.isSelected();
- }
- };
- Disposer.register(this, myToolWindowView);
- }
-
- @Override
- public void buildUi(final RunnerLayoutUi layoutUi) {
- final Content consoleContent = layoutUi.createContent(DebuggerContentInfo.CONSOLE_CONTENT, getComponent(),
- XDebuggerBundle.message("debugger.session.tab.console.content.name"),
- AllIcons.Debugger.Console, getPreferredFocusableComponent());
-
- consoleContent.setCloseable(false);
- layoutUi.addContent(consoleContent, 1, PlaceInGrid.bottom, false);
-
- // todo: provide other icon
- final Content logcatContent = layoutUi.createContent(ANDROID_LOGCAT_CONTENT_ID, myToolWindowView.getContentPanel(), "Logcat",
- AndroidIcons.Android, getPreferredFocusableComponent());
- logcatContent.setCloseable(false);
- logcatContent.setSearchComponent(myToolWindowView.createSearchComponent(myProject));
- layoutUi.addContent(logcatContent, 2, PlaceInGrid.bottom, false);
- final String selectedTabProperty = ANDROID_DEBUG_SELECTED_TAB_PROPERTY + myConfigurationId;
-
- final String tabName = PropertiesComponent.getInstance().getValue(selectedTabProperty);
- Content selectedContent = logcatContent;
-
- if (tabName != null) {
- for (Content content : layoutUi.getContents()) {
- if (tabName.equals(content.getDisplayName())) {
- selectedContent = content;
- }
- }
- }
- layoutUi.getContentManager().setSelectedContent(selectedContent);
-
- layoutUi.addListener(new ContentManagerAdapter() {
- @Override
- public void selectionChanged(final ContentManagerEvent event) {
- final Content content = event.getContent();
-
- if (content.isSelected()) {
- PropertiesComponent.getInstance().setValue(selectedTabProperty, content.getDisplayName());
- }
- myToolWindowView.activate();
- }
- }, myToolWindowView);
-
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- @Override
- public void run() {
- myToolWindowView.activate();
- }
- });
- }
-
- @Nullable
- @Override
- public String getExecutionConsoleId() {
- return "ANDROID_LOGCAT";
- }
-
- @Override
- public JComponent getComponent() {
- return myConsoleView.getComponent();
- }
-
- @Override
- public JComponent getPreferredFocusableComponent() {
- return myConsoleView.getPreferredFocusableComponent();
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void addChangeListener(@NotNull ChangeListener listener, @NotNull Disposable parent) {
- if (myConsoleView instanceof ObservableConsoleView) {
- ((ObservableConsoleView)myConsoleView).addChangeListener(listener, parent);
- }
- }
- }
-
private class MyDebugLauncher implements DebugLauncher {
private final Project myProject;
private final Executor myExecutor;
@@ -543,10 +419,9 @@
private final ExecutionEnvironment myEnvironment;
private RunContentDescriptor myRunDescriptor;
- public MyDebugLauncher(Project project,
- AndroidRunningState state,
+ public MyDebugLauncher(AndroidRunningState state,
ExecutionEnvironment environment) {
- myProject = project;
+ myProject = environment.getProject();
myRunningState = state;
myEnvironment = environment;
myExecutor = environment.getExecutor();
@@ -568,12 +443,15 @@
myRunningState, device);
RunContentDescriptor debugDescriptor = null;
final ProcessHandler processHandler = myRunningState.getProcessHandler();
+ processHandler.detachProcess();
try {
synchronized (myDebugLock) {
assert myRunDescriptor != null;
- debugDescriptor = manager
- .attachVirtualMachine(myExecutor, AndroidDebugRunner.this, myEnvironment, st, myRunDescriptor, st.getRemoteConnection(),
- false);
+ debugDescriptor = manager.attachVirtualMachine(new ExecutionEnvironmentBuilder(myEnvironment)
+ .executor(myExecutor)
+ .runner(AndroidDebugRunner.this)
+ .contentToReuse(myRunDescriptor)
+ .build(), st, st.getRemoteConnection(), false);
}
}
catch (ExecutionException e) {
@@ -581,11 +459,9 @@
}
ProcessHandler newProcessHandler = debugDescriptor != null ? debugDescriptor.getProcessHandler() : null;
if (debugDescriptor == null || newProcessHandler == null) {
- processHandler.notifyTextAvailable("Can't start debugging.", STDERR);
- processHandler.destroyProcess();
+ LOG.info("cannot start debugging");
return;
}
- processHandler.detachProcess();
final AndroidProcessText oldText = AndroidProcessText.get(processHandler);
if (oldText != null) {
oldText.printTo(newProcessHandler);
@@ -594,19 +470,7 @@
myRunningState.getProcessHandler().putUserData(ANDROID_SESSION_INFO, new AndroidSessionInfo(
debugDescriptor, st, myExecutor.getId()));
-
- final DebuggerSessionTab sessionTab = manager.getSessionTab();
- assert sessionTab != null;
- sessionTab.setEnvironment(myEnvironment);
-
- RunProfile profile = myEnvironment.getRunProfile();
- assert profile instanceof AndroidRunConfigurationBase;
- RunContentManager runContentManager = ExecutionManager.getInstance(myProject).getContentManager();
-
setActivateToolWindowWhenAddedProperty(myProject, myExecutor, debugDescriptor, "debugger connected");
-
- runContentManager.showRunContent(myExecutor, debugDescriptor);
- newProcessHandler.startNotify();
}
});
}
diff --git a/android/src/org/jetbrains/android/run/AndroidRunConfiguration.java b/android/src/org/jetbrains/android/run/AndroidRunConfiguration.java
index c70fc61..d33d899 100755
--- a/android/src/org/jetbrains/android/run/AndroidRunConfiguration.java
+++ b/android/src/org/jetbrains/android/run/AndroidRunConfiguration.java
@@ -81,7 +81,7 @@
@Override
protected Pair<Boolean, String> supportsRunningLibraryProjects(@NotNull AndroidFacet facet) {
- return new Pair<Boolean, String>(Boolean.FALSE, AndroidBundle.message("android.cannot.run.library.project.error"));
+ return Pair.create(Boolean.FALSE, AndroidBundle.message("android.cannot.run.library.project.error"));
}
@Override
diff --git a/android/src/org/jetbrains/android/run/AndroidRunningState.java b/android/src/org/jetbrains/android/run/AndroidRunningState.java
index 5bffdd6..254921e 100644
--- a/android/src/org/jetbrains/android/run/AndroidRunningState.java
+++ b/android/src/org/jetbrains/android/run/AndroidRunningState.java
@@ -54,6 +54,7 @@
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.execution.runners.ExecutionUtil;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
@@ -63,6 +64,7 @@
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -112,6 +114,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.*;
@@ -182,7 +185,6 @@
private volatile boolean myApplicationDeployed = false;
private ConsoleView myConsole;
- private Runnable myRestarter;
private TargetChooser myTargetChooser;
private final boolean mySupportMultipleDevices;
private final boolean myClearLogcatBeforeStart;
@@ -201,10 +203,6 @@
return myDebugMode;
}
- public void setRestarter(@NotNull Runnable restarter) {
- myRestarter = restarter;
- }
-
private static void runInDispatchedThread(@NotNull Runnable r, boolean blocking) {
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
@@ -493,7 +491,7 @@
boolean supportMultipleDevices,
boolean clearLogcatBeforeStart,
@NotNull AndroidRunConfigurationBase configuration,
- boolean nonDebuggableOnDevice) throws ExecutionException {
+ boolean nonDebuggableOnDevice) {
myFacet = facet;
myCommandLine = commandLine;
myConfiguration = configuration;
@@ -504,7 +502,7 @@
myAvdName = targetChooser instanceof EmulatorTargetChooser
? ((EmulatorTargetChooser)targetChooser).getAvd()
: null;
-
+
myEnv = environment;
myApplicationLauncher = applicationLauncher;
myClearLogcatBeforeStart = clearLogcatBeforeStart;
@@ -1100,8 +1098,13 @@
AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
if (myDebugMode && bridge != null && AdbService.canDdmsBeCorrupted(bridge)) {
message(AndroidBundle.message("ddms.corrupted.error"), STDERR);
- if (myConsole != null && myRestarter != null) {
- final Runnable r = myRestarter;
+ JComponent component = myConsole == null ? null : myConsole.getComponent();
+ if (component != null) {
+ final ExecutionEnvironment environment = LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
+ if (environment == null) {
+ return false;
+ }
+
myConsole.printHyperlink(AndroidBundle.message("restart.adb.fix.text"), new HyperlinkInfo() {
@Override
public void navigate(Project project) {
@@ -1111,7 +1114,7 @@
if (!processHandler.isProcessTerminated()) {
processHandler.destroyProcess();
}
- r.run();
+ ExecutionUtil.restart(environment);
}
});
myConsole.print("\n", ConsoleViewContentType.NORMAL_OUTPUT);
diff --git a/android/src/org/jetbrains/android/run/LogcatExecutionConsole.java b/android/src/org/jetbrains/android/run/LogcatExecutionConsole.java
new file mode 100644
index 0000000..9f0d605
--- /dev/null
+++ b/android/src/org/jetbrains/android/run/LogcatExecutionConsole.java
@@ -0,0 +1,214 @@
+package org.jetbrains.android.run;
+
+import com.android.ddmlib.IDevice;
+import com.intellij.debugger.ui.DebuggerContentInfo;
+import com.intellij.execution.filters.Filter;
+import com.intellij.execution.filters.HyperlinkInfo;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.execution.ui.*;
+import com.intellij.execution.ui.layout.PlaceInGrid;
+import com.intellij.icons.AllIcons;
+import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.ui.content.Content;
+import com.intellij.ui.content.ContentManagerAdapter;
+import com.intellij.ui.content.ContentManagerEvent;
+import com.intellij.xdebugger.XDebugSession;
+import com.intellij.xdebugger.XDebuggerBundle;
+import com.intellij.xdebugger.XDebuggerManager;
+import icons.AndroidIcons;
+import org.jetbrains.android.logcat.AndroidLogcatView;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+/**
+* @author Eugene.Kudelevsky
+*/
+class LogcatExecutionConsole implements ExecutionConsoleEx, ObservableConsoleView, ConsoleView {
+ @NonNls private static final String ANDROID_DEBUG_SELECTED_TAB_PROPERTY = "ANDROID_DEBUG_SELECTED_TAB_";
+
+ private final Project myProject;
+ private final AndroidLogcatView myToolWindowView;
+ @NotNull private final ConsoleView myConsoleView;
+ private final String myConfigurationId;
+
+ LogcatExecutionConsole(Project project,
+ IDevice device,
+ @NotNull ConsoleView consoleView,
+ String configurationId) {
+ myProject = project;
+ myConsoleView = consoleView;
+ myConfigurationId = configurationId;
+ myToolWindowView = new AndroidLogcatView(project, device) {
+ @Override
+ protected boolean isActive() {
+ final XDebugSession session = XDebuggerManager.getInstance(myProject).getDebugSession(LogcatExecutionConsole.this);
+ if (session == null) {
+ return false;
+ }
+ final Content content = session.getUI().findContent(AndroidDebugRunner.ANDROID_LOGCAT_CONTENT_ID);
+ return content != null && content.isSelected();
+ }
+ };
+ Disposer.register(this, myToolWindowView);
+ }
+
+ @Override
+ public void buildUi(final RunnerLayoutUi layoutUi) {
+ final Content consoleContent = layoutUi.createContent(DebuggerContentInfo.CONSOLE_CONTENT, getComponent(),
+ XDebuggerBundle.message("debugger.session.tab.console.content.name"),
+ AllIcons.Debugger.Console, getPreferredFocusableComponent());
+
+ consoleContent.setCloseable(false);
+ layoutUi.addContent(consoleContent, 1, PlaceInGrid.bottom, false);
+
+ // todo: provide other icon
+ final Content logcatContent = layoutUi.createContent(AndroidDebugRunner.ANDROID_LOGCAT_CONTENT_ID, myToolWindowView.getContentPanel(), "Logcat",
+ AndroidIcons.Android, getPreferredFocusableComponent());
+ logcatContent.setCloseable(false);
+ logcatContent.setSearchComponent(myToolWindowView.createSearchComponent(myProject));
+ layoutUi.addContent(logcatContent, 2, PlaceInGrid.bottom, false);
+ final String selectedTabProperty = ANDROID_DEBUG_SELECTED_TAB_PROPERTY + myConfigurationId;
+
+ final String tabName = PropertiesComponent.getInstance().getValue(selectedTabProperty);
+ Content selectedContent = logcatContent;
+
+ if (tabName != null) {
+ for (Content content : layoutUi.getContents()) {
+ if (tabName.equals(content.getDisplayName())) {
+ selectedContent = content;
+ }
+ }
+ }
+ layoutUi.getContentManager().setSelectedContent(selectedContent);
+
+ layoutUi.addListener(new ContentManagerAdapter() {
+ @Override
+ public void selectionChanged(final ContentManagerEvent event) {
+ final Content content = event.getContent();
+
+ if (content.isSelected()) {
+ PropertiesComponent.getInstance().setValue(selectedTabProperty, content.getDisplayName());
+ }
+ myToolWindowView.activate();
+ }
+ }, logcatContent);
+
+ ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ myToolWindowView.activate();
+ }
+ });
+ }
+
+ @Nullable
+ @Override
+ public String getExecutionConsoleId() {
+ return "ANDROID_LOGCAT";
+ }
+
+ @Override
+ public JComponent getComponent() {
+ return myConsoleView.getComponent();
+ }
+
+ @Override
+ public JComponent getPreferredFocusableComponent() {
+ return myConsoleView.getPreferredFocusableComponent();
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void addChangeListener(@NotNull ChangeListener listener, @NotNull Disposable parent) {
+ if (myConsoleView instanceof ObservableConsoleView) {
+ ((ObservableConsoleView)myConsoleView).addChangeListener(listener, parent);
+ }
+ }
+
+ @Override
+ public void print(@NotNull String s, @NotNull ConsoleViewContentType contentType) {
+ myConsoleView.print(s, contentType);
+ }
+
+ @Override
+ public void clear() {
+ myConsoleView.clear();
+ }
+
+ @Override
+ public void scrollTo(int offset) {
+ myConsoleView.scrollTo(offset);
+ }
+
+ @Override
+ public void attachToProcess(ProcessHandler processHandler) {
+ myConsoleView.attachToProcess(processHandler);
+ }
+
+ @Override
+ public void setOutputPaused(boolean value) {
+ myConsoleView.setOutputPaused(value);
+ }
+
+ @Override
+ public boolean isOutputPaused() {
+ return myConsoleView.isOutputPaused();
+ }
+
+ @Override
+ public boolean hasDeferredOutput() {
+ return myConsoleView.hasDeferredOutput();
+ }
+
+ @Override
+ public void performWhenNoDeferredOutput(Runnable runnable) {
+ myConsoleView.performWhenNoDeferredOutput(runnable);
+ }
+
+ @Override
+ public void setHelpId(String helpId) {
+ myConsoleView.setHelpId(helpId);
+ }
+
+ @Override
+ public void addMessageFilter(Filter filter) {
+ myConsoleView.addMessageFilter(filter);
+ }
+
+ @Override
+ public void printHyperlink(String hyperlinkText, HyperlinkInfo info) {
+ myConsoleView.printHyperlink(hyperlinkText, info);
+ }
+
+ @Override
+ public int getContentSize() {
+ return myConsoleView.getContentSize();
+ }
+
+ @Override
+ public boolean canPause() {
+ return myConsoleView.canPause();
+ }
+
+ @NotNull
+ @Override
+ public AnAction[] createConsoleActions() {
+ return myConsoleView.createConsoleActions();
+ }
+
+ @Override
+ public void allowHeavyFilters() {
+ myConsoleView.allowHeavyFilters();
+ }
+}
diff --git a/android/src/org/jetbrains/android/run/testing/AndroidTestRunConfiguration.java b/android/src/org/jetbrains/android/run/testing/AndroidTestRunConfiguration.java
index 1427719..f619832 100644
--- a/android/src/org/jetbrains/android/run/testing/AndroidTestRunConfiguration.java
+++ b/android/src/org/jetbrains/android/run/testing/AndroidTestRunConfiguration.java
@@ -89,12 +89,12 @@
protected Pair<Boolean, String> supportsRunningLibraryProjects(@NotNull AndroidFacet facet) {
if (!facet.isGradleProject()) {
// Non Gradle projects always require an application
- return new Pair<Boolean, String>(Boolean.FALSE, AndroidBundle.message("android.cannot.run.library.project.error"));
+ return Pair.create(Boolean.FALSE, AndroidBundle.message("android.cannot.run.library.project.error"));
}
final IdeaAndroidProject project = facet.getIdeaAndroidProject();
if (project == null) {
- return new Pair<Boolean, String>(Boolean.FALSE, AndroidBundle.message("android.cannot.run.library.project.error"));
+ return Pair.create(Boolean.FALSE, AndroidBundle.message("android.cannot.run.library.project.error"));
}
// Gradle only supports testing against a single build type (which could be anything, but is "debug" build type by default)
diff --git a/android/src/org/jetbrains/android/sdk/AndroidSdkConfigurableForm.java b/android/src/org/jetbrains/android/sdk/AndroidSdkConfigurableForm.java
index 4f393f5..05d66da 100644
--- a/android/src/org/jetbrains/android/sdk/AndroidSdkConfigurableForm.java
+++ b/android/src/org/jetbrains/android/sdk/AndroidSdkConfigurableForm.java
@@ -93,6 +93,10 @@
Map<OrderRootType, String[]> configuredRoots = new HashMap<OrderRootType, String[]>();
for (OrderRootType type : OrderRootType.getAllTypes()) {
+ if (!AndroidSdkType.getInstance().isRootTypeApplicable(type)) {
+ continue;
+ }
+
final VirtualFile[] oldRoots = sdkModificator.getRoots(type);
final String[] oldRootPaths = new String[oldRoots.length];
diff --git a/android/src/org/jetbrains/android/sdk/AndroidSdkNotConfiguredNotificationProvider.java b/android/src/org/jetbrains/android/sdk/AndroidSdkNotConfiguredNotificationProvider.java
index 9b26853..c75a1eef 100644
--- a/android/src/org/jetbrains/android/sdk/AndroidSdkNotConfiguredNotificationProvider.java
+++ b/android/src/org/jetbrains/android/sdk/AndroidSdkNotConfiguredNotificationProvider.java
@@ -11,7 +11,6 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.EditorNotificationPanel;
import com.intellij.ui.EditorNotifications;
-import org.jetbrains.android.dom.manifest.ManifestDomFileDescription;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.facet.AndroidRootUtil;
import org.jetbrains.annotations.NotNull;
@@ -31,6 +30,7 @@
myNotifications = notifications;
}
+ @NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
return KEY;
@@ -38,7 +38,7 @@
@Nullable
@Override
- public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
+ public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (file.getFileType() != XmlFileType.INSTANCE) {
return null;
}
diff --git a/android/src/org/jetbrains/android/sdk/AndroidSdkType.java b/android/src/org/jetbrains/android/sdk/AndroidSdkType.java
index 4c9f298..8392295 100644
--- a/android/src/org/jetbrains/android/sdk/AndroidSdkType.java
+++ b/android/src/org/jetbrains/android/sdk/AndroidSdkType.java
@@ -22,6 +22,9 @@
import com.intellij.CommonBundle;
import com.intellij.openapi.projectRoots.*;
import com.intellij.openapi.projectRoots.impl.JavaDependentSdkType;
+import com.intellij.openapi.roots.AnnotationOrderRootType;
+import com.intellij.openapi.roots.JavadocOrderRootType;
+import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
@@ -228,6 +231,14 @@
return DEFAULT_EXTERNAL_DOCUMENTATION_URL;
}
+ @Override
+ public boolean isRootTypeApplicable(OrderRootType type) {
+ return type == OrderRootType.CLASSES ||
+ type == OrderRootType.SOURCES ||
+ type == JavadocOrderRootType.getInstance() ||
+ type == AnnotationOrderRootType.getInstance();
+ }
+
@Nullable
private static Sdk getInternalJavaSdk(Sdk sdk) {
final SdkAdditionalData data = sdk.getSdkAdditionalData();
diff --git a/android/src/org/jetbrains/android/spellchecker/AndroidTextSpellcheckingStrategy.java b/android/src/org/jetbrains/android/spellchecker/AndroidTextSpellcheckingStrategy.java
index 1c2c0d8..561fd7a 100644
--- a/android/src/org/jetbrains/android/spellchecker/AndroidTextSpellcheckingStrategy.java
+++ b/android/src/org/jetbrains/android/spellchecker/AndroidTextSpellcheckingStrategy.java
@@ -15,17 +15,20 @@
*/
package org.jetbrains.android.spellchecker;
+import com.android.utils.Pair;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy;
import com.intellij.spellchecker.tokenizer.Tokenizer;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
+
+import java.util.concurrent.atomic.AtomicReference;
import static com.android.SdkConstants.*;
import static com.android.tools.idea.gradle.eclipse.GradleImport.IMPORT_SUMMARY_TXT;
@@ -37,8 +40,7 @@
* over 80 spelling errors from these files!
*/
public class AndroidTextSpellcheckingStrategy extends SpellcheckingStrategy {
- private PsiFile myLastPsiFile;
- private boolean myLastIgnore;
+ private final AtomicReference<Pair<VirtualFile, Boolean>> myLastVirtualFileIgnoredState = new AtomicReference<Pair<VirtualFile, Boolean>>();
@Override
public boolean isMyContext(@NotNull PsiElement element) {
@@ -47,41 +49,41 @@
return false;
}
- return isIgnored(file);
+ return isIgnored(file.getViewProvider().getVirtualFile());
}
- private boolean isIgnored(@Nullable PsiFile psiFile) {
- if (psiFile == null) {
- return false;
- }
- if (psiFile == myLastPsiFile) {
- return myLastIgnore;
+ private boolean isIgnored(@NotNull VirtualFile virtualFile) {
+ Pair<VirtualFile, Boolean> pair = myLastVirtualFileIgnoredState.get();
+
+ if (pair != null && virtualFile.equals(pair.getFirst())) {
+ return Boolean.TRUE == pair.getSecond();
}
- myLastPsiFile = psiFile;
+ FileType fileType = virtualFile.getFileType();
+ boolean lastIgnore = false;
- FileType fileType = psiFile.getFileType();
if (fileType == FileTypes.PLAIN_TEXT) {
- String name = psiFile.getName();
+ String name = virtualFile.getName();
if (Comparing.equal(name, FN_RESOURCE_TEXT, SystemInfo.isFileSystemCaseSensitive) ||
Comparing.equal(name, FN_GRADLE_WRAPPER_UNIX, SystemInfo.isFileSystemCaseSensitive) ||
Comparing.equal(name, FN_GRADLE_WRAPPER_WIN, SystemInfo.isFileSystemCaseSensitive) ||
Comparing.equal(name, IMPORT_SUMMARY_TXT, SystemInfo.isFileSystemCaseSensitive) ||
Comparing.equal(name, ".gitignore", SystemInfo.isFileSystemCaseSensitive)) {
- return myLastIgnore = true;
+ lastIgnore = true;
}
}
else if (fileType == StdFileTypes.PROPERTIES) {
- String name = psiFile.getName();
+ String name = virtualFile.getName();
if (Comparing.equal(name, FN_GRADLE_WRAPPER_PROPERTIES, SystemInfo.isFileSystemCaseSensitive) ||
Comparing.equal(name, FN_LOCAL_PROPERTIES, SystemInfo.isFileSystemCaseSensitive) ||
Comparing.equal(name, FN_GRADLE_PROPERTIES, SystemInfo.isFileSystemCaseSensitive)) {
- return myLastIgnore = true;
-
+ lastIgnore = true;
}
}
- return false;
+ myLastVirtualFileIgnoredState.lazySet(Pair.of(virtualFile, Boolean.valueOf(lastIgnore)));
+
+ return lastIgnore;
}
@NotNull
diff --git a/android/src/org/jetbrains/android/util/AndroidUtils.java b/android/src/org/jetbrains/android/util/AndroidUtils.java
index 70eebd4..59fd82b 100644
--- a/android/src/org/jetbrains/android/util/AndroidUtils.java
+++ b/android/src/org/jetbrains/android/util/AndroidUtils.java
@@ -27,7 +27,6 @@
import com.intellij.codeInsight.navigation.NavigationUtil;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.RunManager;
-import com.intellij.execution.RunManagerEx;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.configurations.ConfigurationType;
@@ -249,7 +248,7 @@
final Runnable r = new Runnable() {
@Override
public void run() {
- final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
+ final RunManager runManager = RunManager.getInstance(project);
final RunnerAndConfigurationSettings settings = runManager.
createRunConfiguration(module.getName(), AndroidRunConfigurationType.getInstance().getFactory());
final AndroidRunConfiguration configuration = (AndroidRunConfiguration)settings.getConfiguration();
@@ -270,7 +269,7 @@
configuration.PREFERRED_AVD = preferredAvdName;
}
runManager.addConfiguration(settings, false);
- runManager.setActiveConfiguration(settings);
+ runManager.setSelectedConfiguration(settings);
}
};
if (!ask) {
diff --git a/android/src/org/jetbrains/android/util/ModuleListCellRendererWrapper.java b/android/src/org/jetbrains/android/util/ModuleListCellRendererWrapper.java
deleted file mode 100644
index 05a65b0..0000000
--- a/android/src/org/jetbrains/android/util/ModuleListCellRendererWrapper.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2000-2012 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.util;
-
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleType;
-import com.intellij.ui.ListCellRendererWrapper;
-
-import javax.swing.*;
-
-/**
-* @author Eugene.Kudelevsky
-*/
-public class ModuleListCellRendererWrapper extends ListCellRendererWrapper<Module> {
- public ModuleListCellRendererWrapper(ListCellRenderer renderer) {
- super();
- }
-
- @Override
- public void customize(JList list, Module module, int index, boolean selected, boolean hasFocus) {
- setText(module.getName());
- setIcon(ModuleType.get(module).getIcon());
- }
-}
diff --git a/android/testData/dom/anim/root1.xml b/android/testData/dom/anim/root1.xml
new file mode 100644
index 0000000..0a2bd26
--- /dev/null
+++ b/android/testData/dom/anim/root1.xml
@@ -0,0 +1 @@
+<animation-li<caret>
\ No newline at end of file
diff --git a/android/testData/dom/anim/root1_after.xml b/android/testData/dom/anim/root1_after.xml
new file mode 100644
index 0000000..a89c054
--- /dev/null
+++ b/android/testData/dom/anim/root1_after.xml
@@ -0,0 +1 @@
+<animation-list
\ No newline at end of file
diff --git a/android/testData/dom/anim/tn1.xml b/android/testData/dom/anim/tn1.xml
new file mode 100644
index 0000000..3deca21
--- /dev/null
+++ b/android/testData/dom/anim/tn1.xml
@@ -0,0 +1,3 @@
+<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <it<caret>
+</animation-list>
\ No newline at end of file
diff --git a/android/testData/dom/anim/tn1_after.xml b/android/testData/dom/anim/tn1_after.xml
new file mode 100644
index 0000000..8f4ce41
--- /dev/null
+++ b/android/testData/dom/anim/tn1_after.xml
@@ -0,0 +1,3 @@
+<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+</animation-list>
\ No newline at end of file
diff --git a/android/testData/maven/myaar/myaar-1.0.aar b/android/testData/maven/myaar/myaar-1.0.aar
index 0c32e88..edad0d7 100644
--- a/android/testData/maven/myaar/myaar-1.0.aar
+++ b/android/testData/maven/myaar/myaar-1.0.aar
Binary files differ
diff --git a/android/testData/psiElementFinder/values.xml b/android/testData/psiElementFinder/values.xml
new file mode 100644
index 0000000..c15f259
--- /dev/null
+++ b/android/testData/psiElementFinder/values.xml
@@ -0,0 +1,4 @@
+<resources>
+ <item name="text_view" type="id"/>
+ <drawable name="pic"/>
+</resources>
\ No newline at end of file
diff --git a/android/testSrc/com/android/tools/idea/actions/AndroidImportProjectActionTest.java b/android/testSrc/com/android/tools/idea/actions/AndroidImportProjectActionTest.java
index 9e69bde..9ecb1ec 100644
--- a/android/testSrc/com/android/tools/idea/actions/AndroidImportProjectActionTest.java
+++ b/android/testSrc/com/android/tools/idea/actions/AndroidImportProjectActionTest.java
@@ -42,28 +42,28 @@
}
public void testFindImportTargetWithDirectoryAndWithoutGradleOrEclipseFiles() {
- assertSame(myProjectRootDir, ProjectImportUtil.findImportTarget(myProjectRootDir));
+ assertEquals(myProjectRootDir, ProjectImportUtil.findImportTarget(myProjectRootDir));
}
public void testFindImportTargetWithDirectoryAndGradleBuildFile() throws IOException {
VirtualFile file = createChildFile(SdkConstants.FN_BUILD_GRADLE);
- assertSame(file, ProjectImportUtil.findImportTarget(myProjectRootDir));
+ assertEquals(file, ProjectImportUtil.findImportTarget(myProjectRootDir));
}
public void testFindImportTargetWithDirectoryAndGradleSettingsFile() throws IOException {
VirtualFile file = createChildFile(SdkConstants.FN_SETTINGS_GRADLE);
- assertSame(file, ProjectImportUtil.findImportTarget(myProjectRootDir));
+ assertEquals(file, ProjectImportUtil.findImportTarget(myProjectRootDir));
}
public void testFindImportTargetWithDirectoryAndEclipseFiles() throws IOException {
createChildFile(GradleImport.ECLIPSE_DOT_CLASSPATH);
VirtualFile file = createChildFile(GradleImport.ECLIPSE_DOT_PROJECT);
- assertSame(file, ProjectImportUtil.findImportTarget(myProjectRootDir));
+ assertEquals(file, ProjectImportUtil.findImportTarget(myProjectRootDir));
}
public void testFindImportTargetWithEclipseProjectFile() throws IOException {
VirtualFile file = createChildFile(GradleImport.ECLIPSE_DOT_PROJECT);
- assertSame(file, ProjectImportUtil.findImportTarget(file));
+ assertEquals(file, ProjectImportUtil.findImportTarget(file));
}
@NotNull
diff --git a/android/testSrc/com/android/tools/idea/exportSignedPackage/ExportSignedPackageTest.java b/android/testSrc/com/android/tools/idea/exportSignedPackage/ExportSignedPackageTest.java
index 2176df0..099f147 100644
--- a/android/testSrc/com/android/tools/idea/exportSignedPackage/ExportSignedPackageTest.java
+++ b/android/testSrc/com/android/tools/idea/exportSignedPackage/ExportSignedPackageTest.java
@@ -21,6 +21,8 @@
import junit.framework.TestCase;
import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ProjectConnection;
+import org.gradle.util.DistributionLocator;
+import org.gradle.util.GradleVersion;
import org.jetbrains.android.AndroidTestBase;
import org.jetbrains.android.exportSignedPackage.ExportSignedPackageWizard;
import org.jetbrains.annotations.NonNls;
@@ -44,6 +46,7 @@
File projectDir = new File(androidPlugin, BASE_PATH + projectPath);
GradleConnector connector = GradleConnector.newConnector();
connector.forProjectDirectory(projectDir);
+ connector.useDistribution(new DistributionLocator().getDistributionFor(GradleVersion.version("1.10")));
AndroidProject model = null;
ProjectConnection connection = connector.connect();
diff --git a/android/testSrc/com/android/tools/idea/gradle/customizer/android/ContentRootModuleCustomizerTest.java b/android/testSrc/com/android/tools/idea/gradle/customizer/android/ContentRootModuleCustomizerTest.java
index b569dc8..f4cbc07 100644
--- a/android/testSrc/com/android/tools/idea/gradle/customizer/android/ContentRootModuleCustomizerTest.java
+++ b/android/testSrc/com/android/tools/idea/gradle/customizer/android/ContentRootModuleCustomizerTest.java
@@ -28,6 +28,7 @@
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.IdeaTestCase;
import com.intellij.util.containers.ContainerUtil;
@@ -95,9 +96,12 @@
SourceFolder[] sourceFolders = contentEntry.getSourceFolders();
List<String> sourcePaths = Lists.newArrayListWithExpectedSize(sourceFolders.length);
+
for (SourceFolder folder : sourceFolders) {
if (!folder.isTestSource()) {
VirtualFile file = folder.getFile();
+ final String path = VfsUtilCore.urlToPath(folder.getUrl());
+ System.out.println("path: " + path + "; " + new File(path).exists());
assertNotNull(file);
sourcePaths.add(file.getPath());
}
diff --git a/android/testSrc/com/android/tools/idea/gradle/project/NonAndroidGradleProjectImportingTestSuite.java b/android/testSrc/com/android/tools/idea/gradle/project/NonAndroidGradleProjectImportingTestSuite.java
new file mode 100644
index 0000000..05e4420
--- /dev/null
+++ b/android/testSrc/com/android/tools/idea/gradle/project/NonAndroidGradleProjectImportingTestSuite.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2000-2013 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 com.android.tools.idea.gradle.project;
+
+import org.jetbrains.plugins.gradle.importing.GradleDependenciesImportingTest;
+import org.jetbrains.plugins.gradle.importing.GradleFoldersImportingTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Check non-android gradle projects import with installed android plugin.
+ *
+ * @author Vladislav.Soroka
+ * @since 7/2/2014
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({GradleDependenciesImportingTest.class, GradleFoldersImportingTest.class})
+public class NonAndroidGradleProjectImportingTestSuite {}
diff --git a/android/testSrc/com/android/tools/idea/gradle/service/AndroidProjectDataServiceTest.java b/android/testSrc/com/android/tools/idea/gradle/service/AndroidProjectDataServiceTest.java
index 929a789..5dfcb67 100644
--- a/android/testSrc/com/android/tools/idea/gradle/service/AndroidProjectDataServiceTest.java
+++ b/android/testSrc/com/android/tools/idea/gradle/service/AndroidProjectDataServiceTest.java
@@ -24,7 +24,7 @@
import com.google.common.collect.Lists;
import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.Key;
-import com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl;
+import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestCase;
import org.jetbrains.plugins.gradle.util.GradleConstants;
@@ -74,7 +74,7 @@
final String jdkPath = Jdks.getJdkHomePath(LanguageLevel.JDK_1_6);
if (jdkPath != null) {
- VirtualDirectoryImpl.allowRootAccess(jdkPath);
+ VfsRootAccess.allowRootAccess(jdkPath);
}
List<DataNode<IdeaAndroidProject>> nodes = Lists.newArrayList();
Key<IdeaAndroidProject> key = AndroidProjectKeys.IDE_ANDROID_PROJECT;
diff --git a/android/testSrc/com/android/tools/idea/gradle/stubs/gradle/GradleProjectStub.java b/android/testSrc/com/android/tools/idea/gradle/stubs/gradle/GradleProjectStub.java
index be8fa50..2026f4e 100644
--- a/android/testSrc/com/android/tools/idea/gradle/stubs/gradle/GradleProjectStub.java
+++ b/android/testSrc/com/android/tools/idea/gradle/stubs/gradle/GradleProjectStub.java
@@ -19,7 +19,6 @@
import org.gradle.tooling.model.DomainObjectSet;
import org.gradle.tooling.model.GradleProject;
import org.gradle.tooling.model.GradleTask;
-import org.gradle.tooling.model.gradle.GradleScript;
import org.gradle.tooling.model.internal.ImmutableDomainObjectSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -33,7 +32,7 @@
@NotNull private final GradleScriptStub myScript;
@NotNull private final List<GradleTaskStub> myTasks;
- public GradleProjectStub(@NotNull String name, @NotNull String path, @Nullable File projectFile, @NotNull String...tasks) {
+ public GradleProjectStub(@NotNull String name, @NotNull String path, @Nullable File projectFile, @NotNull String... tasks) {
myName = name;
myPath = path;
myScript = new GradleScriptStub(projectFile);
diff --git a/android/testSrc/com/android/tools/idea/rendering/ClassConverterTest.java b/android/testSrc/com/android/tools/idea/rendering/ClassConverterTest.java
index 7a6cb34..47e5650 100644
--- a/android/testSrc/com/android/tools/idea/rendering/ClassConverterTest.java
+++ b/android/testSrc/com/android/tools/idea/rendering/ClassConverterTest.java
@@ -116,8 +116,8 @@
result = clz.getMethod("test").invoke(null);
assertEquals(Integer.valueOf(42), result);
- data = ClassConverter.rewriteClass(data, Integer.MAX_VALUE, 60); // future
- assertEquals(60, ClassConverter.getMajorVersion(data));
+ data = ClassConverter.rewriteClass(data, Integer.MAX_VALUE, 52); // latest known
+ assertEquals(52, ClassConverter.getMajorVersion(data));
classLoader = new TestClassLoader(data);
clz = classLoader.loadClass("Test");
assertNotNull(clz);
diff --git a/android/testSrc/com/android/tools/idea/rendering/IncludeReferenceTest.java b/android/testSrc/com/android/tools/idea/rendering/IncludeReferenceTest.java
index 66a8aec..dc03c9a 100644
--- a/android/testSrc/com/android/tools/idea/rendering/IncludeReferenceTest.java
+++ b/android/testSrc/com/android/tools/idea/rendering/IncludeReferenceTest.java
@@ -18,10 +18,8 @@
import com.android.ide.common.resources.ResourceResolver;
import com.android.tools.idea.configurations.Configuration;
import com.android.tools.idea.configurations.ConfigurationManager;
-import com.android.tools.idea.configurations.ResourceResolverCache;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.xml.XmlFile;
import org.jetbrains.android.AndroidTestCase;
@@ -40,11 +38,11 @@
assertEquals("designtime.xml", reference.getFromDisplayName());
assertEquals("designtime", reference.getFromResourceName());
assertEquals("@layout/designtime", reference.getFromResourceUrl());
- assertSame(file1, reference.getFromFile());
- assertSame(file2, reference.getToFile());
- assertSame(file1, LocalFileSystem.getInstance().findFileByIoFile(reference.getFromPath()));
+ assertEquals(file1, reference.getFromFile());
+ assertEquals(file2, reference.getToFile());
+ assertEquals(file1, LocalFileSystem.getInstance().findFileByIoFile(reference.getFromPath()));
//noinspection ConstantConditions
- assertSame(file2, LocalFileSystem.getInstance().findFileByIoFile(reference.getToPath()));
+ assertEquals(file2, LocalFileSystem.getInstance().findFileByIoFile(reference.getToPath()));
assertSame(myModule, reference.getModule());
reference = IncludeReference.create(myModule, file3, file2);
@@ -72,11 +70,11 @@
assertEquals("includer", reference.getFromResourceName());
assertEquals("@layout/includer", reference.getFromResourceUrl());
- assertSame(reference.getFromFile(), includer);
- assertSame(reference.getToFile(), included);
+ assertEquals(reference.getFromFile(), includer);
+ assertEquals(reference.getToFile(), included);
IncludeReference.setIncludingLayout(getProject(), psiFile, null);
- assertSame(IncludeReference.NONE, IncludeReference.get(myModule, psiFile, resourceResolver));
+ assertEquals(IncludeReference.NONE, IncludeReference.get(myModule, psiFile, resourceResolver));
VirtualFile other = myFixture.copyFileToProject("xmlpull/designtime.xml", "res/layout-land/designtime.xml");
assertNotNull(other);
diff --git a/android/testSrc/com/android/tools/idea/rendering/ModuleResourceRepositoryTest.java b/android/testSrc/com/android/tools/idea/rendering/ModuleResourceRepositoryTest.java
index 62334d2..9cbabc3 100644
--- a/android/testSrc/com/android/tools/idea/rendering/ModuleResourceRepositoryTest.java
+++ b/android/testSrc/com/android/tools/idea/rendering/ModuleResourceRepositoryTest.java
@@ -353,7 +353,7 @@
assertNotNull(psiFile);
VirtualFile parent = psiFile.getVirtualFile();
assertNotNull(parent);
- assertSame(dir, parent.getParent().getParent());
+ assertEquals(dir, parent.getParent().getParent());
}
static void assertStringIs(LocalResourceRepository repository, String key, String expected) {
diff --git a/android/testSrc/com/android/tools/idea/templates/TemplateTest.java b/android/testSrc/com/android/tools/idea/templates/TemplateTest.java
index 06614cb..82fa314 100755
--- a/android/testSrc/com/android/tools/idea/templates/TemplateTest.java
+++ b/android/testSrc/com/android/tools/idea/templates/TemplateTest.java
@@ -481,8 +481,7 @@
return;
}
markChecked(templateFile, createWithProject);
- Stopwatch stopwatch = Stopwatch.createUnstarted();
- stopwatch.start();
+ Stopwatch stopwatch = Stopwatch.createStarted();
checkTemplate(templateFile, createWithProject);
stopwatch.stop();
System.out.println("Checked " + templateFile.getName() + " successfully in " + stopwatch.toString());
diff --git a/android/testSrc/com/android/tools/idea/welcome/AndroidVirtualDeviceTest.java b/android/testSrc/com/android/tools/idea/welcome/AndroidVirtualDeviceTest.java
index aa641a5..284e2b8 100755
--- a/android/testSrc/com/android/tools/idea/welcome/AndroidVirtualDeviceTest.java
+++ b/android/testSrc/com/android/tools/idea/welcome/AndroidVirtualDeviceTest.java
@@ -37,7 +37,7 @@
public class AndroidVirtualDeviceTest extends AndroidTestBase {
private static boolean DISABLED = true; // Don't know if all required components are installed on a test farm.
- public static final File ANDROID_HOME = AndroidTestCaseHelper.getAndroidSdkPath();
+ File ANDROID_HOME;
private static Map<String, String> getReferenceMap() {
// Expected values are defined in http://b.android.com/78945
@@ -82,6 +82,7 @@
if (DISABLED) {
return; // Disabled
}
+ ANDROID_HOME = AndroidTestCaseHelper.getAndroidSdkPath();
super.setUp();
final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder =
IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
diff --git a/android/testSrc/org/jetbrains/android/AndroidFacetImporterTest.java b/android/testSrc/org/jetbrains/android/AndroidFacetImporterTest.java
index 1c5c72c..c022443 100644
--- a/android/testSrc/org/jetbrains/android/AndroidFacetImporterTest.java
+++ b/android/testSrc/org/jetbrains/android/AndroidFacetImporterTest.java
@@ -497,18 +497,27 @@
final Library aarLib = ((LibraryOrderEntry)deps[2]).getLibrary();
assertNotNull(aarLib);
final String[] dep2Urls = aarLib.getUrls(OrderRootType.CLASSES);
- assertEquals(2, dep2Urls.length);
- String classesJarDep = dep2Urls[0];
- String resDep = dep2Urls[1];
+ assertEquals(3, dep2Urls.length);
+ String classesJarDep = null;
+ String myJarDep = null;
+ String resDep = null;
- if (resDep.contains("classes.jar")) {
- final String t = resDep;
- resDep = classesJarDep;
- classesJarDep = t;
+ for (String url : dep2Urls) {
+ if (url.contains("classes.jar")) {
+ classesJarDep = url;
+ }
+ else if (url.contains("myjar.jar")) {
+ myJarDep = url;
+ }
+ else {
+ resDep = url;
+ }
}
final String extractedAarDirPath = FileUtil.toCanonicalPath(myDir.getPath() + "/project/gen-external-apklibs/com_myaar_1.0");
assertEquals(VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, extractedAarDirPath + "/classes.jar") +
JarFileSystem.JAR_SEPARATOR, classesJarDep);
+ assertEquals(VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, extractedAarDirPath + "/libs/myjar.jar") +
+ JarFileSystem.JAR_SEPARATOR, myJarDep);
assertEquals(VfsUtilCore.pathToUrl(extractedAarDirPath + "/res"), resDep);
assertInstanceOf(deps[3], LibraryOrderEntry.class);
@@ -904,6 +913,8 @@
assertEquals(new HashSet<String>(Arrays.asList(
"target/generated-sources/combined-resources",
"target/generated-sources/combined-assets",
+ "target/test-classes",
+ "target/classes",
"target/generated-sources/extracted-dependencies")
), new HashSet<String>(Arrays.asList(excludedRootUrls)));
@@ -915,10 +926,11 @@
importProject();
sourceRoots = toRelativePaths(rootManager.getSourceRootUrls());
- assertEquals(0, sourceRoots.length);
+ assertEquals(2, sourceRoots.length);
excludedRootUrls = toRelativePaths(rootManager.getExcludeRootUrls());
assertEquals(new HashSet<String>(Arrays.asList(
+ "target/test-classes", "target/classes",
"target/generated-sources/combined-resources",
"target/generated-sources/combined-assets",
"target/generated-sources/extracted-dependencies",
diff --git a/android/testSrc/org/jetbrains/android/AndroidGotoRelatedTest.java b/android/testSrc/org/jetbrains/android/AndroidGotoRelatedTest.java
index 3ce22f7..e14e9ac 100644
--- a/android/testSrc/org/jetbrains/android/AndroidGotoRelatedTest.java
+++ b/android/testSrc/org/jetbrains/android/AndroidGotoRelatedTest.java
@@ -3,7 +3,7 @@
import com.android.SdkConstants;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
-import com.intellij.ide.actions.GotoRelatedFileAction;
+import com.intellij.ide.actions.GotoRelatedSymbolAction;
import com.intellij.navigation.GotoRelatedItem;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.vfs.VirtualFile;
@@ -160,12 +160,12 @@
private List<GotoRelatedItem> doGotoRelatedFile(VirtualFile file) {
myFixture.configureFromExistingVirtualFile(file);
- final GotoRelatedFileAction action = new GotoRelatedFileAction();
+ final GotoRelatedSymbolAction action = new GotoRelatedSymbolAction();
final TestActionEvent e = new TestActionEvent(action);
action.beforeActionPerformedUpdate(e);
final Presentation presentation = e.getPresentation();
assertTrue(presentation.isEnabled() && presentation.isVisible());
- return GotoRelatedFileAction.getItems(myFixture.getFile(), myFixture.getEditor(), null);
+ return GotoRelatedSymbolAction.getItems(myFixture.getFile(), myFixture.getEditor(), null);
}
private void doCheckLineMarkers(List<VirtualFile> expectedTargetFiles, Class<?> targetElementClass) {
diff --git a/android/testSrc/org/jetbrains/android/AndroidPsiElementFinderTest.java b/android/testSrc/org/jetbrains/android/AndroidPsiElementFinderTest.java
new file mode 100644
index 0000000..227aeb7
--- /dev/null
+++ b/android/testSrc/org/jetbrains/android/AndroidPsiElementFinderTest.java
@@ -0,0 +1,21 @@
+package org.jetbrains.android;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.search.GlobalSearchScope;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class AndroidPsiElementFinderTest extends AndroidTestCase {
+ private static final String BASE_PATH = "/psiElementFinder/";
+
+ public void testResourceClasses() throws Exception {
+ myFixture.copyFileToProject(BASE_PATH + "values.xml", "res/values/values.xml");
+ myFixture.copyFileToProject("R.java", "src/p1/p2/R.java");
+ final Project project = getProject();
+ final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
+ assertNotNull(facade.findClass("p1.p2.R.drawable", GlobalSearchScope.projectScope(project)));
+ assertEquals(1, facade.findClasses("p1.p2.R.drawable", GlobalSearchScope.projectScope(project)).length);
+ }
+}
diff --git a/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java b/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java
index a0910f1..b9c86db 100644
--- a/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java
+++ b/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java
@@ -44,6 +44,7 @@
fail("Exception should be thrown");
}
catch (Exception e) {
+ e.printStackTrace();
assertEquals(AndroidSdkType.getInstance().getUnsatisfiedDependencyMessage(), e.getMessage());
}
}
diff --git a/android/testSrc/org/jetbrains/android/AndroidTestBase.java b/android/testSrc/org/jetbrains/android/AndroidTestBase.java
index 428cb0b..9e6b0f6 100644
--- a/android/testSrc/org/jetbrains/android/AndroidTestBase.java
+++ b/android/testSrc/org/jetbrains/android/AndroidTestBase.java
@@ -18,6 +18,7 @@
import com.android.sdklib.IAndroidTarget;
import com.android.tools.idea.rendering.ResourceHelper;
import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
@@ -84,7 +85,7 @@
if (new File(adtPath).exists()) {
return adtPath;
}
- return new File(PathManager.getHomePath(), "android/android").getPath();
+ return PathManagerEx.findFileUnderCommunityHome("android/android").getPath();
}
public static String getDefaultTestSdkPath() {
diff --git a/android/testSrc/org/jetbrains/android/dom/AndroidAnimationDomTest.java b/android/testSrc/org/jetbrains/android/dom/AndroidAnimationDomTest.java
index 8c65de8..00e63da 100644
--- a/android/testSrc/org/jetbrains/android/dom/AndroidAnimationDomTest.java
+++ b/android/testSrc/org/jetbrains/android/dom/AndroidAnimationDomTest.java
@@ -45,6 +45,10 @@
toTestCompletion("root.xml", "root_after.xml");
}
+ public void testRootCompletion1() throws Throwable {
+ toTestCompletion("root1.xml", "root1_after.xml");
+ }
+
public void testHighlighting() throws Throwable {
doTestHighlighting("hl.xml");
}
@@ -52,4 +56,8 @@
public void testChildren() throws Throwable {
toTestCompletion("tn.xml", "tn_after.xml");
}
+
+ public void testChildren1() throws Throwable {
+ toTestCompletion("tn1.xml", "tn1_after.xml");
+ }
}
diff --git a/android/testSrc/org/jetbrains/android/inspections/lint/DomPsiConverterTest.java b/android/testSrc/org/jetbrains/android/inspections/lint/DomPsiConverterTest.java
index 8953cee..b4fc7ec 100644
--- a/android/testSrc/org/jetbrains/android/inspections/lint/DomPsiConverterTest.java
+++ b/android/testSrc/org/jetbrains/android/inspections/lint/DomPsiConverterTest.java
@@ -19,6 +19,7 @@
import com.android.utils.XmlUtils;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
@@ -78,7 +79,12 @@
public void run() {
try {
assertFalse(ApplicationManager.getApplication().isReadAccessAllowed());
- String formatted = XmlPrettyPrinter.prettyPrint(domDocument, true);
+ String formatted = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
+ @Override
+ public String compute() {
+ return XmlPrettyPrinter.prettyPrint(domDocument, true);
+ }
+ });
formattedHolder.set(formatted);
} catch (Exception e) {
e.printStackTrace();
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSource.java b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSource.java
index 132e4db..9e40a85 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSource.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSource.java
@@ -1,6 +1,8 @@
package org.jetbrains.android.database;
-import com.intellij.javaee.module.view.dataSource.LocalDataSource;
+import com.intellij.database.dataSource.DataSourceTemplate;
+import com.intellij.database.dataSource.LocalDataSource;
+import com.intellij.database.model.info.DataSourceInfo;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.ModificationTracker;
@@ -14,7 +16,6 @@
import icons.AndroidIcons;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.IOException;
@@ -30,8 +31,8 @@
private State myState = new State();
- public AndroidDataSource(@Nullable String name) {
- super(name, "org.sqlite.JDBC", "", null, null);
+ public AndroidDataSource() {
+ super("", "org.sqlite.JDBC", "", null, null);
}
@NotNull
@@ -41,14 +42,17 @@
@NotNull
public State buildFullState() {
- myState.setName(getName());
- myState.setClasspathElements(serializeClasspathElements());
+ myState.name = getName();
+ //myState.uuid = getUniqueId();
+ myState.classpathElements = serializeClasspathElements();
return myState;
}
public void loadState(@NotNull State state) {
myState = state;
- setName(state.getName());
+ setName(state.name);
+ // todo persist uuid must be preserved between sessions
+ //setUniqueId(state.uuid);
setClasspathElements(deserializeClasspathElements());
resetUrl();
}
@@ -78,7 +82,7 @@
@NotNull
private List<SimpleClasspathElement> deserializeClasspathElements() {
- final Element[] serializedElements = myState.getClasspathElements();
+ final Element[] serializedElements = myState.classpathElements;
if (serializedElements == null || serializedElements.length == 0) {
return Collections.emptyList();
@@ -105,7 +109,7 @@
public String buildLocalDbFileOsPath() {
final State state = getState();
return AndroidRemoteDataBaseManager.buildLocalDbFileOsPath(
- state.getDeviceId(), state.getPackageName(), state.getDatabaseName(), state.isExternal());
+ state.deviceId, state.packageName, state.databaseName, state.external);
}
@Override
@@ -115,15 +119,16 @@
@NotNull
public AndroidDataSource copy() {
- final AndroidDataSource newSource = new AndroidDataSource(getName());
- final State newState = newSource.getState();
- final State state = buildFullState();
- newState.setName(state.getName());
- newState.setDeviceId(state.getDeviceId());
- newState.setPackageName(state.getPackageName());
- newState.setDatabaseName(state.getDatabaseName());
- newState.setExternal(state.isExternal());
- newState.setClasspathElements(cloneElementsArray(state.getClasspathElements()));
+ AndroidDataSource newSource = new AndroidDataSource();
+ newSource.setName(getName());
+ State newState = newSource.getState();
+ State state = buildFullState();
+ newState.name = state.name;
+ newState.deviceId = state.deviceId;
+ newState.packageName = state.packageName;
+ newState.databaseName = state.databaseName;
+ newState.external = state.external;
+ newState.classpathElements = cloneElementsArray(state.classpathElements);
newSource.resetUrl();
return newSource;
}
@@ -153,71 +158,25 @@
if (!(o instanceof AndroidDataSource)) return super.equalConfiguration(o);
State s = ((AndroidDataSource)o).getState();
- if (!Comparing.equal(myState.myDeviceId, s.myDeviceId)) return false;
- if (!Comparing.equal(myState.myPackageName, s.myPackageName)) return false;
- if (!Comparing.equal(myState.myDatabaseName, s.myDatabaseName)) return false;
- if (!Comparing.equal(myState.myExternal, s.myExternal)) return false;
- if (!Comparing.equal(myState.myExternal, s.myExternal)) return false;
+ if (!Comparing.equal(myState.deviceId, s.deviceId)) return false;
+ if (!Comparing.equal(myState.packageName, s.packageName)) return false;
+ if (!Comparing.equal(myState.databaseName, s.databaseName)) return false;
+ if (!Comparing.equal(myState.external, s.external)) return false;
+ if (!Comparing.equal(myState.external, s.external)) return false;
return true;
}
@Tag("data-source")
public static class State {
- private String myName = "";
- private String myDeviceId = "";
- private String myPackageName = "";
- private String myDatabaseName = "";
- private boolean myExternal = false;
- private Element[] myClasspathElements = new Element[0];
-
- public String getDeviceId() {
- return myDeviceId;
- }
-
- public String getDatabaseName() {
- return myDatabaseName;
- }
-
- public String getPackageName() {
- return myPackageName;
- }
-
- public String getName() {
- return myName;
- }
-
- public boolean isExternal() {
- return myExternal;
- }
-
+ //@Attribute
+ //public String uuid = "";
+ public String deviceId = "";
+ public String name = "";
+ public String packageName = "";
+ public String databaseName = "";
+ public boolean external = false;
@Tag("classpath-elements")
- public Element[] getClasspathElements() {
- return myClasspathElements;
- }
-
- public void setDeviceId(String deviceId) {
- myDeviceId = deviceId;
- }
-
- public void setDatabaseName(String databaseName) {
- myDatabaseName = databaseName;
- }
-
- public void setPackageName(String packageName) {
- myPackageName = packageName;
- }
-
- public void setExternal(boolean external) {
- myExternal = external;
- }
-
- public void setName(String name) {
- myName = name;
- }
-
- public void setClasspathElements(Element[] classpathElements) {
- myClasspathElements = classpathElements;
- }
+ public Element[] classpathElements = new Element[0];
}
-}
\ No newline at end of file
+}
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceProjectComponent.java b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceProjectComponent.java
index bcb781c..17d77f0 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceProjectComponent.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceProjectComponent.java
@@ -1,10 +1,10 @@
package org.jetbrains.android.database;
+import com.intellij.database.autoconfig.DataSourceConfigUtil;
import com.intellij.facet.ProjectFacetManager;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.persistence.database.autoconfig.DataSourceConfigUtil;
import com.intellij.util.containers.HashSet;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.NotNull;
@@ -45,7 +45,12 @@
for (AndroidDataSource source : AndroidDataSourceStorage.getInstance(myProject).getDataSources()) {
final AndroidDataSource.State s = source.getState();
- result.add(new AndroidRemoteDbInfo(s.getDeviceId(), s.getPackageName(), s.getDatabaseName(), s.isExternal()));
+ String deviceId = s.deviceId;
+
+ if (deviceId == null) {
+ deviceId = "";
+ }
+ result.add(new AndroidRemoteDbInfo(deviceId, s.packageName, s.databaseName, s.external));
}
return result;
}
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourcePropertiesDialog.java b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourcePropertiesDialog.java
index 3755f52..17ce986 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourcePropertiesDialog.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourcePropertiesDialog.java
@@ -4,7 +4,10 @@
import com.android.ddmlib.FileListingService;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.MultiLineReceiver;
-import com.android.tools.idea.ddms.DeviceComboBoxRenderer;
+import com.android.tools.idea.ddms.DeviceRenderer;
+import com.intellij.database.dataSource.AbstractDataSourceConfigurable;
+import com.intellij.database.dataSource.DatabaseDriver;
+import com.intellij.database.util.DbImplUtil;
import com.intellij.facet.ProjectFacetManager;
import com.intellij.javaee.dataSource.AbstractDataSourceConfigurable;
import com.intellij.javaee.dataSource.DatabaseDriver;
@@ -16,7 +19,6 @@
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.persistence.database.DbImplUtil;
import com.intellij.ui.FieldPanel;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.components.JBRadioButton;
@@ -43,7 +45,8 @@
/**
* @author Eugene.Kudelevsky
*/
-public class AndroidDataSourcePropertiesDialog extends AbstractDataSourceConfigurable<AndroidDbManager, AndroidDataSource> implements Disposable {
+public class AndroidDataSourcePropertiesDialog extends AbstractDataSourceConfigurable<AndroidDbManager, AndroidDataSource> implements
+ Disposable {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.database.AndroidDataSourcePropertiesDialog");
private static final String[] DEFAULT_EXTERNAL_DB_PATTERNS = new String[]{"files/"};
@@ -80,7 +83,7 @@
}
});
- myDeviceComboBox.setRenderer(new DeviceComboBoxRenderer() {
+ myDeviceComboBox.setRenderer(new DeviceRenderer.DeviceComboBoxRenderer() {
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof String) {
@@ -184,7 +187,7 @@
private void loadDevices() {
final AndroidDebugBridge bridge = AndroidSdkUtils.getDebugBridge(myProject);
final IDevice[] devices = bridge != null ? getDevicesWithValidDeviceId(bridge) : new IDevice[0];
- final String deviceId = myDataSource.getState().getDeviceId();
+ final String deviceId = myDataSource.getState().deviceId;
final DefaultComboBoxModel model = new DefaultComboBoxModel(devices);
Object selectedItem = null;
@@ -347,10 +350,10 @@
public void saveData(@NotNull AndroidDataSource dataSource) {
dataSource.setName(getNameValue());
AndroidDataSource.State state = dataSource.getState();
- state.setDeviceId(getSelectedDeviceId());
- state.setPackageName(getSelectedPackage());
- state.setDatabaseName(getSelectedDatabase());
- state.setExternal(myExternalStorageRadioButton.isSelected());
+ state.deviceId = getSelectedDeviceId();
+ state.packageName = getSelectedPackage();
+ state.databaseName = getSelectedDatabase();
+ state.external = myExternalStorageRadioButton.isSelected();
dataSource.resetUrl();
}
@@ -372,11 +375,11 @@
AndroidDataSource.State state = myDataSource.getState();
myNameField.setText(StringUtil.notNullize(myDataSource.getName()));
- myInternalStorageRadioButton.setSelected(!state.isExternal());
- myExternalStorageRadioButton.setSelected(state.isExternal());
+ myInternalStorageRadioButton.setSelected(!state.external);
+ myExternalStorageRadioButton.setSelected(state.external);
- myPackageNameComboBox.getEditor().setItem(StringUtil.notNullize(state.getPackageName()));
- myDataBaseComboBox.getEditor().setItem(StringUtil.notNullize(state.getDatabaseName()));
+ myPackageNameComboBox.getEditor().setItem(StringUtil.notNullize(state.packageName));
+ myDataBaseComboBox.getEditor().setItem(StringUtil.notNullize(state.databaseName));
}
private void registerDeviceListener() {
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceStorage.java b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceStorage.java
index ff7f387..7875fec 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceStorage.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidDataSourceStorage.java
@@ -35,7 +35,7 @@
public void loadState(State state) {
myDataSources.clear();
for (AndroidDataSource.State dataSourceState : state.myDataSources) {
- AndroidDataSource dataSource = new AndroidDataSource(null);
+ AndroidDataSource dataSource = new AndroidDataSource();
dataSource.loadState(dataSourceState);
addDataSource(dataSource);
}
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidDbManager.java b/android/ultimate/src/org/jetbrains/android/database/AndroidDbManager.java
index 3ec0383..7a98f60 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidDbManager.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidDbManager.java
@@ -1,5 +1,14 @@
package org.jetbrains.android.database;
+import com.intellij.database.DatabaseMessages;
+import com.intellij.database.dataSource.DataSourceTemplate;
+import com.intellij.database.dialects.DatabaseDialectEx;
+import com.intellij.database.dialects.SqliteDialect;
+import com.intellij.database.model.info.DataSourceInfo;
+import com.intellij.database.psi.BasicDbPsiManager;
+import com.intellij.database.psi.DbDataSourceElement;
+import com.intellij.database.psi.DbElement;
+import com.intellij.database.psi.DbPsiFacade;
import com.intellij.facet.ProjectFacetManager;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.command.UndoConfirmationPolicy;
@@ -13,15 +22,6 @@
import com.intellij.openapi.util.ModificationTracker;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.persistence.DatabaseMessages;
-import com.intellij.persistence.database.DataSourceInfo;
-import com.intellij.persistence.database.DataSourceTemplate;
-import com.intellij.persistence.database.dialects.DatabaseDialect;
-import com.intellij.persistence.database.dialects.SqliteDialect;
-import com.intellij.persistence.database.psi.BasicDbPsiManager;
-import com.intellij.persistence.database.psi.DbDataSourceElement;
-import com.intellij.persistence.database.psi.DbElement;
-import com.intellij.persistence.database.psi.DbPsiFacade;
import icons.AndroidIcons;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.NotNull;
@@ -45,7 +45,7 @@
@Nullable
@Override
- public DatabaseDialect getDatabaseDialect(@NotNull DbDataSourceElement element) {
+ public DatabaseDialectEx getDatabaseDialect(@NotNull DbDataSourceElement element) {
return SqliteDialect.INSTANCE;
}
@@ -186,7 +186,7 @@
result = ((AndroidDataSource)copyFrom).copy();
}
else {
- result = new AndroidDataSource("");
+ result = new AndroidDataSource();
}
result.setName(StringUtil.notNullize(newName, getName()));
result.resolveDriver();
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidDbUtil.java b/android/ultimate/src/org/jetbrains/android/database/AndroidDbUtil.java
index 23d8ad2..b2d7030 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidDbUtil.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidDbUtil.java
@@ -1,6 +1,9 @@
package org.jetbrains.android.database;
-import com.android.ddmlib.*;
+import com.android.ddmlib.AndroidDebugBridge;
+import com.android.ddmlib.IDevice;
+import com.android.ddmlib.MultiLineReceiver;
+import com.android.ddmlib.SyncService;
import com.android.tools.idea.ddms.DevicePropertyUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -166,7 +169,7 @@
@NotNull AndroidDebugBridge debugBridge,
@NotNull AndroidDbErrorReporter errorReporter) {
final AndroidDataSource.State state = dataSource.getState();
- final String deviceId = state.getDeviceId();
+ final String deviceId = state.deviceId;
if (deviceId == null) {
errorReporter.reportError("device is not specified");
@@ -182,19 +185,19 @@
errorReporter.reportError("the device is not online");
return null;
}
- final String packageName = dataSource.getState().getPackageName();
+ final String packageName = dataSource.getState().packageName;
if (packageName == null || packageName.length() == 0) {
errorReporter.reportError("package name is not specified");
return null;
}
- final String dbName = dataSource.getState().getDatabaseName();
+ final String dbName = dataSource.getState().databaseName;
if (dbName == null || dbName.length() == 0) {
errorReporter.reportError("database name is not specified");
return null;
}
- return new AndroidDbConnectionInfo(device, packageName, dbName, dataSource.getState().isExternal());
+ return new AndroidDbConnectionInfo(device, packageName, dbName, dataSource.getState().external);
}
@Nullable
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidSynchronizeHandler.java b/android/ultimate/src/org/jetbrains/android/database/AndroidSynchronizeHandler.java
index ecc15d8..4dc513f 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidSynchronizeHandler.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidSynchronizeHandler.java
@@ -3,14 +3,14 @@
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.IDevice;
import com.intellij.CommonBundle;
-import com.intellij.persistence.database.SynchronizeHandler;
+import com.intellij.database.SynchronizeHandler;
+import com.intellij.database.psi.DbDataSourceElement;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.persistence.database.psi.DbDataSourceElement;
import com.intellij.util.containers.HashSet;
import org.jetbrains.android.sdk.AndroidSdkUtils;
import org.jetbrains.android.util.AndroidBundle;
diff --git a/android/ultimate/src/org/jetbrains/android/database/AndroidUploadDatabaseAction.java b/android/ultimate/src/org/jetbrains/android/database/AndroidUploadDatabaseAction.java
index 6a7e109..cf19c90 100644
--- a/android/ultimate/src/org/jetbrains/android/database/AndroidUploadDatabaseAction.java
+++ b/android/ultimate/src/org/jetbrains/android/database/AndroidUploadDatabaseAction.java
@@ -3,6 +3,7 @@
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.IDevice;
import com.intellij.CommonBundle;
+import com.intellij.database.psi.DbDataSourceElement;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.diagnostic.Logger;
@@ -11,7 +12,6 @@
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
-import com.intellij.persistence.database.psi.DbDataSourceElement;
import org.jetbrains.android.sdk.AndroidSdkUtils;
import org.jetbrains.android.util.AndroidBundle;
import org.jetbrains.annotations.NotNull;
@@ -25,7 +25,7 @@
import java.util.List;
import java.util.Set;
-import static com.intellij.persistence.database.view.DatabaseView.getSelectedElements;
+import static com.intellij.database.view.DatabaseView.getSelectedElements;
/**
* @author Eugene.Kudelevsky
diff --git a/native/WinLauncher/.gitignore b/native/WinLauncher/.gitignore
deleted file mode 100644
index 115c72a..0000000
--- a/native/WinLauncher/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-Debug
-Debug-Win32
-Debug-x64
-obj
-ipch
-*.opensdf
-*.suo
-*.sdf
-*.aps
-*.user
-*.pdb
-*.ncb
-
diff --git a/native/WinLauncher/WinLauncher.cpp b/native/WinLauncher/WinLauncher.cpp
deleted file mode 100644
index 37ec092..0000000
--- a/native/WinLauncher/WinLauncher.cpp
+++ /dev/null
@@ -1,817 +0,0 @@
-/*
-* Copyright 2000-2013 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.
-*/
-
-#include "stdafx.h"
-#include "WinLauncher.h"
-
-typedef JNIIMPORT jint (JNICALL *JNI_createJavaVM)(JavaVM **pvm, JNIEnv **env, void *args);
-
-HINSTANCE hInst; // current instance
-char jvmPath[_MAX_PATH] = "";
-JavaVMOption* vmOptions = NULL;
-int vmOptionCount = 0;
-bool bServerJVM = false;
-HMODULE hJVM = NULL;
-JNI_createJavaVM pCreateJavaVM = NULL;
-JavaVM* jvm = NULL;
-JNIEnv* env = NULL;
-volatile bool terminating = false;
-
-HANDLE hFileMapping;
-HANDLE hEvent;
-HANDLE hSingleInstanceWatcherThread;
-const int FILE_MAPPING_SIZE = 16000;
-
-#ifdef _M_X64
-bool need64BitJRE = true;
-#define BITS_STR "64-bit"
-#else
-bool need64BitJRE = false;
-#define BITS_STR "32-bit"
-#endif
-
-#define ERROR_LAUNCHING_APP "Error launching Android Studio"
-
-std::string EncodeWideACP(const std::wstring &str)
-{
- int cbANSI = WideCharToMultiByte(CP_ACP, 0, str.c_str(), str.size(), NULL, 0, NULL, NULL);
- char* ansiBuf = new char[cbANSI];
- WideCharToMultiByte(CP_ACP, 0, str.c_str(), str.size(), ansiBuf, cbANSI, NULL, NULL);
- std::string result(ansiBuf, cbANSI);
- delete[] ansiBuf;
- return result;
-}
-
-std::string LoadStdString(int id)
-{
- wchar_t *buf = NULL;
- int len = LoadStringW(hInst, id, reinterpret_cast<LPWSTR>(&buf), 0);
- return len ? EncodeWideACP(std::wstring(buf, len)) : "";
-}
-
-bool FileExists(const std::string& path)
-{
- return GetFileAttributesA(path.c_str()) != INVALID_FILE_ATTRIBUTES;
-}
-
-bool IsValidJRE(const char* path)
-{
- std::string dllPath(path);
- if (dllPath[dllPath.size()-1] != '\\')
- {
- dllPath += "\\";
- }
- return FileExists(dllPath + "bin\\server\\jvm.dll") || FileExists(dllPath + "bin\\client\\jvm.dll");
-}
-
-bool Is64BitJRE(const char* path)
-{
- std::string cfgPath(path);
- cfgPath += "\\lib\\amd64\\jvm.cfg";
- return FileExists(cfgPath);
-}
-
-bool FindValidJVM(const char* path)
-{
- if (IsValidJRE(path))
- {
- strcpy_s(jvmPath, _MAX_PATH-1, path);
- return true;
- }
- char jrePath[_MAX_PATH];
- strcpy_s(jrePath, path);
- if (jrePath[strlen(jrePath)-1] != '\\')
- {
- strcat_s(jrePath, "\\");
- }
- strcat_s(jrePath, _MAX_PATH-1, "jre");
- if (IsValidJRE(jrePath))
- {
- strcpy_s(jvmPath, jrePath);
- return true;
- }
- return false;
-}
-
-std::string GetAdjacentDir(const char* suffix)
-{
- char libDir[_MAX_PATH];
- GetModuleFileNameA(NULL, libDir, _MAX_PATH-1);
- char* lastSlash = strrchr(libDir, '\\');
- if (!lastSlash) return "";
- *lastSlash = '\0';
- lastSlash = strrchr(libDir, '\\');
- if (!lastSlash) return "";
- strcpy(lastSlash+1, suffix);
- strcat_s(libDir, "\\");
- return std::string(libDir);
-}
-
-bool FindJVMInEnvVar(const char* envVarName, bool& result)
-{
- char envVarValue[_MAX_PATH];
- if (GetEnvironmentVariableA(envVarName, envVarValue, _MAX_PATH-1))
- {
- if (FindValidJVM(envVarValue))
- {
- if (Is64BitJRE(jvmPath) != need64BitJRE) return false;
- result = true;
- }
- else
- {
- char buf[_MAX_PATH];
- sprintf_s(buf, "The environment variable %s (with the value of %s) does not point to a valid JVM installation.",
- envVarName, envVarValue);
- MessageBoxA(NULL, buf, ERROR_LAUNCHING_APP, MB_OK);
- result = false;
- }
- return true;
- }
- return false;
-}
-
-bool FindJVMInRegistryKey(const char* key, bool wow64_32)
-{
- HKEY hKey;
- int flags = KEY_READ;
- if (wow64_32) flags |= KEY_WOW64_32KEY;
- if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hKey) != ERROR_SUCCESS) return false;
- char javaHome[_MAX_PATH];
- DWORD javaHomeSize = _MAX_PATH-1;
- bool success = false;
- if (RegQueryValueExA(hKey, "JavaHome", NULL, NULL, (LPBYTE) javaHome, &javaHomeSize) == ERROR_SUCCESS)
- {
- success = FindValidJVM(javaHome);
- }
- RegCloseKey(hKey);
- return success;
-}
-
-bool FindJVMInRegistryWithVersion(const char* version, bool wow64_32)
-{
- const char* keyName = LoadStdString(IDS_JDK_ONLY) == std::string("true")
- ? "Java Development Kit"
- : "Java Runtime Environment";
-
- char buf[_MAX_PATH];
- sprintf_s(buf, "Software\\JavaSoft\\%s\\%s", keyName, version);
- return FindJVMInRegistryKey(buf, wow64_32);
-}
-
-bool FindJVMInRegistry()
-{
-#ifndef _M_X64
- if (FindJVMInRegistryWithVersion("1.8", true))
- return true;
- if (FindJVMInRegistryWithVersion("1.7", true))
- return true;
- if (FindJVMInRegistryWithVersion("1.6", true))
- return true;
-#endif
-
- if (FindJVMInRegistryWithVersion("1.8", false))
- return true;
- if (FindJVMInRegistryWithVersion("1.7", false))
- return true;
- if (FindJVMInRegistryWithVersion("1.6", false))
- return true;
- return false;
-}
-
-// The following code is taken from http://msdn.microsoft.com/en-us/library/ms684139(v=vs.85).aspx
-// and provides a backwards compatible way to check if this application is a 32-bit process running
-// on a 64-bit OS
-typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
-LPFN_ISWOW64PROCESS fnIsWow64Process;
-
-BOOL IsWow64()
-{
- BOOL bIsWow64 = FALSE;
-
- //IsWow64Process is not available on all supported versions of Windows.
- //Use GetModuleHandle to get a handle to the DLL that contains the function
- //and GetProcAddress to get a pointer to the function if available.
-
- fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
- GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
-
- if(NULL != fnIsWow64Process)
- {
- if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
- {
- //handle error
- }
- }
- return bIsWow64;
-}
-
-bool LocateJVM()
-{
- bool result;
- if (FindJVMInEnvVar(LoadStdString(IDS_JDK_ENV_VAR).c_str(), result))
- {
- return result;
- }
-
- std::string jreDir = GetAdjacentDir("jre");
- if (FindValidJVM(jreDir.c_str()) && Is64BitJRE(jvmPath) == need64BitJRE)
- {
- return true;
- }
-
- if (FindJVMInRegistry())
- {
- return true;
- }
-
- if (FindJVMInEnvVar("JAVA_HOME", result))
- {
- return result;
- }
-
- std::string jvmError;
- jvmError = "No JVM installation found. Please install a " BITS_STR " JDK.\n"
- "If you already have a JDK installed, define a JAVA_HOME variable in\n"
- "Computer > System Properties > System Settings > Environment Variables.";
-
- if (IsWow64()) {
- // If WoW64, this means we are running a 32-bit program on 64-bit Windows. This may explain
- // why we couldn't locate the JVM.
- jvmError += "\n\nNOTE: We have detected that you are running a 64-bit version of the "
- "Windows® operating system but are running studio.exe, which is a 32-bit process. This "
- "can prevent you from finding a 64-bit installation of Java. Consider running "
- "studio64.exe if this is the problem you're encountering.";
- }
-
- MessageBoxA(NULL, jvmError.c_str(), ERROR_LAUNCHING_APP, MB_OK);
- return false;
-}
-
-void TrimLine(char* line)
-{
- char *p = line + strlen(line) - 1;
- if (p >= line && *p == '\n')
- {
- *p-- = '\0';
- }
- while(p >= line && (*p == ' ' || *p == '\t'))
- {
- *p-- = '\0';
- }
-}
-
-bool LoadVMOptionsFile(const TCHAR* path, std::vector<std::string>& vmOptionLines)
-{
- FILE *f = _tfopen(path, _T("rt"));
- if (!f) return false;
-
- char line[_MAX_PATH];
- while(fgets(line, _MAX_PATH, f))
- {
- TrimLine(line);
- if (line[0] == '#') continue;
- if (strcmp(line, "-server") == 0)
- {
- bServerJVM = true;
- }
- else if (strlen(line) > 0)
- {
- vmOptionLines.push_back(line);
- }
- }
- fclose(f);
-
- return true;
-}
-
-std::string FindToolsJar()
-{
- std::string toolsJarPath = jvmPath;
- size_t lastSlash = toolsJarPath.rfind('\\');
- if (lastSlash != std::string::npos)
- {
- toolsJarPath = toolsJarPath.substr(0, lastSlash+1) + "lib\\tools.jar";
- if (FileExists(toolsJarPath))
- {
- return toolsJarPath;
- }
- }
- return "";
-}
-
-std::string CollectLibJars(const std::string& jarList)
-{
- std::string libDir = GetAdjacentDir("lib");
- if (libDir.size() == 0 || !FileExists(libDir))
- {
- return "";
- }
-
- std::string result;
- int pos = 0;
- while(pos < jarList.size())
- {
- int delimiterPos = jarList.find(';', pos);
- if (delimiterPos == std::string::npos)
- {
- delimiterPos = jarList.size();
- }
- if (result.size() > 0)
- {
- result += ";";
- }
- result += libDir;
- result += jarList.substr(pos, delimiterPos-pos);
- pos = delimiterPos+1;
- }
- return result;
-}
-
-std::string BuildClassPath()
-{
- std::string classpathLibs = LoadStdString(IDS_CLASSPATH_LIBS);
- std::string result = CollectLibJars(classpathLibs);
-
- std::string toolsJar = FindToolsJar();
- if (toolsJar.size() > 0)
- {
- result += ";";
- result += toolsJar;
- }
-
- return result;
-}
-
-bool AddClassPathOptions(std::vector<std::string>& vmOptionLines)
-{
- std::string classPath = BuildClassPath();
- if (classPath.size() == 0) return false;
- vmOptionLines.push_back(std::string("-Djava.class.path=") + classPath);
-
- std::string bootClassPathLibs = LoadStdString(IDS_BOOTCLASSPATH_LIBS);
- std::string bootClassPath = CollectLibJars(bootClassPathLibs);
- if (bootClassPath.size() > 0)
- {
- vmOptionLines.push_back(std::string("-Xbootclasspath/a:") + bootClassPath);
- }
-
- return true;
-}
-
-void AddPredefinedVMOptions(std::vector<std::string>& vmOptionLines)
-{
- std::string vmOptions = LoadStdString(IDS_VM_OPTIONS);
- while(vmOptions.size() > 0)
- {
- int pos = vmOptions.find(' ');
- if (pos == std::string::npos) pos = vmOptions.size();
- vmOptionLines.push_back(vmOptions.substr(0, pos));
- while(pos < vmOptions.size() && vmOptions[pos] == ' ') pos++;
- vmOptions = vmOptions.substr(pos);
- }
-
- char propertiesFile[_MAX_PATH];
- if (GetEnvironmentVariableA(LoadStdString(IDS_PROPS_ENV_VAR).c_str(), propertiesFile, _MAX_PATH)) {
- vmOptionLines.push_back(std::string("-Didea.properties.file=") + propertiesFile);
- }
-}
-
-bool LoadVMOptions()
-{
- TCHAR buffer[_MAX_PATH];
- TCHAR copy[_MAX_PATH];
-
- std::vector<std::wstring> files;
-
- GetModuleFileName(NULL, buffer, _MAX_PATH);
- std::wstring module(buffer);
-
- files.push_back(module + L".vmoptions");
-
-
- if (LoadString(hInst, IDS_VM_OPTIONS_PATH, buffer, _MAX_PATH)) {
- ExpandEnvironmentStrings(buffer, copy, _MAX_PATH - 1);
- std::wstring selector(copy);
- files.push_back(selector + module.substr(module.find_last_of('\\')) + L".vmoptions");
- }
-
- if (LoadString(hInst, IDS_VM_OPTIONS_ENV_VAR, buffer, _MAX_PATH)) {
- if (GetEnvironmentVariableW(buffer, copy, _MAX_PATH)) {
- ExpandEnvironmentStrings(copy, buffer, _MAX_PATH);
- files.push_back(std::wstring(buffer));
- }
- }
-
- if (files.size() == 0) {
- MessageBox(NULL, _T("Cannot find VM options file"), _T(ERROR_LAUNCHING_APP), MB_OK);
- return false;
- }
-
- std::wstring used;
- std::vector<std::string> vmOptionLines;
- for (int i = 0; i < files.size(); i++) {
- if (GetFileAttributes(files[i].c_str()) != INVALID_FILE_ATTRIBUTES) {
- if (LoadVMOptionsFile(files[i].c_str(), vmOptionLines)) {
- used += (used.size() ? L"," : L"") + files[i];
- }
- }
- }
-
- vmOptionLines.push_back(std::string("-Djb.vmOptions=") + EncodeWideACP(used));
-
- if (!AddClassPathOptions(vmOptionLines)) return false;
- AddPredefinedVMOptions(vmOptionLines);
-
- vmOptionCount = vmOptionLines.size();
- vmOptions = (JavaVMOption*) malloc(vmOptionCount * sizeof(JavaVMOption));
- for(int i=0; i<vmOptionLines.size(); i++)
- {
- vmOptions[i].optionString = _strdup(vmOptionLines[i].c_str());
- vmOptions[i].extraInfo = 0;
- }
-
- return true;
-}
-
-bool LoadJVMLibrary()
-{
- std::string dllName(jvmPath);
- std::string binDir = dllName + "\\bin";
- std::string serverDllName = binDir + "\\server\\jvm.dll";
- std::string clientDllName = binDir + "\\client\\jvm.dll";
- if ((bServerJVM && FileExists(serverDllName)) || !FileExists(clientDllName))
- {
- dllName = serverDllName;
- }
- else
- {
- dllName = clientDllName;
- }
-
- // ensure we can find msvcr100.dll which is located in jre/bin directory; jvm.dll depends on it.
- SetCurrentDirectoryA(binDir.c_str());
- hJVM = LoadLibraryA(dllName.c_str());
- if (hJVM)
- {
- pCreateJavaVM = (JNI_createJavaVM) GetProcAddress(hJVM, "JNI_CreateJavaVM");
- }
- if (!pCreateJavaVM)
- {
- std::string jvmError = "Failed to load JVM DLL ";
- jvmError += dllName.c_str();
- jvmError += "\n"
- "If you already have a " BITS_STR " JDK installed, define a JAVA_HOME variable in "
- "Computer > System Properties > System Settings > Environment Variables.";
- MessageBoxA(NULL, jvmError.c_str(), ERROR_LAUNCHING_APP, MB_OK);
- return false;
- }
- return true;
-}
-
-bool CreateJVM()
-{
- JavaVMInitArgs initArgs;
- initArgs.version = JNI_VERSION_1_2;
- initArgs.options = vmOptions;
- initArgs.nOptions = vmOptionCount;
- initArgs.ignoreUnrecognized = JNI_FALSE;
-
- int result = pCreateJavaVM(&jvm, &env, &initArgs);
-
- for(int i=0; i<vmOptionCount; i++)
- {
- free(vmOptions[i].optionString);
- }
- free(vmOptions);
- vmOptions = NULL;
-
- if (result != JNI_OK)
- {
- TCHAR buf[_MAX_PATH + 256];
-
- _stprintf_s(buf,
- _T("Failed to create JVM: error code %d.\n")
- _T("JVM Path: %hs\n")
- _T("If you already have a %s JDK installed, define a JAVA_HOME variable in ")
- _T("Computer > System Properties > System Settings > Environment Variables."),
- result, jvmPath, _T(BITS_STR));
- MessageBox(NULL, buf, _T(ERROR_LAUNCHING_APP), MB_OK);
- }
-
- return result == JNI_OK;
-}
-
-jobjectArray PrepareCommandLine()
-{
- int numArgs;
- LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &numArgs);
- jclass stringClass = env->FindClass("java/lang/String");
- jobjectArray args = env->NewObjectArray(numArgs-1, stringClass, NULL);
- for(int i=1; i<numArgs; i++)
- {
- const wchar_t* arg = argv[i];
- env->SetObjectArrayElement(args, i-1, env->NewString((const jchar *) arg, wcslen(argv[i])));
- }
- return args;
-}
-
-bool RunMainClass()
-{
- std::string mainClassName = LoadStdString(IDS_MAIN_CLASS);
- jclass mainClass = env->FindClass(mainClassName.c_str());
- if (!mainClass)
- {
- char buf[_MAX_PATH + 256];
- sprintf_s(buf,
- "Could not find main class %s",
- mainClassName.c_str());
- MessageBoxA(NULL, buf, ERROR_LAUNCHING_APP, MB_OK);
- return false;
- }
-
- jmethodID mainMethod = env->GetStaticMethodID(mainClass, "main", "([Ljava/lang/String;)V");
- if (!mainMethod)
- {
- MessageBoxA(NULL, "Could not find main method", ERROR_LAUNCHING_APP, MB_OK);
- return false;
- }
-
- jobjectArray args = PrepareCommandLine();
- env->CallStaticVoidMethod(mainClass, mainMethod, args);
- jthrowable exc = env->ExceptionOccurred();
- if (exc)
- {
- MessageBox(NULL, _T("Error invoking main method"), _T(ERROR_LAUNCHING_APP), MB_OK);
- }
-
- return true;
-}
-
-void CallCommandLineProcessor(const std::wstring& curDir, const std::wstring& args)
-{
- JNIEnv *env;
- JavaVMAttachArgs attachArgs;
- attachArgs.version = JNI_VERSION_1_2;
- attachArgs.name = "WinLauncher external command processing thread";
- attachArgs.group = NULL;
- jvm->AttachCurrentThread((void**) &env, &attachArgs);
-
- std::string processorClassName = LoadStdString(IDS_COMMAND_LINE_PROCESSOR_CLASS);
- jclass processorClass = env->FindClass(processorClassName.c_str());
- if (processorClass)
- {
- jmethodID processMethodID = env->GetStaticMethodID(processorClass, "processWindowsLauncherCommandLine", "(Ljava/lang/String;Ljava/lang/String;)V");
- if (processMethodID)
- {
- jstring jCurDir = env->NewString((const jchar *) curDir.c_str(), curDir.size());
- jstring jArgs = env->NewString((const jchar *) args.c_str(), args.size());
- env->CallStaticVoidMethod(processorClass, processMethodID, jCurDir, jArgs);
- jthrowable exc = env->ExceptionOccurred();
- if (exc)
- {
- MessageBox(NULL, _T("Error sending command line to existing instance"), _T("Error"), MB_OK);
- }
- }
- }
-
- jvm->DetachCurrentThread();
-}
-
-DWORD WINAPI SingleInstanceThread(LPVOID args)
-{
- while(true)
- {
- WaitForSingleObject(hEvent, INFINITE);
- if (terminating) break;
-
- wchar_t *view = static_cast<wchar_t *>(MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0));
- if (!view) continue;
- std::wstring command(view);
- int pos = command.find('\n');
- if (pos >= 0)
- {
- std::wstring curDir = command.substr(0, pos);
- std::wstring args = command.substr(pos+1);
-
- CallCommandLineProcessor(curDir, args);
- }
-
- UnmapViewOfFile(view);
- }
- return 0;
-}
-
-void SendCommandLineToFirstInstance()
-{
- wchar_t curDir[_MAX_PATH];
- GetCurrentDirectoryW(_MAX_PATH-1, curDir);
- std::wstring command(curDir);
- command += std::wstring(_T("\n"));
- command += GetCommandLineW();
-
- void *view = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
- if (view)
- {
- memcpy(view, command.c_str(), (command.size()+1) * sizeof(wchar_t));
- UnmapViewOfFile(view);
- }
- SetEvent(hEvent);
-}
-
-bool CheckSingleInstance()
-{
- char moduleFileName[_MAX_PATH];
- GetModuleFileNameA(NULL, moduleFileName, _MAX_PATH-1);
- for(char *p = moduleFileName; *p; p++)
- {
- if (*p == ':' || *p == '\\') *p = '_';
- }
- std::string mappingName = std::string("AndroidStudioLauncherMapping.") + moduleFileName;
- std::string eventName = std::string("AndroidStudioLauncherEvent.") + moduleFileName;
-
- hEvent = CreateEventA(NULL, FALSE, FALSE, eventName.c_str());
-
- hFileMapping = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, mappingName.c_str());
- if (!hFileMapping)
- {
- hFileMapping = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, FILE_MAPPING_SIZE,
- mappingName.c_str());
- return true;
- }
- else
- {
- SendCommandLineToFirstInstance();
- CloseHandle(hFileMapping);
- CloseHandle(hEvent);
- return false;
- }
-}
-
-void DrawSplashImage(HWND hWnd)
-{
- HBITMAP hSplashBitmap = (HBITMAP) GetWindowLongPtr(hWnd, GWLP_USERDATA);
- PAINTSTRUCT ps;
- HDC hDC = BeginPaint(hWnd, &ps);
- HDC hMemDC = CreateCompatibleDC(hDC);
- HBITMAP hOldBmp = (HBITMAP) SelectObject(hMemDC, hSplashBitmap);
- BITMAP splashBitmap;
- GetObject(hSplashBitmap, sizeof(splashBitmap), &splashBitmap);
- BitBlt(hDC, 0, 0, splashBitmap.bmWidth, splashBitmap.bmHeight, hMemDC, 0, 0, SRCCOPY);
- SelectObject(hMemDC, hOldBmp);
- DeleteDC(hMemDC);
- EndPaint(hWnd, &ps);
-}
-
-LRESULT CALLBACK SplashScreenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- case WM_PAINT:
- DrawSplashImage(hWnd);
- break;
- }
- return DefWindowProc(hWnd, uMsg, wParam, lParam);
-}
-
-const TCHAR splashClassName[] = _T("AndroidStudioLauncherSplash");
-
-void RegisterSplashScreenWndClass()
-{
- WNDCLASSEX wcx;
- wcx.cbSize = sizeof(wcx);
- wcx.style = 0;
- wcx.lpfnWndProc = SplashScreenWndProc;
- wcx.cbClsExtra = 0;
- wcx.cbWndExtra = 0;
- wcx.hInstance = hInst;
- wcx.hIcon = 0;
- wcx.hCursor = LoadCursor(NULL, IDC_WAIT);
- wcx.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
- wcx.lpszMenuName = 0;
- wcx.lpszClassName = splashClassName;
- wcx.hIconSm = 0;
-
- RegisterClassEx(&wcx);
-}
-
-HWND ShowSplashScreenWindow(HBITMAP hSplashBitmap)
-{
- RECT workArea;
- SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
- BITMAP splashBitmap;
- GetObject(hSplashBitmap, sizeof(splashBitmap), &splashBitmap);
- int x = workArea.left + ((workArea.right - workArea.left) - splashBitmap.bmWidth) / 2;
- int y = workArea.top + ((workArea.bottom - workArea.top) - splashBitmap.bmHeight) / 2;
-
- HWND splashWindow = CreateWindowEx(WS_EX_TOOLWINDOW, splashClassName, splashClassName, WS_POPUP,
- x, y, splashBitmap.bmWidth, splashBitmap.bmHeight, NULL, NULL, NULL, NULL);
- SetWindowLongPtr(splashWindow, GWLP_USERDATA, (LONG_PTR) hSplashBitmap);
- ShowWindow(splashWindow, SW_SHOW);
- UpdateWindow(splashWindow);
- return splashWindow;
-}
-
-BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
-{
- static DWORD currentProcId = GetCurrentProcessId();
- DWORD procId = 0;
- GetWindowThreadProcessId(hWnd, &procId);
- if(currentProcId == procId)
- {
- TCHAR className[_MAX_PATH];
- GetClassName(hWnd, className, _MAX_PATH-1);
- if (_tcscmp(className, splashClassName) != 0)
- {
- WINDOWINFO wi;
- wi.cbSize = sizeof(WINDOWINFO);
- GetWindowInfo(hWnd, &wi);
- if((wi.dwStyle & WS_VISIBLE) != 0)
- {
- HWND *phNewWindow = (HWND *) lParam;
- *phNewWindow = hWnd;
- return FALSE;
- }
- }
- }
- return TRUE;
-}
-
-
-DWORD WINAPI SplashScreenThread(LPVOID args)
-{
- HBITMAP hSplashBitmap = static_cast<HBITMAP>(args);
- RegisterSplashScreenWndClass();
- HWND splashWindow = ShowSplashScreenWindow(hSplashBitmap);
-
- MSG msg;
- while(true)
- {
- while (PeekMessage(&msg, splashWindow, 0, 0, PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- Sleep(50);
- HWND hNewWindow = NULL;
- EnumWindows(EnumWindowsProc, (LPARAM) &hNewWindow);
- if (hNewWindow)
- {
- BringWindowToTop(hNewWindow);
- DeleteObject(hSplashBitmap);
- DestroyWindow(splashWindow);
- }
- }
- return 0;
-}
-
-int APIENTRY _tWinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPTSTR lpCmdLine,
- int nCmdShow)
-{
- UNREFERENCED_PARAMETER(hPrevInstance);
- UNREFERENCED_PARAMETER(lpCmdLine);
-
- hInst = hInstance;
-
- if (!CheckSingleInstance()) return 1;
-
- HANDLE hSplashBitmap = static_cast<HBITMAP>(LoadImage(hInst, MAKEINTRESOURCE(IDB_SPLASH), IMAGE_BITMAP, 0, 0, 0));
- if (hSplashBitmap)
- {
- CreateThread(NULL, 0, SplashScreenThread, hSplashBitmap, 0, NULL);
- }
-
- if (!LocateJVM()) return 1;
- if (!LoadVMOptions()) return 1;
- if (!LoadJVMLibrary()) return 1;
- if (!CreateJVM()) return 1;
-
- hSingleInstanceWatcherThread = CreateThread(NULL, 0, SingleInstanceThread, NULL, 0, NULL);
-
- if (!RunMainClass()) return 1;
-
- jvm->DestroyJavaVM();
-
- terminating = true;
- SetEvent(hEvent);
- WaitForSingleObject(hSingleInstanceWatcherThread, INFINITE);
- CloseHandle(hEvent);
- CloseHandle(hFileMapping);
-
- return 0;
-}
diff --git a/native/WinLauncher/WinLauncher.h b/native/WinLauncher/WinLauncher.h
deleted file mode 100644
index d00d47e..0000000
--- a/native/WinLauncher/WinLauncher.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-#include "resource.h"
diff --git a/native/WinLauncher/WinLauncher.rc b/native/WinLauncher/WinLauncher.rc
deleted file mode 100755
index 158dd97..0000000
--- a/native/WinLauncher/WinLauncher.rc
+++ /dev/null
@@ -1,174 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#ifndef APSTUDIO_INVOKED
-#include "targetver.h"
-#endif
-#define APSTUDIO_HIDDEN_SYMBOLS
-#include "windows.h"
-#undef APSTUDIO_HIDDEN_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_SPLASH BITMAP "studio_splash.bmp"
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// German (Germany) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
-LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "CompanyName", "Android"
- VALUE "FileDescription", "Android Studio Windows Launcher"
- VALUE "FileVersion", "1.0.0.1"
- VALUE "InternalName", "studio.exe"
- VALUE "LegalCopyright", "Copyright (C) 2013"
- VALUE "OriginalFilename", "studio.exe"
- VALUE "ProductName", "Android Studio"
- VALUE "ProductVersion", "1.0.0.1"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
-
-#endif // German (Germany) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_WINLAUNCHER ICON "..\\..\\adt-branding\\src\\artwork\\androidstudio.ico"
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#ifndef APSTUDIO_INVOKED\r\n"
- "#include ""targetver.h""\r\n"
- "#endif\r\n"
- "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
- "#include ""windows.h""\r\n"
- "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE
-BEGIN
- IDS_APP_TITLE "Android Studio Launcher"
- IDS_JDK_ENV_VAR "STUDIO_JDK"
- IDS_VM_OPTIONS_PATH "%USERPROFILE%\\.AndroidStudio"
- IDS_MAIN_CLASS "com/intellij/idea/Main"
- IDS_CLASSPATH_LIBS "bootstrap.jar;extensions.jar;util.jar;jdom.jar;log4j.jar;trove4j.jar;jna.jar"
- IDS_JDK_ONLY "true"
- IDC_WINLAUNCHER "ANDROID_STUDIO_LAUNCHER"
- IDS_COMMAND_LINE_PROCESSOR_CLASS
- "com/intellij/ide/WindowsCommandLineProcessor"
- IDS_BOOTCLASSPATH_LIBS "boot.jar"
-END
-
-STRINGTABLE
-BEGIN
- IDS_VM_OPTIONS "-Didea.jre.check=false"
-END
-
-STRINGTABLE
-BEGIN
- IDS_PROPS_ENV_VAR "STUDIO_PROPERTIES"
- IDS_VM_OPTIONS_ENV_VAR "STUDIO_VM_OPTIONS"
-END
-
-#endif // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/native/WinLauncher/WinLauncher.sln b/native/WinLauncher/WinLauncher.sln
deleted file mode 100644
index ecf264b..0000000
--- a/native/WinLauncher/WinLauncher.sln
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinLauncher", "WinLauncher.vcxproj", "{335EFCE5-FA90-4AD5-8352-49991D4D67D0}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Debug|Win32.ActiveCfg = Debug|Win32
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Debug|Win32.Build.0 = Debug|Win32
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Debug|x64.ActiveCfg = Debug|x64
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Debug|x64.Build.0 = Debug|x64
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Release|Win32.ActiveCfg = Release|Win32
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Release|Win32.Build.0 = Release|Win32
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Release|x64.ActiveCfg = Release|x64
- {335EFCE5-FA90-4AD5-8352-49991D4D67D0}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/native/WinLauncher/WinLauncher.vcproj b/native/WinLauncher/WinLauncher.vcproj
deleted file mode 100755
index 8fe595f..0000000
--- a/native/WinLauncher/WinLauncher.vcproj
+++ /dev/null
@@ -1,425 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="WinLauncher"
- ProjectGUID="{335EFCE5-FA90-4AD5-8352-49991D4D67D0}"
- RootNamespace="WinLauncher"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)out\$(ConfigurationName)-$(PlatformName)"
- IntermediateDirectory="obj\$(ConfigurationName)-$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="2"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\studio.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(SolutionDir)out\$(ConfigurationName)-$(PlatformName)"
- IntermediateDirectory="obj\$(ConfigurationName)-$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\studio64.exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)out\$(ConfigurationName)-$(PlatformName)"
- IntermediateDirectory="obj\$(ConfigurationName)-$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories=""$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\studio.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- VerboseOutput="true"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(SolutionDir)out\$(ConfigurationName)-$(PlatformName)"
- IntermediateDirectory="obj\$(ConfigurationName)-$(PlatformName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories=""$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="2"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\studio64.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- VerboseOutput="true"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\stdafx.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\WinLauncher.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\Resource.h"
- >
- </File>
- <File
- RelativePath=".\stdafx.h"
- >
- </File>
- <File
- RelativePath=".\targetver.h"
- >
- </File>
- <File
- RelativePath=".\WinLauncher.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\..\adt-branding\src\artwork\androidstudio.ico"
- >
- </File>
- <File
- RelativePath=".\studio_splash.bmp"
- >
- </File>
- <File
- RelativePath=".\WinLauncher.rc"
- >
- </File>
- </Filter>
- <File
- RelativePath=".\ReadMe.txt"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/native/WinLauncher/WinLauncher.vcxproj b/native/WinLauncher/WinLauncher.vcxproj
deleted file mode 100644
index 20abf78..0000000
--- a/native/WinLauncher/WinLauncher.vcxproj
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{335EFCE5-FA90-4AD5-8352-49991D4D67D0}</ProjectGuid>
- <RootNamespace>WinLauncher</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <UseOfMfc>Static</UseOfMfc>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <UseOfMfc>Static</UseOfMfc>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <UseOfMfc>Static</UseOfMfc>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <UseOfMfc>Static</UseOfMfc>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)out\$(Configuration)-$(Platform)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">obj\$(Configuration)-$(Platform)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)out\$(Configuration)-$(Platform)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">obj\$(Configuration)-$(Platform)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)out\$(Configuration)-$(Platform)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">obj\$(Configuration)-$(Platform)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)out\$(Configuration)-$(Platform)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">obj\$(Configuration)-$(Platform)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</EmbedManifest>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">studio</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">studio</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">studio64</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">studio64</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- <AdditionalDependencies>user32.lib;gdi32.lib;shell32.lib;advapi32.lib</AdditionalDependencies>
- </Link>
- <Manifest>
- <EnableDPIAwareness>false</EnableDPIAwareness>
- </Manifest>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <TargetMachine>MachineX64</TargetMachine>
- <AdditionalDependencies>user32.lib;gdi32.lib;shell32.lib;advapi32.lib</AdditionalDependencies>
- </Link>
- <Manifest>
- <EnableDPIAwareness>false</EnableDPIAwareness>
- </Manifest>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX86</TargetMachine>
- <AdditionalDependencies>user32.lib;gdi32.lib;shell32.lib;advapi32.lib</AdditionalDependencies>
- </Link>
- <Manifest>
- <VerboseOutput>true</VerboseOutput>
- <EnableDPIAwareness>false</EnableDPIAwareness>
- </Manifest>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX64</TargetMachine>
- <AdditionalDependencies>user32.lib;gdi32.lib;shell32.lib;advapi32.lib</AdditionalDependencies>
- </Link>
- <Manifest>
- <VerboseOutput>true</VerboseOutput>
- <EnableDPIAwareness>false</EnableDPIAwareness>
- </Manifest>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="stdafx.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="WinLauncher.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Resource.h" />
- <ClInclude Include="stdafx.h" />
- <ClInclude Include="targetver.h" />
- <ClInclude Include="WinLauncher.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\adt-branding\src\artwork\androidstudio.ico" />
- <None Include="studio_splash.bmp" />
- <None Include="ReadMe.txt" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="WinLauncher.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
diff --git a/native/WinLauncher/WinLauncher.vcxproj.filters b/native/WinLauncher/WinLauncher.vcxproj.filters
deleted file mode 100644
index 4122cf7..0000000
--- a/native/WinLauncher/WinLauncher.vcxproj.filters
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="stdafx.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="WinLauncher.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="stdafx.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="targetver.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="WinLauncher.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\adt-branding\src\artwork\androidstudio.ico">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="studio_splash.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="ReadMe.txt" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="WinLauncher.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/native/WinLauncher/out/Release-Win32/studio.exe b/native/WinLauncher/out/Release-Win32/studio.exe
deleted file mode 100755
index e031e2f..0000000
--- a/native/WinLauncher/out/Release-Win32/studio.exe
+++ /dev/null
Binary files differ
diff --git a/native/WinLauncher/out/Release-x64/studio64.exe b/native/WinLauncher/out/Release-x64/studio64.exe
deleted file mode 100755
index 81d5acb..0000000
--- a/native/WinLauncher/out/Release-x64/studio64.exe
+++ /dev/null
Binary files differ
diff --git a/native/WinLauncher/resource.h b/native/WinLauncher/resource.h
deleted file mode 100644
index 9e634c5..0000000
--- a/native/WinLauncher/resource.h
+++ /dev/null
Binary files differ
diff --git a/native/WinLauncher/stdafx.cpp b/native/WinLauncher/stdafx.cpp
deleted file mode 100644
index 43d93c7..0000000
--- a/native/WinLauncher/stdafx.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-// WinLauncher.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/native/WinLauncher/stdafx.h b/native/WinLauncher/stdafx.h
deleted file mode 100644
index 776d53c..0000000
--- a/native/WinLauncher/stdafx.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-
-#include "targetver.h"
-
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-// Windows Header Files:
-#include <windows.h>
-#include <ShellAPI.h>
-
-// C RunTime Header Files
-#include <stdio.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <memory.h>
-#include <tchar.h>
-
-#include <jni.h>
-
-#include <vector>
-#include <string>
-
-// TODO: reference additional headers your program requires here
-#include <shlobj.h>
-#include <ctype.h>
diff --git a/native/WinLauncher/studio_splash.bmp b/native/WinLauncher/studio_splash.bmp
deleted file mode 100755
index e527ba1..0000000
--- a/native/WinLauncher/studio_splash.bmp
+++ /dev/null
Binary files differ
diff --git a/native/WinLauncher/targetver.h b/native/WinLauncher/targetver.h
deleted file mode 100644
index 1a771d6..0000000
--- a/native/WinLauncher/targetver.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-// Including SDKDDKVer.h defines the highest available Windows platform.
-
-// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
-// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
-
-
-// Indicate we want at least all Windows Server 2003 (5.2) APIs.
-// Note: default is set by system/core/include/arch/windows/AndroidConfig.h to 0x0500
-// which is Win2K. However our minimum SDK tools requirement is Win XP (0x0501).
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-// Indicate we want at least all IE 5 shell APIs
-#define _WIN32_IE 0x0500
-
-
-#include <SDKDDKVer.h>
-