Search in sources :

Example 1 with MutableBoolean

use of org.gradle.internal.MutableBoolean in project gradle by gradle.

the class JUnitPlatformTestExecutionListener method createDescriptorIfAbsent.

private boolean createDescriptorIfAbsent(TestIdentifier node) {
    MutableBoolean wasCreated = new MutableBoolean(false);
    descriptorsByUniqueId.computeIfAbsent(node.getUniqueId(), uniqueId -> {
        wasCreated.set(true);
        boolean isTestClassId = isTestClassIdentifier(node);
        if (node.getType().isContainer() || isTestClassId) {
            if (isTestClassId) {
                return createTestClassDescriptor(node);
            }
            String displayName = node.getDisplayName();
            Optional<TestDescriptorInternal> parentId = node.getParentId().map(descriptorsByUniqueId::get);
            if (parentId.isPresent()) {
                Object candidateId = parentId.get().getId();
                if (candidateId instanceof CompositeIdGenerator.CompositeId) {
                    return createNestedTestSuite(node, displayName, (CompositeIdGenerator.CompositeId) candidateId);
                }
            }
        }
        return createTestDescriptor(node, node.getLegacyReportingName(), node.getDisplayName());
    });
    return wasCreated.get();
}
Also used : TestDescriptorInternal(org.gradle.api.internal.tasks.testing.TestDescriptorInternal) MutableBoolean(org.gradle.internal.MutableBoolean) CompositeIdGenerator(org.gradle.internal.id.CompositeIdGenerator)

Example 2 with MutableBoolean

use of org.gradle.internal.MutableBoolean in project gradle by gradle.

the class AbstractFileCollection method visitAll.

/**
 * Visits all the files of the given tree.
 */
protected static boolean visitAll(FileSystemMirroringFileTree tree) {
    final MutableBoolean hasContent = new MutableBoolean();
    tree.visit(new FileVisitor() {

        @Override
        public void visitDir(FileVisitDetails dirDetails) {
            dirDetails.getFile();
            hasContent.set(true);
        }

        @Override
        public void visitFile(FileVisitDetails fileDetails) {
            fileDetails.getFile();
            hasContent.set(true);
        }
    });
    return hasContent.get();
}
Also used : FileVisitDetails(org.gradle.api.file.FileVisitDetails) MutableBoolean(org.gradle.internal.MutableBoolean) FileVisitor(org.gradle.api.file.FileVisitor)

Example 3 with MutableBoolean

use of org.gradle.internal.MutableBoolean in project gradle by gradle.

the class AbstractFileTree method isEmpty.

@Override
public boolean isEmpty() {
    final MutableBoolean found = new MutableBoolean();
    visit(new EmptyFileVisitor() {

        @Override
        public void visitFile(FileVisitDetails fileDetails) {
            found.set(true);
            fileDetails.stopVisiting();
        }
    });
    return !found.get();
}
Also used : FileVisitDetails(org.gradle.api.file.FileVisitDetails) EmptyFileVisitor(org.gradle.api.file.EmptyFileVisitor) MutableBoolean(org.gradle.internal.MutableBoolean)

Example 4 with MutableBoolean

use of org.gradle.internal.MutableBoolean in project gradle by gradle.

the class DefaultWorkerLeaseService method allLockedByCurrentThread.

private boolean allLockedByCurrentThread(final Iterable<? extends ResourceLock> locks) {
    final MutableBoolean allLocked = new MutableBoolean();
    coordinationService.withStateLock(new Transformer<ResourceLockState.Disposition, ResourceLockState>() {

        @Override
        public ResourceLockState.Disposition transform(ResourceLockState resourceLockState) {
            allLocked.set(CollectionUtils.every(locks, new Spec<ResourceLock>() {

                @Override
                public boolean isSatisfiedBy(ResourceLock lock) {
                    return lock.isLockedByCurrentThread();
                }
            }));
            return FINISHED;
        }
    });
    return allLocked.get();
}
Also used : MutableBoolean(org.gradle.internal.MutableBoolean) ResourceLock(org.gradle.internal.resources.ResourceLock) ResourceLockState(org.gradle.internal.resources.ResourceLockState)

Example 5 with MutableBoolean

use of org.gradle.internal.MutableBoolean in project gradle by gradle.

the class OutputUnpacker method visitOutputFileProperty.

@Override
public void visitOutputFileProperty(String propertyName, boolean optional, PropertyValue value, OutputFilePropertyType filePropertyType) {
    hasDeclaredOutputs = true;
    MutableBoolean hasSpecs = new MutableBoolean();
    if (finalizeBeforeUnpacking) {
        value.maybeFinalizeValue();
    }
    FileParameterUtils.resolveOutputFilePropertySpecs(ownerDisplayName, propertyName, value, filePropertyType, fileCollectionFactory, locationOnly, spec -> {
        hasSpecs.set(true);
        unpackedOutputConsumer.visitUnpackedOutputFileProperty(propertyName, optional, value, spec);
    });
    if (!hasSpecs.get()) {
        unpackedOutputConsumer.visitEmptyOutputFileProperty(propertyName, optional, value);
    }
}
Also used : MutableBoolean(org.gradle.internal.MutableBoolean)

Aggregations

MutableBoolean (org.gradle.internal.MutableBoolean)5 FileVisitDetails (org.gradle.api.file.FileVisitDetails)2 EmptyFileVisitor (org.gradle.api.file.EmptyFileVisitor)1 FileVisitor (org.gradle.api.file.FileVisitor)1 TestDescriptorInternal (org.gradle.api.internal.tasks.testing.TestDescriptorInternal)1 CompositeIdGenerator (org.gradle.internal.id.CompositeIdGenerator)1 ResourceLock (org.gradle.internal.resources.ResourceLock)1 ResourceLockState (org.gradle.internal.resources.ResourceLockState)1