Skip to content

Commit 39edda0

Browse files
committed
fix: #67
1 parent 83522de commit 39edda0

File tree

8 files changed

+29
-24
lines changed

8 files changed

+29
-24
lines changed

.github/workflows/build_publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
java: [
1717
21, # Current Java LTS & minimum supported by Minecraft
1818
]
19-
os: [ubuntu-22.04]
19+
os: [ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121
if: "!contains(github.event.head_commit.message, 'ci skip')"
2222
steps:
2323
- name: checkout repository
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
- name: setup jdk ${{ matrix.java }}
26-
uses: actions/setup-java@v3
26+
uses: actions/setup-java@v4
2727
with:
2828
java-version: ${{ matrix.java }}
2929
distribution: 'microsoft'
@@ -34,14 +34,14 @@ jobs:
3434
- name: build
3535
run: ./gradlew build
3636
- name: upload to modrinth
37-
if: "github.ref == 'refs/heads/multi/latest' && !contains(github.event.head_commit.message, 'upload skip')"
37+
if: "github.ref == 'refs/heads/multi/1.21.5' && !contains(github.event.head_commit.message, 'upload skip')"
3838
run: ./gradlew modrinth
3939
env:
4040
MODRINTH_TOKEN: ${{ secrets.MODRINTH_UPLOAD_TOKEN }}
4141
GITHUB_RUN_NUMBER: ${{ github.run_number }}
4242
GITHUB_EVENT_RAW_PATH: ${{ github.event_path }}
4343
- name: upload to curseforge
44-
if: "github.ref == 'refs/heads/multi/latest' && !contains(github.event.head_commit.message, 'upload skip')"
44+
if: "github.ref == 'refs/heads/multi/1.21.5' && !contains(github.event.head_commit.message, 'upload skip')"
4545
run: ./gradlew publishCurseForge
4646
env:
4747
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_UPLOAD_TOKEN }}

common/src/main/java/de/rafael/modflared/binary/download/DownloadedCloudflared.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public CompletableFuture<Pair<Boolean, String>> isUptoDate() {
124124

125125
// Check if file is corrupt
126126
if(fileHash.compareTo(file)) {
127+
Modflared.LOGGER.info("Preparing cloudflared binary...");
128+
prepareFile(file);
127129
Modflared.LOGGER.info("Download finished of cloudflared version {}!", version);
128130
return;
129131
} else {
@@ -139,6 +141,20 @@ public CompletableFuture<Pair<Boolean, String>> isUptoDate() {
139141
}, Modflared.EXECUTOR);
140142
}
141143

144+
private void prepareFile(File file) throws IOException, InterruptedException {
145+
switch (Platform.get()) {
146+
case MACOSX:
147+
new ProcessBuilder("tar", "-xzf", file.getName()).directory(file.getParentFile()).start().waitFor();
148+
new ProcessBuilder("mv", "cloudflared", file.getName()).directory(file.getParentFile()).start().waitFor();
149+
//Fallthrough
150+
case LINUX:
151+
new ProcessBuilder("chmod", "+x", file.getName()).directory(file.getParentFile()).start();
152+
break;
153+
default:
154+
break;
155+
}
156+
}
157+
142158
private @NotNull File syncDownloadFile() throws IOException, InterruptedException {
143159
File output = new File(TunnelManager.DATA_FOLDER, download.fileName());
144160
if(!output.getParentFile().exists()) output.getParentFile().mkdirs();
@@ -152,17 +168,6 @@ public CompletableFuture<Pair<Boolean, String>> isUptoDate() {
152168
fileOutputStream.flush();
153169
}
154170

155-
switch (Platform.get()) {
156-
case MACOSX:
157-
new ProcessBuilder("tar", "-xzf", output.getName()).directory(output.getParentFile()).start().waitFor();
158-
new ProcessBuilder("mv", "cloudflared", output.getName()).directory(output.getParentFile()).start().waitFor();
159-
//Fallthrough
160-
case LINUX:
161-
new ProcessBuilder("chmod", "+x", output.getName()).directory(output.getParentFile()).start();
162-
break;
163-
default:
164-
break;
165-
}
166171
return output;
167172
}
168173

fabric/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge
77
import java.nio.file.Files
88

99
plugins {
10-
id "com.gradleup.shadow" version "9.0.0-beta11"
10+
id "com.gradleup.shadow" version "9.0.0-beta17"
1111
id "com.modrinth.minotaur" version "2.+"
1212
id 'net.darkhax.curseforgegradle' version '1.1.15'
1313
}

gradle/wrapper/gradle-wrapper.jar

181 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -205,15 +205,15 @@ fi
205205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206206

207207
# Collect all arguments for the java command:
208-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209209
# and any embedded shellness will be escaped.
210210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211211
# treated as '${Hostname}' itself on the command line.
212212

213213
set -- \
214214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215215
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217217
"$@"
218218

219219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

neoforge/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge
77
import java.nio.file.Files
88

99
plugins {
10-
id "com.gradleup.shadow" version "9.0.0-beta11"
10+
id "com.gradleup.shadow" version "9.0.0-beta17"
1111
id "com.modrinth.minotaur" version "2.+"
1212
id 'net.darkhax.curseforgegradle' version '1.1.15'
1313
}

0 commit comments

Comments
 (0)