本文整理汇总了Java中org.gradle.api.specs.Spec类的典型用法代码示例。如果您正苦于以下问题:Java Spec类的具体用法?Java Spec怎么用?Java Spec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Spec类属于org.gradle.api.specs包,在下文中一共展示了Spec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeGetPCHArgs
import org.gradle.api.specs.Spec; //导入依赖的package包/类
protected List<String> maybeGetPCHArgs(final T spec, File sourceFile) {
if (spec.getPreCompiledHeader() == null) {
return Lists.newArrayList();
}
final IncludeDirectives includes = spec.getSourceFileIncludeDirectives().get(sourceFile);
final String header = spec.getPreCompiledHeader();
List<Include> headers = includes.getIncludesAndImports();
boolean usePCH = !headers.isEmpty() && header.equals(headers.get(0).getValue());
if (usePCH) {
return getPCHArgs(spec);
} else {
boolean containsHeader = CollectionUtils.any(headers, new Spec<Include>() {
@Override
public boolean isSatisfiedBy(Include include) {
return include.getValue().equals(header);
}
});
if (containsHeader) {
logger.log(LogLevel.WARN, getCantUsePCHMessage(spec.getPreCompiledHeader(), sourceFile));
}
return Lists.newArrayList();
}
}
示例2: findJvms
import org.gradle.api.specs.Spec; //导入依赖的package包/类
public List<JvmInstallation> findJvms() {
List<JvmInstallation> jvms = new ArrayList<JvmInstallation>();
if (OperatingSystem.current().isLinux()) {
jvms = addJvm(jvms, JavaVersion.VERSION_1_5, "1.5.0", new File("/opt/jdk/sun-jdk-5"), true, JvmInstallation.Arch.i386);
jvms = addJvm(jvms, JavaVersion.VERSION_1_6, "1.6.0", new File("/opt/jdk/sun-jdk-6"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_6, "1.6.0", new File("/opt/jdk/ibm-jdk-6"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_7, "1.7.0", new File("/opt/jdk/oracle-jdk-7"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_8, "1.8.0", new File("/opt/jdk/oracle-jdk-8"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_9, "1.9.0", new File("/opt/jdk/oracle-jdk-9"), true, JvmInstallation.Arch.x86_64);
}
return CollectionUtils.filter(jvms, new Spec<JvmInstallation>() {
public boolean isSatisfiedBy(JvmInstallation element) {
return element.getJavaHome().isDirectory();
}
});
}
示例3: determineGcStrategy
import org.gradle.api.specs.Spec; //导入依赖的package包/类
private static GarbageCollectorMonitoringStrategy determineGcStrategy() {
JVMStrategy jvmStrategy = JVMStrategy.current();
final List<String> garbageCollectors = CollectionUtils.collect(ManagementFactory.getGarbageCollectorMXBeans(), new Transformer<String, GarbageCollectorMXBean>() {
@Override
public String transform(GarbageCollectorMXBean garbageCollectorMXBean) {
return garbageCollectorMXBean.getName();
}
});
GarbageCollectorMonitoringStrategy gcStrategy = CollectionUtils.findFirst(jvmStrategy.getGcStrategies(), new Spec<GarbageCollectorMonitoringStrategy>() {
@Override
public boolean isSatisfiedBy(GarbageCollectorMonitoringStrategy strategy) {
return garbageCollectors.contains(strategy.getGarbageCollectorName());
}
});
if (gcStrategy == null) {
LOGGER.info("Unable to determine a garbage collection monitoring strategy for " + jvmStrategy.toString());
return GarbageCollectorMonitoringStrategy.UNKNOWN;
} else {
return gcStrategy;
}
}
示例4: exceedsThreshold
import org.gradle.api.specs.Spec; //导入依赖的package包/类
private boolean exceedsThreshold(String pool, GarbageCollectionStats gcStats, Spec<GarbageCollectionStats> spec) {
if (isEnabled()
&& strategy != GarbageCollectorMonitoringStrategy.UNKNOWN
&& spec.isSatisfiedBy(gcStats)) {
if (gcStats.getUsage() > 0) {
LOGGER.debug(String.format("GC rate: %.2f/s %s usage: %s%%", gcStats.getRate(), pool, gcStats.getUsage()));
} else {
LOGGER.debug("GC rate: 0.0/s");
}
return true;
}
return false;
}
示例5: checkExpiration
import org.gradle.api.specs.Spec; //导入依赖的package包/类
@Override
public DaemonExpirationResult checkExpiration() {
Spec<DaemonInfo> spec = new Spec<DaemonInfo>() {
@Override
public boolean isSatisfiedBy(DaemonInfo daemonInfo) {
return compatibilitySpec.isSatisfiedBy(daemonInfo.getContext());
}
};
Collection<DaemonInfo> compatibleIdleDaemons = CollectionUtils.filter(daemon.getDaemonRegistry().getIdle(), spec);
if (compatibleIdleDaemons.size() > 1) {
return new DaemonExpirationResult(DaemonExpirationStatus.GRACEFUL_EXPIRE, EXPIRATION_REASON);
} else {
return DaemonExpirationResult.NOT_TRIGGERED;
}
}
示例6: queryClientStatus
import org.gradle.api.specs.Spec; //导入依赖的package包/类
public Response<ClientStatus> queryClientStatus(final String portalUrl, final boolean shouldValidate, final String checksum) {
ClientStatusKey key = new ClientStatusKey(portalUrl);
Factory<Response<ClientStatus>> factory = new Factory<Response<ClientStatus>>() {
public Response<ClientStatus> create() {
return delegate.queryClientStatus(portalUrl, shouldValidate, checksum);
}
};
if (shouldValidate) {
return fetch(CLIENT_STATUS_OP_NAME, clientStatusCache, key, factory);
} else {
return maybeFetch(CLIENT_STATUS_OP_NAME, clientStatusCache, key, factory, new Spec<Response<ClientStatus>>() {
public boolean isSatisfiedBy(Response<ClientStatus> element) {
return !element.getClientStatusChecksum().equals(checksum);
}
});
}
}
示例7: BuildScriptTransformer
import org.gradle.api.specs.Spec; //导入依赖的package包/类
public BuildScriptTransformer(ScriptSource scriptSource, ScriptTarget scriptTarget) {
final List<String> blocksToIgnore = Arrays.asList(scriptTarget.getClasspathBlockName(), InitialPassStatementTransformer.PLUGINS, InitialPassStatementTransformer.PLUGIN_REPOS);
this.filter = new Spec<Statement>() {
@Override
public boolean isSatisfiedBy(Statement statement) {
return AstUtils.detectScriptBlock(statement, blocksToIgnore) != null;
}
};
this.scriptSource = scriptSource;
}
示例8: resolveFromContainer
import org.gradle.api.specs.Spec; //导入依赖的package包/类
private <T extends Platform> T resolveFromContainer(Class<T> type, PlatformRequirement platformRequirement) {
final String target = platformRequirement.getPlatformName();
NamedDomainObjectSet<T> allWithType = platforms.withType(type);
T matching = CollectionUtils.findFirst(allWithType, new Spec<T>() {
public boolean isSatisfiedBy(T element) {
return element.getName().equals(target);
}
});
if (matching == null) {
throw new InvalidUserDataException(String.format("Invalid %s: %s", type.getSimpleName(), target));
}
return matching;
}
示例9: named
import org.gradle.api.specs.Spec; //导入依赖的package包/类
@Override
public void named(final String name, Action<? super T> configAction) {
collection.matching(new Spec<T>() {
@Override
public boolean isSatisfiedBy(T element) {
return get(name) == element;
}
}).all(configAction);
}
示例10: formatKnownTypes
import org.gradle.api.specs.Spec; //导入依赖的package包/类
private String formatKnownTypes(Spec<ModelType<?>> constraints, Set<? extends ModelType<?>> supportedTypes) {
StringBuilder builder = new StringBuilder();
for (ModelType<?> supportedType : supportedTypes) {
if (constraints.isSatisfiedBy(supportedType)) {
if (builder.length() > 0) {
builder.append(", ");
}
builder.append(supportedType);
}
}
if (builder.length() == 0) {
return "(none)";
}
return builder.toString();
}
示例11: findEclipseProjectByName
import org.gradle.api.specs.Spec; //导入依赖的package包/类
private DefaultEclipseProject findEclipseProjectByName(final String eclipseProjectName) {
return CollectionUtils.findFirst(eclipseProjects, new Spec<DefaultEclipseProject>() {
@Override
public boolean isSatisfiedBy(DefaultEclipseProject element) {
return element.getName().equals(eclipseProjectName);
}
});
}
示例12: SingleIncludePatternFileTree
import org.gradle.api.specs.Spec; //导入依赖的package包/类
public SingleIncludePatternFileTree(File baseDir, String includePattern, Spec<FileTreeElement> excludeSpec) {
this.baseDir = baseDir;
if (includePattern.endsWith("/") || includePattern.endsWith("\\")) {
includePattern += "**";
}
this.includePattern = includePattern;
this.patternSegments = Arrays.asList(includePattern.split("[/\\\\]"));
this.excludeSpec = excludeSpec;
}
示例13: setOnlyIf
import org.gradle.api.specs.Spec; //导入依赖的package包/类
public void setOnlyIf(final Spec<? super Task> spec) {
taskMutator.mutate("Task.setOnlyIf(Spec)", new Runnable() {
public void run() {
onlyIfSpec = createNewOnlyIfSpec().and(spec);
}
});
}
示例14: findEclipseProject
import org.gradle.api.specs.Spec; //导入依赖的package包/类
private DefaultEclipseProject findEclipseProject(final Project project) {
return CollectionUtils.findFirst(eclipseProjects, new Spec<DefaultEclipseProject>() {
@Override
public boolean isSatisfiedBy(DefaultEclipseProject element) {
return element.getGradleProject().getPath().equals(project.getPath());
}
});
}
示例15: getPendingResolutions
import org.gradle.api.specs.Spec; //导入依赖的package包/类
public List<NativeBinaryRequirementResolveResult> getPendingResolutions() {
return CollectionUtils.filter(resolutions, new Spec<NativeBinaryRequirementResolveResult>() {
public boolean isSatisfiedBy(NativeBinaryRequirementResolveResult element) {
return !element.isComplete();
}
});
}