diff options
4 files changed, 37 insertions, 36 deletions
diff --git a/anttasks/src/com/android/ant/TaskHelper.java b/anttasks/src/com/android/ant/TaskHelper.java index 8c50e49..a360eaf 100644 --- a/anttasks/src/com/android/ant/TaskHelper.java +++ b/anttasks/src/com/android/ant/TaskHelper.java @@ -37,18 +37,7 @@ final class TaskHelper { // check if it's valid and exists if (sdkOsPath == null || sdkOsPath.length() == 0) { - // LEGACY support: project created with 1.6 or before may be using a different - // property to declare the location of the SDK. At this point, we cannot - // yet check which target is running so we check both always. - sdkOsPath = antProject.getProperty(ProjectProperties.PROPERTY_SDK_LEGACY); - if (sdkOsPath == null || sdkOsPath.length() == 0) { - throw new BuildException("SDK Location is not set."); - } - } - - // Make sure the OS sdk path ends with a directory separator - if (sdkOsPath.length() > 0 && !sdkOsPath.endsWith(File.separator)) { - sdkOsPath += File.separator; + throw new BuildException("SDK Location is not set."); } File sdk = new File(sdkOsPath); 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 e9f65ab..16dd8eb 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 @@ -170,7 +170,6 @@ public class ProjectCreator { * @param pathToMainProject if non-null the project will be setup to test a main project * located at the given path. */ - @SuppressWarnings("deprecation") public void createProject(String folderPath, String projectName, String packageName, String activityEntry, IAndroidTarget target, boolean library, String pathToMainProject) { @@ -205,12 +204,6 @@ public class ProjectCreator { ProjectPropertiesWorkingCopy buildProperties = ProjectProperties.create(folderPath, PropertyType.BUILD); - // only put application.package for older target where the rules file didn't. - // grab it through xpath - if (target.getVersion().getApiLevel() < 4) { - buildProperties.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE, packageName); - } - if (isTestProject) { buildProperties.setProperty(ProjectProperties.PROPERTY_TESTED_PROJECT, pathToMainProject); diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java index 5870db9..4fe574b 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java @@ -63,11 +63,8 @@ public class ProjectProperties { public final static String PROPERTY_PROGUARD_CONFIG = "proguard.config"; public final static String PROPERTY_SDK = "sdk.dir"; - // LEGACY - compatibility with 1.6 and before - public final static String PROPERTY_SDK_LEGACY = "sdk-location"; - - @Deprecated //This is not needed by the new Ant rules - public final static String PROPERTY_APP_PACKAGE = "application.package"; + // LEGACY - Kept so that we can actually remove it from local.properties. + private final static String PROPERTY_SDK_LEGACY = "sdk-location"; public final static String PROPERTY_SPLIT_BY_DENSITY = "split.density"; public final static String PROPERTY_SPLIT_BY_ABI = "split.abi"; @@ -87,29 +84,40 @@ public class ProjectProperties { public static enum PropertyType { BUILD(SdkConstants.FN_BUILD_PROPERTIES, BUILD_HEADER, new String[] { PROPERTY_BUILD_SOURCE_DIR, PROPERTY_BUILD_OUT_DIR - }), + }, null), DEFAULT(SdkConstants.FN_DEFAULT_PROPERTIES, DEFAULT_HEADER, new String[] { PROPERTY_TARGET, PROPERTY_LIBRARY, PROPERTY_LIB_REF_REGEX, PROPERTY_KEY_STORE, PROPERTY_KEY_ALIAS, PROPERTY_PROGUARD_CONFIG - }), + }, null), LOCAL(SdkConstants.FN_LOCAL_PROPERTIES, LOCAL_HEADER, new String[] { PROPERTY_SDK - }), + }, + new String[] { PROPERTY_SDK_LEGACY }), EXPORT(SdkConstants.FN_EXPORT_PROPERTIES, EXPORT_HEADER, new String[] { PROPERTY_PACKAGE, PROPERTY_VERSIONCODE, PROPERTY_PROJECTS, PROPERTY_KEY_STORE, PROPERTY_KEY_ALIAS - }); + }, null); private final String mFilename; private final String mHeader; private final Set<String> mKnownProps; + private final Set<String> mRemovedProps; - PropertyType(String filename, String header, String[] validProps) { + PropertyType(String filename, String header, String[] validProps, String[] removedProps) { mFilename = filename; mHeader = header; HashSet<String> s = new HashSet<String>(); - s.addAll(Arrays.asList(validProps)); + if (validProps != null) { + s.addAll(Arrays.asList(validProps)); + } mKnownProps = Collections.unmodifiableSet(s); + + s = new HashSet<String>(); + if (removedProps != null) { + s.addAll(Arrays.asList(removedProps)); + } + mRemovedProps = Collections.unmodifiableSet(s); + } public String getFilename() { @@ -132,6 +140,19 @@ public class ProjectProperties { return false; } + + /** + * Returns whether a given property should be removed for the property type. + */ + public boolean isRemovedProperty(String name) { + for (String propRegex : mRemovedProps) { + if (propRegex.equals(name) || Pattern.matches(propRegex, name)) { + return true; + } + } + + return false; + } } private final static String LOCAL_HEADER = diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java index e0f713c..23cdd09 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java @@ -42,7 +42,6 @@ import java.util.regex.Matcher; * To get access to an instance, use {@link ProjectProperties#makeWorkingCopy()} or * {@link ProjectProperties#create(IAbstractFolder, PropertyType)}. */ -@SuppressWarnings("deprecation") public class ProjectPropertiesWorkingCopy extends ProjectProperties { private final static Map<String, String> COMMENT_MAP = new HashMap<String, String>(); @@ -56,9 +55,6 @@ public class ProjectPropertiesWorkingCopy extends ProjectProperties { "# location of the SDK. This is only used by Ant\n" + "# For customization when using a Version Control System, please read the\n" + "# header note.\n"); - COMMENT_MAP.put(PROPERTY_APP_PACKAGE, - "# The name of your application package as defined in the manifest.\n" + - "# Used by the 'uninstall' rule.\n"); COMMENT_MAP.put(PROPERTY_PACKAGE, "# Package of the application being exported\n"); COMMENT_MAP.put(PROPERTY_VERSIONCODE, @@ -159,8 +155,10 @@ public class ProjectPropertiesWorkingCopy extends ProjectProperties { // record the prop visitedProps.add(key); - // check if the property still exists. - if (mProperties.containsKey(key)) { + // check if this property must be removed. + if (mType.isRemovedProperty(key)) { + value = null; + } else if (mProperties.containsKey(key)) { // if the property still exists. // put the new value. value = mProperties.get(key); } else { |