aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/libs/sdklib
diff options
context:
space:
mode:
Diffstat (limited to 'sdkmanager/libs/sdklib')
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/IAndroidTarget.java8
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java2
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/build/IArchiveBuilder.java35
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java25
5 files changed, 56 insertions, 16 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/IAndroidTarget.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/IAndroidTarget.java
index 44c46ee..9c369ed 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/IAndroidTarget.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/IAndroidTarget.java
@@ -61,9 +61,13 @@ public interface IAndroidTarget extends Comparable<IAndroidTarget> {
public final static int SOURCES = 18;
/** OS Path to the target specific docs */
public final static int DOCS = 19;
- /** OS Path to the target's version of the aapt tool. */
+ /** OS Path to the target's version of the aapt tool.
+ * This is deprecated as aapt is now in the platform tools and not in the platform. */
+ @Deprecated
public final static int AAPT = 20;
- /** OS Path to the target's version of the aidl tool. */
+ /** OS Path to the target's version of the aidl tool.
+ * This is deprecated as aidl is now in the platform tools and not in the platform. */
+ @Deprecated
public final static int AIDL = 21;
/** OS Path to the target's version of the dx too.<br>
* This is deprecated as dx is now in the platform tools and not in the platform. */
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
index 713e8a8..181e7ec 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
@@ -50,6 +50,8 @@ public final class SdkConstants {
/** An SDK Project's AndroidManifest.xml file */
public static final String FN_ANDROID_MANIFEST_XML= "AndroidManifest.xml";
+ /** pre-dex jar filename. i.e. "classes.jar" */
+ public final static String FN_CLASSES_JAR = "classes.jar"; //$NON-NLS-1$
/** Dex filename inside the APK. i.e. "classes.dex" */
public final static String FN_APK_CLASSES_DEX = "classes.dex"; //$NON-NLS-1$
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java
index 2148ccf..da1790e 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java
@@ -47,7 +47,7 @@ import java.util.regex.Pattern;
* - Native libraries from the project or its library.
*
*/
-public final class ApkBuilder {
+public final class ApkBuilder implements IArchiveBuilder {
private final static Pattern PATTERN_NATIVELIB_EXT = Pattern.compile("^.+\\.so$",
Pattern.CASE_INSENSITIVE);
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/IArchiveBuilder.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/IArchiveBuilder.java
new file mode 100644
index 0000000..e2230e9
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/IArchiveBuilder.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 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.
+ * 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.sdklib.build;
+
+import java.io.File;
+
+public interface IArchiveBuilder {
+
+ /**
+ * Adds a file to the archive at a given path
+ * @param file the file to add
+ * @param archivePath the path of the file inside the APK archive.
+ * @throws ApkCreationException if an error occurred
+ * @throws SealedApkException if the APK is already sealed.
+ * @throws DuplicateFileException if a file conflicts with another already added to the APK
+ * at the same location inside the APK archive.
+ */
+ void addFile(File file, String archivePath) throws ApkCreationException,
+ SealedApkException, DuplicateFileException;
+
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
index 8db9587..e2874b9 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
@@ -603,20 +603,19 @@ public class ProjectCreator {
// Build.xml: create if not present or no <androidinit/> in it
File buildXml = new File(projectFolder, SdkConstants.FN_BUILD_XML);
boolean needsBuildXml = projectName != null || !buildXml.exists();
+
if (!needsBuildXml) {
- // Look for for a classname="com.android.ant.SetupTask" attribute
- needsBuildXml = !checkFileContainsRegexp(buildXml,
- "classname=\"com.android.ant.SetupTask\""); //$NON-NLS-1$
- }
- if (!needsBuildXml) {
- // Note that "<setup" must be followed by either a whitespace, a "/" (for the
- // XML /> closing tag) or an end-of-line. This way we know the XML tag is really this
- // one and later we will be able to use an "androidinit2" tag or such as necessary.
- needsBuildXml = !checkFileContainsRegexp(buildXml, "<setup(?:\\s|/|$)"); //$NON-NLS-1$
- }
- if (needsBuildXml) {
- if (buildXml.exists()) {
- println("File %1$s is too old and needs to be updated.", SdkConstants.FN_BUILD_XML);
+ // we are looking for version-tag: followed by either an integer or "custom".
+ if (checkFileContainsRegexp(buildXml, "version-tag:\\s*custom")) { //$NON-NLS-1$
+ println("File %1$s is custom and will not be overriden.",
+ SdkConstants.FN_BUILD_XML);
+ } else {
+ // TODO: look for the version value and update if too old.
+ if (!checkFileContainsRegexp(buildXml, "version-tag:\\s*(\\d*)")) { //$NON-NLS-1$
+ needsBuildXml = true;
+ println("File %1$s is too old and needs to be updated.",
+ SdkConstants.FN_BUILD_XML);
+ }
}
}