org.gradle.model.Mutate Java Examples
The following examples show how to use
org.gradle.model.Mutate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RuleSourceBackedRuleAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public static <R, T> RuleSourceBackedRuleAction<R, T> create(ModelType<T> subjectType, R ruleSourceInstance) { ModelType<R> ruleSourceType = ModelType.typeOf(ruleSourceInstance); List<Method> mutateMethods = JavaReflectionUtil.findAllMethods(ruleSourceType.getConcreteClass(), new Spec<Method>() { public boolean isSatisfiedBy(Method element) { return element.isAnnotationPresent(Mutate.class); } }); if (mutateMethods.size() != 1) { throw invalid(ruleSourceType, "must have at exactly one method annotated with @Mutate"); } Method ruleMethod = mutateMethods.get(0); if (ruleMethod.getReturnType() != Void.TYPE) { throw invalid(ruleSourceType, "rule method must return void"); } Type[] parameterTypes = ruleMethod.getGenericParameterTypes(); if (parameterTypes.length == 0) { throw invalid(ruleSourceType, "rule method must have at least one parameter"); } if (!subjectType.isAssignableFrom(ModelType.of(parameterTypes[0]))) { throw invalid(ruleSourceType, String.format("first parameter of rule method must be of type %s", subjectType)); } return new RuleSourceBackedRuleAction<R, T>(ruleSourceInstance, new JavaMethod<R, T>(ruleSourceType.getConcreteClass(), subjectType.getConcreteClass(), ruleMethod)); }
Example #2
Source File: JvmComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder, NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) { Instantiator instantiator = serviceRegistry.get(Instantiator.class); List<Action<? super JarBinarySpec>> actions = Lists.newArrayList(); actions.add(new JarBinarySpecInitializer(buildDir)); actions.add(new MarkBinariesBuildable()); Action<JarBinarySpec> initAction = Actions.composite(actions); JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction); Action<JvmLibrarySpec> createBinariesAction = new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms); for (JvmLibrarySpec jvmLibrary : libraries) { createBinariesAction.execute(jvmLibrary); binaries.addAll(jvmLibrary.getBinaries()); } }
Example #3
Source File: VisualStudioPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate @SuppressWarnings("GroovyUnusedDeclaration") public static void createTasksForVisualStudio(TaskContainer tasks, VisualStudioExtensionInternal visualStudioExtension) { for (VisualStudioProject vsProject : visualStudioExtension.getProjects()) { vsProject.builtBy(createProjectsFileTask(tasks, vsProject)); vsProject.builtBy(createFiltersFileTask(tasks, vsProject)); } for (VisualStudioSolution vsSolution : visualStudioExtension.getSolutions()) { Task solutionTask = tasks.create(vsSolution.getName() + "VisualStudio"); solutionTask.setDescription(String.format("Generates the '%s' Visual Studio solution file.", vsSolution.getName())); vsSolution.setBuildTask(solutionTask); vsSolution.builtBy(createSolutionTask(tasks, vsSolution)); // Lifecycle task for component NativeComponentSpec component = vsSolution.getComponent(); Task lifecycleTask = tasks.maybeCreate(component.getName() + "VisualStudio"); lifecycleTask.dependsOn(vsSolution); lifecycleTask.setGroup("IDE"); lifecycleTask.setDescription(String.format("Generates the Visual Studio solution for %s.", component)); } addCleanTask(tasks); }
Example #4
Source File: MicrosoftVisualCppPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class); final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class); final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class); toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() { public VisualCpp create(String name) { return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator); } }); toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class); }
Example #5
Source File: MicrosoftVisualCppPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class); final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class); final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class); toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() { public VisualCpp create(String name) { return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator); } }); toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class); }
Example #6
Source File: LanguageBasePlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate void createLifecycleTaskForBinary(TaskContainer tasks, BinaryContainer binaries) { Task assembleTask = tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME); for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) { if (!binary.isLegacyBinary()) { Task binaryLifecycleTask = tasks.create(binary.getNamingScheme().getLifecycleTaskName()); binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP); binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary)); binary.setBuildTask(binaryLifecycleTask); if (binary.isBuildable()) { assembleTask.dependsOn(binary); } } } }
Example #7
Source File: LanguageBasePlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate void createLifecycleTaskForBinary(TaskContainer tasks, BinaryContainer binaries) { Task assembleTask = tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME); for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) { if (!binary.isLegacyBinary()) { Task binaryLifecycleTask = tasks.create(binary.getNamingScheme().getLifecycleTaskName()); binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP); binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary)); binary.setBuildTask(binaryLifecycleTask); if (binary.isBuildable()) { assembleTask.dependsOn(binary); } } } }
Example #8
Source File: VisualStudioPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate @SuppressWarnings("GroovyUnusedDeclaration") public static void createTasksForVisualStudio(TaskContainer tasks, VisualStudioExtensionInternal visualStudioExtension) { for (VisualStudioProject vsProject : visualStudioExtension.getProjects()) { vsProject.builtBy(createProjectsFileTask(tasks, vsProject)); vsProject.builtBy(createFiltersFileTask(tasks, vsProject)); } for (VisualStudioSolution vsSolution : visualStudioExtension.getSolutions()) { Task solutionTask = tasks.create(vsSolution.getName() + "VisualStudio"); solutionTask.setDescription(String.format("Generates the '%s' Visual Studio solution file.", vsSolution.getName())); vsSolution.setBuildTask(solutionTask); vsSolution.builtBy(createSolutionTask(tasks, vsSolution)); // Lifecycle task for component NativeComponentSpec component = vsSolution.getComponent(); Task lifecycleTask = tasks.maybeCreate(component.getName() + "VisualStudio"); lifecycleTask.dependsOn(vsSolution); lifecycleTask.setGroup("IDE"); lifecycleTask.setDescription(String.format("Generates the Visual Studio solution for %s.", component)); } addCleanTask(tasks); }
Example #9
Source File: RuleSourceBackedRuleAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public static <R, T> RuleSourceBackedRuleAction<R, T> create(ModelType<T> subjectType, R ruleSourceInstance) { ModelType<R> ruleSourceType = ModelType.typeOf(ruleSourceInstance); List<Method> mutateMethods = JavaReflectionUtil.findAllMethods(ruleSourceType.getConcreteClass(), new Spec<Method>() { public boolean isSatisfiedBy(Method element) { return element.isAnnotationPresent(Mutate.class); } }); if (mutateMethods.size() != 1) { throw invalid(ruleSourceType, "must have at exactly one method annotated with @Mutate"); } Method ruleMethod = mutateMethods.get(0); if (ruleMethod.getReturnType() != Void.TYPE) { throw invalid(ruleSourceType, "rule method must return void"); } Type[] parameterTypes = ruleMethod.getGenericParameterTypes(); if (parameterTypes.length == 0) { throw invalid(ruleSourceType, "rule method must have at least one parameter"); } if (!subjectType.isAssignableFrom(ModelType.of(parameterTypes[0]))) { throw invalid(ruleSourceType, String.format("first parameter of rule method must be of type %s", subjectType)); } return new RuleSourceBackedRuleAction<R, T>(ruleSourceInstance, new JavaMethod<R, T>(ruleSourceType.getConcreteClass(), subjectType.getConcreteClass(), ruleMethod)); }
Example #10
Source File: JvmComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Mutate public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder, NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) { Instantiator instantiator = serviceRegistry.get(Instantiator.class); List<Action<? super JarBinarySpec>> actions = Lists.newArrayList(); actions.add(new JarBinarySpecInitializer(buildDir)); actions.add(new MarkBinariesBuildable()); Action<JarBinarySpec> initAction = Actions.composite(actions); JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction); Action<JvmLibrarySpec> createBinariesAction = new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms); for (JvmLibrarySpec jvmLibrary : libraries) { createBinariesAction.execute(jvmLibrary); binaries.addAll(jvmLibrary.getBinaries()); } }
Example #11
Source File: CUnitPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createCUnitTestSuitePerComponent(TestSuiteContainer testSuites, NamedDomainObjectSet<NativeComponentSpec> components, ProjectSourceSet projectSourceSet, ServiceRegistry serviceRegistry) { Instantiator instantiator = serviceRegistry.get(Instantiator.class); for (NativeComponentSpec component : components) { testSuites.add(createCUnitTestSuite(component, instantiator, projectSourceSet)); } }
Example #12
Source File: CUnitPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createCUnitTestBinaries(final BinaryContainer binaries, TestSuiteContainer testSuites, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry) { for (final CUnitTestSuiteSpec cUnitTestSuite : testSuites.withType(CUnitTestSuiteSpec.class)) { for (NativeBinarySpec testedBinary : cUnitTestSuite.getTestedComponent().getNativeBinaries()) { DefaultCUnitTestSuiteBinary testBinary = createTestBinary(serviceRegistry, cUnitTestSuite, testedBinary); configure(testBinary, buildDir); cUnitTestSuite.getBinaries().add(testBinary); binaries.add(testBinary); } } }
Example #13
Source File: CUnitPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createCUnitLauncherTasks(TaskContainer tasks, TestSuiteContainer testSuites, ProjectSourceSet sources) { for (final CUnitTestSuiteSpec suite : testSuites.withType(CUnitTestSuiteSpec.class)) { String taskName = suite.getName() + "CUnitLauncher"; GenerateCUnitLauncher skeletonTask = tasks.create(taskName, GenerateCUnitLauncher.class); CSourceSet launcherSources = findLaucherSources(suite); skeletonTask.setSourceDir(launcherSources.getSource().getSrcDirs().iterator().next()); skeletonTask.setHeaderDir(launcherSources.getExportedHeaders().getSrcDirs().iterator().next()); launcherSources.builtBy(skeletonTask); } }
Example #14
Source File: CUnitPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void configureCUnitTestSuiteSources(ProjectSourceSet projectSourceSet, TestSuiteContainer testSuites, @Path("buildDir") File buildDir) { for (final CUnitTestSuiteSpec suite : testSuites.withType(CUnitTestSuiteSpec.class)) { FunctionalSourceSet suiteSourceSet = ((ComponentSpecInternal) suite).getMainSource(); CSourceSet launcherSources = suiteSourceSet.maybeCreate(CUNIT_LAUNCHER_SOURCE_SET, CSourceSet.class); File baseDir = new File(buildDir, String.format("src/%s/cunitLauncher", suite.getName())); launcherSources.getSource().srcDir(new File(baseDir, "c")); launcherSources.getExportedHeaders().srcDir(new File(baseDir, "headers")); CSourceSet testSources = suiteSourceSet.maybeCreate("c", CSourceSet.class); testSources.lib(launcherSources); } }
Example #15
Source File: AndroidComponentModelPlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Create all source sets for each AndroidBinary. */ @Mutate public void createVariantSourceSet( @Path("android.sources") final AndroidComponentModelSourceSet sources, @Path("android.buildTypes") final ModelMap<BuildType> buildTypes, @Path("android.productFlavors") ModelMap<ProductFlavor> flavors, List<ProductFlavorCombo<ProductFlavor>> flavorGroups, ProjectSourceSet projectSourceSet, LanguageRegistry languageRegistry) { sources.setProjectSourceSet(projectSourceSet); for (LanguageRegistration languageRegistration : languageRegistry) { sources.registerLanguage(languageRegistration); } // Create main source set. sources.create("main"); for (BuildType buildType : buildTypes.values()) { sources.maybeCreate(buildType.getName()); for (ProductFlavorCombo group : flavorGroups) { sources.maybeCreate(group.getName()); if (!group.getFlavorList().isEmpty()) { sources.maybeCreate( group.getName() + StringHelper.capitalize(buildType.getName())); } } } if (flavorGroups.size() != flavors.size()) { // If flavorGroups and flavors are the same size, there is at most 1 flavor // dimension. So we don't need to reconfigure the source sets for flavorGroups. for (ProductFlavor flavor : flavors.values()) { sources.maybeCreate(flavor.getName()); } } }
Example #16
Source File: JvmComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void registerJavaPlatformType(PlatformContainer platforms, ServiceRegistry serviceRegistry) { final Instantiator instantiator = serviceRegistry.get(Instantiator.class); platforms.registerFactory(JavaPlatform.class, new NamedDomainObjectFactory<JavaPlatform>() { public JavaPlatform create(String name) { return instantiator.newInstance(DefaultJavaPlatform.class, name); } }); }
Example #17
Source File: JvmComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createJavaPlatforms(PlatformContainer platforms, ServiceRegistry serviceRegistry) { final Instantiator instantiator = serviceRegistry.get(Instantiator.class); //Create default platforms available for Java for (JavaVersion javaVersion: JavaVersion.values()) { DefaultJavaPlatform javaPlatform = instantiator.newInstance(DefaultJavaPlatform.class, javaVersion); platforms.add(javaPlatform); } }
Example #18
Source File: JvmComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createTasks(TaskContainer tasks, BinaryContainer binaries) { for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) { Task jarTask = createJarTask(tasks, projectJarBinary); projectJarBinary.builtBy(jarTask); projectJarBinary.getTasks().add(jarTask); } }
Example #19
Source File: ClangCompilerPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() { public Clang create(String name) { return instantiator.newInstance(ClangToolChain.class, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator); } }); toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class); }
Example #20
Source File: PublishingPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate void addConfiguredPublicationsToProjectPublicationRegistry(ProjectPublicationRegistry projectPublicationRegistry, PublishingExtension extension, ProjectIdentifier projectIdentifier) { for (Publication publication : extension.getPublications()) { PublicationInternal internalPublication = (PublicationInternal) publication; projectPublicationRegistry.registerPublication(projectIdentifier.getPath(), new DefaultProjectPublication(internalPublication.getCoordinates())); } }
Example #21
Source File: VisualStudioPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void includeBuildFileInProject(VisualStudioExtensionInternal visualStudio, final ProjectIdentifier projectIdentifier) { visualStudio.getProjects().all(new Action<VisualStudioProject>() { public void execute(VisualStudioProject project) { if (projectIdentifier.getBuildFile() != null) { ((DefaultVisualStudioProject) project).addSourceFile(projectIdentifier.getBuildFile()); } } }); }
Example #22
Source File: VisualStudioPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate @SuppressWarnings("GroovyUnusedDeclaration") public static void createVisualStudioModelForBinaries(VisualStudioExtensionInternal visualStudioExtension, BinaryContainer binaryContainer) { for (NativeBinarySpec binary : binaryContainer.withType(NativeBinarySpec.class)) { VisualStudioProjectConfiguration configuration = visualStudioExtension.getProjectRegistry().addProjectConfiguration(binary); // Only create a solution if one of the binaries is buildable if (binary.isBuildable()) { DefaultVisualStudioProject visualStudioProject = configuration.getProject(); visualStudioExtension.getSolutionRegistry().addSolution(visualStudioProject); } } }
Example #23
Source File: MavenPublishPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate @SuppressWarnings("UnusedDeclaration") public void realizePublishingTasks(CollectionBuilder<Task> tasks, @Path("tasks.publish") Task publishLifecycleTask, @Path("tasks.publishToMavenLocal") Task publishLocalLifecycleTask, PublishingExtension extension) { // Create generatePom tasks for any Maven publication PublicationContainer publications = extension.getPublications(); for (final MavenPublicationInternal publication : publications.withType(MavenPublicationInternal.class)) { String publicationName = publication.getName(); createGeneratePomTask(tasks, publication, publicationName); createLocalInstallTask(tasks, publishLocalLifecycleTask, publication, publicationName); createPublishTasksForEachMavenRepo(tasks, extension, publishLifecycleTask, publication, publicationName); } }
Example #24
Source File: GccCompilerPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Gcc.class, new NamedDomainObjectFactory<Gcc>() { public Gcc create(String name) { return instantiator.newInstance(GccToolChain.class, instantiator, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory); } }); toolChainRegistry.registerDefaultToolChain(GccToolChain.DEFAULT_NAME, Gcc.class); }
Example #25
Source File: CUnitPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createCUnitTestBinaries(final BinaryContainer binaries, TestSuiteContainer testSuites, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry) { for (final CUnitTestSuiteSpec cUnitTestSuite : testSuites.withType(CUnitTestSuiteSpec.class)) { for (NativeBinarySpec testedBinary : cUnitTestSuite.getTestedComponent().getNativeBinaries()) { DefaultCUnitTestSuiteBinary testBinary = createTestBinary(serviceRegistry, cUnitTestSuite, testedBinary); configure(testBinary, buildDir); cUnitTestSuite.getBinaries().add(testBinary); binaries.add(testBinary); } } }
Example #26
Source File: CUnitPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createCUnitLauncherTasks(TaskContainer tasks, TestSuiteContainer testSuites, ProjectSourceSet sources) { for (final CUnitTestSuiteSpec suite : testSuites.withType(CUnitTestSuiteSpec.class)) { String taskName = suite.getName() + "CUnitLauncher"; GenerateCUnitLauncher skeletonTask = tasks.create(taskName, GenerateCUnitLauncher.class); CSourceSet launcherSources = findLaucherSources(suite); skeletonTask.setSourceDir(launcherSources.getSource().getSrcDirs().iterator().next()); skeletonTask.setHeaderDir(launcherSources.getExportedHeaders().getSrcDirs().iterator().next()); launcherSources.builtBy(skeletonTask); } }
Example #27
Source File: CUnitPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void configureCUnitTestSuiteSources(ProjectSourceSet projectSourceSet, TestSuiteContainer testSuites, @Path("buildDir") File buildDir) { for (final CUnitTestSuiteSpec suite : testSuites.withType(CUnitTestSuiteSpec.class)) { FunctionalSourceSet suiteSourceSet = ((ComponentSpecInternal) suite).getMainSource(); CSourceSet launcherSources = suiteSourceSet.maybeCreate(CUNIT_LAUNCHER_SOURCE_SET, CSourceSet.class); File baseDir = new File(buildDir, String.format("src/%s/cunitLauncher", suite.getName())); launcherSources.getSource().srcDir(new File(baseDir, "c")); launcherSources.getExportedHeaders().srcDir(new File(baseDir, "headers")); CSourceSet testSources = suiteSourceSet.maybeCreate("c", CSourceSet.class); testSources.lib(launcherSources); } }
Example #28
Source File: CUnitPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public void createCUnitTestSuitePerComponent(TestSuiteContainer testSuites, NamedDomainObjectSet<NativeComponentSpec> components, ProjectSourceSet projectSourceSet, ServiceRegistry serviceRegistry) { Instantiator instantiator = serviceRegistry.get(Instantiator.class); for (NativeComponentSpec component : components) { testSuites.add(createCUnitTestSuite(component, instantiator, projectSourceSet)); } }
Example #29
Source File: ClangCompilerPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() { public Clang create(String name) { return instantiator.newInstance(ClangToolChain.class, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator); } }); toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class); }
Example #30
Source File: PublishingPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Mutate void addConfiguredPublicationsToProjectPublicationRegistry(ProjectPublicationRegistry projectPublicationRegistry, PublishingExtension extension, ProjectIdentifier projectIdentifier) { for (Publication publication : extension.getPublications()) { PublicationInternal internalPublication = (PublicationInternal) publication; projectPublicationRegistry.registerPublication(projectIdentifier.getPath(), new DefaultProjectPublication(internalPublication.getCoordinates())); } }