Skip to content

Commit

Permalink
chore: update gradle and resolve checkstyle warnings (#534)
Browse files Browse the repository at this point in the history
* update Gradle to 6.2.2
* use code metrics configuration from TeraConfig
* resolve checkstyleTest warnings
* disallow failures when checking with (build should fail if new Checkstyle warnings are
introduced)
* run `gradle check` on push validation
  • Loading branch information
skaldarnar authored Mar 28, 2020
1 parent e5e42fb commit 0684c5b
Show file tree
Hide file tree
Showing 18 changed files with 211 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
java-version: 1.8
java-package: jdk+fx
- name: Build and test with Gradle
run: ./gradlew test
run: ./gradlew check
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

checkstyle {
ignoreFailures = true
configFile = new File("$rootDir/config/metrics/checkstyle/checkstyle.xml")
configProperties.samedir = checkstyle.configFile.parentFile
}
Expand Down
21 changes: 0 additions & 21 deletions config/checkstyle/suppressions.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* - directories managed by the launcher
* - user settings in form of {@link BaseLauncherSettings}
* - the {@link PackageManager} used to download new games
*
* @deprecated use {@link org.terasology.launcher.config.Config} instead
*/
@Deprecated
public class LauncherConfiguration {
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/terasology/launcher/LauncherInitTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import org.terasology.launcher.updater.LauncherUpdater;
import org.terasology.launcher.util.BundleUtils;
import org.terasology.launcher.util.DirectoryCreator;
import org.terasology.launcher.util.HostServices;
import org.terasology.launcher.util.LauncherDirectoryUtils;
import org.terasology.launcher.util.DownloadUtils;
import org.terasology.launcher.util.FileUtils;
import org.terasology.launcher.util.GuiUtils;
import org.terasology.launcher.util.HostServices;
import org.terasology.launcher.util.LauncherDirectoryUtils;
import org.terasology.launcher.util.LauncherManagedDirectory;
import org.terasology.launcher.util.LauncherStartFailedException;
import org.terasology.launcher.util.OperatingSystem;
Expand Down Expand Up @@ -135,7 +135,7 @@ private OperatingSystem getOperatingSystem() throws LauncherStartFailedException
private void initDirectory(Path dir, String errorLabel, DirectoryCreator... creators)
throws LauncherStartFailedException {
try {
for (DirectoryCreator creator: creators) {
for (DirectoryCreator creator : creators) {
creator.apply(dir);
}
} catch (IOException e) {
Expand Down Expand Up @@ -183,7 +183,7 @@ private boolean checkForLauncherUpdates(Path downloadDirectory, Path tempDirecto
boolean selfUpdaterStarted = false;
updateMessage(BundleUtils.getLabel("splash_launcherUpdateCheck"));
final LauncherUpdater updater = new LauncherUpdater(TerasologyLauncherVersionInfo.getInstance());
final GitHubRelease release = updater.updateAvailable() ;
final GitHubRelease release = updater.updateAvailable();
if (release != null) {
logger.info("Launcher update available: {}", release.getTagName());
updateMessage(BundleUtils.getLabel("splash_launcherUpdateAvailable"));
Expand All @@ -201,9 +201,10 @@ private boolean checkForLauncherUpdates(Path downloadDirectory, Path tempDirecto
if (update) {
showDownloadPage();
// TODO: start self-updater instead
if (false){
if (false) {
final Path targetDirectory = saveDownloadedFiles ? downloadDirectory : tempDirectory;
selfUpdaterStarted = updater.update(targetDirectory, tempDirectory);}
selfUpdaterStarted = updater.update(targetDirectory, tempDirectory);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* is a singleton class and its instance should be
* accessed only by using the {@code get()} method.
*/
public class ConfigManager {
public final class ConfigManager {
private static final Logger logger = LoggerFactory.getLogger(ConfigManager.class);
private static final String CONFIG_FILE = "config.json";
private static volatile ConfigManager instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ public Package read(JsonReader in) throws IOException {

return new Package(id, null, version, null, Collections.emptyList());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.terasology.launcher.packages.PackageBuild;
import org.terasology.launcher.packages.PackageManager;
import org.terasology.launcher.util.BundleUtils;
import org.terasology.launcher.util.DownloadException;
Expand All @@ -40,7 +39,6 @@
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/terasology/launcher/github/GitHubClient.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology.launcher.github;

import com.jcabi.github.Github;
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/terasology/launcher/github/GitHubRelease.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright 2020 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


package org.terasology.launcher.github;

import com.google.common.base.Preconditions;
Expand Down
Loading

0 comments on commit 0684c5b

Please sign in to comment.