This repository has been archived by the owner on Jan 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring, extract classes, javadocs
- Loading branch information
1 parent
0309e5e
commit 4920672
Showing
5 changed files
with
158 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/groovy/org/mockito/release/internal/gradle/CloneGitRepositoryTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.mockito.release.internal.gradle; | ||
|
||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.logging.Logger; | ||
import org.gradle.api.logging.Logging; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.OutputDirectory; | ||
import org.gradle.api.tasks.TaskAction; | ||
import org.mockito.release.exec.ProcessRunner; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* This task clone git project from repository to target dir. | ||
* It support clone from remote server and from local filesystem. | ||
*/ | ||
public class CloneGitRepositoryTask extends DefaultTask { | ||
|
||
private static final Logger LOG = Logging.getLogger(CloneGitRepositoryTask.class); | ||
|
||
private String repository; | ||
private File targetDir; | ||
|
||
@TaskAction | ||
public void cloneRepository() { | ||
LOG.lifecycle(" Clone repository"); | ||
getProject().getBuildDir().mkdirs(); // build dir can be not created yet | ||
ProcessRunner processRunner = org.mockito.release.exec.Exec.getProcessRunner(getProject().getBuildDir()); | ||
processRunner.run("git", "clone", repository, targetDir.getAbsolutePath()); | ||
} | ||
|
||
@Input | ||
public void setRepository(String repository) { | ||
this.repository = repository; | ||
} | ||
|
||
@OutputDirectory | ||
public void setTargetDir(File targetDir) { | ||
this.targetDir = targetDir; | ||
} | ||
|
||
public File getTargetDir() { | ||
return targetDir; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/groovy/org/mockito/release/internal/gradle/RunTestReleaseTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.mockito.release.internal.gradle; | ||
|
||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.logging.Logger; | ||
import org.gradle.api.logging.Logging; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.OutputFile; | ||
import org.gradle.api.tasks.TaskAction; | ||
import org.mockito.release.exec.ProcessRunner; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
/** | ||
* This task run external process and additionally store output of external process to file. | ||
*/ | ||
public class RunTestReleaseTask extends DefaultTask { | ||
|
||
private static final Logger LOG = Logging.getLogger(RunTestReleaseTask.class); | ||
|
||
private List<String> command; | ||
private File buildOutput; | ||
private File workDir; | ||
private String repoName; | ||
|
||
@TaskAction | ||
public void runTest() { | ||
LOG.lifecycle(" Run test of {}. The output will be save in {}", repoName, buildOutput.getAbsoluteFile()); | ||
ProcessRunner processRunner = org.mockito.release.exec.Exec.getProcessRunner(workDir, buildOutput); | ||
processRunner.run(command); | ||
} | ||
|
||
@Input | ||
public void setWorkDir(File workDir) { | ||
this.workDir = workDir; | ||
} | ||
|
||
@Input | ||
public void setCommand(List<String> command) { | ||
this.command = command; | ||
} | ||
|
||
@Input | ||
public void setRepoName(String repoName) { | ||
this.repoName = repoName; | ||
} | ||
|
||
@OutputFile | ||
public void setBuildOutputFile(File file) { | ||
buildOutput = file; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters