org.gradle.tooling.model.gradle.GradleBuild Java Examples

The following examples show how to use org.gradle.tooling.model.gradle.GradleBuild. 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: RootProjectActionProvider.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
@Override
public void invokeAction(String command, Lookup context) throws IllegalArgumentException {
    if (project.getLookup().lookup(GradleBuild.class) != null) {
        switch (command) {
            case ActionProvider.COMMAND_REBUILD:
                callGradleRebuild();
                break;
            case ActionProvider.COMMAND_BUILD:
                callGradleBuild();
                break;
            case ActionProvider.COMMAND_CLEAN:
                callGradleClean();
                break;
            case AndroidConstants.COMMAND_BUILD_TEST:
                callAndroidTest();
                break;
        }
    }

}
 
Example #2
Source File: GradleBuildAdapterProducer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
    if (type.getName().equals(GradleBuild.class.getName()) && !versionDetails.maySupportModel(type)) {
        GradleProject gradleProject = delegate.produceModel(GradleProject.class, operationParameters);
        final DefaultGradleBuild convert = new GradleBuildConverter().convert(gradleProject);
        return adapter.adapt(type, convert);
    }
    return delegate.produceModel(type, operationParameters);
}
 
Example #3
Source File: ModelMapping.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void addModelVersions(Map<Class<?>, String> map) {
    map.put(HierarchicalEclipseProject.class, "1.0-milestone-3");
    map.put(EclipseProject.class, "1.0-milestone-3");
    map.put(IdeaProject.class, "1.0-milestone-5");
    map.put(GradleProject.class, "1.0-milestone-5");
    map.put(BasicIdeaProject.class, "1.0-milestone-5");
    map.put(BuildEnvironment.class, "1.0-milestone-8");
    map.put(ProjectOutcomes.class, "1.2");
    map.put(Void.class, "1.0-milestone-3");
    map.put(GradleBuild.class, "1.8");
}
 
Example #4
Source File: NbAndroidProjectImpl.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public void resultChanged(LookupEvent ev) {
    super.resultChanged(ev);
    SOURCE_FOR_BINARY_QUERY.removeClassPathProvider(androidClassPathProvider);
    JAVADOC_FOR_BINARY_QUERY.removeClassPathProvider(androidClassPathProvider);
    Set<Class<? extends Object>> allClasses = modelLookupResult.allClasses();
    if (allClasses.contains(GradleBuild.class) && allClasses.contains(AndroidProject.class)) {
        SOURCE_FOR_BINARY_QUERY.addClassPathProvider(androidClassPathProvider);
        JAVADOC_FOR_BINARY_QUERY.addClassPathProvider(androidClassPathProvider);
    }

}
 
Example #5
Source File: GradleBuildAdapterProducer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
    if (type.equals(GradleBuild.class)) {
        GradleProject gradleProject = delegate.produceModel(GradleProject.class, operationParameters);
        final DefaultGradleBuild convert = new GradleBuildConverter().convert(gradleProject);
        return adapter.adapt(type, convert);
    }
    return delegate.produceModel(type, operationParameters);
}
 
Example #6
Source File: AndroidClassPathProvider.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public void resultChanged(LookupEvent ev) {
    Collection<? extends AndroidProject> allInstances = lookupResultProjectModel.allInstances();
    if (!allInstances.isEmpty()) {
        gradleBuildModel = project.getLookup().lookup(GradleBuild.class);
        androidProjectModel = allInstances.iterator().next();
        if (buildConfig.getCurrentVariant() != null) {
            update();
        }
    }
}
 
Example #7
Source File: ModelMapping.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void addModelVersions(Map<Class<?>, String> map) {
    map.put(HierarchicalEclipseProject.class, "1.0-milestone-3");
    map.put(EclipseProject.class, "1.0-milestone-3");
    map.put(IdeaProject.class, "1.0-milestone-5");
    map.put(GradleProject.class, "1.0-milestone-5");
    map.put(BasicIdeaProject.class, "1.0-milestone-5");
    map.put(BuildEnvironment.class, "1.0-milestone-8");
    map.put(ProjectOutcomes.class, "1.2");
    map.put(Void.class, "1.0-milestone-3");
    map.put(GradleBuild.class, "1.8");
}
 
Example #8
Source File: ModelBuilderBackedConsumerConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public boolean maySupportModel(Class<?> modelType) {
    if (modelType == GradleBuild.class) {
        return true;
    }
    return super.maySupportModel(modelType);
}
 
Example #9
Source File: ModelBuilderBackedConsumerConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public boolean maySupportModel(Class<?> modelType) {
    if (modelType == GradleBuild.class) {
        return true;
    }
    return super.maySupportModel(modelType);
}
 
Example #10
Source File: ModelMapping.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void addModelVersions(Map<Class<?>, String> map) {
    map.put(HierarchicalEclipseProject.class, "1.0-milestone-3");
    map.put(EclipseProject.class, "1.0-milestone-3");
    map.put(IdeaProject.class, "1.0-milestone-5");
    map.put(GradleProject.class, "1.0-milestone-5");
    map.put(BasicIdeaProject.class, "1.0-milestone-5");
    map.put(BuildEnvironment.class, "1.0-milestone-8");
    map.put(ProjectOutcomes.class, "1.2");
    map.put(Void.class, "1.0-milestone-3");
    map.put(GradleBuild.class, "1.8");
}
 
Example #11
Source File: GradleBuildAdapterProducer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
    if (type.equals(GradleBuild.class)) {
        GradleProject gradleProject = delegate.produceModel(GradleProject.class, operationParameters);
        final DefaultGradleBuild convert = new GradleBuildConverter().convert(gradleProject);
        return adapter.adapt(type, convert);
    }
    return delegate.produceModel(type, operationParameters);
}
 
Example #12
Source File: GradleBuildAdapterProducer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
    if (type.getName().equals(GradleBuild.class.getName()) && !versionDetails.maySupportModel(type)) {
        GradleProject gradleProject = delegate.produceModel(GradleProject.class, operationParameters);
        final DefaultGradleBuild convert = new GradleBuildConverter().convert(gradleProject);
        return adapter.adapt(type, convert);
    }
    return delegate.produceModel(type, operationParameters);
}
 
Example #13
Source File: ModelMapping.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void addModelVersions(Map<Class<?>, String> map) {
    map.put(HierarchicalEclipseProject.class, "1.0-milestone-3");
    map.put(EclipseProject.class, "1.0-milestone-3");
    map.put(IdeaProject.class, "1.0-milestone-5");
    map.put(GradleProject.class, "1.0-milestone-5");
    map.put(BasicIdeaProject.class, "1.0-milestone-5");
    map.put(BuildEnvironment.class, "1.0-milestone-8");
    map.put(ProjectOutcomes.class, "1.2");
    map.put(Void.class, "1.0-milestone-3");
    map.put(GradleBuild.class, "1.8");
}
 
Example #14
Source File: ModelBuilderBackedConsumerConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean maySupportModel(Class<?> modelType) {
    return modelType != BuildInvocations.class
            && modelType != GradleBuild.class;
}
 
Example #15
Source File: ModelBuilderBackedConsumerConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean maySupportModel(Class<?> modelType) {
    return modelType != BuildInvocations.class
            && modelType != GradleBuild.class;
}
 
Example #16
Source File: BuildControllerAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleBuild getBuildModel() {
    return getModel(null, GradleBuild.class);
}
 
Example #17
Source File: BuildControllerAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleBuild getBuildModel() {
    return getModel(null, GradleBuild.class);
}
 
Example #18
Source File: ModelBuilderBackedConsumerConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean maySupportModel(Class<?> modelType) {
    return modelType != BuildInvocations.class
            && modelType != GradleBuild.class;
}
 
Example #19
Source File: RootProjectActionProvider.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isActionEnabled(String command, Lookup context) throws IllegalArgumentException {
    return project.getLookup().lookup(GradleBuild.class) != null;
}
 
Example #20
Source File: RootProjectActionProvider.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
public RootProjectActionProvider(NbAndroidRootProjectImpl project) {
    this.project = project;
    modelLookupResult = project.getLookup().lookupResult(GradleBuild.class);
    modelLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, this, project.getLookup()));
}
 
Example #21
Source File: NbAndroidRootProjectImpl.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
protected Class[] getGradleModels() {
    return new Class[]{GradleBuild.class};
}
 
Example #22
Source File: NbAndroidProjectImpl.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
protected Class[] getGradleModels() {
    return new Class[]{GradleBuild.class, ProjectBuildOutput.class, AndroidProject.class};
}
 
Example #23
Source File: BuildControllerAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleBuild getBuildModel() {
    return getModel(null, GradleBuild.class);
}
 
Example #24
Source File: ModelBuilderBackedConsumerConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean maySupportModel(Class<?> modelType) {
    return modelType != BuildInvocations.class
            && modelType != GradleBuild.class;
}
 
Example #25
Source File: BuildControllerAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleBuild getBuildModel() {
    return getModel(null, GradleBuild.class);
}
 
Example #26
Source File: GradleBuildAware.java    From NBANDROID-V2 with Apache License 2.0 2 votes vote down vote up
/**
 * Called to update the object with new version of BasicGradleProject.
 */
void setGradleBuild(GradleBuild build);
 
Example #27
Source File: BuildController.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Returns an overview of the Gradle build, including some basic details of the projects that make up the build.
 * This is equivalent to calling {@code #getModel(GradleBuild.class)}.
 *
 * @return The model.
 */
GradleBuild getBuildModel();
 
Example #28
Source File: BuildController.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Returns an overview of the Gradle build, including some basic details of the projects that make up the build.
 * This is equivalent to calling {@code #getModel(GradleBuild.class)}.
 *
 * @return The model.
 */
GradleBuild getBuildModel();
 
Example #29
Source File: BuildController.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Returns an overview of the Gradle build, including some basic details of the projects that make up the build.
 * This is equivalent to calling {@code #getModel(GradleBuild.class)}.
 *
 * @return The model.
 */
GradleBuild getBuildModel();
 
Example #30
Source File: BuildController.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Returns an overview of the Gradle build, including some basic details of the projects that make up the build.
 * This is equivalent to calling {@code #getModel(GradleBuild.class)}.
 *
 * @return The model.
 */
GradleBuild getBuildModel();