| 1 |
/* |
| 2 |
* Copyright (C) 2015 The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package com.android.build.gradle.model; |
| 18 |
|
| 19 |
import com.android.annotations.NonNull; |
| 20 |
import com.android.build.gradle.AndroidConfig; |
| 21 |
import com.android.build.gradle.internal.ApplicationTaskManager; |
| 22 |
import com.android.build.gradle.internal.DependencyManager; |
| 23 |
import com.android.build.gradle.internal.ndk.NdkHandler; |
| 24 |
import com.android.build.gradle.internal.SdkHandler; |
| 25 |
import com.android.build.gradle.internal.scope.VariantScope; |
| 26 |
import com.android.build.gradle.internal.variant.BaseVariantData; |
| 27 |
import com.android.builder.core.AndroidBuilder; |
| 28 |
import com.google.common.collect.ImmutableList; |
| 29 |
|
| 30 |
import org.gradle.api.Project; |
| 31 |
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry; |
| 32 |
|
| 33 |
import android.databinding.tool.DataBindingBuilder; |
| 34 |
|
| 35 |
import java.util.Collection; |
| 36 |
|
| 37 |
/** |
| 38 |
* TaskManager for creating tasks in an Android application project with component model plugin. |
| 39 |
*/ |
| 40 |
public class ApplicationComponentTaskManager extends ApplicationTaskManager { |
| 41 |
|
| 42 |
public ApplicationComponentTaskManager ( |
| 43 |
@NonNull Project project, |
| 44 |
@NonNull AndroidBuilder androidBuilder, |
| 45 |
@NonNull DataBindingBuilder dataBindingBuilder, |
| 46 |
@NonNull AndroidConfig extension, |
| 47 |
@NonNull SdkHandler sdkHandler, |
| 48 |
@NonNull NdkHandler ndkHandler, |
| 49 |
@NonNull DependencyManager dependencyManager, |
| 50 |
@NonNull ToolingModelBuilderRegistry toolingRegistry) { |
| 51 |
super( |
| 52 |
project, |
| 53 |
androidBuilder, |
| 54 |
dataBindingBuilder, |
| 55 |
extension, |
| 56 |
sdkHandler, |
| 57 |
ndkHandler, |
| 58 |
dependencyManager, |
| 59 |
toolingRegistry); |
| 60 |
isComponentModelPlugin = true; |
| 61 |
} |
| 62 |
|
| 63 |
@Override |
| 64 |
protected Collection<Object> getNdkBuildable(BaseVariantData variantData) { |
| 65 |
NdkComponentModelPlugin plugin = project.getPlugins().getPlugin(NdkComponentModelPlugin.class); |
| 66 |
return ImmutableList.<Object>copyOf(plugin.getBinaries(variantData.getVariantConfiguration())); |
| 67 |
} |
| 68 |
|
| 69 |
@Override |
| 70 |
public void configureScopeForNdk(@NonNull VariantScope scope) { |
| 71 |
NdkComponentModelPlugin.configureScopeForNdk(scope); |
| 72 |
} |
| 73 |
} |