Skip to content

Commit

Permalink
Update dependencies / Fix deprecation warnings
Browse files Browse the repository at this point in the history
- sphinx-maven-plugin 2.6.1 -> 2.7.0
- Gradle 6.3
- Use new build configurations (compile -> implementation)
- Fix deprecation warnings:
  - Property 'X' has redundant getters: 'getX()' and 'isX()'.
  - Property 'X' has @input annotation used on property of type 'File'.
  - Property 'X' is not annotated with an input or output annotation.
  • Loading branch information
trustin committed Mar 29, 2020
1 parent 6da58a9 commit 952cbcb
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 43 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.gradle.plugin-publish' version '0.10.1'
id 'com.gradle.plugin-publish' version '0.11.0'
}

apply plugin: 'groovy'
Expand All @@ -13,16 +13,16 @@ repositories {
}

dependencies {
compile gradleApi()
compile localGroovy()
compile(group: 'kr.motd.maven', name: 'sphinx-maven-plugin', version: '2.6.0') {
implementation gradleApi()
implementation localGroovy()
implementation(group: 'kr.motd.maven', name: 'sphinx-maven-plugin', version: '2.7.0') {
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'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}

testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}

task sourceJar(type: Jar) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=kr.motd.gradle
name=sphinx-gradle-plugin
version=2.6.2-SNAPSHOT
version=2.7.0-SNAPSHOT
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
distributionSha256Sum=6c4276f97c9059ef4dfb06cc7325c43ed9b933ab04f032e9d9372e8589cb6faf
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
33 changes: 14 additions & 19 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -154,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
3 changes: 3 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand Down
93 changes: 77 additions & 16 deletions src/main/groovy/kr/motd/gradle/sphinx/gradle/SphinxTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ import java.util.concurrent.Callable

class SphinxTask extends DefaultTask {

def binaryUrl = { SphinxRunner.DEFAULT_BINARY_URL }
def binaryCacheDir = { "${project.gradle.gradleUserHomeDir}/caches/sphinx-binary" }
def environments = { Collections.emptyMap() }
private def binaryUrl = { SphinxRunner.DEFAULT_BINARY_URL }
private def binaryCacheDir = { "${project.gradle.gradleUserHomeDir}/caches/sphinx-binary" }
private def environments = { Collections.emptyMap() }
private final def additionalEnvironments = new HashMap<String, String>()
def dotBinary = null
def sourceDirectory = {
private def dotBinary = null
private def sourceDirectory = {
"${project.projectDir}${File.separator}src${File.separator}site${File.separator}sphinx"
}
def outputDirectory = { "${project.buildDir}${File.separator}site" }
def doctreeCacheDirectory = { "${project.buildDir}${File.separator}site${File.separator}.doctrees" }
def builder = { "html" }
def tags = { Collections.emptyList() }
private def outputDirectory = { "${project.buildDir}${File.separator}site" }
private def doctreeCacheDirectory = { "${project.buildDir}${File.separator}site${File.separator}.doctrees" }
private def builder = { "html" }
private def tags = { Collections.emptyList() }
private final def additionalTags = new ArrayList<String>()
def verbose = { true }
def traceback = { true }
def force = { false }
def warningsAsErrors = { false }
def skip = { false }
def useDoctreeCache = { false }
private def verbose = { true }
private def traceback = { true }
private def force = { false }
private def warningsAsErrors = { false }
private def skip = { false }
private def useDoctreeCache = { false }

private static def unwrap(Object o) {
if (o instanceof Callable) {
Expand All @@ -44,11 +44,20 @@ class SphinxTask extends DefaultTask {
return String.valueOf(unwrap(binaryUrl))
}

@Input
void setBinaryUrl(Object binaryUrl) {
this.binaryUrl = binaryUrl
}

@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
File getBinaryCacheDir() {
return project.file(binaryCacheDir).getCanonicalFile()
}

void setBinaryCacheDir(Object binaryCacheDir) {
this.binaryCacheDir = binaryCacheDir;
}

@Input
Map<String, String> getEnvironments() {
def unwrapped = unwrap(environments)
Expand All @@ -63,6 +72,10 @@ class SphinxTask extends DefaultTask {
return env
}

void setEnvironments(Object environments) {
this.environments = environments
}

void env(String name, String value) {
additionalEnvironments.put(name, value)
}
Expand All @@ -78,29 +91,49 @@ class SphinxTask extends DefaultTask {
}
}

void setDotBinary(Object dotBinary) {
this.dotBinary = dotBinary
}

@SkipWhenEmpty
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
File getSourceDirectory() {
project.file(sourceDirectory).getCanonicalFile()
}

void setSourceDirectory(Object sourceDirectory) {
this.sourceDirectory = sourceDirectory
}

@OutputDirectory
File getOutputDirectory() {
project.file(outputDirectory).getCanonicalFile()
}

void setOutputDirectory(Object outputDirectory) {
this.outputDirectory = outputDirectory
}

@Input
@Optional
File getDoctreeCacheDirectory() {
project.file(doctreeCacheDirectory).getCanonicalFile()
}

void setDoctreeCacheDirectory(Object doctreeCacheDirectory) {
this.doctreeCacheDirectory = doctreeCacheDirectory
}

@Input
String getBuilder() {
return String.valueOf(unwrap(builder))
}

void setBuilder(Object builder) {
this.builder = builder
}

@Input
List<String> getTags() {
def unwrapped = unwrap(tags)
Expand All @@ -114,6 +147,10 @@ class SphinxTask extends DefaultTask {
return result
}

void setTags(Object tags) {
this.tags = tags
}

void tags(String... tags) {
additionalTags.addAll(tags)
}
Expand All @@ -127,31 +164,55 @@ class SphinxTask extends DefaultTask {
(verbose instanceof Boolean ? verbose : verbose()).asBoolean()
}

void setVerbose(Object verbose) {
this.verbose = verbose
}

@Input
boolean isTraceback() {
(traceback instanceof Boolean ? traceback : verbose()).asBoolean()
}

void setTraceback(Object traceback) {
this.traceback = traceback
}

@Input
boolean isForce() {
(force instanceof Boolean ? force : force()).asBoolean()
}

void setForce(Object force) {
this.force = force
}

@Input
boolean isWarningsAsErrors() {
(warningsAsErrors instanceof Boolean ? warningsAsErrors : warningsAsErrors()).asBoolean()
}

void setWarningsAsErrors(Object warningsAsErrors) {
this.warningsAsErrors = warningsAsErrors
}

@Input
boolean isUseDoctreeCache() {
(useDoctreeCache instanceof Boolean ? useDoctreeCache : useDoctreeCache()).asBoolean()
}

void setUseDoctreeCache(Object useDoctreeCache) {
this.useDoctreeCache = useDoctreeCache
}

@Input
boolean isSkip() {
(skip instanceof Boolean ? skip : skip()).asBoolean()
}

void setSkip(Object skip) {
this.skip = skip
}

@TaskAction
def run() {
if (isSkip()) {
Expand Down

0 comments on commit 952cbcb

Please sign in to comment.