|
| 1 | +package org.hjug.gradlereport; |
| 2 | + |
| 3 | +import java.io.File; |
| 4 | + |
| 5 | +/** |
| 6 | + * Gradle extension to configure RefactorFirst plugin.<br> |
| 7 | + * Mirrors the Maven plugin parameters where possible. |
| 8 | + * |
| 9 | + * @author FX |
| 10 | + */ |
| 11 | +public class RefactorFirstExtension { |
| 12 | + private boolean showDetails = false; |
| 13 | + private int backEdgeAnalysisCount = 50; |
| 14 | + private boolean analyzeCycles = true; |
| 15 | + private boolean minifyHtml = false; |
| 16 | + private boolean excludeTests = true; |
| 17 | + /** |
| 18 | + * The test source directory containing test class sources (pattern). |
| 19 | + */ |
| 20 | + private String testSourceDirectory; // e.g. "src/test" |
| 21 | + |
| 22 | + private String projectName; // default to Gradle project name if null |
| 23 | + private String projectVersion; // default to Gradle project version if null |
| 24 | + |
| 25 | + /** |
| 26 | + * Output directory relative to project root for generated site files. |
| 27 | + * Defaults to target/site (to match Maven plugin output paths). |
| 28 | + */ |
| 29 | + private String outputDirectory; // e.g. "target/site" |
| 30 | + |
| 31 | + public boolean isShowDetails() { |
| 32 | + return showDetails; |
| 33 | + } |
| 34 | + |
| 35 | + public void setShowDetails(boolean showDetails) { |
| 36 | + this.showDetails = showDetails; |
| 37 | + } |
| 38 | + |
| 39 | + public int getBackEdgeAnalysisCount() { |
| 40 | + return backEdgeAnalysisCount; |
| 41 | + } |
| 42 | + |
| 43 | + public void setBackEdgeAnalysisCount(int backEdgeAnalysisCount) { |
| 44 | + this.backEdgeAnalysisCount = backEdgeAnalysisCount; |
| 45 | + } |
| 46 | + |
| 47 | + public boolean isAnalyzeCycles() { |
| 48 | + return analyzeCycles; |
| 49 | + } |
| 50 | + |
| 51 | + public void setAnalyzeCycles(boolean analyzeCycles) { |
| 52 | + this.analyzeCycles = analyzeCycles; |
| 53 | + } |
| 54 | + |
| 55 | + public boolean isMinifyHtml() { |
| 56 | + return minifyHtml; |
| 57 | + } |
| 58 | + |
| 59 | + public void setMinifyHtml(boolean minifyHtml) { |
| 60 | + this.minifyHtml = minifyHtml; |
| 61 | + } |
| 62 | + |
| 63 | + public boolean isExcludeTests() { |
| 64 | + return excludeTests; |
| 65 | + } |
| 66 | + |
| 67 | + public void setExcludeTests(boolean excludeTests) { |
| 68 | + this.excludeTests = excludeTests; |
| 69 | + } |
| 70 | + |
| 71 | + public String getTestSourceDirectory() { |
| 72 | + return testSourceDirectory; |
| 73 | + } |
| 74 | + |
| 75 | + public void setTestSourceDirectory(String testSourceDirectory) { |
| 76 | + this.testSourceDirectory = testSourceDirectory; |
| 77 | + } |
| 78 | + |
| 79 | + public String getProjectName() { |
| 80 | + return projectName; |
| 81 | + } |
| 82 | + |
| 83 | + public void setProjectName(String projectName) { |
| 84 | + this.projectName = projectName; |
| 85 | + } |
| 86 | + |
| 87 | + public String getProjectVersion() { |
| 88 | + return projectVersion; |
| 89 | + } |
| 90 | + |
| 91 | + public void setProjectVersion(String projectVersion) { |
| 92 | + this.projectVersion = projectVersion; |
| 93 | + } |
| 94 | + |
| 95 | + public String getOutputDirectory() { |
| 96 | + return outputDirectory; |
| 97 | + } |
| 98 | + |
| 99 | + public void setOutputDirectory(String outputDirectory) { |
| 100 | + this.outputDirectory = outputDirectory; |
| 101 | + } |
| 102 | + |
| 103 | + // Convenience to resolve output directory to an absolute File |
| 104 | + File resolveOutputDir(File projectDir) { |
| 105 | + String out = outputDirectory; |
| 106 | + if (out == null || out.trim().isEmpty()) { |
| 107 | + out = "target/site"; // match Maven default location |
| 108 | + } |
| 109 | + return new File(projectDir, out); |
| 110 | + } |
| 111 | +} |
0 commit comments