-
Notifications
You must be signed in to change notification settings - Fork 69
Fix #677 Error if project is in OneDrive #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
573fcad
9aa10ec
a85d4a9
ca2c585
abf64b3
6d9b7e8
8a55882
e551c83
bc8d841
1e04d0d
cd1603f
fa90f32
e900c37
35af31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
import edu.wpi.first.gradlerio.deploy.FRCDeployPlugin; | ||
import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO; | ||
import edu.wpi.first.gradlerio.wpi.WPIPlugin; | ||
import edu.wpi.first.gradlerio.OneDriveException; | ||
|
||
public abstract class GradleRIOPlugin implements Plugin<Project> { | ||
|
||
|
@@ -77,6 +78,18 @@ public void execute(Parameters parameters) { | |
|
||
@Override | ||
public void apply(Project project) { | ||
boolean onedrive = false; | ||
try { | ||
if (project.getRootDir().toString().toUpperCase().contains("ONEDRIVE")) { | ||
onedrive = true; | ||
} | ||
} catch(Exception e) { | ||
System.out.println(e.toString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't print anything here. We just want to ignore any issue completely. |
||
} | ||
|
||
if (onedrive == true) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just |
||
throw new OneDriveException(project); | ||
} | ||
|
||
project.getPluginManager().apply(DeployUtils.class); | ||
project.getPluginManager().apply(FRCDeployPlugin.class); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package edu.wpi.first.gradlerio; | ||
|
||
import org.gradle.api.Project; | ||
|
||
public class OneDriveException extends java.lang.RuntimeException { | ||
public OneDriveException(Project project) { | ||
super(String.format("Error cannot create project inside OneDrive. Project Directory = %S", project.getRootDir().toString())); | ||
System.out.println(String.format("Error cannot create project inside OneDrive. Project Directory = %S", project.getRootDir().toString())); | ||
_project = project; | ||
} | ||
|
||
public void printError() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need the printError function, or to store the project variable. |
||
System.out.println(String.format("Error cannot create project inside OneDrive. Project Directory = %S", _project.getRootDir().toString())); | ||
} | ||
|
||
private Project _project; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the if here. You can just assign onedrive straight to the whole result of the contains statement.