Java 类org.gradle.api.plugins.Convention 实例源码

项目:Reer    文件:ScalaBasePlugin.java   
private static void configureSourceSetDefaults(final Project project, final SourceDirectorySetFactory sourceDirectorySetFactory) {
    final JavaBasePlugin javaPlugin = project.getPlugins().getPlugin(JavaBasePlugin.class);
    project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(new Action<SourceSet>() {
        @Override
        public void execute(final SourceSet sourceSet) {
            String displayName = (String) InvokerHelper.invokeMethod(sourceSet, "getDisplayName", null);
            Convention sourceSetConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
            DefaultScalaSourceSet scalaSourceSet = new DefaultScalaSourceSet(displayName, sourceDirectorySetFactory);
            sourceSetConvention.getPlugins().put("scala", scalaSourceSet);
            final SourceDirectorySet scalaDirectorySet = scalaSourceSet.getScala();
            scalaDirectorySet.srcDir(new Callable<File>() {
                @Override
                public File call() throws Exception {
                    return project.file("src/" + sourceSet.getName() + "/scala");
                }
            });
            sourceSet.getAllJava().source(scalaDirectorySet);
            sourceSet.getAllSource().source(scalaDirectorySet);
            sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() {
                @Override
                public boolean isSatisfiedBy(FileTreeElement element) {
                    return scalaDirectorySet.contains(element.getFile());
                }
            });

            configureScalaCompile(project, javaPlugin, sourceSet);
        }

    });
}
项目:Reer    文件:ScalaBasePlugin.java   
private static void configureScalaCompile(final Project project, JavaBasePlugin javaPlugin, final SourceSet sourceSet) {
    String taskName = sourceSet.getCompileTaskName("scala");
    final ScalaCompile scalaCompile = project.getTasks().create(taskName, ScalaCompile.class);
    scalaCompile.dependsOn(sourceSet.getCompileJavaTaskName());
    javaPlugin.configureForSourceSet(sourceSet, scalaCompile);
    Convention scalaConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
    ScalaSourceSet scalaSourceSet = scalaConvention.findPlugin(ScalaSourceSet.class);
    scalaCompile.setDescription("Compiles the " + scalaSourceSet.getScala() + ".");
    scalaCompile.setSource(scalaSourceSet.getScala());
    project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(taskName);

    // cannot use convention mapping because the resulting object won't be serializable
    // cannot compute at task execution time because we need association with source set
    project.getGradle().addBuildListener(new BuildAdapter() {
        @Override
        public void projectsEvaluated(Gradle gradle) {
            IncrementalCompileOptions incrementalOptions = scalaCompile.getScalaCompileOptions().getIncrementalOptions();
            if (incrementalOptions.getAnalysisFile() == null) {
                String analysisFilePath = project.getBuildDir().getPath() + "/tmp/scala/compilerAnalysis/" + scalaCompile.getName() + ".analysis";
                incrementalOptions.setAnalysisFile(new File(analysisFilePath));
            }

            if (incrementalOptions.getPublishedCode() == null) {
                Jar jarTask = (Jar) project.getTasks().findByName(sourceSet.getJarTaskName());
                incrementalOptions.setPublishedCode(jarTask == null ? null : jarTask.getArchivePath());
            }
        }
    });
}
项目:Reer    文件:JettyPlugin.java   
public void apply(Project project) {
    DeprecationLogger.nagUserOfPluginReplacedWithExternalOne("Jetty", "Gretty (https://github.com/akhikhl/gretty)");
    project.getPluginManager().apply(WarPlugin.class);
    JettyPluginConvention jettyConvention = new JettyPluginConvention();
    Convention convention = project.getConvention();
    convention.getPlugins().put("jetty", jettyConvention);

    configureMappingRules(project, jettyConvention);
    configureJettyRun(project);
    configureJettyRunWar(project);
    configureJettyStop(project, jettyConvention);
}
项目:Reer    文件:ExtensibleDynamicObject.java   
public ExtensibleDynamicObject(Object delegate, AbstractDynamicObject dynamicDelegate, Convention convention) {
    this.dynamicDelegate = dynamicDelegate;
    this.convention = convention;
    this.extraPropertiesDynamicObject = new ExtraPropertiesDynamicObjectAdapter(delegate.getClass(), convention.getExtraProperties());

    updateDelegates();
}
项目:Reer    文件:ConventionAwareHelper.java   
public MappedProperty map(String propertyName, final Closure<?> value) {
    return map(propertyName, new Value<Object>() {
        public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
            switch (value.getMaximumNumberOfParameters()) {
                case 0:
                    return value.call();
                case 1:
                    return value.call(convention);
                default:
                    return value.call(convention, conventionAwareObject);
            }
        }
    });
}
项目:Reer    文件:ConventionAwareHelper.java   
public MappedProperty map(String propertyName, final Callable<?> value) {
    return map(propertyName, new Value<Object>() {
        public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
            return uncheckedCall(value);
        }
    });
}
项目:Reer    文件:ConventionAwareHelper.java   
public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
    if (!cache) {
        return value.getValue(convention, conventionAwareObject);
    }
    if (!haveValue) {
        cachedValue = value.getValue(convention, conventionAwareObject);
        haveValue = true;
    }
    return cachedValue;
}
项目:Pushjet-Android    文件:JettyPlugin.java   
public void apply(Project project) {
    project.getPlugins().apply(WarPlugin.class);
    JettyPluginConvention jettyConvention = new JettyPluginConvention();
    Convention convention = project.getConvention();
    convention.getPlugins().put("jetty", jettyConvention);

    configureMappingRules(project, jettyConvention);
    configureJettyRun(project);
    configureJettyRunWar(project);
    configureJettyStop(project, jettyConvention);
}
项目:Pushjet-Android    文件:ExtensibleDynamicObject.java   
public ExtensibleDynamicObject(Object delegate, AbstractDynamicObject dynamicDelegate, Convention convention) {
    this.dynamicDelegate = dynamicDelegate;
    this.convention = convention;
    this.extraPropertiesDynamicObject = new ExtraPropertiesDynamicObjectAdapter(delegate.getClass(), convention.getExtraProperties());

    updateDelegates();
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public MappedProperty map(String propertyName, final Closure<?> value) {
    return map(propertyName, new Value<Object>() {
        public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
            switch (value.getMaximumNumberOfParameters()) {
                case 0:
                    return value.call();
                case 1:
                    return value.call(convention);
                default:
                    return value.call(convention, conventionAwareObject);
            }
        }
    });
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public MappedProperty map(String propertyName, final Callable<?> value) {
    return map(propertyName, new Value<Object>() {
        public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
            try {
                return value.call();
            } catch (Exception e) {
                throw UncheckedException.throwAsUncheckedException(e);
            }
        }
    });
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
    if (!cache) {
        return value.getValue(convention, conventionAwareObject);
    }
    if (!haveValue) {
        cachedValue = value.getValue(convention, conventionAwareObject);
        haveValue = true;
    }
    return cachedValue;
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public Object getProperty(String name) throws MissingPropertyException {
    if (extensionsStorage.hasExtension(name)) {
        return extensionsStorage.getByName(name);
    }
    for (Object object : plugins.values()) {
        DynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasProperty(name)) {
            return dynamicObject.getProperty(name);
        }
    }
    throw new MissingPropertyException(name, Convention.class);
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public void setProperty(String name, Object value) {
    extensionsStorage.checkExtensionIsNotReassigned(name);
    for (Object object : plugins.values()) {
        BeanDynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasProperty(name)) {
            dynamicObject.setProperty(name, value);
            return;
        }
    }
    throw new MissingPropertyException(name, Convention.class);
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public Object invokeMethod(String name, Object... args) {
    if (extensionsStorage.isConfigureExtensionMethod(name, args)) {
        return extensionsStorage.configureExtension(name, args);
    }
    for (Object object : plugins.values()) {
        BeanDynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasMethod(name, args)) {
            return dynamicObject.invokeMethod(name, args);
        }
    }
    throw new MissingMethodException(name, Convention.class, args);
}
项目:Pushjet-Android    文件:JettyPlugin.java   
public void apply(Project project) {
    project.getPlugins().apply(WarPlugin.class);
    JettyPluginConvention jettyConvention = new JettyPluginConvention();
    Convention convention = project.getConvention();
    convention.getPlugins().put("jetty", jettyConvention);

    configureMappingRules(project, jettyConvention);
    configureJettyRun(project);
    configureJettyRunWar(project);
    configureJettyStop(project, jettyConvention);
}
项目:Pushjet-Android    文件:ExtensibleDynamicObject.java   
public ExtensibleDynamicObject(Object delegate, AbstractDynamicObject dynamicDelegate, Convention convention) {
    this.dynamicDelegate = dynamicDelegate;
    this.convention = convention;
    this.extraPropertiesDynamicObject = new ExtraPropertiesDynamicObjectAdapter(delegate, this, convention.getExtraProperties());

    updateDelegates();
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public MappedProperty map(String propertyName, final Closure<?> value) {
    return map(propertyName, new Value<Object>() {
        public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
            switch (value.getMaximumNumberOfParameters()) {
                case 0:
                    return value.call();
                case 1:
                    return value.call(convention);
                default:
                    return value.call(convention, conventionAwareObject);
            }
        }
    });
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public MappedProperty map(String propertyName, final Callable<?> value) {
    return map(propertyName, new Value<Object>() {
        public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
            try {
                return value.call();
            } catch (Exception e) {
                throw UncheckedException.throwAsUncheckedException(e);
            }
        }
    });
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public Object getValue(Convention convention, IConventionAware conventionAwareObject) {
    if (!cache) {
        return value.getValue(convention, conventionAwareObject);
    }
    if (!haveValue) {
        cachedValue = value.getValue(convention, conventionAwareObject);
        haveValue = true;
    }
    return cachedValue;
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public Object getProperty(String name) throws MissingPropertyException {
    if (extensionsStorage.hasExtension(name)) {
        return extensionsStorage.getByName(name);
    }
    for (Object object : plugins.values()) {
        DynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasProperty(name)) {
            return dynamicObject.getProperty(name);
        }
    }
    throw new MissingPropertyException(name, Convention.class);
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public void setProperty(String name, Object value) {
    extensionsStorage.checkExtensionIsNotReassigned(name);
    for (Object object : plugins.values()) {
        BeanDynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasProperty(name)) {
            dynamicObject.setProperty(name, value);
            return;
        }
    }
    throw new MissingPropertyException(name, Convention.class);
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public Object invokeMethod(String name, Object... args) {
    if (extensionsStorage.isConfigureExtensionMethod(name, args)) {
        return extensionsStorage.configureExtension(name, args);
    }
    for (Object object : plugins.values()) {
        BeanDynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasMethod(name, args)) {
            return dynamicObject.invokeMethod(name, args);
        }
    }
    throw new MissingMethodException(name, Convention.class, args);
}
项目:Reer    文件:DefaultProject.java   
public Convention getConvention() {
    return extensibleDynamicObject.getConvention();
}
项目:Reer    文件:ExtensibleDynamicObject.java   
public Convention getConvention() {
    return convention;
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public Convention getConvention() {
    return convention;
}
项目:Reer    文件:AbstractTask.java   
public Convention getConvention() {
    assertDynamicObject();
    return extensibleDynamicObject.getConvention();
}
项目:Reer    文件:ConventionAwareHelper.java   
public ConventionAwareHelper(IConventionAware source, Convention convention) {
    this._source = source;
    this._convention = convention;
}
项目:Reer    文件:ConventionAwareHelper.java   
public Convention getConvention() {
    return _convention;
}
项目:Reer    文件:DslObject.java   
public Convention getConvention() {
    if (convention == null) {
        this.convention = toType(object, HasConvention.class).getConvention();
    }
    return convention;
}
项目:Pushjet-Android    文件:AbstractProject.java   
public Convention getConvention() {
    return extensibleDynamicObject.getConvention();
}
项目:Pushjet-Android    文件:ExtensibleDynamicObject.java   
public Convention getConvention() {
    return convention;
}
项目:Pushjet-Android    文件:DefaultNamedDomainObjectCollection.java   
public Convention getConvention() {
    return convention;
}
项目:Pushjet-Android    文件:AbstractTask.java   
public Convention getConvention() {
    return extensibleDynamicObject.getConvention();
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public ConventionAwareHelper(IConventionAware source, Convention convention) {
    this._source = source;
    this._convention = convention;
}
项目:Pushjet-Android    文件:ConventionAwareHelper.java   
public Convention getConvention() {
    return _convention;
}
项目:Pushjet-Android    文件:TypedDomainObjectContainerWrapper.java   
public Convention getConvention() {
    return convention;
}
项目:Pushjet-Android    文件:AbstractPolymorphicDomainObjectContainer.java   
@Override
public Convention getConvention() {
    return convention;
}
项目:Pushjet-Android    文件:DslObject.java   
public Convention getConvention() {
    if (convention == null) {
        this.convention = toType(object, HasConvention.class).getConvention();
    }
    return convention;
}
项目:Pushjet-Android    文件:AbstractProject.java   
public Convention getConvention() {
    return extensibleDynamicObject.getConvention();
}