Commit abf65e27 by andrewlewis Committed by marcbaechinger

Fix publishing to bintray

The configuration to publish to Maven seems to be incompatible with the
configuration for bintray, so only enable one at once. Once the GMaven
publishing flow is completely set up we can remove the exoplayerPublishEnabled
constant and the first branch entirely.

Issue: #5246
PiperOrigin-RevId: 359056610
parent e3adac59
Showing with 38 additions and 40 deletions
...@@ -12,10 +12,9 @@ ...@@ -12,10 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// For publishing to Bintray.
if (project.ext.has("exoplayerPublishEnabled") if (project.ext.has("exoplayerPublishEnabled")
&& project.ext.exoplayerPublishEnabled) { && project.ext.exoplayerPublishEnabled) {
// For publishing to Bintray.
apply plugin: 'bintray-release' apply plugin: 'bintray-release'
publish { publish {
artifactId = releaseArtifact artifactId = releaseArtifact
...@@ -41,44 +40,10 @@ if (project.ext.has("exoplayerPublishEnabled") ...@@ -41,44 +40,10 @@ if (project.ext.has("exoplayerPublishEnabled")
} }
} }
} }
} } else {
// For publishing to a Maven repository.
def getBintrayRepo() { apply plugin: 'maven-publish'
boolean publicRepo = hasProperty('publicRepo') && afterEvaluate {
property('publicRepo').toBoolean()
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))
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
def printer = new XmlNodePrinter(writer)
printer.preserveWhitespace = true
printer.print(xml)
writer.close()
}
// For publishing to a Maven repository.
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}
apply plugin: 'maven-publish'
afterEvaluate {
publishing { publishing {
repositories { repositories {
maven { maven {
...@@ -115,4 +80,37 @@ afterEvaluate { ...@@ -115,4 +80,37 @@ afterEvaluate {
} }
} }
} }
}
}
def getBintrayRepo() {
boolean publicRepo = hasProperty('publicRepo') &&
property('publicRepo').toBoolean()
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))
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
def printer = new XmlNodePrinter(writer)
printer.preserveWhitespace = true
printer.print(xml)
writer.close()
}
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment