diff options
author | Xavier Ducrohet <xav@android.com> | 2012-03-29 19:28:25 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-04-16 12:54:55 -0700 |
commit | 1daa8f999d87443d14f698ca8ccc103e3309fa3e (patch) | |
tree | 29f034c67acbecc4933e35a46484edf1f9c9d055 /sdkmanager/libs/sdklib | |
parent | 4a8a17e5f23eace570b54084318b30bdd593fbc0 (diff) | |
download | sdk-1daa8f999d87443d14f698ca8ccc103e3309fa3e.zip sdk-1daa8f999d87443d14f698ca8ccc103e3309fa3e.tar.gz sdk-1daa8f999d87443d14f698ca8ccc103e3309fa3e.tar.bz2 |
Fix "ant test" + misc clean up / reorganization of build.xml
- Split NewSetupTask in several tasks to make things more flexible.
Particularly this allows more targets to get access to the project
type (app, lib, test, ...) as it's not so computive intensive.
- Fix test project to give them access to the full tested project's
classpath.
- Fix support for projects that test themselves.
- Make sure library projects are instrumented when using the
emma target.
Change-Id: Ia0c9564eacee2521e7cbd5154b8a85ea287ad4fd
Diffstat (limited to 'sdkmanager/libs/sdklib')
4 files changed, 32 insertions, 9 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/IPropertySource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/IPropertySource.java new file mode 100644 index 0000000..360c755 --- /dev/null +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/IPropertySource.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 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.internal.project; + +/** + * A source able to return properties by name. + * + */ +public interface IPropertySource { + String getProperty(String name); +} 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 2bb6b71..17d3ccf 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 @@ -55,7 +55,7 @@ import java.util.regex.Pattern; * {@link #makeWorkingCopy()}. * */ -public class ProjectProperties { +public class ProjectProperties implements IPropertySource { protected final static Pattern PATTERN_PROP = Pattern.compile( "^([a-zA-Z0-9._-]+)\\s*=\\s*(.*)\\s*$"); @@ -343,6 +343,7 @@ public class ProjectProperties { * @param name the name of the property. * @return the property value or null if the property is not set. */ + @Override public synchronized String getProperty(String name) { return mProperties.get(name); } 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 13c8f6a..797b505 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 @@ -90,18 +90,15 @@ public class ProjectPropertiesWorkingCopy extends ProjectProperties { * <p/> * Typical usage: * <ul> - * <li>Create a ProjectProperties with {@code PropertyType#BUILD} - * <li>Merge in values using {@code PropertyType#DEFAULT} + * <li>Create a ProjectProperties with {@code PropertyType#ANT} + * <li>Merge in values using {@code PropertyType#PROJECT} * <li>The result is that this contains all the properties from default plus those * overridden by the build.properties file. * </ul> * * @param type One the possible {@link PropertyType}s. * @return this object, for chaining. - * - * @deprecated FIXME this method is not referenced anywhere. */ - @Deprecated public synchronized ProjectPropertiesWorkingCopy merge(PropertyType type) { if (mProjectFolder.exists() && mType != type) { IAbstractFile propFile = mProjectFolder.getFile(type.getFilename()); diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java index 8373d8a..d6b2a6b 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java @@ -18,7 +18,7 @@ package com.android.sdklib.xml; import com.android.sdklib.SdkConstants; -import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -42,7 +42,7 @@ public class AndroidXPathFactory { DEFAULT_NS_PREFIX); private final String mAndroidPrefix; - private final List<String> mAndroidPrefixes = new ArrayList<String>(); + private final List<String> mAndroidPrefixes; /** * Returns the default {@link AndroidNamespaceContext}. @@ -57,7 +57,7 @@ public class AndroidXPathFactory { */ public AndroidNamespaceContext(String androidPrefix) { mAndroidPrefix = androidPrefix; - mAndroidPrefixes.add(mAndroidPrefix); + mAndroidPrefixes = Collections.singletonList(mAndroidPrefix); } @Override |