Browse Source

Include licenses in maven pom

Test: Manual checked pom that is generated by grade uploadArchives

Bug: 35018649
Change-Id: Ibc0fc09737fc327a8e5acc04cf88e3e27d633b01
transition-compose-core
Siyamed Sinir 7 years ago
parent
commit
558f0e2f35
  1. 29
      src/main/groovy/android/support/SupportLibraryExtension.groovy
  2. 11
      src/main/groovy/android/support/SupportLibraryPlugin.groovy

29
src/main/groovy/android/support/SupportLibraryExtension.groovy

@ -16,11 +16,38 @@
package android.support;
import org.gradle.api.Project
/**
* Extension for {@link SupportLibraryPlugin}.
*/
class SupportLibraryExtension {
Project project
String name;
String description;
String inceptionYear;
}
Collection<License> licenses = [];
SupportLibraryExtension(Project project) {
this.project = project
}
License license(Closure closure) {
def license = project.configure(new License(), closure)
licenses.add(license)
return license
}
class License {
String name;
String url;
void url(String p) {
url = p
}
void name(String p) {
name = p
}
}
}

11
src/main/groovy/android/support/SupportLibraryPlugin.groovy

@ -42,7 +42,7 @@ class SupportLibraryPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
SupportLibraryExtension supportLibraryExtension =
project.getExtensions().create("supportLibrary", SupportLibraryExtension);
project.getExtensions().create("supportLibrary", SupportLibraryExtension, project);
project.apply(ImmutableMap.of("plugin", "com.android.library"));
project.apply(ImmutableMap.of("plugin", ErrorProneBasePlugin.class));
@ -142,6 +142,15 @@ class SupportLibraryPlugin implements Plugin<Project> {
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
supportLibraryExtension.getLicenses().each {
SupportLibraryExtension.License supportLicense ->
license {
name supportLicense.name
url supportLicense.url
distribution 'repo'
}
}
}
scm {

Loading…
Cancel
Save