Use Input instead of InputDirectory for directory property

This commit is contained in:
Sebastian Sdorra
2021-01-13 16:05:25 +01:00
committed by René Pfeuffer
parent d1575b8b8d
commit 64cb20a951
6 changed files with 41 additions and 10 deletions

View File

@@ -1,16 +1,39 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.cloudogu.scm
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.TaskAction
import java.time.Instant
class TouchFilesTask extends DefaultTask {
@InputDirectory
File directory
@Input
Object directory
@Input
String extension
@@ -28,8 +51,16 @@ class TouchFilesTask extends DefaultTask {
@TaskAction
public void execute() {
if (directory.exists()) {
touch(directory)
if (directory instanceof File) {
touchDirectory(directory)
} else if (directory instanceof String) {
touchDirectory(new File((String) directory))
}
}
private void touchDirectory(File file) {
if (file.exists()) {
touch(file)
}
}

View File

@@ -24,7 +24,7 @@
plugins {
id 'org.scm-manager.smp' version '0.7.1'
id 'org.scm-manager.smp' version '0.7.2'
}
def jgitVersion = '5.6.1.202002131546-r-scm1'

View File

@@ -24,7 +24,7 @@
plugins {
id 'org.scm-manager.smp' version '0.7.1'
id 'org.scm-manager.smp' version '0.7.2'
}
dependencies {

View File

@@ -24,7 +24,7 @@
plugins {
id 'org.scm-manager.smp' version '0.7.1'
id 'org.scm-manager.smp' version '0.7.2'
}
dependencies {

View File

@@ -24,7 +24,7 @@
plugins {
id 'org.scm-manager.smp' version '0.7.1'
id 'org.scm-manager.smp' version '0.7.2'
}
dependencies {

View File

@@ -24,7 +24,7 @@
plugins {
id 'org.scm-manager.smp' version '0.7.1'
id 'org.scm-manager.smp' version '0.7.2'
}
def svnkitVersion = '1.10.1-scm2'