本文整理汇总了Java中org.gradle.model.ModelMap类的典型用法代码示例。如果您正苦于以下问题:Java ModelMap类的具体用法?Java ModelMap怎么用?Java ModelMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelMap类属于org.gradle.model包,在下文中一共展示了ModelMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createBinaries
import org.gradle.model.ModelMap; //导入依赖的package包/类
@ComponentBinaries
public void createBinaries(ModelMap<JarBinarySpec> binaries, PlatformResolvers platforms, final JvmLibrarySpecInternal jvmLibrary) {
List<JavaPlatform> selectedPlatforms = resolvePlatforms(platforms, jvmLibrary);
final Set<String> exportedPackages = exportedPackagesOf(jvmLibrary);
final Collection<DependencySpec> apiDependencies = apiDependenciesOf(jvmLibrary);
final Collection<DependencySpec> dependencies = componentDependenciesOf(jvmLibrary);
for (final JavaPlatform platform : selectedPlatforms) {
final BinaryNamingScheme namingScheme = namingSchemeFor(jvmLibrary, selectedPlatforms, platform);
binaries.create(namingScheme.getBinaryName(), new Action<JarBinarySpec>() {
@Override
public void execute(JarBinarySpec jarBinarySpec) {
JarBinarySpecInternal jarBinary = (JarBinarySpecInternal) jarBinarySpec;
jarBinary.setNamingScheme(namingScheme);
jarBinary.setTargetPlatform(platform);
jarBinary.setExportedPackages(exportedPackages);
jarBinary.setApiDependencies(apiDependencies);
jarBinary.setDependencies(dependencies);
}
});
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:JvmComponentPlugin.java
示例2: execute
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Override
protected void execute(ModelRuleInvoker<?> invoker, final T binary, List<ModelView<?>> inputs) {
NamedEntityInstantiator<Task> taskFactory = Cast.uncheckedCast(ModelViews.getInstance(inputs.get(0), TASK_FACTORY));
ModelMap<Task> cast = DomainObjectCollectionBackedModelMap.wrap(
"tasks",
Task.class,
binary.getTasks(),
taskFactory,
new Task.Namer(),
new Action<Task>() {
@Override
public void execute(Task task) {
binary.getTasks().add(task);
binary.builtBy(task);
}
});
List<ModelView<?>> inputsWithBinary = new ArrayList<ModelView<?>>(inputs.size());
inputsWithBinary.addAll(inputs.subList(1, inputs.size()));
inputsWithBinary.add(InstanceModelView.of(getSubject().getPath(), getSubject().getType(), binary));
invoke(invoker, inputsWithBinary, cast, binary, binary);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:BinaryTasksModelRuleExtractor.java
示例3: visitSubject
import org.gradle.model.ModelMap; //导入依赖的package包/类
protected <V> void visitSubject(RuleMethodDataCollector dataCollector, MethodRuleDefinition<?, ?> ruleDefinition, ModelType<V> typeParameter, RuleSourceValidationProblemCollector problems) {
if (ruleDefinition.getReferences().size() == 0) {
problems.add(ruleDefinition, "A method " + getDescription() + " must have at least two parameters.");
return;
}
ModelType<?> subjectType = ruleDefinition.getSubjectReference().getType();
if (!isModelMap(subjectType)) {
problems.add(ruleDefinition, String.format("The first parameter of a method %s must be of type %s.", getDescription(), ModelMap.class.getName()));
return;
}
List<ModelType<?>> typeVariables = subjectType.getTypeVariables();
if (typeVariables.size() != 1) {
problems.add(ruleDefinition, String.format("Parameter of type %s must declare a type parameter extending %s.", ModelMap.class.getSimpleName(), typeParameter.getDisplayName()));
return;
}
ModelType<?> elementType = typeVariables.get(0);
if (elementType.isWildcard()) {
problems.add(ruleDefinition, String.format("%s type %s cannot be a wildcard type (i.e. cannot use ? super, ? extends etc.).", typeParameter.getDisplayName(), elementType.getDisplayName()));
return;
}
dataCollector.parameterTypes.put(typeParameter, elementType);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:AbstractAnnotationDrivenComponentModelRuleExtractor.java
示例4: invoke
import org.gradle.model.ModelMap; //导入依赖的package包/类
protected void invoke(ModelRuleInvoker<?> ruleInvoker, List<ModelView<?>> inputs, ModelMap<?> modelMap, T baseTypeParameter, Object... ignoredInputs) {
List<Object> ignoredInputsList = Arrays.asList(ignoredInputs);
Object[] args = new Object[inputs.size() + 2 - ignoredInputs.length];
args[0] = modelMap;
args[baseTypeParameterIndex] = baseTypeParameter;
for (ModelView<?> view : inputs) {
Object instance = view.getInstance();
if (ignoredInputsList.contains(instance)) {
continue;
}
for (int i = 0; i < args.length; i++) {
if (args[i] == null) {
args[i] = instance;
break;
}
}
}
ruleInvoker.invoke(args);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:ModelMapBasedRule.java
示例5: extract
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Override
public <T> void extract(ModelSchemaExtractionContext<T> extractionContext) {
ModelType<T> type = extractionContext.getType();
if (MODEL_MAP_MODEL_TYPE.isAssignableFrom(type)) {
if (!type.getRawClass().equals(ModelMap.class)) {
extractionContext.add(String.format("subtyping %s is not supported.", ModelMap.class.getName()));
return;
}
if (type.isHasWildcardTypeVariables()) {
extractionContext.add(String.format("type parameter of %s cannot be a wildcard.", ModelMap.class.getName()));
return;
}
List<ModelType<?>> typeVariables = type.getTypeVariables();
if (typeVariables.isEmpty()) {
extractionContext.add(String.format("type parameter of %s has to be specified.", ModelMap.class.getName()));
return;
}
ModelType<?> elementType = typeVariables.get(0);
extractionContext.found(getModelSchema(extractionContext, elementType));
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:ModelMapStrategy.java
示例6: itemType
import org.gradle.model.ModelMap; //导入依赖的package包/类
private ModelType<? extends I> itemType(ModelType<?> targetType) {
Class<?> targetClass = targetType.getRawClass();
if (targetClass.equals(ModelMap.class)) {
ModelType<?> targetItemClass = targetType.getTypeVariables().get(0);
if (targetItemClass.isAssignableFrom(baseItemModelType)) {
return baseItemModelType;
}
if (baseItemModelType.isAssignableFrom(targetItemClass)) {
return targetItemClass.asSubtype(baseItemModelType);
}
return null;
}
if (targetClass.isAssignableFrom(ModelMap.class)) {
return baseItemModelType;
}
return null;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:ModelMapModelProjection.java
示例7: linkTestSuiteBinariesRunTaskToBinariesCheckTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Finalize
void linkTestSuiteBinariesRunTaskToBinariesCheckTasks(@Path("binaries") ModelMap<TestSuiteBinarySpec> binaries) {
binaries.afterEach(new Action<TestSuiteBinarySpec>() {
@Override
public void execute(TestSuiteBinarySpec testSuiteBinary) {
if (testSuiteBinary.isBuildable()) {
if (testSuiteBinary.getTasks() instanceof TestSuiteTaskCollection) {
testSuiteBinary.checkedBy(((TestSuiteTaskCollection) testSuiteBinary.getTasks()).getRun());
}
BinarySpec testedBinary = testSuiteBinary.getTestedBinary();
if (testedBinary != null && testedBinary.isBuildable()) {
testedBinary.checkedBy(testSuiteBinary.getCheckTask());
}
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:TestingModelBasePlugin.java
示例8: realizePublishingTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Mutate
@SuppressWarnings("UnusedDeclaration")
public void realizePublishingTasks(ModelMap<Task> tasks, PublishingExtension extension, @Path("buildDir") File buildDir) {
// Create generatePom tasks for any Maven publication
PublicationContainer publications = extension.getPublications();
Task publishLifecycleTask = tasks.get(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
Task publishLocalLifecycleTask = tasks.get(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
for (final MavenPublicationInternal publication : publications.withType(MavenPublicationInternal.class)) {
String publicationName = publication.getName();
createGeneratePomTask(tasks, publication, publicationName, buildDir);
createLocalInstallTask(tasks, publishLocalLifecycleTask, publication, publicationName);
createPublishTasksForEachMavenRepo(tasks, extension, publishLifecycleTask, publication, publicationName);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:MavenPublishPlugin.java
示例9: createPublishTasksForEachMavenRepo
import org.gradle.model.ModelMap; //导入依赖的package包/类
private void createPublishTasksForEachMavenRepo(ModelMap<Task> tasks, PublishingExtension extension, final Task publishLifecycleTask, final MavenPublicationInternal publication,
final String publicationName) {
for (final MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
final String repositoryName = repository.getName();
String publishTaskName = "publish" + capitalize(publicationName) + "PublicationTo" + capitalize(repositoryName) + "Repository";
tasks.create(publishTaskName, PublishToMavenRepository.class, new Action<PublishToMavenRepository>() {
public void execute(PublishToMavenRepository publishTask) {
publishTask.setPublication(publication);
publishTask.setRepository(repository);
publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
publishTask.setDescription("Publishes Maven publication '" + publicationName + "' to Maven repository '" + repositoryName + "'.");
}
});
publishLifecycleTask.dependsOn(publishTaskName);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:MavenPublishPlugin.java
示例10: createNativeBinaries
import org.gradle.model.ModelMap; //导入依赖的package包/类
public static void createNativeBinaries(
NativeComponentSpec component,
ModelMap<NativeBinarySpec> binaries,
NativeDependencyResolver resolver,
FileCollectionFactory fileCollectionFactory,
BinaryNamingScheme namingScheme,
NativePlatform platform,
BuildType buildType,
Flavor flavor
) {
if (component instanceof NativeLibrarySpec) {
createNativeBinary(SharedLibraryBinarySpec.class, binaries, resolver, fileCollectionFactory, namingScheme.withBinaryType("SharedLibrary").withRole("shared", false), platform, buildType, flavor);
createNativeBinary(StaticLibraryBinarySpec.class, binaries, resolver, fileCollectionFactory, namingScheme.withBinaryType("StaticLibrary").withRole("static", false), platform, buildType, flavor);
} else {
createNativeBinary(NativeExecutableBinarySpec.class, binaries, resolver, fileCollectionFactory, namingScheme.withBinaryType("Executable").withRole("executable", true), platform, buildType, flavor);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:NativeBinaries.java
示例11: getBinaries
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Nullable
@Override
public DomainObjectSet<NativeLibraryBinary> getBinaries(LibraryIdentifier libraryIdentifier) {
ModelRegistry projectModel = projectModelResolver.resolveProjectModel(libraryIdentifier.getProjectPath());
ComponentSpecContainer components = projectModel.find("components", ComponentSpecContainer.class);
if (components == null) {
return null;
}
String libraryName = libraryIdentifier.getLibraryName();
NativeLibrarySpec library = components.withType(NativeLibrarySpec.class).get(libraryName);
if (library == null) {
return null;
}
ModelMap<NativeBinarySpec> projectBinaries = library.getBinaries().withType(NativeBinarySpec.class);
DomainObjectSet<NativeLibraryBinary> binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
for (NativeBinarySpec nativeBinarySpec : projectBinaries.values()) {
binaries.add((NativeLibraryBinary) nativeBinarySpec);
}
return binaries;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:ProjectLibraryBinaryLocator.java
示例12: createBuildDependentComponentsTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
public static void createBuildDependentComponentsTasks(ModelMap<Task> tasks, ComponentSpecContainer components) {
for (final VariantComponentSpec component : components.withType(NativeComponentSpec.class).withType(VariantComponentSpec.class)) {
tasks.create(getAssembleDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {
@Override
public void execute(DefaultTask assembleDependents) {
assembleDependents.setGroup("Build Dependents");
assembleDependents.setDescription("Assemble dependents of " + component.getDisplayName() + ".");
}
});
tasks.create(getBuildDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {
@Override
public void execute(DefaultTask buildDependents) {
buildDependents.setGroup("Build Dependents");
buildDependents.setDescription("Build dependents of " + component.getDisplayName() + ".");
}
});
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:NativeComponents.java
示例13: sharedLibraryTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
@BinaryTasks
public void sharedLibraryTasks(ModelMap<Task> tasks, final SharedLibraryBinarySpecInternal binary) {
String taskName = binary.getNamingScheme().getTaskName("link");
tasks.create(taskName, LinkSharedLibrary.class, new Action<LinkSharedLibrary>() {
@Override
public void execute(LinkSharedLibrary linkTask) {
linkTask.setDescription("Links " + binary.getDisplayName());
linkTask.setToolChain(binary.getToolChain());
linkTask.setTargetPlatform(binary.getTargetPlatform());
linkTask.setOutputFile(binary.getSharedLibraryFile());
linkTask.setInstallName(binary.getSharedLibraryFile().getName());
linkTask.setLinkerArgs(binary.getLinker().getArgs());
linkTask.lib(new NativeComponents.BinaryLibs(binary) {
@Override
protected FileCollection getFiles(NativeDependencySet nativeDependencySet) {
return nativeDependencySet.getLinkFiles();
}
});
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:NativeComponentModelPlugin.java
示例14: createJvmTestSuiteBinaries
import org.gradle.model.ModelMap; //导入依赖的package包/类
/**
* Create binaries for test suites. TODO: This should really be a @ComponentBinaries rule, but at this point we have no clue what the concrete binary type is, so everything has to be duplicated in
* specific plugins. See usages for example.
*/
public static void createJvmTestSuiteBinaries(ModelMap<BinarySpec> testBinaries,
PlatformResolvers platformResolver,
JvmTestSuiteSpec testSuite,
JavaToolChainRegistry toolChains,
Class<? extends JvmTestSuiteBinarySpec> testSuiteBinary) {
JvmComponentSpec testedComponent = testSuite.getTestedComponent();
if (testedComponent == null) {
// standalone test suite
createJvmTestSuiteBinary(testBinaries, testSuiteBinary, testSuite, null, toolChains, platformResolver);
} else {
// component under test
for (final JvmBinarySpec testedBinary : testedBinariesOf(testSuite)) {
createJvmTestSuiteBinary(testBinaries, testSuiteBinary, testSuite, testedBinary, toolChains, platformResolver);
}
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:JvmTestSuiteRules.java
示例15: createDebugTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
/**
* Create debug tasks
*
* @param tasks Task container to create new tasks
* @param config Project configuration
* @param project Current project identifier
*/
@Mutate
public void createDebugTasks(ModelMap<Task> tasks, ProjectConfig config, ProjectIdentifier project) {
// Create debug task to dump dependencies
if (config.isEnableDebugTasks()) {
tasks.create("debugDependencies", Task.class, tt -> {
tt.doLast(t -> {
PrintStream out = System.out;
out.print("Project: ");
out.println(project.getName());
for (Configuration configuration : t.getProject().getConfigurations()) {
out.print(" Configuration: ");
out.println(configuration.getName());
for (Dependency dependency : configuration.getDependencies()) {
out.print(" Dependency: ");
out.println(formatDependency(dependency));
}
}
});
});
}
}
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:31,代码来源:ProjectConfigPlugin.java
示例16: configureCheckstyleTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
/**
* Create Checkstyle tasks
*
* @param tasks Task container
* @param checkstyleConfig Checkstyle configuration
* @param sources Source sets
* @param files
* @param context
*/
@Finalize
public void configureCheckstyleTasks(ModelMap<Checkstyle> tasks, CheckstyleConfig checkstyleConfig,
ProjectSourceSet sources, FileOperations files, ProjectContext context) {
for (JavaSourceSet source : sources.withType(JavaSourceSet.class)) {
String taskName = getCheckstyleTaskName(source);
if (!checkstyleConfig.getIgnoreSourceSets().contains(source.getParentName())) {
tasks.named(taskName, t -> {
File checkstyleConfigFile = getCheckstyleConfigFile(source.getParentName(), files);
t.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
t.setConfigFile(checkstyleConfigFile);
if (checkstyleConfigFile.getParentFile() != null) {
t.setConfigDir(context.provider(() -> checkstyleConfigFile.getParentFile()));
}
t.dependsOn(getUpdateConfigTaskName(source));
});
}
}
}
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:32,代码来源:CheckstyleConfigPlugin.java
示例17: createEclipseAnnotationsTasks
import org.gradle.model.ModelMap; //导入依赖的package包/类
/**
* Create Eclipse annotations tasks
*
* @param tasks Task container
* @param configurations Container to access configurations
* @param buildDir Build directory
*/
@Mutate
public void createEclipseAnnotationsTasks(ModelMap<Task> tasks, ConfigurationContainer configurations,
@Path("buildDir") File buildDir) {
tasks.create("eclipseAnnotations", EclipseAnnotationsTask.class, t -> {
t.setDescription("Generates external nullability annotations for dependencies.");
t.setGroup("IDE");
ConventionMapping parameters = t.getConventionMapping();
parameters.map("jars", () -> {
Set<File> jars = configurations.stream()
.filter(c -> c.isCanBeResolved()
&& !c.getName().equals(JavaConfigPlugin.ANNOTATIONS_CONFIGURATION))
.map(c -> c.getResolvedConfiguration().getLenientConfiguration())
.flatMap(c -> c.getArtifacts().stream().filter(
a -> !(a.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier)
&& a.getType().equals("jar"))
.map(a -> a.getFile()))
.collect(Collectors.toSet());
return jars;
});
});
}
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:31,代码来源:EclipseConfigPlugin.java
示例18: createBinaries
import org.gradle.model.ModelMap; //导入依赖的package包/类
@ComponentBinaries
public void createBinaries(
final ModelMap<AndroidBinary> binaries,
@Path("android") final AndroidConfig androidConfig,
@Path("android.buildTypes") final ModelMap<BuildType> buildTypes,
final List<ProductFlavorCombo<ProductFlavor>> flavorCombos,
final AndroidComponentSpec spec) {
if (flavorCombos.isEmpty()) {
flavorCombos.add(new ProductFlavorCombo<ProductFlavor>());
}
for (final BuildType buildType : buildTypes.values()) {
for (final ProductFlavorCombo<ProductFlavor> flavorCombo : flavorCombos) {
binaries.create(getBinaryName(buildType, flavorCombo),
new Action<AndroidBinary>() {
@Override
public void execute(AndroidBinary androidBinary) {
DefaultAndroidBinary binary = (DefaultAndroidBinary) androidBinary;
binary.setBuildType(buildType);
binary.setProductFlavors(flavorCombo.getFlavorList());
}
});
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidComponentModelPlugin.java
示例19: attachNativeTasksToAndroidBinary
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Finalize
public void attachNativeTasksToAndroidBinary(ModelMap<AndroidBinary> binaries) {
binaries.afterEach(new Action<AndroidBinary>() {
@Override
public void execute(AndroidBinary androidBinary) {
DefaultAndroidBinary binary = (DefaultAndroidBinary) androidBinary;
if (binary.getTargetAbi().isEmpty()) {
binary.builtBy(binary.getNativeBinaries());
} else {
for (NativeLibraryBinarySpec nativeBinary : binary.getNativeBinaries()) {
if (binary.getTargetAbi()
.contains(nativeBinary.getTargetPlatform().getName())) {
binary.builtBy(nativeBinary);
}
}
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:NdkComponentModelPlugin.java
示例20: createVariantData
import org.gradle.model.ModelMap; //导入依赖的package包/类
@Mutate
public void createVariantData(
ModelMap<AndroidBinary> binaries,
ModelMap<AndroidComponentSpec> specs,
TaskManager taskManager) {
final VariantManager variantManager =
((DefaultAndroidComponentSpec) specs.get(COMPONENT_NAME)).getVariantManager();
binaries.afterEach(new Action<AndroidBinary>() {
@Override
public void execute(AndroidBinary androidBinary) {
DefaultAndroidBinary binary = (DefaultAndroidBinary) androidBinary;
List<ProductFlavorAdaptor> adaptedFlavors = Lists.newArrayList();
for (ProductFlavor flavor : binary.getProductFlavors()) {
adaptedFlavors.add(new ProductFlavorAdaptor(flavor));
}
binary.setVariantData(
variantManager.createVariantData(
new BuildTypeAdaptor(binary.getBuildType()),
adaptedFlavors));
variantManager.getVariantDataList().add(binary.getVariantData());
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:BaseComponentModelPlugin.java
注:本文中的org.gradle.model.ModelMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论