Skip to content

Commit 0607b28

Browse files
committed
fix: not rebuilding for new spigot builds
1 parent 8719775 commit 0607b28

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ COPY . .
3636

3737
RUN cargo install --path .
3838

39-
CMD ["bin_patch_gen"]
39+
CMD ["bin_patch_gen", "-v", "1.21.3"]

docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ services:
55
volumes:
66
- ./config.toml:/app/config.toml
77
- ./work:/app/run
8+
- /tmp/bpg:/tmp/bin-patch-gen
89
mem_limit: 2G
910
tests:
1011
container_name: sploon-bin-patch-gen-tests
@@ -13,4 +14,5 @@ services:
1314
volumes:
1415
- ./config.toml:/app/config.toml
1516
- ./work:/app/run
16-
mem_limit: 2G
17+
- /tmp/bpg:/tmp/bin-patch-gen
18+
mem_limit: 2G

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pub async fn run(
220220
warn!("{version} metadata is invalid or could not be read! Rebuilding...");
221221
} else {
222222
let patched_meta = patched_meta.unwrap();
223-
if remote_meta.refs == patched_meta.commit_hashes && !force_build && library_file.exists() {
223+
if remote_meta.refs_eq(patched_meta.commit_hashes) && !force_build && library_file.exists() {
224224
info!("Already built version {version}, skipping");
225225
continue;
226226
}

src/version/schema/spigot.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,26 @@ pub struct SpigotVersionMeta {
77
pub refs: SpigotVersionRefs,
88
}
99

10+
impl SpigotVersionMeta {
11+
pub fn refs_eq(&self, other: SpigotVersionRefs) -> bool {
12+
let refs = self.refs.clone();
13+
14+
refs.build_data == other.build_data
15+
&& refs.bukkit == other.bukkit
16+
&& refs.craft_bukkit == other.craft_bukkit
17+
&& refs.spigot == other.spigot
18+
}
19+
}
20+
1021
#[serial_pascal]
1122
pub struct SpigotVersionRefs {
1223
pub build_data: String,
1324
pub bukkit: String,
1425
pub craft_bukkit: String,
15-
pub spigot: String
26+
pub spigot: String,
1627
}
1728

1829
#[serial]
1930
pub struct SpigotBuildData {
20-
pub server_url: String
31+
pub server_url: String,
2132
}

0 commit comments

Comments
 (0)