本文整理匯總了Java中org.gradle.tooling.internal.consumer.Distribution類的典型用法代碼示例。如果您正苦於以下問題:Java Distribution類的具體用法?Java Distribution怎麽用?Java Distribution使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Distribution類屬於org.gradle.tooling.internal.consumer包,在下文中一共展示了Distribution類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
if (lock.tryLock()) {
try {
return delegate.create(distribution, progressLoggerFactory, connectionParameters, cancellationToken);
} finally {
lock.unlock();
}
}
ProgressLogger logger = progressLoggerFactory.newOperation(SynchronizedToolingImplementationLoader.class);
logger.setDescription("Wait for the other thread to finish acquiring the distribution");
logger.started();
lock.lock();
try {
return delegate.create(distribution, progressLoggerFactory, connectionParameters, cancellationToken);
} finally {
lock.unlock();
logger.completed();
}
}
示例2: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters) {
if (lock.tryLock()) {
try {
return delegate.create(distribution, progressLoggerFactory, connectionParameters);
} finally {
lock.unlock();
}
}
ProgressLogger logger = progressLoggerFactory.newOperation(SynchronizedToolingImplementationLoader.class);
logger.setDescription("Wait for the other thread to finish acquiring the distribution");
logger.started();
lock.lock();
try {
return delegate.create(distribution, progressLoggerFactory, connectionParameters);
} finally {
lock.unlock();
logger.completed();
}
}
示例3: createImplementationClassLoader
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
private ClassLoader createImplementationClassLoader(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, File userHomeDir, BuildCancellationToken cancellationToken) {
ClassPath implementationClasspath = distribution.getToolingImplementationClasspath(progressLoggerFactory, userHomeDir, cancellationToken);
LOGGER.debug("Using tooling provider classpath: {}", implementationClasspath);
FilteringClassLoader.Spec filterSpec = new FilteringClassLoader.Spec();
filterSpec.allowPackage("org.gradle.tooling.internal.protocol");
FilteringClassLoader filteringClassLoader = new FilteringClassLoader(classLoader, filterSpec);
return new VisitableURLClassLoader(filteringClassLoader, implementationClasspath);
}
示例4: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
ClassPath classpath = distribution.getToolingImplementationClasspath(progressLoggerFactory, connectionParameters.getGradleUserHomeDir(), cancellationToken);
ConsumerConnection connection = connections.get(classpath);
if (connection == null) {
connection = loader.create(distribution, progressLoggerFactory, connectionParameters, cancellationToken);
connections.put(classpath, connection);
}
return connection;
}
示例5: getWrappedDistribution
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
/**
* Returns the default distribution to use for the specified project.
*/
public Distribution getWrappedDistribution(File propertiesFile) {
//noinspection UseOfSystemOutOrSystemErr
WrapperExecutor wrapper = WrapperExecutor.forWrapperPropertiesFile(propertiesFile, System.out);
if (wrapper.getDistribution() != null) {
return new ZippedDistribution(wrapper.getConfiguration(), myExecutorFactory);
}
return getDownloadedDistribution(GradleVersion.current().getVersion());
}
示例6: createImplementationClassLoader
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
private ClassLoader createImplementationClassLoader(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, File userHomeDir, BuildCancellationToken cancellationToken) {
ClassPath implementationClasspath = distribution.getToolingImplementationClasspath(progressLoggerFactory, userHomeDir, cancellationToken);
LOGGER.debug("Using tooling provider classpath: {}", implementationClasspath);
// On IBM JVM 5, ClassLoader.getResources() uses a combination of findResources() and getParent() and traverses the hierarchy rather than just calling getResources()
// Wrap our real classloader in one that hides the parent.
// TODO - move this into FilteringClassLoader
MultiParentClassLoader parentObfuscatingClassLoader = new MultiParentClassLoader(classLoader);
FilteringClassLoader filteringClassLoader = new FilteringClassLoader(parentObfuscatingClassLoader);
filteringClassLoader.allowPackage("org.gradle.tooling.internal.protocol");
return new MutableURLClassLoader(filteringClassLoader, implementationClasspath.getAsURLArray());
}
示例7: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters) {
LOGGER.debug("Using tooling provider from {}", distribution.getDisplayName());
ClassLoader classLoader = createImplementationClassLoader(distribution, progressLoggerFactory, connectionParameters.getGradleUserHomeDir());
ServiceLocator serviceLocator = new ServiceLocator(classLoader);
try {
Factory<ConnectionVersion4> factory = serviceLocator.findFactory(ConnectionVersion4.class);
if (factory == null) {
return new NoToolingApiConnection(distribution);
}
// ConnectionVersion4 is a part of the protocol and cannot be easily changed.
ConnectionVersion4 connection = factory.create();
ProtocolToModelAdapter adapter = new ProtocolToModelAdapter(new ConsumerTargetTypeProvider());
ModelMapping modelMapping = new ModelMapping();
// Adopting the connection to a refactoring friendly type that the consumer owns
AbstractConsumerConnection adaptedConnection;
if (connection instanceof ModelBuilder && connection instanceof InternalBuildActionExecutor) {
adaptedConnection = new ActionAwareConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof ModelBuilder) {
adaptedConnection = new ModelBuilderBackedConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof BuildActionRunner) {
adaptedConnection = new BuildActionRunnerBackedConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof InternalConnection) {
adaptedConnection = new InternalConnectionBackedConsumerConnection(connection, modelMapping, adapter);
} else {
adaptedConnection = new ConnectionVersion4BackedConsumerConnection(connection, modelMapping, adapter);
}
adaptedConnection.configure(connectionParameters);
return adaptedConnection;
} catch (UnsupportedVersionException e) {
throw e;
} catch (Throwable t) {
throw new GradleConnectionException(String.format("Could not create an instance of Tooling API implementation using the specified %s.", distribution.getDisplayName()), t);
}
}
示例8: createImplementationClassLoader
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
private ClassLoader createImplementationClassLoader(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, File userHomeDir) {
ClassPath implementationClasspath = distribution.getToolingImplementationClasspath(progressLoggerFactory, userHomeDir);
LOGGER.debug("Using tooling provider classpath: {}", implementationClasspath);
// On IBM JVM 5, ClassLoader.getResources() uses a combination of findResources() and getParent() and traverses the hierarchy rather than just calling getResources()
// Wrap our real classloader in one that hides the parent.
// TODO - move this into FilteringClassLoader
MultiParentClassLoader parentObfuscatingClassLoader = new MultiParentClassLoader(classLoader);
FilteringClassLoader filteringClassLoader = new FilteringClassLoader(parentObfuscatingClassLoader);
filteringClassLoader.allowPackage("org.gradle.tooling.internal.protocol");
return new MutableURLClassLoader(filteringClassLoader, implementationClasspath.getAsURLArray());
}
示例9: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters) {
ClassPath classpath = distribution.getToolingImplementationClasspath(progressLoggerFactory, connectionParameters.getGradleUserHomeDir());
ConsumerConnection connection = connections.get(classpath);
if (connection == null) {
connection = loader.create(distribution, progressLoggerFactory, connectionParameters);
connections.put(classpath, connection);
}
return connection;
}
示例10: unsupportedFeature
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public static UnsupportedVersionException unsupportedFeature(String feature, Distribution distro, String versionAdded) {
return new UnsupportedVersionException(String.format("The version of Gradle you are using (%s) does not support the %s. Support for this is available in Gradle %s and all later versions.",
distro.getDisplayName(), feature, versionAdded));
}
示例11: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
LOGGER.debug("Using tooling provider from {}", distribution.getDisplayName());
ClassLoader serviceClassLoader = createImplementationClassLoader(distribution, progressLoggerFactory, connectionParameters.getGradleUserHomeDir(), cancellationToken);
ServiceLocator serviceLocator = new DefaultServiceLocator(serviceClassLoader);
try {
Factory<ConnectionVersion4> factory = serviceLocator.findFactory(ConnectionVersion4.class);
if (factory == null) {
return new NoToolingApiConnection(distribution);
}
// ConnectionVersion4 is a part of the protocol and cannot be easily changed.
ConnectionVersion4 connection = factory.create();
ProtocolToModelAdapter adapter = new ProtocolToModelAdapter(new ConsumerTargetTypeProvider());
ModelMapping modelMapping = new ModelMapping();
// Adopting the connection to a refactoring friendly type that the consumer owns
AbstractConsumerConnection adaptedConnection;
if (connection instanceof InternalTestExecutionConnection){
adaptedConnection = new TestExecutionConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof StoppableConnection) {
adaptedConnection = new ShutdownAwareConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof InternalCancellableConnection) {
adaptedConnection = new CancellableConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof ModelBuilder && connection instanceof InternalBuildActionExecutor) {
adaptedConnection = new ActionAwareConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof ModelBuilder) {
adaptedConnection = new ModelBuilderBackedConsumerConnection(connection, modelMapping, adapter);
} else if (connection instanceof BuildActionRunner) {
adaptedConnection = new BuildActionRunnerBackedConsumerConnection(connection, modelMapping, adapter);
} else {
return new UnsupportedOlderVersionConnection(connection, adapter);
}
adaptedConnection.configure(connectionParameters);
if (!adaptedConnection.getVersionDetails().supportsCancellation()) {
return new NonCancellableConsumerConnectionAdapter(adaptedConnection);
}
return adaptedConnection;
} catch (UnsupportedVersionException e) {
throw e;
} catch (Throwable t) {
throw new GradleConnectionException(String.format("Could not create an instance of Tooling API implementation using the specified %s.", distribution.getDisplayName()), t);
}
}
示例12: create
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory,
ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken);
示例13: LazyConsumerActionExecutor
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public LazyConsumerActionExecutor(Distribution distribution, ToolingImplementationLoader implementationLoader, LoggingProvider loggingProvider, ConnectionParameters connectionParameters) {
this.distribution = distribution;
this.implementationLoader = implementationLoader;
this.loggingProvider = loggingProvider;
this.connectionParameters = connectionParameters;
}
示例14: NoToolingApiConnection
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
public NoToolingApiConnection(Distribution distribution) {
this.distribution = distribution;
}
示例15: getDownloadedDistribution
import org.gradle.tooling.internal.consumer.Distribution; //導入依賴的package包/類
private Distribution getDownloadedDistribution(String gradleVersion) {
URI distUri = new DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion));
return getDistribution(distUri);
}