import com.android.builder.signing.SigningConfig;
import com.android.manifmerger.ManifestMerger;
import com.android.manifmerger.MergerLog;
+import com.android.sdklib.BuildToolInfo;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
import com.android.sdklib.repository.FullRevision;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
/**
* This is the main builder class. It is given all the data to process the build (such as
* build steps.
*
* To use:
- * create a builder with {@link #AndroidBuilder(SdkParser, ILogger, boolean)},
- * configure compile target with {@link #setTarget(String)}
+ * create a builder with {@link #AndroidBuilder(SdkParser, ILogger, boolean)}
*
* then build steps can be done with
* {@link #generateBuildConfig(String, boolean, java.util.List, String)}
private final CommandLineRunner mCmdLineRunner;
private final boolean mVerboseExec;
- private IAndroidTarget mTarget;
+ @NonNull
+ private final IAndroidTarget mTarget;
+ @NonNull
+ private final BuildToolInfo mBuildTools;
/**
* Creates an AndroidBuilder
platformToolsRevision, MIN_PLATFORM_TOOLS_REV));
}
+
+ mTarget = mSdkParser.getTarget();
+ mBuildTools = mSdkParser.getBuildTools();
}
@VisibleForTesting
mCmdLineRunner = checkNotNull(cmdLineRunner);
mLogger = checkNotNull(logger);
mVerboseExec = verboseExec;
- }
-
- /**
- * Sets the compilation target hash string.
- *
- * @param target the compilation target
- *
- * @see IAndroidTarget#hashString()
- */
- public void setTarget(@NonNull String target) {
- checkNotNull(target, "target cannot be null.");
- mTarget = mSdkParser.resolveTarget(target, mLogger);
-
- if (mTarget == null) {
- throw new RuntimeException("Unknown target: " + target);
- }
- }
-
- public int getTargetApiLevel() {
- checkState(mTarget != null, "Target not set.");
-
- return mTarget.getVersion().getApiLevel();
+ mTarget = mSdkParser.getTarget();
+ mBuildTools = mSdkParser.getBuildTools();
}
/**
* Returns the runtime classpath to be used during compilation.
*/
public List<String> getRuntimeClasspath() {
- checkState(mTarget != null, "Target not set.");
List<String> classpath = Lists.newArrayList();
* @return an AaptRunner object
*/
public AaptRunner getAaptRunner() {
- return new AaptRunner(mSdkParser.getAapt().getAbsolutePath(), mCmdLineRunner);
+ return new AaptRunner(
+ mBuildTools.getPath(BuildToolInfo.PathId.AAPT),
+ mCmdLineRunner);
}
/**
boolean debuggable,
@NonNull List<String> javaLines,
@NonNull String sourceOutputDir) throws IOException {
- checkState(mTarget != null, "Target not set.");
BuildConfigGenerator generator = new BuildConfigGenerator(
sourceOutputDir, packageName, debuggable);
int minSdkVersion,
int targetSdkVersion,
@NonNull String outManifestLocation) {
- checkState(mTarget != null, "Target not set.");
checkNotNull(mainManifest, "mainManifest cannot be null.");
checkNotNull(manifestOverlays, "manifestOverlays cannot be null.");
checkNotNull(libraries, "libraries cannot be null.");
@NonNull String instrumentationRunner,
@NonNull List<? extends ManifestDependency> libraries,
@NonNull String outManifestLocation) {
- checkState(mTarget != null, "Target not set.");
checkNotNull(testPackageName, "testPackageName cannot be null.");
checkNotNull(testedPackageName, "testedPackageName cannot be null.");
checkNotNull(instrumentationRunner, "instrumentationRunner cannot be null.");
@NonNull AaptOptions options)
throws IOException, InterruptedException {
- checkState(mTarget != null, "Target not set.");
checkNotNull(manifestFile, "manifestFile cannot be null.");
checkNotNull(resFolder, "resFolder cannot be null.");
checkNotNull(libraries, "libraries cannot be null.");
// launch aapt: create the command line
ArrayList<String> command = Lists.newArrayList();
- File aapt = mSdkParser.getAapt();
- if (aapt == null || !aapt.isFile()) {
+ String aapt = mBuildTools.getPath(BuildToolInfo.PathId.AAPT);
+ if (aapt == null || !new File(aapt).isFile()) {
throw new IllegalStateException("aapt is missing");
}
- command.add(aapt.getAbsolutePath());
+ command.add(aapt);
command.add("package");
if (mVerboseExec) {
@NonNull List<File> importFolders,
@Nullable DependencyFileProcessor dependencyFileProcessor)
throws IOException, InterruptedException, ExecutionException {
- checkState(mTarget != null, "Target not set.");
checkNotNull(sourceFolders, "sourceFolders cannot be null.");
checkNotNull(sourceOutputDir, "sourceOutputDir cannot be null.");
checkNotNull(importFolders, "importFolders cannot be null.");
- File aidl = mSdkParser.getAidlCompiler();
- if (aidl == null || !aidl.isFile()) {
+ String aidl = mBuildTools.getPath(BuildToolInfo.PathId.AIDL);
+ if (aidl == null || !new File(aidl).isFile()) {
throw new IllegalStateException("aidl is missing");
}
fullImportList.addAll(importFolders);
AidlProcessor processor = new AidlProcessor(
- aidl.getAbsolutePath(),
+ aidl,
mTarget.getPath(IAndroidTarget.ANDROID_AIDL),
fullImportList,
sourceOutputDir,
@NonNull List<File> importFolders,
@Nullable DependencyFileProcessor dependencyFileProcessor)
throws IOException, InterruptedException {
- checkState(mTarget != null, "Target not set.");
checkNotNull(aidlFile, "aidlFile cannot be null.");
checkNotNull(sourceOutputDir, "sourceOutputDir cannot be null.");
checkNotNull(importFolders, "importFolders cannot be null.");
- File aidl = mSdkParser.getAidlCompiler();
- if (aidl == null || !aidl.isFile()) {
+ String aidl = mBuildTools.getPath(BuildToolInfo.PathId.AIDL);
+ if (aidl == null || !new File(aidl).isFile()) {
throw new IllegalStateException("aidl is missing");
}
AidlProcessor processor = new AidlProcessor(
- aidl.getAbsolutePath(),
+ aidl,
mTarget.getPath(IAndroidTarget.ANDROID_AIDL),
importFolders,
sourceOutputDir,
boolean debugBuild,
int optimLevel)
throws IOException, InterruptedException, ExecutionException {
- checkState(mTarget != null, "Target not set.");
checkNotNull(sourceFolders, "sourceFolders cannot be null.");
checkNotNull(importFolders, "importFolders cannot be null.");
checkNotNull(sourceOutputDir, "sourceOutputDir cannot be null.");
checkNotNull(resOutputDir, "resOutputDir cannot be null.");
- File renderscript = mSdkParser.getRenderscriptCompiler();
- if (renderscript == null || !renderscript.isFile()) {
+ String renderscript = mBuildTools.getPath(BuildToolInfo.PathId.LLVM_RS_CC);
+ if (renderscript == null || !new File(renderscript).isFile()) {
throw new IllegalStateException("llvm-rs-cc is missing");
}
return;
}
- @SuppressWarnings("deprecation")
- String rsPath = mTarget.getPath(IAndroidTarget.ANDROID_RS);
-
- @SuppressWarnings("deprecation")
- String rsClangPath = mTarget.getPath(IAndroidTarget.ANDROID_RS_CLANG);
+ String rsPath = mBuildTools.getPath(BuildToolInfo.PathId.ANDROID_RS);
+ String rsClangPath = mBuildTools.getPath(BuildToolInfo.PathId.ANDROID_RS_CLANG);
// the renderscript compiler doesn't expect the top res folder,
// but the raw folder directly.
File rawFolder = new File(resOutputDir, SdkConstants.FD_RES_RAW);
-
// compile all the files in a single pass
ArrayList<String> command = Lists.newArrayList();
- command.add(renderscript.getAbsolutePath());
+ command.add(renderscript);
if (debugBuild) {
command.add("-g");
@NonNull String outDexFile,
@NonNull DexOptions dexOptions,
boolean incremental) throws IOException, InterruptedException {
- checkState(mTarget != null, "Target not set.");
checkNotNull(classesLocation, "classesLocation cannot be null.");
checkNotNull(libraries, "libraries cannot be null.");
checkNotNull(outDexFile, "outDexFile cannot be null.");
// launch dx: create the command line
ArrayList<String> command = Lists.newArrayList();
- File dx = mSdkParser.getDx();
- if (dx == null || !dx.isFile()) {
+ String dx = mBuildTools.getPath(BuildToolInfo.PathId.DX);
+ if (dx == null || !new File(dx).isFile()) {
throw new IllegalStateException("dx is missing");
}
- command.add(dx.getAbsolutePath());
+ command.add(dx);
command.add("--dex");
@Nullable SigningConfig signingConfig,
@NonNull String outApkLocation) throws DuplicateFileException, FileNotFoundException,
KeytoolException, PackagerException, SigningException {
- checkState(mTarget != null, "Target not set.");
checkNotNull(androidResPkgLocation, "androidResPkgLocation cannot be null.");
checkNotNull(classesDexLocation, "classesDexLocation cannot be null.");
checkNotNull(outApkLocation, "outApkLocation cannot be null.");
import com.android.SdkConstants;
import com.android.annotations.NonNull;
+import com.android.sdklib.BuildToolInfo;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkManager;
import com.android.sdklib.repository.FullRevision;
import com.android.sdklib.repository.PkgProps;
import com.android.utils.ILogger;
import com.google.common.base.Charsets;
-import com.google.common.collect.Maps;
import com.google.common.io.Closeables;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
-import java.util.Map;
import java.util.Properties;
import static com.android.SdkConstants.FD_PLATFORM_TOOLS;
private final String mSdkLocation;
private SdkManager mManager;
+ private IAndroidTarget mTarget;
+ private BuildToolInfo mBuildToolInfo;
+
private File mTools;
private File mPlatformTools;
- private final Map<String, File> mToolsMap = Maps.newHashMapWithExpectedSize(6);
+ private File mAdb;
+ private File mZipAlign;
public DefaultSdkParser(@NonNull String sdkLocation) {
if (!sdkLocation.endsWith(File.separator)) {
}
@Override
- public IAndroidTarget resolveTarget(@NonNull String target, @NonNull ILogger logger) {
+ public void initParser(@NonNull String target,
+ @NonNull FullRevision buildToolRevision,
+ @NonNull ILogger logger) {
if (mManager == null) {
mManager = SdkManager.createManager(mSdkLocation, logger);
if (mManager == null) {
- throw new RuntimeException("failed to parse SDK!");
+ throw new IllegalStateException("failed to parse SDK!");
+ }
+
+ mTarget = mManager.getTargetFromHashString(target);
+ if (mTarget == null) {
+ throw new IllegalStateException("failed to find target " + target);
+ }
+
+ mBuildToolInfo = mManager.getBuildTool(buildToolRevision);
+ if (mBuildToolInfo == null) {
+ throw new IllegalStateException("failed to find Build Tools revision "
+ + buildToolRevision.toString());
}
}
+ }
+
+ @NonNull
+ @Override
+ public IAndroidTarget getTarget() {
+ if (mManager == null) {
+ throw new IllegalStateException("SdkParser was not initialized.");
+ }
+ return mTarget;
+ }
- return mManager.getTargetFromHashString(target);
+ @NonNull
+ @Override
+ public BuildToolInfo getBuildTools() {
+ if (mManager == null) {
+ throw new IllegalStateException("SdkParser was not initialized.");
+ }
+ return mBuildToolInfo;
}
@Override
return null;
}
- @Override
- public File getAapt() {
- return getPlatformTool(SdkConstants.FN_AAPT);
- }
-
- @Override
- public File getAidlCompiler() {
- return getPlatformTool(SdkConstants.FN_AIDL);
- }
-
- @Override
- public File getRenderscriptCompiler() {
- return getPlatformTool(SdkConstants.FN_RENDERSCRIPT);
- }
-
- @Override
- public File getDx() {
- return getPlatformTool(SdkConstants.FN_DX);
- }
-
@Override
public File getZipAlign() {
- return getTool(SdkConstants.FN_ZIPALIGN);
+ if (mZipAlign == null) {
+ mZipAlign = new File(getToolsFolder(), SdkConstants.FN_ZIPALIGN);
+ }
+ return mZipAlign;
}
@Override
public File getAdb() {
- return getPlatformTool(SdkConstants.FN_ADB);
- }
-
- private File getPlatformTool(String filename) {
- File f = mToolsMap.get(filename);
- if (f == null) {
- File platformTools = getPlatformToolsFolder();
- if (!platformTools.isDirectory()) {
- return null;
- }
-
- f = new File(platformTools, filename);
- mToolsMap.put(filename, f);
- }
-
- return f;
- }
-
- private File getTool(String filename) {
- File f = mToolsMap.get(filename);
- if (f == null) {
- File platformTools = getToolsFolder();
- if (!platformTools.isDirectory()) {
- return null;
- }
-
- f = new File(platformTools, filename);
- mToolsMap.put(filename, f);
+ if (mAdb == null) {
+ mAdb = new File(getPlatformToolsFolder(), SdkConstants.FN_ADB);
}
-
- return f;
+ return mAdb;
}
+ @NonNull
private File getPlatformToolsFolder() {
if (mPlatformTools == null) {
mPlatformTools = new File(mSdkLocation, FD_PLATFORM_TOOLS);
+ if (!mPlatformTools.isDirectory()) {
+ throw new IllegalStateException("Platform-tools folder missing: " +
+ mPlatformTools.getAbsolutePath());
+ }
}
return mPlatformTools;
}
+ @NonNull
private File getToolsFolder() {
if (mTools == null) {
mTools = new File(mSdkLocation, FD_TOOLS);
+ if (!mTools.isDirectory()) {
+ throw new IllegalStateException("Platform-tools folder missing: " +
+ mTools.getAbsolutePath());
+ }
}
return mTools;
import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.builder.internal.FakeAndroidTarget;
+import com.android.sdklib.BuildToolInfo;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.repository.FullRevision;
import com.android.utils.ILogger;
-import com.google.common.collect.Maps;
import java.io.File;
-import java.util.Map;
/**
* Implementation of {@link SdkParser} for the SDK prebuilds in the Android source tree.
public class PlatformSdkParser implements SdkParser {
private final String mPlatformRootFolder;
+ private boolean mInitialized = false;
+ private IAndroidTarget mTarget;
+ private BuildToolInfo mBuildToolInfo;
+
private File mHostTools;
- private final Map<String, File> mToolsMap = Maps.newHashMapWithExpectedSize(6);
- private File mDx;
+ private File mZipAlign;
private File mAdb;
PlatformSdkParser(@NonNull String sdkLocation) {
}
@Override
- public IAndroidTarget resolveTarget(String target, ILogger logger) {
- return new FakeAndroidTarget(mPlatformRootFolder, target);
+ public void initParser(@NonNull String target,
+ @NonNull FullRevision buildToolRevision,
+ @NonNull ILogger logger) {
+ if (!mInitialized) {
+ mTarget = new FakeAndroidTarget(mPlatformRootFolder, target);
+
+ mBuildToolInfo = new BuildToolInfo(buildToolRevision, new File(mPlatformRootFolder),
+ new File(getHostToolsFolder(), SdkConstants.FN_AAPT),
+ new File(getHostToolsFolder(), SdkConstants.FN_AIDL),
+ new File(mPlatformRootFolder, "prebuilts/sdk/tools/dx"),
+ new File(mPlatformRootFolder, "prebuilts/sdk/tools/lib/dx.jar"),
+ new File(getHostToolsFolder(), SdkConstants.FN_RENDERSCRIPT),
+ new File(mPlatformRootFolder, "prebuilts/sdk/renderscript/include"),
+ new File(mPlatformRootFolder, "prebuilts/sdk/renderscript/clang-include"));
+ }
+ }
+
+ @NonNull
+ @Override
+ public IAndroidTarget getTarget() {
+ if (!mInitialized) {
+ throw new IllegalStateException("SdkParser was not initialized.");
+ }
+ return mTarget;
+ }
+
+ @NonNull
+ @Override
+ public BuildToolInfo getBuildTools() {
+ if (!mInitialized) {
+ throw new IllegalStateException("SdkParser was not initialized.");
+ }
+ return mBuildToolInfo;
}
@Override
}
@Override
- public File getAapt() {
- return getTool(SdkConstants.FN_AAPT);
- }
-
- @Override
- public File getAidlCompiler() {
- return getTool(SdkConstants.FN_AIDL);
- }
-
- @Override
- public File getRenderscriptCompiler() {
- return getTool(SdkConstants.FN_RENDERSCRIPT);
- }
-
- @Override
- public File getDx() {
- if (mDx == null) {
- mDx = new File(mPlatformRootFolder, "prebuilts/sdk/tools/dx");
+ public File getZipAlign() {
+ if (mZipAlign == null) {
+ mZipAlign = new File(getHostToolsFolder(), SdkConstants.FN_ZIPALIGN);
}
- return mDx;
- }
-
- @Override
- public File getZipAlign() {
- return getTool(SdkConstants.FN_ZIPALIGN);
+ return mZipAlign;
}
@Override
} else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
mAdb = new File(mPlatformRootFolder, "out/host/linux-x86/bin/adb");
} else {
- throw new IllegalStateException("Windows is not supported for platform development");
+ throw new IllegalStateException(
+ "Windows is not supported for platform development");
}
}
return mAdb;
}
- private File getTool(String filename) {
- File f = mToolsMap.get(filename);
- if (f == null) {
- File platformTools = getHostToolsFolder();
- if (!platformTools.isDirectory()) {
- return null;
- }
-
- f = new File(platformTools, filename);
- mToolsMap.put(filename, f);
- }
-
- return f;
- }
-
+ @NonNull
private File getHostToolsFolder() {
if (mHostTools == null) {
File tools = new File(mPlatformRootFolder, "prebuilts/sdk/tools");
} else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
mHostTools = new File(tools, "linux");
} else {
- throw new IllegalStateException("Windows is not supported for platform development");
+ throw new IllegalStateException(
+ "Windows is not supported for platform development");
+ }
+
+ if (!mHostTools.isDirectory()) {
+ throw new IllegalStateException("Host tools folder missing: " +
+ mHostTools.getAbsolutePath());
}
}
return mHostTools;
package com.android.builder;
import com.android.annotations.NonNull;
+import com.android.sdklib.BuildToolInfo;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.repository.FullRevision;
import com.android.utils.ILogger;
public interface SdkParser {
/**
- * Resolves a target hash string and returns the corresponding {@link IAndroidTarget}
+ * Inits the parser with a target hash string and a build tools FullRevision.
+ *
+ * Note that this may be called several times on the same object, though it will always
+ * be with the same values. Extra calls can be ignored.
+ *
* @param target the target hash string.
+ * @param buildToolRevision the build tools revision
* @param logger a logger object.
- * @return the target or null if no match is found.
*
- * @throws RuntimeException if the SDK cannot parsed.
+ * @throws IllegalStateException if the SDK cannot parsed.
*
* @see IAndroidTarget#hashString()
*/
- IAndroidTarget resolveTarget(@NonNull String target, @NonNull ILogger logger);
-
- /**
- * Returns the location of the annotations jar for compilation targets that are <= 15.
- */
- String getAnnotationsJar();
+ public void initParser(@NonNull String target,
+ @NonNull FullRevision buildToolRevision,
+ @NonNull ILogger logger);
/**
- * Returns the revision of the installed platform tools component.
+ * Returns the compilation target
+ * @return the target.
*
- * @return the FullRevision or null if the revision couldn't not be found
+ * @throws IllegalStateException if the sdk was not initialized.
*/
- FullRevision getPlatformToolsRevision();
+ @NonNull
+ IAndroidTarget getTarget();
/**
- * Returns the location of the aapt tool.
- */
- File getAapt();
-
- /**
- * Returns the location of the aidl compiler.
+ * Returns the BuildToolInfo
+ * @return the build tool info
+ *
+ * @throws IllegalStateException if the sdk was not initialized.
*/
- File getAidlCompiler();
+ @NonNull
+ BuildToolInfo getBuildTools();
/**
- * Returns the location of the renderscript compiler.
- */
- File getRenderscriptCompiler();
+ * Returns the location of the annotations jar for compilation targets that are <= 15.
+ */
+ String getAnnotationsJar();
/**
- * Returns the location of the dx tool.
+ * Returns the revision of the installed platform tools component.
+ *
+ * @return the FullRevision or null if the revision couldn't not be found
*/
- File getDx();
+ FullRevision getPlatformToolsRevision();
/**
* Returns the location of the zip align tool.
mPaths.put(ANDROID_JAR, apiPrebuilts + SdkConstants.FN_FRAMEWORK_LIBRARY);
mPaths.put(ANDROID_AIDL, apiPrebuilts + SdkConstants.FN_FRAMEWORK_AIDL);
}
-
- // location of the renderscript imports.
- String rsPrebuilts = mSdkLocation + "/prebuilts/sdk/renderscript/";
- mPaths.put(ANDROID_RS, rsPrebuilts + SdkConstants.OS_FRAMEWORK_RS);
- mPaths.put(ANDROID_RS_CLANG, rsPrebuilts + SdkConstants.OS_FRAMEWORK_RS_CLANG);
}
private int getApiLevel(String target) {
super(instantiator)
}
+ @Override
+ protected BaseExtension getAndroidExtension() {
+ return extension;
+ }
+
@Override
void apply(Project project) {
super.apply(project)
return variant;
}
-
- @Override
- protected String getTarget() {
- return extension.compileSdkVersion;
- }
}
* limitations under the License.
*/
package com.android.build.gradle
+
import com.android.build.gradle.internal.CompileOptions
import com.android.build.gradle.internal.dsl.AaptOptionsImpl
import com.android.build.gradle.internal.dsl.AndroidSourceSetFactory
import com.android.build.gradle.internal.test.TestOptions
import com.android.builder.BuilderConstants
import com.android.builder.ProductFlavor
+import com.android.sdklib.repository.FullRevision
import org.gradle.api.Action
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.artifacts.Configuration
public abstract class BaseExtension {
private String target
+ private FullRevision buildToolsRevision
final ProductFlavor defaultConfig
final AaptOptionsImpl aaptOptions
compileSdkVersion(target)
}
+ void buildToolsVersion(String version) {
+ buildToolsRevision = FullRevision.parseRevision(version)
+ }
+
+ void setBuildToolsVersion(String version) {
+ buildToolsVersion(version)
+ }
+
void sourceSets(Action<NamedDomainObjectContainer<AndroidSourceSet>> action) {
action.execute(sourceSetsContainer)
}
public String getCompileSdkVersion() {
return target
}
+
+ public FullRevision getBuildToolsRevision() {
+ return buildToolsRevision
+ }
}
import com.android.builder.dependency.AndroidDependency
import com.android.builder.dependency.JarDependency
import com.android.builder.signing.SigningConfig
+import com.android.sdklib.repository.FullRevision
import com.android.utils.ILogger
import com.google.common.collect.ArrayListMultimap
import com.google.common.collect.Lists
protected Task assembleTest
protected Task deviceCheck
- protected abstract String getTarget()
+ protected abstract BaseExtension getAndroidExtension()
protected BasePlugin(Instantiator instantiator) {
this.instantiator = instantiator
AndroidBuilder androidBuilder = builders.get(variant)
if (androidBuilder == null) {
- androidBuilder = variant.createBuilder(this)
+ String target = androidExtension.getCompileSdkVersion()
+ if (target == null) {
+ throw new IllegalArgumentException("android.compileSdkVersion is missing!")
+ }
+
+ FullRevision buildToolsRevision = androidExtension.buildToolsRevision
+ if (buildToolsRevision == null) {
+ throw new IllegalArgumentException("android.buildToolsVersion is missing!")
+
+ }
+
+ sdkParser.initParser(target, buildToolsRevision, logger)
+ androidBuilder = new AndroidBuilder(sdkParser, logger, verbose)
+
builders.put(variant, androidBuilder)
}
super(instantiator)
}
+ @Override
+ protected BaseExtension getAndroidExtension() {
+ return extension;
+ }
+
@Override
void apply(Project project) {
super.apply(project)
return testVariant
}
-
- @Override
- protected String getTarget() {
- return extension.compileSdkVersion
- }
}
return config.getPackageName()
}
- abstract AndroidBuilder createBuilder(BasePlugin androidBasePlugin)
-
protected String getFlavoredName(boolean capitalized) {
StringBuilder builder = new StringBuilder()
for (ProductFlavor flavor : config.flavorConfigs) {
*/
package com.android.build.gradle.internal
-import com.android.build.gradle.BasePlugin
-import com.android.builder.AndroidBuilder
import com.android.builder.VariantConfiguration
class ProductionAppVariant extends ApplicationVariant {
boolean getRunProguard() {
return config.buildType.runProguard
}
-
- @Override
- AndroidBuilder createBuilder(BasePlugin androidBasePlugin) {
- AndroidBuilder androidBuilder = new AndroidBuilder(
- androidBasePlugin.sdkParser,
- androidBasePlugin.logger,
- androidBasePlugin.verbose)
-
- androidBuilder.setTarget(androidBasePlugin.target)
-
- return androidBuilder
- }
}
*/
package com.android.build.gradle.internal
-import com.android.build.gradle.BasePlugin
-import com.android.builder.AndroidBuilder
import com.android.builder.VariantConfiguration
class TestAppVariant extends ApplicationVariant {
boolean getRunProguard() {
return false
}
-
- @Override
- AndroidBuilder createBuilder(BasePlugin androidBasePlugin) {
- AndroidBuilder androidBuilder = new AndroidBuilder(
- androidBasePlugin.sdkParser,
- androidBasePlugin.logger,
- androidBasePlugin.verbose)
-
- androidBuilder.setTarget(androidBasePlugin.target)
-
- return androidBuilder
- }
}
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
// query for all (non-test) variants and inject a new step in the builds
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
// query for all (non-test) variants and inject a new step in the builds
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
//
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
- defaultConfig {
- testPackageName = "com.android.tests.testprojecttest.testlib"
- }
+ defaultConfig {
+ testPackageName = "com.android.tests.testprojecttest.testlib"
+ }
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
+
testBuildType "debug"
signingConfigs {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
+
testBuildType "blah"
defaultConfig {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
+
testBuildType = "staging"
defaultConfig {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
productFlavors {
flavor1 {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
productFlavors {
flavor1 {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
+
flavorGroups "group1", "group2"
productFlavors {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
//
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
-// buildToolsVersion "1.0"
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
-// buildToolsVersion "1.0"
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
-// buildToolsVersion "1.0"
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
sourceSets {
main {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
dependencies {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
sourceSets {
main {
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
productFlavors {
one {}
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
defaultConfig {
packageName "com.android.tests.basic.foo"
android {
compileSdkVersion 17
+ buildToolsVersion "1.0"
defaultConfig {
renderscriptTargetApi = 17
android {
compileSdkVersion 17
+ buildToolsVersion "1.0"
defaultConfig {
renderscriptTargetApi = 11
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
android {
compileSdkVersion 17
+ buildToolsVersion "1.0"
defaultConfig {
renderscriptTargetApi = 11
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
group = 'com.example.android.multiproject'
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
group = 'com.example.android.multiproject'
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
android {
compileSdkVersion 15
+ buildToolsVersion "1.0"
}
\ No newline at end of file