下面列出了org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#org.pf4j.PluginManager 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public HiveStoragePlugin(HiveConf hiveConf, PluginManager pf4jManager, SabotContext context, String name) {
super(context, name);
this.isCoordinator = context.isCoordinator();
this.hiveConf = hiveConf;
this.pf4jManager = pf4jManager;
this.sabotConfig = context.getConfig();
this.hiveSettings = new HiveSettings(context.getOptionManager());
this.optionManager = context.getOptionManager();
this.dremioConfig = context.getDremioConfig();
storageImpersonationEnabled = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS);
// Hive Metastore impersonation is enabled if:
// - "hive.security.authorization.enabled" is set to true,
// - "hive.metastore.execute.setugi" is set to true (in SASL disabled scenarios) or
// - "hive.metastore.sasl.enabled" is set to true in which case all metastore calls are impersonated as
// the authenticated user.
this.metastoreImpersonationEnabled =
hiveConf.getBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED) ||
hiveConf.getBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI) ||
hiveConf.getBoolVar(ConfVars.METASTORE_USE_THRIFT_SASL);
}
public static KnownNativeRuleTypes create(
BuckConfig config, ToolchainProvider toolchainProvider, ProcessExecutor processExecutor) {
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
SandboxExecutionStrategyFactory sandboxExecutionStrategyFactory =
new TestSandboxExecutionStrategyFactory();
return KnownNativeRuleTypes.of(
KnownBuildRuleDescriptionsFactory.createBuildDescriptions(
config,
processExecutor,
toolchainProvider,
pluginManager,
sandboxExecutionStrategyFactory),
ImmutableList.of(),
KnownBuildRuleDescriptionsFactory.createBuiltInProviders(pluginManager));
}
public Hive3StoragePlugin(HiveConf hiveConf, PluginManager pf4jManager, SabotContext context, String name) {
super(context, name);
this.isCoordinator = context.isCoordinator();
this.hiveConf = hiveConf;
this.pf4jManager = pf4jManager;
this.sabotConfig = context.getConfig();
this.hiveSettings = new HiveSettings(context.getOptionManager());
this.optionManager = context.getOptionManager();
this.dremioConfig = context.getDremioConfig();
storageImpersonationEnabled = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS);
// Hive Metastore impersonation is enabled if:
// - "hive.security.authorization.enabled" is set to true,
// - "hive.metastore.execute.setugi" is set to true (in SASL disabled scenarios) or
// - "hive.metastore.sasl.enabled" is set to true in which case all metastore calls are impersonated as
// the authenticated user.
this.metastoreImpersonationEnabled =
hiveConf.getBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED) ||
hiveConf.getBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI) ||
hiveConf.getBoolVar(ConfVars.METASTORE_USE_THRIFT_SASL);
}
public static void main(String[] args) {
// print logo
printLogo();
// retrieves the spring application context
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfiguration.class);
// retrieves automatically the extensions for the Greeting.class extension point
Greetings greetings = applicationContext.getBean(Greetings.class);
greetings.printGreetings();
// stop plugins
PluginManager pluginManager = applicationContext.getBean(PluginManager.class);
/*
// retrieves manually the extensions for the Greeting.class extension point
List<Greeting> greetings = pluginManager.getExtensions(Greeting.class);
System.out.println("greetings.size() = " + greetings.size());
*/
pluginManager.stopPlugins();
}
/**
* Creates a new command line owner that parses arguments/options and set them into the given
* object.
*
* @param bean instance of a class annotated by {@link Option}, {@link Argument} and {@link
* AdditionalOptions}. This object will receive values. If this is null, the processing will
* be skipped, which is useful if you'd like to feed metadata from other sources.
* @throws IllegalAnnotationError if the option bean class is using args4j annotations
* incorrectly.
* @see CmdLineParser#CmdLineParser(Object)
*/
public AdditionalOptionsCmdLineParser(PluginManager pluginManager, Object bean) {
/**
* Disable '@' syntax. We convert this ourselves in {@link BuckArgsMethods#expandAtFiles}, so
* options passed to parseArgument() should already be properly expanded. This allows us to have
* things like `buck run @file //:script -- @this_goes_to_the_script`, as @file is expanded
* before hitting this method.
*/
super(null, ParserProperties.defaults().withAtSyntax(false));
this.pluginManager = pluginManager;
// This is copied in simplified form from CmdLineParser constructor and put here to save the
// reference to the plugin manager before doing the parsing of options.
new ClassParser().parse(bean, this);
getOptions().sort(DEFAULT_COMPARATOR);
Set<Class<?>> visited = new HashSet<>();
parseAnnotations(new ClassParser(), bean, visited);
}
private static void testBuckModuleHashProvider() {
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
BuckModuleJarHashProvider hashProvider = new BuckModuleJarHashProvider();
BuckModuleManager moduleManager = new DefaultBuckModuleManager(pluginManager, hashProvider);
try {
moduleManager.getModuleHash(NonModuleClassTest.class);
fail("Should throw IllegalStateException");
} catch (IllegalStateException e) {
assertEquals(
"Requested module hash for class "
+ "com.facebook.buck.core.module.impl.nonmoduleclass.NonModuleClassTest but "
+ "its class loader is not PluginClassCloader",
e.getMessage());
}
assertFalse(moduleManager.isClassInModule(NonModuleClassTest.class));
}
static ImmutableList<Description<?>> createBuildDescriptions(
BuckConfig config,
ProcessExecutor processExecutor,
ToolchainProvider toolchainProvider,
PluginManager pluginManager,
SandboxExecutionStrategyFactory sandboxExecutionStrategyFactory) {
ImmutableList.Builder<Description<?>> builder = ImmutableList.builder();
SandboxExecutionStrategy sandboxExecutionStrategy =
sandboxExecutionStrategyFactory.create(processExecutor, config);
DescriptionCreationContext descriptionCreationContext =
DescriptionCreationContext.of(
config, toolchainProvider, sandboxExecutionStrategy, pluginManager);
List<DescriptionProvider> descriptionProviders =
pluginManager.getExtensions(DescriptionProvider.class);
for (DescriptionProvider provider : descriptionProviders) {
builder.addAll(provider.getDescriptions(descriptionCreationContext));
}
return builder.build();
}
@Before
public void setUp() {
projectFilesystem = FakeProjectFilesystem.createRealTempFilesystem();
skylarkFilesystem = SkylarkFilesystem.using(projectFilesystem);
cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
knownRuleTypesProvider = TestKnownRuleTypesProvider.create(pluginManager);
eventCollector = new EventCollector(EnumSet.allOf(EventKind.class));
ProjectBuildFileParserOptions options =
ProjectBuildFileParserOptions.builder()
.setProjectRoot(cell.getRootCell().getRoot())
.setAllowEmptyGlobs(false)
.setIgnorePaths(ImmutableSet.of())
.setBuildFileName("PACKAGE")
.setRawConfig(
ImmutableMap.of("dummy_section", ImmutableMap.of("dummy_key", "dummy_value")))
.setDescriptions(ImmutableSet.of())
.setPerFeatureProviders(ImmutableList.of())
.setBuildFileImportWhitelist(ImmutableList.of())
.setPythonInterpreter("skylark")
.build();
parser =
SkylarkPackageFileParser.using(
options,
BuckEventBusForTests.newInstance(),
skylarkFilesystem,
BuckGlobals.of(
SkylarkPackageModule.PACKAGE_MODULE,
options.getDescriptions(),
options.getUserDefinedRulesState(),
options.getImplicitNativeRulesState(),
new RuleFunctionFactory(new DefaultTypeCoercerFactory()),
LabelCache.newLabelCache(),
knownRuleTypesProvider.getUserDefinedRuleTypes(cell.getRootCell()),
options.getPerFeatureProviders()),
eventCollector);
}
private static void testBuckModuleHashProvider(TestExtension testExtension) {
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
BuckModuleJarHashProvider hashProvider = new BuckModuleJarHashProvider();
BuckModuleManager moduleManager = new DefaultBuckModuleManager(pluginManager, hashProvider);
Hasher hasher = Hashing.murmur3_128().newHasher();
hasher.putUnencodedChars("some content that never changes");
assertEquals(hasher.hash().toString(), moduleManager.getModuleHash(testExtension.getClass()));
assertTrue(moduleManager.isClassInModule(testExtension.getClass()));
assertFalse(moduleManager.isClassInModule(ModuleClassTest.class));
}
private RouterFunction<?> getReactiveRoutes(PluginManager pm) {
RouterFunction<?> base = baseRoot(pm);
RouterFunction<?> routes = pm.getExtensions(PluginInterface.class).stream()
.flatMap(g -> g.reactiveRoutes().stream())
.map(r-> (RouterFunction<ServerResponse>)r)
.reduce((o,r )-> (RouterFunction<ServerResponse>) o.andOther(r))
.orElse(null);
return routes == null ? base : base.andOther(routes);
}
public CommandRunnerParams build() {
TestCellBuilder cellBuilder = new TestCellBuilder();
if (toolchainProvider != null) {
cellBuilder.setToolchainProvider(toolchainProvider);
}
Cells cell = cellBuilder.build();
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
KnownRuleTypesProvider knownRuleTypesProvider =
TestKnownRuleTypesProvider.create(pluginManager);
Parser parser =
TestParserFactory.create(executor, cell.getRootCell(), knownRuleTypesProvider);
return createCommandRunnerParamsForTesting(
executor,
console,
cell,
artifactCache,
eventBus,
config,
platform,
environment,
javaPackageFinder,
webServer,
pluginManager,
knownRuleTypesProvider,
parser);
}
private String pluginNamesMono(PluginManager pm) {
List<String> identityList = pm.getExtensions(PluginInterface.class).stream()
.map(g-> g.getClass().getName() + ": " + g.identify())
.collect(Collectors.toList());
try {
return objectMapper.writeValueAsString(identityList);
} catch (JsonProcessingException e) {
return "[]";
}
}
private void registerMvcEndpoints(PluginManager pm) {
pm.getExtensions(PluginInterface.class).stream()
.flatMap(g -> g.mvcControllers().stream())
.forEach(r -> ((ConfigurableBeanFactory) beanFactory)
.registerSingleton(r.getClass().getName(), r));
applicationContext
.getBeansOfType(RequestMappingHandlerMapping.class)
.forEach((k, v) -> v.afterPropertiesSet());
}
private static PluginWrapper getPluginWrapperForClass(PluginManager pluginManager, Class<?> cls)
throws Exception {
Field pluginDescriptorField = PluginClassLoader.class.getDeclaredField("pluginDescriptor");
pluginDescriptorField.setAccessible(true);
PluginDescriptor pluginDescriptor =
(PluginDescriptor) pluginDescriptorField.get(cls.getClassLoader());
return pluginManager.getPlugin(pluginDescriptor.getPluginId());
}
@SneakyThrows
static int getGRPCPort(ApplicationContext ctx) {
var pluginManager = ctx.getBean(PluginManager.class);
var classLoader = pluginManager.getPluginClassLoader("grpc-transport");
var serverClazz = classLoader.loadClass(Server.class.getName());
var getPortMethod = serverClazz.getDeclaredMethod("getPort");
var server = ctx.getBean(serverClazz);
return (int) getPortMethod.invoke(server);
}
private static void testBuckModuleHashProvider(List<TestExtension> testExtensions) {
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
BuckModuleJarHashProvider hashProvider = new BuckModuleJarHashProvider();
BuckModuleManager moduleManager = new DefaultBuckModuleManager(pluginManager, hashProvider);
TestExtension testExtension1 = testExtensions.get(0);
TestExtension testExtension2 = testExtensions.get(1);
String hash1 = moduleManager.getModuleHash(testExtension1.getClass());
String hash2 = moduleManager.getModuleHash(testExtension2.getClass());
assertNotEquals(hash1, hash2);
TestExtension extensionFromDependentModule;
TestExtension extensionFromIndependentModule;
if (testExtension1 instanceof Serializable) {
extensionFromDependentModule = testExtension2;
extensionFromIndependentModule = testExtension1;
} else {
extensionFromDependentModule = testExtension1;
extensionFromIndependentModule = testExtension2;
}
assertEquals(
hash(HASH), moduleManager.getModuleHash(extensionFromIndependentModule.getClass()));
assertEquals(
hash(hash(HASH), HASH),
moduleManager.getModuleHash(extensionFromDependentModule.getClass()));
}
@Override
protected void configure() {
bind(ServiceRuntime.class).in(Singleton.class);
expose(ServiceRuntime.class);
bind(ClassLoadingScopeChecker.class);
bind(new TypeLiteral<Map<String, Class<?>>>() {})
.annotatedWith(named(DEPENDENCY_REFERENCE_CLASSES_KEY))
.toInstance(dependencyReferenceClasses);
bind(ServiceLoader.class).to(Pf4jServiceLoader.class);
bind(ServicesFactory.class).to(GuiceServicesFactory.class);
bind(BlockchainDataFactory.class).toInstance(new BlockchainDataFactory() {});
bind(PluginManager.class).to(JarPluginManager.class);
}
@Test
void loadsUnloadsJarPlugins(@TempDir Path tmp) throws IOException {
Path pluginPath = tmp.resolve("test-plugin.jar");
String pluginId = "test-plugin";
String version = "1.0.1";
new ServiceArtifactBuilder()
.setPluginId(pluginId)
.setPluginVersion(version)
.addExtensionClass(TestServiceModule1.class)
.writeTo(pluginPath);
PluginManager pluginManager = new JarPluginManager();
// Try to load the plugin
String loadedPluginId = pluginManager.loadPlugin(pluginPath);
assertThat(loadedPluginId).isEqualTo(pluginId);
// Try to start
PluginState pluginState = pluginManager.startPlugin(pluginId);
assertThat(pluginState).isEqualTo(PluginState.STARTED);
// Check the extensions
List<Class<? extends ServiceModule>> extensionClasses = pluginManager
.getExtensionClasses(ServiceModule.class, pluginId);
assertThat(extensionClasses).hasSize(1);
Class<?> extensionType = extensionClasses.get(0);
assertNamesEqual(extensionType, TestServiceModule1.class);
// Try to stop and unload
pluginState = pluginManager.stopPlugin(pluginId);
assertThat(pluginState).isEqualTo(PluginState.STOPPED);
boolean unloadResult = pluginManager.unloadPlugin(pluginId);
assertTrue(unloadResult);
}
@Override
public StoragePlugin newPlugin(SabotContext context, String name, Provider<StoragePluginId> pluginIdProvider) {
final PluginManager manager = new NativeLibPluginManager();
manager.loadPlugins();
manager.startPlugin(getPf4jPluginId());
final StoragePluginCreator pluginCreator =
manager.getExtensions(StoragePluginCreator.class, getPf4jPluginId()).get(0);
return pluginCreator.createStoragePlugin(manager, this, context, name, pluginIdProvider);
}
@Override
public StoragePlugin newPlugin(SabotContext context, String name, Provider<StoragePluginId> pluginIdProvider) {
final PluginManager manager = new NativeLibPluginManager();
manager.loadPlugins();
manager.startPlugin(getPf4jPluginId());
final StoragePluginCreator pluginCreator =
manager.getExtensions(StoragePluginCreator.class, getPf4jPluginId()).get(0);
return pluginCreator.createStoragePlugin(manager, this, context, name, pluginIdProvider);
}
public ExpressionsSupport(
Class<?>[] extraAllowedReturnTypes,
List<ExpressionFunctionProvider> extraExpressionFunctionProviders,
PluginManager pluginManager) {
allowedReturnTypes =
new HashSet<>(
Arrays.asList(
Collection.class,
Map.class,
SortedMap.class,
List.class,
Set.class,
SortedSet.class,
ArrayList.class,
LinkedList.class,
HashSet.class,
LinkedHashSet.class,
HashMap.class,
LinkedHashMap.class,
TreeMap.class,
TreeSet.class));
Collections.addAll(allowedReturnTypes, extraAllowedReturnTypes);
expressionFunctionProviders =
new ArrayList<>(
Arrays.asList(
new JsonExpressionFunctionProvider(), new StringExpressionFunctionProvider()));
if (extraExpressionFunctionProviders != null) {
expressionFunctionProviders.addAll(extraExpressionFunctionProviders);
}
// TODO(rz): Once plugins are no longer an incubating feature, extraExpressionFunctionProviders
// var could be removed
if (pluginManager != null) {
expressionFunctionProviders.addAll(
pluginManager.getExtensions(ExpressionFunctionProvider.class));
}
}
@Before
public void setUp() {
projectFilesystem = FakeProjectFilesystem.createRealTempFilesystem();
skylarkFilesystem = SkylarkFilesystem.using(projectFilesystem);
cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
knownRuleTypesProvider = TestKnownRuleTypesProvider.create(pluginManager);
parser = createParser(new PrintingEventHandler(EventKind.ALL_EVENTS));
}
private void setupWorkspace(String scenario) throws IOException {
workspace = TestDataHelper.createProjectWorkspaceForScenario(this, scenario, tmp.getRoot());
workspace.setUp();
projectFilesystem = new FakeProjectFilesystem(CanonicalCellName.rootCell(), tmp.getRoot());
skylarkFilesystem = SkylarkFilesystem.using(projectFilesystem);
cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
knownRuleTypesProvider = TestKnownRuleTypesProvider.create(pluginManager);
parser = createParser(new PrintingEventHandler(EventKind.ALL_EVENTS));
}
private static void testBuckModuleHashProvider(List<TestExtension> testExtensions) {
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
BuckModuleJarHashProvider hashProvider = new BuckModuleJarHashProvider();
BuckModuleManager moduleManager = new DefaultBuckModuleManager(pluginManager, hashProvider);
TestExtension testExtension1 = testExtensions.get(0);
TestExtension testExtension2 = testExtensions.get(1);
String hash1 = moduleManager.getModuleHash(testExtension1.getClass());
String hash2 = moduleManager.getModuleHash(testExtension2.getClass());
assertNotEquals(hash1, hash2);
TestExtension extensionFromDependentModule;
TestExtension extensionFromIndependentModule;
if (testExtension1 instanceof Serializable) {
extensionFromDependentModule = testExtension2;
extensionFromIndependentModule = testExtension1;
} else {
extensionFromDependentModule = testExtension1;
extensionFromIndependentModule = testExtension2;
}
assertEquals(
hash(HASH), moduleManager.getModuleHash(extensionFromIndependentModule.getClass()));
assertEquals(
hash(hash(HASH), HASH),
moduleManager.getModuleHash(extensionFromDependentModule.getClass()));
}
public static XCodeDescriptions create(PluginManager pluginManager) {
List<XCodeDescriptionClassSupplier> xcodeDescriptionClassSuppliers =
pluginManager.getExtensions(XCodeDescriptionClassSupplier.class);
return new XCodeDescriptions(
xcodeDescriptionClassSuppliers.stream()
.flatMap(supplier -> supplier.getXCodeDescriptions().stream())
.collect(ImmutableSet.toImmutableSet()));
}
/**
* This constructor allows integration tests to add/remove/modify known build rules (aka
* descriptions).
*
* @param console the {@link Console} to print to for this command
* @param stdIn the input stream to the command being ran
* @param knownRuleTypesFactoryFactory the known rule types for this command
* @param buildId the {@link BuildId} for this command
* @param clientEnvironment the environment variable map for this command
* @param platform the current running {@link Platform}
* @param projectRoot the project root of the current command
* @param pluginManager the {@link PluginManager} for this command
* @param moduleManager the {@link BuckModuleManager} for this command
* @param context the {@link NGContext} from nailgun for this command
*/
@VisibleForTesting
public MainRunner(
Console console,
InputStream stdIn,
KnownRuleTypesFactoryFactory knownRuleTypesFactoryFactory,
BuildId buildId,
ImmutableMap<String, String> clientEnvironment,
Platform platform,
Path projectRoot,
PluginManager pluginManager,
BuckModuleManager moduleManager,
BackgroundTaskManager bgTaskManager,
CommandMode commandMode,
Optional<NGContext> context) {
this.printConsole = new DuplicatingConsole(console);
this.stdIn = stdIn;
this.knownRuleTypesFactoryFactory = knownRuleTypesFactoryFactory;
this.projectRoot = projectRoot;
this.pluginManager = pluginManager;
this.moduleManager = moduleManager;
this.bgTaskManager = bgTaskManager;
this.architecture = Architecture.detect();
this.buildId = buildId;
this.clientEnvironment = clientEnvironment;
this.platform = platform;
this.context = context;
this.commandMode = commandMode;
}
public Cells build() {
ProjectFilesystem filesystem =
this.filesystem != null ? this.filesystem : new FakeProjectFilesystem();
BuckConfig config =
buckConfig == null
? FakeBuckConfig.builder().setFilesystem(filesystem).build()
: buckConfig;
PluginManager pluginManager = BuckPluginManagerFactory.createPluginManager();
ProcessExecutor processExecutor = new DefaultProcessExecutor(new TestConsole());
ExecutableFinder executableFinder = new ExecutableFinder();
ImmutableMap<String, String> environmentCopy = ImmutableMap.copyOf(environment);
ToolchainProviderFactory toolchainProviderFactory =
toolchainProvider == null
? new DefaultToolchainProviderFactory(
pluginManager, environmentCopy, processExecutor, executableFinder)
: (buckConfig, filesystemIgnore, ruleKeyConfiguration) -> toolchainProvider;
DefaultCellPathResolver rootCellCellPathResolver =
DefaultCellPathResolver.create(filesystem.getRootPath(), config.getConfig());
return new Cells(
LocalCellProviderFactory.create(
filesystem,
config,
cellConfig,
rootCellCellPathResolver.getPathMapping(),
rootCellCellPathResolver,
TestBuckModuleManagerFactory.create(pluginManager),
toolchainProviderFactory,
new DefaultProjectFilesystemFactory(),
new ParsingUnconfiguredBuildTargetViewFactory())
.getCellByPath(filesystem.getRootPath()));
}
/** Creates a {@link PluginManager} and loads plugins. */
public static PluginManager createPluginManager() {
PluginManager pluginManager = new DefaultBuckPluginManager();
pluginManager.loadPlugins();
pluginManager.startPlugins();
return pluginManager;
}
public static Cell create(
ImmutableSortedSet<AbsPath> knownRoots,
CellProvider cellProvider,
NewCellPathResolver newCellPathResolver,
CellPathResolver rootCellCellPathResolver,
ProjectFilesystem rootFilesystem,
BuckModuleManager moduleManager,
PluginManager pluginManager,
BuckConfig rootConfig,
ImmutableMap<String, String> environment,
ProcessExecutor processExecutor,
ExecutableFinder executableFinder) {
Preconditions.checkState(
!rootCellCellPathResolver.getCanonicalCellName(rootFilesystem.getRootPath()).isPresent(),
"Root cell should be nameless");
RuleKeyConfiguration ruleKeyConfiguration =
ConfigRuleKeyConfigurationFactory.create(rootConfig, moduleManager);
ToolchainProvider toolchainProvider =
new DefaultToolchainProvider(
pluginManager,
environment,
rootConfig,
rootFilesystem,
processExecutor,
executableFinder,
ruleKeyConfiguration);
return ImmutableCellImpl.of(
knownRoots,
CanonicalCellName.rootCell(),
rootFilesystem,
rootConfig,
cellProvider,
toolchainProvider,
rootCellCellPathResolver,
newCellPathResolver,
rootCellCellPathResolver.getCellNameResolver());
}
public DefaultBuckModuleManager(
PluginManager pluginManager, BuckModuleJarHashProvider moduleJarHashProvider) {
this.pluginManager = pluginManager;
this.moduleJarHashProvider = moduleJarHashProvider;
try {
pluginDescriptorField = PluginClassLoader.class.getDeclaredField("pluginDescriptor");
pluginDescriptorField.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new RuntimeException(
"Cannot find pluginDescriptor field in " + PluginClassLoader.class.getName());
}
}