com.android.build.gradle.internal.model.DefaultAndroidProject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle Show documentation
Show all versions of gradle Show documentation
Gradle plug-in to build Android applications.
/*
* Copyright (C) 2013 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.build.gradle.internal.model;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.build.gradle.internal.CompileOptions;
import com.android.builder.model.AaptOptions;
import com.android.builder.model.AndroidProject;
import com.android.builder.model.ArtifactMetaData;
import com.android.builder.model.BuildTypeContainer;
import com.android.builder.model.JavaCompileOptions;
import com.android.builder.model.LintOptions;
import com.android.builder.model.ProductFlavorContainer;
import com.android.builder.model.SigningConfig;
import com.android.builder.model.Variant;
import com.google.common.collect.Lists;
import java.io.File;
import java.io.Serializable;
import java.util.Collection;
/**
* Implementation of the AndroidProject model object.
*/
class DefaultAndroidProject implements AndroidProject, Serializable {
private static final long serialVersionUID = 1L;
@NonNull
private final String modelVersion;
@NonNull
private final String name;
@NonNull
private final String compileTarget;
@NonNull
private final Collection bootClasspath;
@NonNull
private final Collection frameworkSource;
@NonNull
private final Collection signingConfigs;
@NonNull
private final AaptOptions aaptOptions;
@NonNull
private final Collection extraArtifacts;
@NonNull
private final Collection unresolvedDependencies;
@NonNull
private final JavaCompileOptions javaCompileOptions;
@NonNull
private final LintOptions lintOptions;
@NonNull
private final File buildFolder;
@Nullable
private final String resourcePrefix;
private final boolean isLibrary;
private final Collection buildTypes = Lists.newArrayList();
private final Collection productFlavors = Lists.newArrayList();
private final Collection variants = Lists.newArrayList();
private ProductFlavorContainer defaultConfig;
DefaultAndroidProject(@NonNull String modelVersion,
@NonNull String name,
@NonNull String compileTarget,
@NonNull Collection bootClasspath,
@NonNull Collection frameworkSource,
@NonNull Collection signingConfigs,
@NonNull AaptOptions aaptOptions,
@NonNull Collection extraArtifacts,
@NonNull Collection unresolvedDependencies,
@NonNull CompileOptions compileOptions,
@NonNull LintOptions lintOptions,
@NonNull File buildFolder,
@Nullable String resourcePrefix,
boolean isLibrary) {
this.modelVersion = modelVersion;
this.name = name;
this.compileTarget = compileTarget;
this.bootClasspath = bootClasspath;
this.frameworkSource = frameworkSource;
this.signingConfigs = signingConfigs;
this.aaptOptions = aaptOptions;
this.extraArtifacts = extraArtifacts;
this.unresolvedDependencies = unresolvedDependencies;
javaCompileOptions = new DefaultJavaCompileOptions(compileOptions);
this.lintOptions = lintOptions;
this.buildFolder = buildFolder;
this.resourcePrefix = resourcePrefix;
this.isLibrary = isLibrary;
}
@NonNull
DefaultAndroidProject setDefaultConfig(@NonNull ProductFlavorContainer defaultConfigContainer) {
defaultConfig = defaultConfigContainer;
return this;
}
@NonNull
DefaultAndroidProject addBuildType(@NonNull BuildTypeContainer buildTypeContainer) {
buildTypes.add(buildTypeContainer);
return this;
}
@NonNull
DefaultAndroidProject addProductFlavors(
@NonNull ProductFlavorContainer productFlavorContainer) {
productFlavors.add(productFlavorContainer);
return this;
}
@NonNull
DefaultAndroidProject addVariant(@NonNull VariantImpl variant) {
variants.add(variant);
return this;
}
@Override
@NonNull
public String getModelVersion() {
return modelVersion;
}
@Override
@NonNull
public String getName() {
return name;
}
@Override
@NonNull
public ProductFlavorContainer getDefaultConfig() {
return defaultConfig;
}
@Override
@NonNull
public Collection getBuildTypes() {
return buildTypes;
}
@Override
@NonNull
public Collection getProductFlavors() {
return productFlavors;
}
@Override
@NonNull
public Collection getVariants() {
return variants;
}
@NonNull
@Override
public Collection getExtraArtifacts() {
return extraArtifacts;
}
@Override
public boolean isLibrary() {
return isLibrary;
}
@Override
@NonNull
public String getCompileTarget() {
return compileTarget;
}
@Override
@NonNull
public Collection getBootClasspath() {
return bootClasspath;
}
@Override
@NonNull
public Collection getFrameworkSources() {
return frameworkSource;
}
@Override
@NonNull
public Collection getSigningConfigs() {
return signingConfigs;
}
@Override
@NonNull
public AaptOptions getAaptOptions() {
return aaptOptions;
}
@Override
@NonNull
public LintOptions getLintOptions() {
return lintOptions;
}
@Override
@NonNull
public Collection getUnresolvedDependencies() {
return unresolvedDependencies;
}
@Override
@NonNull
public JavaCompileOptions getJavaCompileOptions() {
return javaCompileOptions;
}
@Override
@NonNull
public File getBuildFolder() {
return buildFolder;
}
@Override
@Nullable
public String getResourcePrefix() {
return resourcePrefix;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy