From ecc20ea2f494efaa7fc9ac31657ac41787e08c0a Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 21 Mar 2012 21:21:35 +0100 Subject: [PATCH] Android runtime module extracted --- .idea/modules.xml | 1 + build/scripts/layouts.gant | 5 +- .../intellij/openapi/util/io/FileUtilRt.java | 84 +++++++++++++++++++ .../openapi/util/text/StringUtilRt.java | 4 + .../intellij/openapi/util/io/FileUtil.java | 62 ++------------ .../openapi/util/text/StringUtil.java | 2 +- plugins/android/android.iml | 1 + plugins/android/common/android-common.iml | 32 +++++++ .../compiler/tools/AndroidApkBuilder.java | 2 +- .../android/compiler/tools/AndroidApt.java | 2 +- .../android/compiler/tools/AndroidIdl.java | 2 +- .../compiler/tools/AndroidRenderscript.java | 15 ++++ .../android/sdk/MessageBuildingSdkLog.java | 2 +- .../android/util/AndroidCommonUtils.java | 15 ++++ .../util/AndroidCompilerMessageKind.java | 23 +++++ .../android/util/AndroidExecutionUtil.java | 2 +- .../android/util/AndroidOSProcessHandler.java | 15 ++++ .../jetbrains/android/util/ResourceEntry.java | 15 ++++ .../util/ValueResourcesFileParser.java | 15 ++++ .../android/jps-plugin/android-jps-plugin.iml | 1 + .../jps/android/AndroidDexBuilder.java | 18 +++- plugins/android/rt/android-rt.iml | 22 +---- .../compiler/tools/AndroidDxRunner.java | 15 ++-- .../util/AndroidCompilerMessageKind.java | 8 -- plugins/android/src/META-INF/plugin.xml | 2 +- .../compiler/tools/AndroidDxWrapper.java | 6 +- 26 files changed, 270 insertions(+), 101 deletions(-) create mode 100644 plugins/android/common/android-common.iml rename plugins/android/{rt => common}/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java (99%) rename plugins/android/{rt => common}/src/org/jetbrains/android/compiler/tools/AndroidApt.java (99%) rename plugins/android/{rt => common}/src/org/jetbrains/android/compiler/tools/AndroidIdl.java (98%) rename plugins/android/{rt => common}/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java (80%) rename plugins/android/{rt => common}/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java (97%) rename plugins/android/{rt => common}/src/org/jetbrains/android/util/AndroidCommonUtils.java (95%) create mode 100644 plugins/android/common/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java rename plugins/android/{rt => common}/src/org/jetbrains/android/util/AndroidExecutionUtil.java (98%) rename plugins/android/{rt => common}/src/org/jetbrains/android/util/AndroidOSProcessHandler.java (74%) rename plugins/android/{rt => common}/src/org/jetbrains/android/util/ResourceEntry.java (60%) rename plugins/android/{rt => common}/src/org/jetbrains/android/util/ValueResourcesFileParser.java (79%) delete mode 100644 plugins/android/rt/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java diff --git a/.idea/modules.xml b/.idea/modules.xml index 553b6854a1ac..cb457d298f4a 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -10,6 +10,7 @@ + diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant index 1985a382aaa9..734760c5262c 100644 --- a/build/scripts/layouts.gant +++ b/build/scripts/layouts.gant @@ -383,7 +383,10 @@ public def layoutCommunityPlugins(String home) { exclude(name: "**/ddmlib_1.jar") } - jar("android_rt.jar") {module("android-rt")} + jar("android-common.jar") { + module("android-rt") + module("android-common") + } dir("jps") { jar("android-jps-plugin.jar") { module("android-jps-plugin") } diff --git a/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java b/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java index e69e572a4074..2881afe12457 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java +++ b/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java @@ -44,6 +44,90 @@ public class FileUtilRt { private static String ourCanonicalTempPathCache = null; + @NotNull + public static String getExtension(@NotNull String fileName) { + int index = fileName.lastIndexOf('.'); + if (index < 0) return ""; + return fileName.substring(index + 1).toLowerCase(); + } + + @NotNull + public static String toSystemDependentName(@NonNls @NotNull String aFileName) { + return aFileName.replace('/', File.separatorChar).replace('\\', File.separatorChar); + } + + @NotNull + public static String toSystemIndependentName(@NonNls @NotNull String aFileName) { + return aFileName.replace('\\', '/'); + } + + @Nullable + public static String getRelativePath(File base, File file) { + if (base == null || file == null) return null; + + if (!base.isDirectory()) { + base = base.getParentFile(); + if (base == null) return null; + } + + if (base.equals(file)) return "."; + + final String filePath = file.getAbsolutePath(); + String basePath = base.getAbsolutePath(); + return getRelativePath(basePath, filePath, File.separatorChar); + } + + @Nullable + public static String getRelativePath(@NotNull String basePath, @NotNull String filePath, final char separator) { + return getRelativePath(basePath, filePath, separator, SystemInfoRt.isFileSystemCaseSensitive); + } + + @Nullable + public static String getRelativePath(@NotNull String basePath, + @NotNull String filePath, + final char separator, + final boolean caseSensitive) { + basePath = ensureEnds(basePath, separator); + + String basePathToCompare = caseSensitive ? basePath : basePath.toLowerCase(); + String filePathToCompare = caseSensitive ? filePath : filePath.toLowerCase(); + if (basePathToCompare.equals(ensureEnds(filePathToCompare, separator))) return "."; + int len = 0; + int lastSeparatorIndex = 0; // need this for cases like this: base="/temp/abcde/base" and file="/temp/ab" + while (len < filePath.length() && len < basePath.length() && filePathToCompare.charAt(len) == basePathToCompare.charAt(len)) { + if (basePath.charAt(len) == separator) { + lastSeparatorIndex = len; + } + len++; + } + + if (len == 0) return null; + + StringBuilder relativePath = new StringBuilder(); + for (int i = len; i < basePath.length(); i++) { + if (basePath.charAt(i) == separator) { + relativePath.append(".."); + relativePath.append(separator); + } + } + relativePath.append(filePath.substring(lastSeparatorIndex + 1)); + + return relativePath.toString(); + } + + private static String ensureEnds(@NotNull String s, final char endsWith) { + return StringUtilRt.endsWithChar(s, endsWith) ? s : s + endsWith; + } + + @NotNull + public static String getNameWithoutExtension(@NotNull String name) { + int i = name.lastIndexOf('.'); + if (i != -1) { + name = name.substring(0, i); + } + return name; + } + @NotNull public static File createTempDirectory(@NotNull @NonNls String prefix, @Nullable @NonNls String suffix) throws IOException { File file = doCreateTempFile(prefix, suffix); diff --git a/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java b/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java index 4034cb9a6dc6..cd4fad48a19e 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java +++ b/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java @@ -186,4 +186,8 @@ public class StringUtilRt { } return fqName; } + + public static boolean endsWithChar(@Nullable CharSequence s, char suffix) { + return s != null && s.length() != 0 && s.charAt(s.length() - 1) == suffix; + } } diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java index 5c0903db9429..e40e3d4abdd9 100644 --- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java +++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java @@ -64,58 +64,20 @@ public class FileUtil extends FileUtilRt { @Nullable public static String getRelativePath(File base, File file) { - if (base == null || file == null) return null; - - if (!base.isDirectory()) { - base = base.getParentFile(); - if (base == null) return null; - } - - if (base.equals(file)) return "."; - - final String filePath = file.getAbsolutePath(); - String basePath = base.getAbsolutePath(); - return getRelativePath(basePath, filePath, File.separatorChar); + return FileUtilRt.getRelativePath(base, file); } + @Nullable public static String getRelativePath(@NotNull String basePath, @NotNull String filePath, final char separator) { - return getRelativePath(basePath, filePath, separator, SystemInfo.isFileSystemCaseSensitive); - } - - private static String ensureEnds(@NotNull String s, final char endsWith) { - return StringUtil.endsWithChar(s, endsWith) ? s : s + endsWith; + return FileUtilRt.getRelativePath(basePath, filePath, separator); } + @Nullable public static String getRelativePath(@NotNull String basePath, @NotNull String filePath, final char separator, final boolean caseSensitive) { - basePath = ensureEnds(basePath, separator); - - String basePathToCompare = caseSensitive ? basePath : basePath.toLowerCase(); - String filePathToCompare = caseSensitive ? filePath : filePath.toLowerCase(); - if (basePathToCompare.equals(ensureEnds(filePathToCompare, separator))) return "."; - int len = 0; - int lastSeparatorIndex = 0; // need this for cases like this: base="/temp/abcde/base" and file="/temp/ab" - while (len < filePath.length() && len < basePath.length() && filePathToCompare.charAt(len) == basePathToCompare.charAt(len)) { - if (basePath.charAt(len) == separator) { - lastSeparatorIndex = len; - } - len++; - } - - if (len == 0) return null; - - StringBuilder relativePath = new StringBuilder(); - for (int i = len; i < basePath.length(); i++) { - if (basePath.charAt(i) == separator) { - relativePath.append(".."); - relativePath.append(separator); - } - } - relativePath.append(filePath.substring(lastSeparatorIndex + 1)); - - return relativePath.toString(); + return FileUtilRt.getRelativePath(basePath, filePath, separator, caseSensitive); } public static boolean isAbsolute(@NotNull String path) { @@ -597,11 +559,7 @@ public class FileUtil extends FileUtilRt { @NotNull public static String getNameWithoutExtension(@NotNull String name) { - int i = name.lastIndexOf('.'); - if (i != -1) { - name = name.substring(0, i); - } - return name; + return FileUtilRt.getNameWithoutExtension(name); } public static String createSequentFileName(@NotNull File aParentFolder, @NotNull @NonNls String aFilePrefix, @NotNull String aExtension) { @@ -624,12 +582,12 @@ public class FileUtil extends FileUtilRt { @NotNull public static String toSystemDependentName(@NonNls @NotNull String aFileName) { - return aFileName.replace('/', File.separatorChar).replace('\\', File.separatorChar); + return FileUtilRt.toSystemDependentName(aFileName); } @NotNull public static String toSystemIndependentName(@NonNls @NotNull String aFileName) { - return aFileName.replace('\\', '/'); + return FileUtilRt.toSystemIndependentName(aFileName); } @NotNull @@ -738,9 +696,7 @@ public class FileUtil extends FileUtilRt { @NotNull public static String getExtension(@NotNull String fileName) { - int index = fileName.lastIndexOf('.'); - if (index < 0) return ""; - return fileName.substring(index + 1).toLowerCase(); + return FileUtilRt.getExtension(fileName); } @NotNull diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index a6ea44e784bf..cc4a6340f6ac 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -803,7 +803,7 @@ public class StringUtil extends StringUtilRt { } public static boolean endsWithChar(@Nullable CharSequence s, char suffix) { - return s != null && s.length() != 0 && s.charAt(s.length() - 1) == suffix; + return StringUtilRt.endsWithChar(s, suffix); } @NotNull diff --git a/plugins/android/android.iml b/plugins/android/android.iml index 348cd17b2c7d..9da7d4398eb8 100644 --- a/plugins/android/android.iml +++ b/plugins/android/android.iml @@ -62,6 +62,7 @@ + diff --git a/plugins/android/common/android-common.iml b/plugins/android/common/android-common.iml new file mode 100644 index 000000000000..4e8e59de5816 --- /dev/null +++ b/plugins/android/common/android-common.iml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java similarity index 99% rename from plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java rename to plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java index 70daf97f8e74..9465c698cfe2 100644 --- a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java +++ b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidApkBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. diff --git a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidApt.java b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidApt.java similarity index 99% rename from plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidApt.java rename to plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidApt.java index 19bf21739f52..4457646134b1 100644 --- a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidApt.java +++ b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidApt.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. diff --git a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidIdl.java b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidIdl.java similarity index 98% rename from plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidIdl.java rename to plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidIdl.java index 90f4faec384d..12dc0a97e293 100644 --- a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidIdl.java +++ b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidIdl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. diff --git a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java similarity index 80% rename from plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java rename to plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java index b3346c8401d5..0b7a523b9f32 100644 --- a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java +++ b/plugins/android/common/src/org/jetbrains/android/compiler/tools/AndroidRenderscript.java @@ -1,3 +1,18 @@ +/* + * 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.compiler.tools; import com.android.sdklib.IAndroidTarget; diff --git a/plugins/android/rt/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java b/plugins/android/common/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java similarity index 97% rename from plugins/android/rt/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java rename to plugins/android/common/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java index 49e083d10236..040211d7e23b 100644 --- a/plugins/android/rt/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java +++ b/plugins/android/common/src/org/jetbrains/android/sdk/MessageBuildingSdkLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. diff --git a/plugins/android/rt/src/org/jetbrains/android/util/AndroidCommonUtils.java b/plugins/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java similarity index 95% rename from plugins/android/rt/src/org/jetbrains/android/util/AndroidCommonUtils.java rename to plugins/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java index 52163c045387..78d50b0566ce 100644 --- a/plugins/android/rt/src/org/jetbrains/android/util/AndroidCommonUtils.java +++ b/plugins/android/common/src/org/jetbrains/android/util/AndroidCommonUtils.java @@ -1,3 +1,18 @@ +/* + * 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.android.resources.ResourceFolderType; diff --git a/plugins/android/common/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java b/plugins/android/common/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java new file mode 100644 index 000000000000..677a75bcc0c2 --- /dev/null +++ b/plugins/android/common/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java @@ -0,0 +1,23 @@ +/* + * 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; + +/** + * @author Eugene.Kudelevsky + */ +public enum AndroidCompilerMessageKind { + ERROR, INFORMATION, WARNING +} diff --git a/plugins/android/rt/src/org/jetbrains/android/util/AndroidExecutionUtil.java b/plugins/android/common/src/org/jetbrains/android/util/AndroidExecutionUtil.java similarity index 98% rename from plugins/android/rt/src/org/jetbrains/android/util/AndroidExecutionUtil.java rename to plugins/android/common/src/org/jetbrains/android/util/AndroidExecutionUtil.java index e871048b6871..6d56b9a65671 100644 --- a/plugins/android/rt/src/org/jetbrains/android/util/AndroidExecutionUtil.java +++ b/plugins/android/common/src/org/jetbrains/android/util/AndroidExecutionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. diff --git a/plugins/android/rt/src/org/jetbrains/android/util/AndroidOSProcessHandler.java b/plugins/android/common/src/org/jetbrains/android/util/AndroidOSProcessHandler.java similarity index 74% rename from plugins/android/rt/src/org/jetbrains/android/util/AndroidOSProcessHandler.java rename to plugins/android/common/src/org/jetbrains/android/util/AndroidOSProcessHandler.java index 1811d0e24fc7..4a48d0687d9a 100644 --- a/plugins/android/rt/src/org/jetbrains/android/util/AndroidOSProcessHandler.java +++ b/plugins/android/common/src/org/jetbrains/android/util/AndroidOSProcessHandler.java @@ -1,3 +1,18 @@ +/* + * 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.execution.process.BaseOSProcessHandler; diff --git a/plugins/android/rt/src/org/jetbrains/android/util/ResourceEntry.java b/plugins/android/common/src/org/jetbrains/android/util/ResourceEntry.java similarity index 60% rename from plugins/android/rt/src/org/jetbrains/android/util/ResourceEntry.java rename to plugins/android/common/src/org/jetbrains/android/util/ResourceEntry.java index c9fbe72541fa..af49933d48ad 100644 --- a/plugins/android/rt/src/org/jetbrains/android/util/ResourceEntry.java +++ b/plugins/android/common/src/org/jetbrains/android/util/ResourceEntry.java @@ -1,3 +1,18 @@ +/* + * 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 org.jetbrains.annotations.NotNull; diff --git a/plugins/android/rt/src/org/jetbrains/android/util/ValueResourcesFileParser.java b/plugins/android/common/src/org/jetbrains/android/util/ValueResourcesFileParser.java similarity index 79% rename from plugins/android/rt/src/org/jetbrains/android/util/ValueResourcesFileParser.java rename to plugins/android/common/src/org/jetbrains/android/util/ValueResourcesFileParser.java index 240271a0027f..fb260ad45ca3 100644 --- a/plugins/android/rt/src/org/jetbrains/android/util/ValueResourcesFileParser.java +++ b/plugins/android/common/src/org/jetbrains/android/util/ValueResourcesFileParser.java @@ -1,3 +1,18 @@ +/* + * 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.android.resources.ResourceType; diff --git a/plugins/android/jps-plugin/android-jps-plugin.iml b/plugins/android/jps-plugin/android-jps-plugin.iml index f88dae99cac0..7177beeceb26 100644 --- a/plugins/android/jps-plugin/android-jps-plugin.iml +++ b/plugins/android/jps-plugin/android-jps-plugin.iml @@ -9,6 +9,7 @@ + diff --git a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java index 62c00c78e32b..85359ccb62c9 100644 --- a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java +++ b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java @@ -1,9 +1,25 @@ +/* + * 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.jps.android; import com.android.sdklib.IAndroidTarget; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.ArrayUtil; import com.intellij.util.containers.HashMap; import com.intellij.util.containers.HashSet; @@ -217,7 +233,7 @@ public class AndroidDexBuilder extends ProjectLevelBuilder { final List classPath = new ArrayList(); classPath.add(ClasspathBootstrap.getResourcePath(AndroidDxRunner.class).getPath()); - classPath.add(ClasspathBootstrap.getResourcePath(FileUtil.class).getPath()); + classPath.add(ClasspathBootstrap.getResourcePath(FileUtilRt.class).getPath()); final File outFile = new File(outFilePath); if (outFile.exists() && !outFile.delete()) { diff --git a/plugins/android/rt/android-rt.iml b/plugins/android/rt/android-rt.iml index a45948b193fb..7e88b0067116 100644 --- a/plugins/android/rt/android-rt.iml +++ b/plugins/android/rt/android-rt.iml @@ -4,29 +4,11 @@ - - - - - - - - - - - - - - - - - - - - + + diff --git a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java b/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java index 93a1905e390c..017d393d6aab 100644 --- a/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java +++ b/plugins/android/rt/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -15,7 +15,7 @@ */ package org.jetbrains.android.compiler.tools; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -56,8 +56,7 @@ public class AndroidDxRunner { private static Field myConsoleOut; private static Field myConsoleErr; - private AndroidDxRunner() { - } + private AndroidDxRunner() { } private static void loadDex(String dxPath) { try { @@ -166,10 +165,10 @@ public class AndroidDxRunner { } } else { - if ("class".equals(FileUtil.getExtension(file.getName()))) { + if ("class".equals(FileUtilRt.getExtension(file.getName()))) { final String qName = getQualifiedName(root, file); if (qName != null && !qNames.add(qName)) { - reportWarning(FileUtil.toSystemDependentName(file.getPath()) + " won't be added. Class " + + reportWarning(FileUtilRt.toSystemDependentName(file.getPath()) + " won't be added. Class " + qName + " already exists in classpath"); return; } @@ -180,12 +179,12 @@ public class AndroidDxRunner { @Nullable private static String getQualifiedName(File root, File classFile) { - String relativePath = FileUtil.getRelativePath(root, classFile); + String relativePath = FileUtilRt.getRelativePath(root, classFile); if (relativePath == null) { return null; } - return FileUtil.getNameWithoutExtension(FileUtil.toSystemIndependentName(relativePath)).replace('/', '.'); + return FileUtilRt.getNameWithoutExtension(FileUtilRt.toSystemIndependentName(relativePath)).replace('/', '.'); } public static void main(String[] args) { diff --git a/plugins/android/rt/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java b/plugins/android/rt/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java deleted file mode 100644 index 6c8a8cb80c50..000000000000 --- a/plugins/android/rt/src/org/jetbrains/android/util/AndroidCompilerMessageKind.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jetbrains.android.util; - -/** - * @author Eugene.Kudelevsky - */ -public enum AndroidCompilerMessageKind { - ERROR, INFORMATION, WARNING -} diff --git a/plugins/android/src/META-INF/plugin.xml b/plugins/android/src/META-INF/plugin.xml index 008774bdaad1..bdb604995847 100644 --- a/plugins/android/src/META-INF/plugin.xml +++ b/plugins/android/src/META-INF/plugin.xml @@ -217,7 +217,7 @@ - + diff --git a/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxWrapper.java b/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxWrapper.java index 3de13461b4bc..892ff18591ea 100644 --- a/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxWrapper.java +++ b/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -25,7 +25,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.PathUtil; import com.intellij.util.PathsList; import com.intellij.util.containers.HashMap; @@ -97,7 +97,7 @@ public class AndroidDxWrapper { } final PathsList classPath = parameters.getClassPath(); classPath.add(PathUtil.getJarPathForClass(AndroidDxRunner.class)); - classPath.add(PathUtil.getJarPathForClass(FileUtil.class)); + classPath.add(PathUtil.getJarPathForClass(FileUtilRt.class)); // delete file to check if it will exist after dex compilation if (!new File(outFile).delete()) {