Search in sources :

Example 1 with Nullable

use of org.gradle.api.Nullable in project gradle by gradle.

the class AstUtils method extractBareMethodCall.

@Nullable
public static MethodCallExpression extractBareMethodCall(Statement statement) {
    if (!(statement instanceof ExpressionStatement)) {
        return null;
    }
    ExpressionStatement expressionStatement = (ExpressionStatement) statement;
    if (!(expressionStatement.getExpression() instanceof MethodCallExpression)) {
        return null;
    }
    MethodCallExpression methodCall = (MethodCallExpression) expressionStatement.getExpression();
    if (!targetIsThis(methodCall)) {
        return null;
    }
    return methodCall;
}
Also used : ExpressionStatement(org.codehaus.groovy.ast.stmt.ExpressionStatement) Nullable(org.gradle.api.Nullable)

Example 2 with Nullable

use of org.gradle.api.Nullable in project gradle by gradle.

the class PrebuiltLibraryBinaryLocator method getBinaries.

@Nullable
@Override
public DomainObjectSet<NativeLibraryBinary> getBinaries(LibraryIdentifier library) {
    ModelRegistry projectModel = projectModelResolver.resolveProjectModel(library.getProjectPath());
    Repositories repositories = projectModel.find("repositories", Repositories.class);
    if (repositories == null) {
        return null;
    }
    PrebuiltLibrary prebuiltLibrary = getPrebuiltLibrary(repositories.withType(PrebuiltLibraries.class), library.getLibraryName());
    return prebuiltLibrary != null ? prebuiltLibrary.getBinaries() : null;
}
Also used : Repositories(org.gradle.nativeplatform.Repositories) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) PrebuiltLibrary(org.gradle.nativeplatform.PrebuiltLibrary) PrebuiltLibraries(org.gradle.nativeplatform.PrebuiltLibraries) Nullable(org.gradle.api.Nullable)

Example 3 with Nullable

use of org.gradle.api.Nullable in project gradle by gradle.

the class ProjectLibraryBinaryLocator method getBinaries.

// Converts the binaries of a project library into regular binary instances
@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;
}
Also used : NativeLibraryBinary(org.gradle.nativeplatform.NativeLibraryBinary) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) NativeBinarySpec(org.gradle.nativeplatform.NativeBinarySpec) ComponentSpecContainer(org.gradle.platform.base.ComponentSpecContainer) NativeLibrarySpec(org.gradle.nativeplatform.NativeLibrarySpec) DefaultDomainObjectSet(org.gradle.api.internal.DefaultDomainObjectSet) Nullable(org.gradle.api.Nullable)

Example 4 with Nullable

use of org.gradle.api.Nullable in project gradle by gradle.

the class DefaultPluginManager method addPluginInternal.

// if the plugin has already been added
@Nullable
private Runnable addPluginInternal(final PluginImplementation<?> plugin) {
    final Class<?> pluginClass = plugin.asClass();
    if (plugins.containsKey(pluginClass)) {
        return null;
    }
    plugins.put(pluginClass, plugin);
    return new Runnable() {

        @Override
        public void run() {
            // Take a copy because adding to an idMappings value may result in new mappings being added (i.e. ConcurrentModificationException)
            Iterable<PluginId> pluginIds = Lists.newArrayList(idMappings.keySet());
            for (PluginId id : pluginIds) {
                if (plugin.isAlsoKnownAs(id)) {
                    idMappings.get(id).add(new PluginWithId(id, pluginClass));
                }
            }
        }
    };
}
Also used : PluginId(org.gradle.plugin.use.PluginId) DefaultPluginId(org.gradle.plugin.use.internal.DefaultPluginId) Nullable(org.gradle.api.Nullable)

Example 5 with Nullable

use of org.gradle.api.Nullable in project gradle by gradle.

the class Signature method defaultDate.

@Nullable
private Date defaultDate() {
    File file = getFile();
    if (file == null) {
        return null;
    }
    long modified = file.lastModified();
    if (modified == 0L) {
        return null;
    }
    return new Date(modified);
}
Also used : File(java.io.File) Date(java.util.Date) Nullable(org.gradle.api.Nullable)

Aggregations

Nullable (org.gradle.api.Nullable)15 File (java.io.File)3 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)3 PluginId (org.gradle.plugin.use.PluginId)2 SignatureType (org.gradle.plugins.signing.type.SignatureType)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 Date (java.util.Date)1 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)1 PGPSecretKey (org.bouncycastle.openpgp.PGPSecretKey)1 PGPSecretKeyRing (org.bouncycastle.openpgp.PGPSecretKeyRing)1 ExpressionStatement (org.codehaus.groovy.ast.stmt.ExpressionStatement)1 UnknownProjectException (org.gradle.api.UnknownProjectException)1 DefaultDomainObjectSet (org.gradle.api.internal.DefaultDomainObjectSet)1 DefaultModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata)1 ModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata)1 LocallyAvailableExternalResource (org.gradle.internal.resource.local.LocallyAvailableExternalResource)1 ModelPath (org.gradle.model.internal.core.ModelPath)1 ModelProperty (org.gradle.model.internal.manage.schema.ModelProperty)1 ModelSchemaAspectExtractionResult (org.gradle.model.internal.manage.schema.extract.ModelSchemaAspectExtractionResult)1 PropertyAccessorExtractionContext (org.gradle.model.internal.manage.schema.extract.PropertyAccessorExtractionContext)1