Skip to content

Commit

Permalink
Fix API key read; update build.gradle with JAR generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerng committed Feb 3, 2019
1 parent be7a712 commit 84a5b4f
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 17 deletions.
14 changes: 11 additions & 3 deletions .idea/artifacts/org_usfirst_frc_team25_scouting_client_main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ repositories {
mavenCentral()
}

//create a single Jar with all dependencies
task createJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'org.usfirst.frc.team25.scouting.client.ui.Main'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}


dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile 'com.google.code.gson:gson:2.7'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void initialize() {

if (backupJson.isSelected()) {
FileManager.createBackup(jsonFileList, currentDataDirectory);
status += "Backup JSON files created";
status += "\nBackup JSON files created";
}

if (combineJson.isSelected() && eventReport.generateCombineJson(currentDataDirectory)) {
Expand Down Expand Up @@ -132,7 +132,7 @@ public void initialize() {
if (status.isEmpty()) {
addStatus("Please select data processing options!");
} else {
addStatus("Data processing for event " + eventName + " successful:\n\n" + status);
addStatus("Data processing for event " + eventName + " successful:\n" + status);
}

});
Expand Down Expand Up @@ -161,12 +161,28 @@ public void initialize() {
retrieveEventReport();

if (teamBasedReport.isSelected()) {
int teamNum = Integer.parseInt(analysisTeamOne.getText());

int teamNum;
try {
teamNum = Integer.parseInt(analysisTeamOne.getText());
} catch (NumberFormatException e) {
addStatus("Invalid or missing team number. Please try again.");
return;
}

addStatus(eventReport.getTeamReport(teamNum).getQuickStatus());
} else {
int teamOne = Integer.parseInt(analysisTeamOne.getText());
int teamTwo = Integer.parseInt(analysisTeamTwo.getText());
int teamThree = Integer.parseInt(analysisTeamThree.getText());
int teamOne, teamTwo, teamThree;

try {
teamOne = Integer.parseInt(analysisTeamOne.getText());
teamTwo = Integer.parseInt(analysisTeamTwo.getText());
teamThree = Integer.parseInt(analysisTeamThree.getText());
} catch (NumberFormatException e) {
addStatus("Invalid or missing team number(s). Please try again.");
return;
}

addStatus(eventReport.getAllianceReport(teamOne, teamTwo, teamThree).getQuickAllianceReport());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void start(Stage primaryStage) throws Exception {
try {
BlueAlliance.initializeApi(getClass());
} catch (IOException e) {

e.printStackTrace();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class BlueAlliance {
public static void initializeApi(Class c) throws IOException {


String apiKey = IOUtils.toString(c.getClassLoader().getResourceAsStream("apikey/secret.txt"), "utf5");

String apiKey = IOUtils.toString(c.getClassLoader().getResourceAsStream("apikey/secret.txt"), "utf-8");
System.out.println("API key: " + apiKey);
TBA = new TBA(apiKey);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ public boolean isTeamPlaying(int teamNum) {
}





public void processTeamReports() {

for (Integer key : teamReports.keySet()) {
Expand Down Expand Up @@ -374,7 +371,7 @@ public void generatePicklists(File outputDirectory) {
}

public void generateMatchPredictions(File outputDirectory) {

//TODO write this
}

public TeamReport getTeamReport(int teamNum) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class ScoutEntry implements Serializable {
private Autonomous auto;
private TeleOp teleOp;
private PostMatch postMatch;
private transient int sandstormPoints, teleOpPoints, calculatedPointContribution, autoHatches, autoCargo,
private transient int sandstormPoints, teleOpPoints, climbPoints, calculatedPointContribution, autoHatches,
autoCargo,
teleOpHatches, teleOpCargo, totalHatches, totalCargo;


Expand Down

0 comments on commit 84a5b4f

Please sign in to comment.