Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unescape gcc defines before use #376

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ dependencies {
implementation('commons-fileupload:commons-fileupload:1.3.3')
implementation('commons-io:commons-io:2.11.0')
implementation('io.micrometer:micrometer-core:1.8.1')
implementation('org.apache.commons:commons-compress:1.21')
implementation('org.apache.commons:commons-lang3:3.8.1')
implementation('org.apache.commons:commons-text:1.12.+')
implementation('org.apache.commons:commons-compress:1.26.+')
implementation('org.apache.commons:commons-lang3:3.14.0')
implementation('org.apache.httpcomponents:httpclient:4.5.13')
implementation('org.apache.httpcomponents:httpmime:4.5.13')
implementation('org.influxdb:influxdb-java:2.10')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.beans.factory.annotation.Value;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.stereotype.Service;
import org.apache.commons.text.StringEscapeUtils;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
Expand Down Expand Up @@ -605,6 +606,14 @@ private JSONArray getAsJSONArray(JSONObject o, String key) {
return a;
}

private List<String> unescapeStrings(List<String> strings) {
List<String> unescapedStrings = new ArrayList<>();
for (String s : strings) {
unescapedStrings.add(StringEscapeUtils.unescapeJava(s));
}
return unescapedStrings;
}

// get a string value from a JSON object and split it into a list using space character as delimiter
// will return an empty list if the value does not exist
private List<String> getAsSplitString(JSONObject o, String key) {
Expand Down Expand Up @@ -653,7 +662,7 @@ private void parseConfig(JSONObject config, LanguageSet flags, Set<String> linkf
// https://pewpewthespells.com/blog/buildsettings.html
// defines
if (hasString(config, "GCC_PREPROCESSOR_DEFINITIONS")) {
defines.addAll(getAsSplitString(config, "GCC_PREPROCESSOR_DEFINITIONS"));
defines.addAll(unescapeStrings(getAsSplitString(config, "GCC_PREPROCESSOR_DEFINITIONS")));
}
// linker flags
// https://xcodebuildsettings.com/#other_ldflags
Expand Down
Loading