Skip to content

Commit

Permalink
Upload to plugins.gradle.org / Update sphinx-maven-plugin to 2.2.2 / …
Browse files Browse the repository at this point in the history
…Remove unnecessary sections about how to use an extension
  • Loading branch information
trustin committed May 2, 2018
1 parent 722492e commit e341c0f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 331 deletions.
156 changes: 22 additions & 134 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id 'com.gradle.plugin-publish' version '0.9.10'
}

apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'signing'

sourceCompatibility = 1.6
targetCompatibility = 1.6
Expand All @@ -15,16 +17,14 @@ repositories {
mavenCentral()
}

configurations {
all*.exclude module: 'maven-filtering'
all*.exclude module: 'maven-reporting-api'
all*.exclude module: 'maven-reporting-impl'
}

dependencies {
compile gradleApi()
compile localGroovy()
compile group: 'kr.motd.maven', name: 'sphinx-maven-plugin', version: '2.2.2'
compile(group: 'kr.motd.maven', name: 'sphinx-maven-plugin', version: '2.2.2') {
exclude group: 'org.apache.maven.shared', module: 'maven-filtering'
exclude group: 'org.apache.maven.reporting', module: 'maven-reporting-api'
exclude group: 'org.apache.maven.reporting', module: 'maven-reporting-impl'
}

testCompile group: 'junit', name: 'junit', version: '4.12'
}
Expand All @@ -45,136 +45,24 @@ artifacts {
archives javadocJar
}

signing {
required { signatory != null && project.ext.isReleaseVersion }
sign configurations.archives
}

publishing {
repositories {
maven {
if (project.ext.isReleaseVersion) {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
} else {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}

credentials {
username = project.properties.ossrhUsername
password = project.properties.ossrhPassword
}
pluginBundle {
website = 'https://trustin.github.io/sphinx-gradle-plugin/'
vcsUrl = 'https://github.com/trustin/sphinx-gradle-plugin'
plugins {
sphinxPlugin {
id = 'kr.motd.sphinx'
displayName = "${project.name}"
description = 'Sphinx site generation plugin for Gradle'
tags = ['documentation', 'generator', 'python', 'site', 'site-generator', 'sphinx']
}
}
publications {
jar(MavenPublication) {
pom.withXml {
NodeList children = asNode().children()
Node dependencies = children.find { it.name().localPart == 'dependencies' } as Node

children[children.indexOf(dependencies) - 1] + {
resolveStrategy = Closure.DELEGATE_FIRST
name "${project.name}"
description 'Sphinx site generation plugin for Gradle'
url 'http://trustin.github.io/sphinx-gradle-plugin/'
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
inceptionYear 2016
organization {
name 'Trustin Lee et al'
url 'http://trustin.github.io/sphinx-maven-plugin/'
}
developers {
developer {
id 'trustin'
name 'Trustin Lee'
url 'https://github.com/trustin'
}
}
scm {
url 'https://github.com/trustin/sphinx-gradle-plugin'
connection 'scm:git:https://github.com/trustin/sphinx-gradle-plugin.git'
developerConnection 'scm:git:ssh://[email protected]/trustin/sphinx-gradle-plugin.git'
}
}

// Exclude Maven-related transitive dependencies.
dependencies.children().find { it.artifactId.text() == 'sphinx-maven-plugin' }
.children().last() + {

resolveStrategy = Closure.DELEGATE_FIRST
exclusions {
exclusion {
groupId 'org.apache.maven.shared'
artifactId 'maven-filtering'
}
exclusion {
groupId 'org.apache.maven.reporting'
artifactId 'maven-reporting-api'
}
exclusion {
groupId 'org.apache.maven.reporting'
artifactId 'maven-reporting-impl'
}
}
}
}

from components.java

artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}

// Sign the pom.xml and artifacts.
if (signing.required) {
// Sign the pom.xml.
pom.withXml {
writeTo(project.ext.pomFile)
def pomAscFile = signing.sign(project.ext.pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
project.ext.pomFile.delete()
}

// Sign the artifacts.
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
}
}
}
mavenCoordinates {
groupId = "${project.group}"
artifactId = "${project.name}"
}
}

model {
tasks.publishJarPublicationToMavenLocal {
dependsOn(project.tasks.signArchives)
}
tasks.publishJarPublicationToMavenRepository {
dependsOn(project.tasks.signArchives)
}
}

task install(dependsOn: publishToMavenLocal)

task site(type: JavaExec, dependsOn: install) {
task site(type: JavaExec, dependsOn: tasks.check) {
inputs.dir "${project.projectDir}/src/sphinx"
outputs.dir "${project.buildDir}/site"
classpath sourceSets.test.runtimeClasspath
Expand Down
16 changes: 7 additions & 9 deletions src/site/sphinx/basic-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@ To apply this plugin, add the following to your ``build.gradle`` file:

.. parsed-literal::
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'kr.motd.gradle', name: 'sphinx-gradle-plugin', version: '\ |release|\ '
}
plugins {
id "kr.motd.sphinx" version "\ |release|\ "
}
// Apply the 'base' plugin, which adds the 'site' task.
// Note: You do not need to apply the 'base' plugin if you applied
// other plugin that extends 'base', such as 'java'.
apply plugin: 'base'
// Apply the Sphinx plugin.
apply plugin: 'kr.motd.sphinx'
.. hint::

You can also use the traditional ``buildscript`` approach.
See `plugins.gradle.org <https://plugins.gradle.org/plugin/kr.motd.sphinx>`_
for more information.

Now you can build your project web site using the ``site`` or ``sphinx`` task::

Expand Down
2 changes: 1 addition & 1 deletion src/site/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
project = u'sphinx-gradle-plugin'
copyright = u'2017, Trustin Lee et al'
version = '2.2'
release = '2.2.0'
release = '2.2.2'

# General options
needs_sphinx = '1.0'
Expand Down
Loading

0 comments on commit e341c0f

Please sign in to comment.