build: fix x-pack pom and allow installation
* The found-license project is removed since it is no longer needed * The plugin-api classes have moved into the license-plugin since there is only one plugin * The license/base project publishes the proper artifactId in the pom file * The x-pack jar file is added as an artifact so that it can be installed * The x-pack pom no longer declares the packaging as `zip` * The x-pack pom uses the right artifactId for license-core * Removed disabling of installing the x-plugins artifacts * Cleaned up a use of guava in watcher (found when trying to remove guava as a compile dependency but is needed by the HTML sanitizer) * Removed the dependency on the mustache compiler since it is no longer necessary Closes elastic/elasticsearch#1987 Original commit: elastic/x-pack-elasticsearch@9d3b50b054
This commit is contained in:
parent
42bb1c5932
commit
0cce436641
|
@ -6,7 +6,6 @@ subprojects {
|
|||
// we must not publish to sonatype until we have set up x-plugins to only publish the parts we want to publish!
|
||||
project.afterEvaluate {
|
||||
if (project.plugins.hasPlugin('com.bmuschko.nexus') && project.nexus.repositoryUrl.startsWith('file://') == false) {
|
||||
install.enabled = false
|
||||
uploadArchives.enabled = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,3 +11,8 @@ jar {
|
|||
baseName = 'license-core'
|
||||
}
|
||||
|
||||
modifyPom {
|
||||
project {
|
||||
artifactId 'license-core'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/eclipse-build/
|
|
@ -1,19 +0,0 @@
|
|||
apply plugin: 'elasticsearch.esplugin'
|
||||
esplugin {
|
||||
name 'found-plugin'
|
||||
description 'Internal Elasticsearch Licensing Plugin for Found'
|
||||
classname 'org.elasticsearch.license.plugin.LicensePlugin'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':x-plugins:elasticsearch:license:plugin-api')
|
||||
testCompile project(':x-plugins:elasticsearch:license:licensor')
|
||||
}
|
||||
|
||||
// no tests
|
||||
test.enabled = false
|
||||
integTest.enabled = false
|
||||
|
||||
dependencyLicenses.enabled = false
|
||||
|
||||
compileJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.license.plugin;
|
||||
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.license.core.LicenseVerifier;
|
||||
import org.elasticsearch.license.plugin.core.FoundLicensesService;
|
||||
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
||||
import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
||||
|
||||
public class LicenseModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(LicenseVerifier.class).asEagerSingleton();
|
||||
bind(LicenseeRegistry.class).to(FoundLicensesService.class);
|
||||
bind(LicensesManagerService.class).to(FoundLicensesService.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.license.plugin;
|
||||
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.Module;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.license.plugin.core.FoundLicensesService;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class LicensePlugin extends Plugin {
|
||||
|
||||
public static final String NAME = "license";
|
||||
|
||||
@Inject
|
||||
public LicensePlugin(Settings settings) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Internal Elasticsearch Licensing Plugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
|
||||
Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
|
||||
services.add(FoundLicensesService.class);
|
||||
return services;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Module> nodeModules() {
|
||||
Collection<Module> modules = new ArrayList<Module>();
|
||||
modules.add(new LicenseModule());
|
||||
return modules;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.license.plugin.core;
|
||||
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.Singleton;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.license.core.License;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Singleton
|
||||
public class FoundLicensesService extends AbstractLifecycleComponent<FoundLicensesService> implements LicenseeRegistry,
|
||||
LicensesManagerService {
|
||||
|
||||
@Inject
|
||||
public FoundLicensesService(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void register(Licensee licensee) {
|
||||
licensee.onChange(new Licensee.Status(License.OperationMode.PLATINUM, LicenseState.ENABLED));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart() throws ElasticsearchException {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() throws ElasticsearchException {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doClose() throws ElasticsearchException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> licenseesWithState(LicenseState state) {
|
||||
return Collections.<String>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public License getLicense() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
/eclipse-build/
|
|
@ -1,15 +0,0 @@
|
|||
apply plugin: 'elasticsearch.build'
|
||||
|
||||
dependencies {
|
||||
compile project(':x-plugins:elasticsearch:license:base')
|
||||
compile "org.elasticsearch:elasticsearch:${version}"
|
||||
testCompile project(':x-plugins:elasticsearch:license:licensor')
|
||||
testCompile "org.elasticsearch.test:framework:${version}"
|
||||
}
|
||||
|
||||
dependencyLicenses.enabled = false
|
||||
|
||||
jar {
|
||||
baseName = 'license-plugin-api'
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ dependencyLicenses.enabled = false
|
|||
|
||||
dependencies {
|
||||
// license deps
|
||||
compile project(':x-plugins:elasticsearch:license:plugin-api')
|
||||
compile project(':x-plugins:elasticsearch:license:base')
|
||||
testCompile project(':x-plugins:elasticsearch:license:licensor')
|
||||
|
||||
// shield deps
|
||||
|
@ -31,11 +31,9 @@ dependencies {
|
|||
|
||||
// watcher deps
|
||||
compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239'
|
||||
compile 'com.google.guava:guava:16.0.1' // needed by watcher and shield tests for jimfs
|
||||
compile 'com.google.guava:guava:16.0.1' // needed by watcher for the html sanitizer and shield tests for jimfs
|
||||
compile 'com.google.code.findbugs:jsr305:3.0.1' // TODO: remove this
|
||||
compile 'com.sun.mail:javax.mail:1.5.3'
|
||||
// fork of mustache: https://github.com/elastic/x-plugins/issues/1116
|
||||
compile 'com.github.spullara.mustache.java:compiler:0.9.1' // TODO: remove this
|
||||
testCompile 'org.subethamail:subethasmtp:3.1.7'
|
||||
|
||||
// common test deps
|
||||
|
@ -153,6 +151,8 @@ task testJar(type: Jar) {
|
|||
from sourceSets.test.output
|
||||
}
|
||||
artifacts {
|
||||
// normal es plugins do not publish the jar but we need to since users need it for Transport Clients and extensions
|
||||
archives jar
|
||||
testArtifacts testJar
|
||||
}
|
||||
|
||||
|
@ -176,3 +176,25 @@ licenseHeaders.enabled = false
|
|||
forbiddenApisMain {
|
||||
signaturesURLs += [file('signatures.txt').toURI().toURL()]
|
||||
}
|
||||
|
||||
modifyPom { MavenPom pom ->
|
||||
pom.withXml { XmlProvider xml ->
|
||||
// first find if we have dependencies at all, and grab the node
|
||||
NodeList depsNodes = xml.asNode().get('dependencies')
|
||||
if (depsNodes.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
// find the 'base' dependency and replace it with the correct name because the project name is
|
||||
// always used even when the pom of the other project is correct
|
||||
for (Node depNode : depsNodes.get(0).children()) {
|
||||
String groupId = depNode.get('groupId').get(0).text()
|
||||
Node artifactIdNode = depNode.get('artifactId').get(0)
|
||||
String artifactId = artifactIdNode.text()
|
||||
if (groupId.equals('org.elasticsearch') && artifactId.equals('base')) {
|
||||
artifactIdNode.replaceNode(new Node(null, 'artifactId', 'license-core'))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,13 +5,13 @@
|
|||
*/
|
||||
package org.elasticsearch.watcher.actions.email.service.attachment;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class EmailAttachmentsParser {
|
|||
|
||||
@Inject
|
||||
public EmailAttachmentsParser(Map<String, EmailAttachmentParser> parsers) {
|
||||
this.parsers = ImmutableMap.copyOf(parsers);
|
||||
this.parsers = Collections.unmodifiableMap(parsers);
|
||||
}
|
||||
|
||||
public EmailAttachments parse(XContentParser parser) throws IOException {
|
||||
|
|
Loading…
Reference in New Issue