Skip to content

Commit

Permalink
Added more debug messages to gradle base plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
faab007nl committed Dec 27, 2023
1 parent eda4efb commit 515c846
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def artifactId = 'GradleBasePlugin'
// /---> Major Version - Increment this when you make a breaking change
// | /---> Patch Version - Increment this when you add a new feature
// | | /---> Minor Version - Increment this when you make a bug fix
def versionNum = '3.1.4'
def versionNum = '3.1.5'

group = groupId
version = versionNum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

import me.TechsCode.GradeBasePlugin.Color;
import me.TechsCode.GradeBasePlugin.GradleBasePlugin;
import net.rubygrapefruit.platform.terminal.TerminalOutput;
import org.gradle.api.Project;

import me.TechsCode.GradeBasePlugin.extensions.Downloader;
Expand Down Expand Up @@ -51,9 +54,14 @@ public static ResourceResponse loadBasePlugin(Project project, MetaExtension met
}

public static void createGitIgnore(Project project) throws IOException {
Files.copy(ResourceManager.class.getResourceAsStream("/gitignore.file"),
Paths.get(new File(project.getProjectDir().getAbsolutePath() + "/.gitignore").toURI()),
StandardCopyOption.REPLACE_EXISTING);
File gitIgnoreDestination = new File(project.getProjectDir().getAbsolutePath() + "/.gitignore");
gitIgnoreDestination.mkdirs();

InputStream src = ResourceManager.class.getResourceAsStream("/gitignore.file");
if(src == null) throw new IOException("Gitignore file not found in resources");

Files.copy(src, Paths.get(gitIgnoreDestination.toURI()), StandardCopyOption.REPLACE_EXISTING);
GradleBasePlugin.log(Color.GREEN + "Copied .gitignore file to " + gitIgnoreDestination.getAbsolutePath());
}

public static void createWorkflow(Project project, boolean isApi) throws IOException {
Expand All @@ -63,14 +71,17 @@ public static void createWorkflow(Project project, boolean isApi) throws IOExcep
String workflowFile;
if(isApi){
workflowFile = "/workflows/api.yml";
GradleBasePlugin.log(Color.BLUE + "Using API workflow file");
}else{
workflowFile = "/workflows/plugin.yml";
GradleBasePlugin.log(Color.BLUE + "Using Plugin workflow file");
}

InputStream src = ResourceManager.class.getResourceAsStream(workflowFile);
if(src == null) throw new IOException("Workflow file not found in resources");

Files.copy(src, Paths.get(destination.toURI()), StandardCopyOption.REPLACE_EXISTING);
GradleBasePlugin.log(Color.GREEN + "Copied workflow file to " + destination.getAbsolutePath());
}

public static void createGradleFiles(Project project) throws IOException {
Expand All @@ -82,6 +93,7 @@ public static void createGradleFiles(Project project) throws IOException {
if(buildGradleSrc == null) throw new IOException("build.gradle file not found in resources");

Files.copy(buildGradleSrc, Paths.get(buildGradleDestination.toURI()), StandardCopyOption.REPLACE_EXISTING);
GradleBasePlugin.log(Color.GREEN + "Copied build.gradle file to " + buildGradleDestination.getAbsolutePath());
}

}

0 comments on commit 515c846

Please sign in to comment.