Skip to content

Commit

Permalink
Merge pull request #247 from ogri-la/curseforge-classic-fix
Browse files Browse the repository at this point in the history
* adds fix for ignoring classic (BC) addons from curseforge
* removes errant debug statement I left in the 3.3.0 release
  • Loading branch information
torkus authored Apr 3, 2021
2 parents ad332cf + a67d964 commit 45e2c9b
Show file tree
Hide file tree
Showing 11 changed files with 763 additions and 87 deletions.
45 changes: 45 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Clojure CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-clojure/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/clojure:openjdk-11

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

environment:
# LEIN_ROOT: "true" # running as root not cool
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m # 3.2GB, 2.9GiB

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "project.clj" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: |
sudo apt install libgtk-3-0 libxtst6 --no-install-recommends -y
# 'lein cloverage -h' will pull down further deps for the plugin without actually running it
lein deps && lein cloverage -h
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "project.clj" }}

# run tests!
- run: ./run-tests.sh
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Arch Linux users can install `strongbox` from the [AUR](https://aur.archlinux.or

For other Linux users:

1. download: [./releases/strongbox](https://github.com/ogri-la/strongbox/releases/download/3.3.0/strongbox)
1. download: [./releases/strongbox](https://github.com/ogri-la/strongbox/releases/download/3.3.1/strongbox)
2. make executable: `chmod +x strongbox`
3. run: `./strongbox`

If you're on macOS or just prefer Java `.jar` files (requires Java 11+):

1. download: [./releases/strongbox-3.3.0-standalone.jar](https://github.com/ogri-la/strongbox/releases/download/3.3.0/strongbox-3.3.0-standalone.jar)
2. run: `java -jar strongbox-3.3.0-standalone.jar`
1. download: [./releases/strongbox-3.3.1-standalone.jar](https://github.com/ogri-la/strongbox/releases/download/3.3.1/strongbox-3.3.1-standalone.jar)
2. run: `java -jar strongbox-3.3.1-standalone.jar`

## Usage

Expand Down
24 changes: 12 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>ogri-la</groupId>
<artifactId>strongbox</artifactId>
<packaging>jar</packaging>
<version>3.3.0</version>
<version>3.3.1</version>
<name>strongbox</name>
<description>World Of Warcraft Addon Manager</description>
<url>https://github.com/ogri-la/strongbox</url>
Expand All @@ -18,7 +18,7 @@
<url>https://github.com/ogri-la/strongbox</url>
<connection>scm:git:git://github.com/ogri-la/strongbox.git</connection>
<developerConnection>scm:git:ssh://git@github.com/ogri-la/strongbox.git</developerConnection>
<tag>9b3efb0dd48022d95bdd2ac797f731f43aeed05a</tag>
<tag>f6b4359c59efaaa30eac242497c6ffe01b54c6c9</tag>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
Expand Down Expand Up @@ -156,7 +156,7 @@
<dependency>
<groupId>cljfx</groupId>
<artifactId>cljfx</artifactId>
<version>1.7.8</version>
<version>1.7.13</version>
<exclusions>
<exclusion>
<artifactId>javafx-web</artifactId>
Expand All @@ -176,52 +176,52 @@
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>14</version>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>14</version>
<version>15.0.1</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>14</version>
<version>15.0.1</version>
<classifier>mac</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
<version>15.0.1</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
<version>15.0.1</version>
<classifier>mac</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>14</version>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>14</version>
<version>15.0.1</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>14</version>
<version>15.0.1</version>
<classifier>mac</classifier>
</dependency>
<dependency>
Expand Down
30 changes: 17 additions & 13 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject ogri-la/strongbox "3.3.0"
(defproject ogri-la/strongbox "3.3.1"
:description "World Of Warcraft Addon Manager"
:url "https://github.com/ogri-la/strongbox"
:license {:name "GNU Affero General Public License (AGPL)"
Expand All @@ -23,21 +23,21 @@
[envvar "1.1.0"] ;; environment variable wrangling
[gui-diff "0.6.7"] ;; pops up a graphical diff for test results
[com.taoensso/tufte "2.1.0"]
[cljfx "1.7.8" :exclusions [org.openjfx/javafx-web
org.openjfx/javafx-media]]
[cljfx "1.7.13" :exclusions [org.openjfx/javafx-web
org.openjfx/javafx-media]]
[cljfx/css "1.1.0"]

[org.openjfx/javafx-base "14"]
[org.openjfx/javafx-base "14" :classifier "linux"]
[org.openjfx/javafx-base "14" :classifier "mac"]
[org.openjfx/javafx-base "15.0.1"]
[org.openjfx/javafx-base "15.0.1" :classifier "linux"]
[org.openjfx/javafx-base "15.0.1" :classifier "mac"]

[org.openjfx/javafx-controls "14"]
[org.openjfx/javafx-controls "14" :classifier "linux"]
[org.openjfx/javafx-controls "14" :classifier "mac"]
[org.openjfx/javafx-controls "15.0.1"]
[org.openjfx/javafx-controls "15.0.1" :classifier "linux"]
[org.openjfx/javafx-controls "15.0.1" :classifier "mac"]

[org.openjfx/javafx-graphics "14"]
[org.openjfx/javafx-graphics "14" :classifier "linux"]
[org.openjfx/javafx-graphics "14" :classifier "mac"]
[org.openjfx/javafx-graphics "15.0.1"]
[org.openjfx/javafx-graphics "15.0.1" :classifier "linux"]
[org.openjfx/javafx-graphics "15.0.1" :classifier "mac"]

;; remember to update the LICENCE.txt
;; remember to update pom file (`lein pom`)
Expand All @@ -54,11 +54,15 @@
;; - https://github.com/cljfx/cljfx/issues/17
:injections [(javafx.application.Platform/exit)]}}

;; debug output from JavaFX about which GTK it is looking for.
;; was useful in figuring out why javafx was failing to initialise even with xvfb.
;;:jvm-opts ["-Djdk.gtk.verbose=true"]

:main strongbox.main

:plugins [[lein-cljfmt "0.6.4"]
[jonase/eastwood "0.3.13"]
[lein-cloverage "1.1.1"]]
[lein-cloverage "1.2.2"]]
:eastwood {:exclude-linters [:constant-test]
;; linters that are otherwise disabled
:add-linters [:unused-namespaces
Expand Down
25 changes: 15 additions & 10 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ function finish {
}
trap finish EXIT

lein cloverage --runner "strongbox" --fail-threshold "$fail_threshold" --html || {
retval="$?"
# 1 for failed tests
# 253 for failed coverage
if [ "$retval" = "253" ]; then
if which otter-browser; then
otter-browser "file://$(pwd)/target/coverage/index.html" &
if which xvfb-run; then
# CI
xvfb-run lein cloverage --runner "strongbox" --fail-threshold "$fail_threshold" --html
else
lein cloverage --runner "strongbox" --fail-threshold "$fail_threshold" --html || {
retval="$?"
# 1 for failed tests
# 253 for failed coverage
if [ "$retval" = "253" ]; then
if which otter-browser; then
otter-browser "file://$(pwd)/target/coverage/index.html" &
fi
fi
fi
exit "$retval"
}
exit "$retval"
}
fi
17 changes: 13 additions & 4 deletions src/strongbox/curseforge_api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
[release map?]
(let [;; "wow_retail", "wow_classic" => :retail, :classic
fallback (if (= (:gameVersionFlavor release) "wow_classic") :classic :retail)

;; if the `:gameVersion` value is missing we assume this addon supports the latest version of `:retail`
;; if we know the `gameVersionFlavor` we can switch that assumption to the latest version of `:classic`
release (if (empty? (:gameVersion release))
(assoc release :gameVersion [(utils/game-track-to-latest-game-version fallback)])
release)
Expand All @@ -94,8 +97,15 @@
:version (:displayName release)
:release-label (format "[WoW %s] %s" (first (:gameVersion release)) name)
:game-track (utils/game-version-to-game-track game-version)}
interface-version)))]
(mapv pad-release (:gameVersion release))))
interface-version)))

padded-release-list (mapv pad-release (:gameVersion release))

;; 2021-04-02: curseforge is using a `:gameVersionFlavor` of `null` and `2.5.1` as the `:gameVersion` for WoW Classic (BC).
;; this fn must return a valid `:addon/release-list` and that means `:game-track` cannot be anything other than `:classic` or `:retail`.
;; so lets remove these releases until we can support them.
unknown-game-track (comp nil? :game-track)]
(vec (remove unknown-game-track padded-release-list))))

(defn-spec prune-leading-duplicates (s/or :ok :addon/release-list, :garbage-in nil?)
"curseforge may produce the same release under `:latestFiles` and `:gameVersionLatestFiles`.
Expand All @@ -109,8 +119,7 @@
(if (= (:download-url latest-release)
(:download-url latest-release-by-game-version))
(concat [latest-release] (rest (rest release-list)))
(do (info "no match!" latest-release latest-release-by-game-version)
release-list)))))
release-list))))

(defn-spec group-releases map?
"given a curseforge api result, returns a map of release data keyed by `game-track`."
Expand Down
5 changes: 4 additions & 1 deletion src/strongbox/github_api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@
vals)
(map utils/interface-version-to-game-version)
(map utils/game-version-to-game-track)
;; 2021-04-02: game versions of 2.x are now considered "Classic (BC)" and return `nil` as the game track.
;; classic-bc is not yet supported.
(remove nil?)
set
vec ;; do I need this ..?
vec
utils/nilable)))

(defn-spec find-gametracks-toc-data (s/or :ok ::sp/game-track-list, :error nil?)
Expand Down
13 changes: 8 additions & 5 deletions src/strongbox/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,16 @@
(when (and major minor)
(+ (* 10000 major) (* 100 minor)))))

(defn-spec game-version-to-game-track ::sp/game-track
(defn-spec game-version-to-game-track (s/nilable ::sp/game-track)
"'1.13.2' => ':classic', '8.2.0' => 'retail'"
[game-version string?]
(if (= "1." (subs game-version 0 2))
;; 1.x.x == classic (for now)
:classic
:retail))
(let [prefix (safe-subs game-version 2)]
(case prefix
;; 1.x.x == classic (vanilla)
"1." :classic
;; 2.x.x == classic (burning crusade) (probably)
"2." nil ;; todo
:retail)))

(defn-spec interface-version-to-game-track (s/or :ok ::sp/game-track, :err nil?)
"converts an interface version like '80000' to a game track like ':retail'"
Expand Down
Loading

0 comments on commit 45e2c9b

Please sign in to comment.