Skip to content

Commit

Permalink
Merge pull request #35 from robojumper/small_updates
Browse files Browse the repository at this point in the history
All the build updates & fixes
  • Loading branch information
robojumper authored May 2, 2021
2 parents f2ff47e + b6893fe commit 13fa97a
Show file tree
Hide file tree
Showing 24 changed files with 102 additions and 121 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/wasm.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: wasm
name: build

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
rust:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -17,6 +22,12 @@ jobs:
toolchain: nightly-2021-04-25
override: true
profile: minimal
- name: Test
run: |
cd rust/ddsaveedit
cargo check
cargo test
cargo test --release
- name: Install Node
uses: actions/setup-node@v1
with:
Expand All @@ -31,9 +42,33 @@ jobs:
npm run build
cd ../../../
- name: Deploy
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: rust/ddsaveedit/wasm-ddsaveedit/dist # The folder the action should deploy.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


java:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Java
uses: actions/setup-java@v1
with:
java-version: '8'
java-package: jdk
- name: Test
run: |
./gradlew test
- name: Build distribution zip
run: |
./gradlew dist
- name: Upload distribution zip
uses: actions/upload-artifact@v1
with:
name: DDSaveEditor
path: build/dist/
43 changes: 0 additions & 43 deletions .github/workflows/test.yml

This file was deleted.

51 changes: 23 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
plugins {
id 'de.fuerstenau.buildconfig' version '1.1.8'
id 'java'
id 'application'
id 'com.github.gmazzo.buildconfig' version '3.0.0'
}


apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'

repositories {
mavenCentral()
jcenter()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8


dependencies {
testCompile 'org.testng:testng:6.8.8'
compile 'com.google.code.gson:gson:2.8.5'
compile 'com.google.api-client:google-api-client:1.23.0'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
compile 'com.google.apis:google-api-services-sheets:v4-rev516-1.23.0'
compile 'com.fifesoft:rsyntaxtextarea:3.0.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.6'
testImplementation 'org.testng:testng:7.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.api-client:google-api-client:1.31.2'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.31.2'
implementation 'com.google.apis:google-api-services-sheets:v4-rev612-1.25.0'
implementation 'com.fifesoft:rsyntaxtextarea:3.1.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.3'
}

buildConfig {
appName = project.name
version = project.version

buildConfigField 'String', 'DISPLAY_NAME', "$displayname"
buildConfigField 'String', 'GITHUB_URL', "$githuburl"
buildConfigField 'String', 'UPDATE_URL', "$releasesurl"
buildConfigField 'String', 'JAR_NAME', "${jarname}.jar"
buildConfigField 'String', 'DATA_DIR', "$datadir"
packageName("de.robojumper.ddsavereader")
buildConfigField('String', 'NAME', "\"${project.name}\"")
buildConfigField('String', 'VERSION', "\"${project.version}\"")

clsName = 'BuildConfig'
packageName = project.group
charset = 'UTF-8'
buildConfigField('String', 'DISPLAY_NAME', "\"$displayname\"")
buildConfigField('String', 'GITHUB_URL', "\"$githuburl\"")
buildConfigField('String', 'UPDATE_URL', "\"$releasesurl\"")
buildConfigField('String', 'JAR_NAME', "\"${jarname}.jar\"")
buildConfigField('String', 'DATA_DIR', "\"$datadir\"")
}

test {
Expand All @@ -61,9 +54,10 @@ task fatJar(type: Jar) {
'Implementation-Version': project.version,
'Main-Class': mainClassName
}
setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
archiveBaseName = "$jarname"
archiveFileName = "${jarname}.jar"
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

Expand All @@ -84,6 +78,7 @@ task dist(type: Zip, dependsOn: fatJar) {
include "**/*"
into "docs"
}
destinationDir = file("${buildDir}/dist")
baseName = "${jarname}"

destinationDirectory = file("${buildDir}/dist")
archiveBaseName = "${jarname}"
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
displayname=Darkest Dungeon Save Editor
version=v0.0.69
version=v0.0.70
githuburl=https://github.com/robojumper/DarkestDungeonSaveEditor
releasesurl=https://api.github.com/repos/robojumper/DarkestDungeonSaveEditor/releases/latest
jarname=DDSaveEditor
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions rust/ddsaveedit/ddsavelib/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ fn hardcoded_type(parents: &'_ [impl AsRef<str>], name: impl AsRef<str>) -> Opti
[IntVector, "result_event_history"],
[IntVector, "dead_hero_entries"],
[IntVector, "additional_mash_disabled_infestation_monster_class_ids"],
[IntVector, "mash", "valid_additional_mash_entry_indexes"],
[IntVector, "party", "heroes"],
[IntVector, "skill_cooldown_keys"],
[IntVector, "skill_cooldown_values"],
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/robojumper/ddsavereader/Dson2Json.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;

import de.fuerstenau.buildconfig.BuildConfig;
import de.robojumper.ddsavereader.BuildConfig;
import de.robojumper.ddsavereader.file.DsonFile;
import de.robojumper.ddsavereader.file.DsonTypes;
import de.robojumper.ddsavereader.file.DsonFile.UnhashBehavior;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/robojumper/ddsavereader/Json2Dson.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.nio.file.Paths;
import java.text.ParseException;

import de.fuerstenau.buildconfig.BuildConfig;
import de.robojumper.ddsavereader.BuildConfig;
import de.robojumper.ddsavereader.file.DsonWriter;

public class Json2Dson {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/robojumper/ddsavereader/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.robojumper.ddsavereader;

import de.fuerstenau.buildconfig.BuildConfig;
import de.robojumper.ddsavereader.BuildConfig;
import de.robojumper.ddsavereader.spreadsheets.SpreadsheetsService;
import de.robojumper.ddsavereader.ui.MainWindow;
import de.robojumper.ddsavereader.util.ReadNames;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/robojumper/ddsavereader/file/DsonFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public DsonFile(byte[] File, UnhashBehavior behavior) throws ParseException {
Stack<Integer> parentIdxStack = new Stack<Integer>();
// base_root starts at -1
int runningObjIdx = -1;
parentIdxStack.push(new Integer(runningObjIdx));
parentIdxStack.push(Integer.valueOf(runningObjIdx));
rootFields = new ArrayList<DsonField>();
// Is this the correct way to do it?
// WARNING: Apparently, META2 is not necessarily ordered the same way as DATA
Expand Down Expand Up @@ -180,7 +180,7 @@ public DsonFile(byte[] File, UnhashBehavior behavior) throws ParseException {
// If we have an object, push it to the stack
if (field.type == FieldType.TYPE_OBJECT) {
fieldStack.push(field);
parentIdxStack.push(new Integer(runningObjIdx));
parentIdxStack.push(Integer.valueOf(runningObjIdx));
}

// Then check if the object on top of the stack has all its children. If so, pop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum FieldType {
{ "result_event_history" }, // town_event.json
{ "dead_hero_entries" }, // town_event.json
{ "additional_mash_disabled_infestation_monster_class_ids" }, // campaign_mash.json
{ "mash", "valid_additional_mash_entry_indexes" }, // raid.json
{ "party", "heroes" }, // raid.json
{ "skill_cooldown_keys" }, // raid.json
{ "skill_cooldown_values" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public void write(JsonWriter out, Chapter value) throws IOException {

@Override
public Chapter read(JsonReader in) throws IOException {
JsonParser p = new JsonParser();
JsonObject chapterRoot = p.parse(in).getAsJsonObject();
JsonObject chapterRoot = JsonParser.parseReader(in).getAsJsonObject();
Chapter c = new Chapter();
c.chapterIndex = chapterRoot.getAsJsonPrimitive("chapterIndex").getAsInt();
Gson g = SaveState.makeGson();
Expand Down Expand Up @@ -189,8 +188,7 @@ public List<String> getCells() {

@Override
public void update(String json) {
JsonParser parser = new JsonParser();
JsonObject o = parser.parse(json).getAsJsonObject();
JsonObject o = JsonParser.parseString(json).getAsJsonObject();
o = o.getAsJsonObject("base_root");

Gson g = SaveState.makeGson();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/de/robojumper/ddsavereader/model/Estate.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class ItemEntry {

@Override
public void update(String json) {
JsonParser parser = new JsonParser();
JsonObject o = parser.parse(json).getAsJsonObject();
JsonObject o = JsonParser.parseString(json).getAsJsonObject();
o = o.getAsJsonObject("base_root");

Gson g = SaveState.makeGson();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/de/robojumper/ddsavereader/model/Roster.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Map<Integer, Hero> read(JsonReader in) throws IOException {
Map<Integer, Hero> map = new HashMap<>();
in.beginObject();
while (in.peek() != JsonToken.END_OBJECT) {
int id = new Integer(in.nextName());
int id = Integer.valueOf(in.nextName());

in.beginObject();
if (!Objects.equals(in.nextName(), "hero_file_data"))
Expand Down Expand Up @@ -94,8 +94,7 @@ class RosterData {

@Override
public void update(String json) {
JsonParser parser = new JsonParser();
JsonObject o = parser.parse(json).getAsJsonObject();
JsonObject o = JsonParser.parseString(json).getAsJsonObject();
o = o.getAsJsonObject("base_root");

Gson g = SaveState.makeGson();
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/de/robojumper/ddsavereader/model/Town.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public static class BuildingActivitiesTypeAdapter extends TypeAdapter<Map<Intege
@Override
public Map<Integer, String> read(JsonReader in) throws IOException {
Map<Integer, String> map = new LinkedTreeMap<>();
JsonParser p = new JsonParser();
JsonObject o = p.parse(in).getAsJsonObject();
JsonObject o = JsonParser.parseReader(in).getAsJsonObject();
for (Entry<String, JsonElement> e : o.entrySet()) {
String activityName = e.getKey();
for (Entry<String, JsonElement> slot : e.getValue().getAsJsonObject().entrySet()) {
Expand Down Expand Up @@ -78,8 +77,7 @@ class District {

@Override
public void update(String json) {
JsonParser parser = new JsonParser();
JsonObject o = parser.parse(json).getAsJsonObject();
JsonObject o = JsonParser.parseString(json).getAsJsonObject();
o = o.getAsJsonObject("base_root");

Gson g = SaveState.makeGson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.sheets.v4.Sheets;
import com.google.api.services.sheets.v4.SheetsScopes;
Expand All @@ -40,7 +40,7 @@
import de.robojumper.ddsavereader.model.CampaignLog.BaseRTTI;
import de.robojumper.ddsavereader.model.CampaignLog.Chapter;
import de.robojumper.ddsavereader.util.Helpers;
import de.fuerstenau.buildconfig.BuildConfig;
import de.robojumper.ddsavereader.BuildConfig;
import de.robojumper.ddsavereader.file.DsonTypes;
import de.robojumper.ddsavereader.model.Hero;
import de.robojumper.ddsavereader.model.SaveState;
Expand All @@ -49,7 +49,7 @@

public class SpreadsheetsService {
private static final String APPLICATION_NAME = "robojumper-" + BuildConfig.NAME + "/" + BuildConfig.VERSION;
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance();

private static final List<String> SCOPES = Collections.singletonList(SheetsScopes.SPREADSHEETS);
private static final String CLIENT_SECRET_DIR = "/client_secret.json";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void changedUpdate(DocumentEvent e) {

JButton chooseGamePathButton = new JButton("Browse...");
chooseGamePathButton.addActionListener(e -> {
MainWindow.directoryChooser("", s -> this.gameDir = s);
MainWindow.directoryChooser(state.getGameDir(), s -> this.gameDir = s);
gameDataPathBox.setText(this.gameDir);
});
gameDataPathPanel.add(chooseGamePathButton);
Expand All @@ -122,7 +122,7 @@ public void changedUpdate(DocumentEvent e) {

JButton chooseWorkshopPathButton = new JButton("Browse...");
chooseWorkshopPathButton.addActionListener(e -> {
MainWindow.directoryChooser("", s -> this.modsDir = s);
MainWindow.directoryChooser(state.getModsDir(), s -> this.modsDir = s);
workshopPathBox.setText(this.modsDir);
});
workshopPathPanel.add(chooseWorkshopPathButton);
Expand Down
Loading

0 comments on commit 13fa97a

Please sign in to comment.