Merge pull request #5732 from ToxicBakery:feature/add-license-to-pom
PiperOrigin-RevId: 257138448
This commit is contained in:
commit
3ac8b6acee
@ -44,6 +44,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
buildDir = "${externalBuildDir}/${project.name}"
|
buildDir = "${externalBuildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
|
group = 'com.google.android.exoplayer'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'javadoc_combined.gradle'
|
apply from: 'javadoc_combined.gradle'
|
||||||
|
@ -23,6 +23,21 @@ if (project.ext.has("exoplayerPublishEnabled")
|
|||||||
groupId = 'com.google.android.exoplayer'
|
groupId = 'com.google.android.exoplayer'
|
||||||
website = 'https://github.com/google/ExoPlayer'
|
website = 'https://github.com/google/ExoPlayer'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gradle.taskGraph.whenReady { taskGraph ->
|
||||||
|
project.tasks
|
||||||
|
.findAll { task -> task.name.contains("generatePomFileFor") }
|
||||||
|
.forEach { task ->
|
||||||
|
task.doLast {
|
||||||
|
task.outputs.files
|
||||||
|
.filter { File file ->
|
||||||
|
file.path.contains("publications")
|
||||||
|
&& file.name.matches("^pom-.+\\.xml\$")
|
||||||
|
}
|
||||||
|
.forEach { File file -> addLicense(file) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getBintrayRepo() {
|
def getBintrayRepo() {
|
||||||
@ -30,3 +45,23 @@ def getBintrayRepo() {
|
|||||||
property('publicRepo').toBoolean()
|
property('publicRepo').toBoolean()
|
||||||
return publicRepo ? 'exoplayer' : 'exoplayer-test'
|
return publicRepo ? 'exoplayer' : 'exoplayer-test'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addLicense(File pom) {
|
||||||
|
def licenseNode = new Node(null, "license")
|
||||||
|
licenseNode.append(
|
||||||
|
new Node(null, "name", "The Apache Software License, Version 2.0"))
|
||||||
|
licenseNode.append(
|
||||||
|
new Node(null, "url", "http://www.apache.org/licenses/LICENSE-2.0.txt"))
|
||||||
|
licenseNode.append(new Node(null, "distribution", "repo"))
|
||||||
|
def licensesNode = new Node(null, "licenses")
|
||||||
|
licensesNode.append(licenseNode)
|
||||||
|
|
||||||
|
def xml = new XmlParser().parse(pom)
|
||||||
|
xml.append(licensesNode)
|
||||||
|
|
||||||
|
def writer = new PrintWriter(new FileWriter(pom))
|
||||||
|
def printer = new XmlNodePrinter(writer)
|
||||||
|
printer.preserveWhitespace = true
|
||||||
|
printer.print(xml)
|
||||||
|
writer.close()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user