Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -79,7 +78,7 @@ public ExtenderClient(String extenderBaseUrl, File cacheDir) throws IOException
public ExtenderClient(CookieStore cookieStore,
String extenderBaseUrl,
File cacheDir) throws IOException {
this(new ExtenderClientCache(cacheDir), cookieStore,
this(new ExtenderClientCache(cacheDir),
HttpClientBuilder.create()
.setDefaultRequestConfig(
RequestConfig.custom()
Expand All @@ -92,7 +91,6 @@ public ExtenderClient(CookieStore cookieStore,
}

public ExtenderClient(ExtenderClientCache cache,
CookieStore cookieStore,
HttpClient httpClient,
String extenderBaseUrl) {
this.extenderBaseUrl = extenderBaseUrl;
Expand Down Expand Up @@ -401,7 +399,7 @@ public boolean health() throws IOException {
}

public HttpGet createGetRequest(String url) throws UnsupportedEncodingException {
HttpGet request = new HttpGet(extenderBaseUrl);
HttpGet request = new HttpGet(url);
addAuthorizationHeader(request);
addHeaders(request);
return request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testClientHeaders() throws Exception {
final String HDR_VALUE_2 = "my custom header2";
DefaultHttpClient httpClient = Mockito.mock(DefaultHttpClient.class);

ExtenderClient extenderClient = new ExtenderClient(null, null, httpClient, "http://localhost");
ExtenderClient extenderClient = new ExtenderClient(null, httpClient, "http://localhost");
extenderClient.setHeader(HDR_NAME_1, HDR_VALUE_1);
extenderClient.setHeader(HDR_NAME_2, HDR_VALUE_2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public HtmlMerger(Logger logger) {
HtmlMerger.logger = logger;
}

class HtmlMergeException extends RuntimeException {
};

private MergePolicy getMergePolicy(Element e) {
String attr = e.attr("merge");
return MergePolicy.fromString(attr);
Expand Down Expand Up @@ -108,17 +105,9 @@ private Document loadDocument(File file) throws IOException {
public void merge(File main, File[] libraries, File out) throws RuntimeException, IOException {
Document baseDocument = loadDocument(main);

// For error reporting/troubleshooting
String paths = "\n" + main.getAbsolutePath();

for (File library : libraries) {
paths += "\n" + library.getAbsolutePath();
Document libraryDocument = loadDocument(library);
try {
mergeDocuments(baseDocument, libraryDocument);
} catch (HtmlMergeException e) {
throw new RuntimeException(String.format("Errors merging html files: %s + %s:\n%s", paths, library.getAbsolutePath(), e.toString()));
}
mergeDocuments(baseDocument, libraryDocument);
}

writeDocument(baseDocument, out);
Expand Down
10 changes: 4 additions & 6 deletions server/src/main/java/com/defold/extender/Extender.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Extender {
// * libraryJars - Array of .jar files should be passed to ProGuard as '-libraryjar' entries.
// Everything from a libraryjar will be kept by ProGuard, i.e no optimization or
// obfuscation will be performed.
private class ProGuardContext {
private static class ProGuardContext {
public List<String> proGuardFiles = new ArrayList<>();
public List<String> libraryJars = new ArrayList<>();
}
Expand Down Expand Up @@ -1377,8 +1377,6 @@ private List<File> buildPipelineExtension(File manifest, Map<String, Object> man
// ***************************************************************************
// Python
{
List<File> srcFiles = ExtenderUtil.listFiles(srcDirs, platformConfig.sourceRe);

if (!protoFiles.isEmpty()) {
List<File> generatedFiles = generateProtoSrcForPlugin(extDir, manifestContext, protoFiles, "python");
outputFiles.addAll(generatedFiles);
Expand Down Expand Up @@ -2204,7 +2202,7 @@ private File buildWin32Resources(Map<String, Object> mergedAppContext) throws Ex
context.put("tgt", ExtenderUtil.getRelativePath(buildState.jobDir, resourceFile));

String command = templateExecutor.execute(platformConfig.windresCmd, context);
if (command.equals("")) {
if (command.isEmpty()) {
return null;
}
try {
Expand Down Expand Up @@ -2343,7 +2341,7 @@ private boolean shouldBuildArtifact(String artifact) {
}

private boolean shouldBuildEngine() {
return buildState.getBuildArtifacts().equals("") || shouldBuildArtifact("engine");
return buildState.getBuildArtifacts().isEmpty() || shouldBuildArtifact("engine");
}
private boolean shouldBuildPlugins() {
return shouldBuildArtifact("plugins");
Expand Down Expand Up @@ -2711,7 +2709,7 @@ private List<File> buildApple(String platform) throws ExtenderException {
}

private String getBasePlatform(String platform) {
String[] platformParts = buildState.fullPlatform.split("-");
String[] platformParts = platform.split("-");
return platformParts[1];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void buildEngineAsync(HttpServletRequest _request,
if (remoteBuilderEnabled && buildEnvDescription != null && isRemotePlatform(buildEnvDescription[0], buildEnvDescription[1])) {
LOGGER.info("Building engine on remote builder");
RemoteInstanceConfig remoteInstanceConfig = getRemoteBuilderConfig(buildEnvDescription[0], buildEnvDescription[1]);
this.remoteEngineBuilder.buildAsync(remoteInstanceConfig, uploadDirectory, platform, sdkVersion, jobDirectory, buildDirectory, metricsWriter);
this.remoteEngineBuilder.buildAsync(remoteInstanceConfig, uploadDirectory, platform, sdkVersion, jobDirectory, metricsWriter);
} else if (instanceType.equals(InstanceType.MIXED)) {
asyncBuilder.asyncBuildEngine(metricsWriter, platform, sdkVersion, jobDirectory, uploadDirectory, buildDirectory);
} else {
Expand Down
1 change: 0 additions & 1 deletion server/src/main/java/com/defold/extender/ExtenderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
public class ExtenderUtil
{
static String convertStringToLiteral(String expression) {
String expressionOriginal = expression;
int begin = expression.indexOf("{{");
if (begin >= 0)
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
Expand All @@ -38,7 +37,6 @@

import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -86,7 +84,7 @@ public void buildAsync(final RemoteInstanceConfig remoteInstanceConfig,
final File projectDirectory,
final String platform,
final String sdkVersion,
File jobDirectory, File buildDirectory, MetricsWriter metricsWriter) throws FileNotFoundException, IOException {
File jobDirectory, MetricsWriter metricsWriter) throws FileNotFoundException, IOException {

LOGGER.info("Building engine remotely at {}", remoteInstanceConfig.getUrl());
String jobName = jobDirectory.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class DataCacheService {

private DataCache dataCache;

public class DataCacheServiceInfo {
public static class DataCacheServiceInfo {
public AtomicInteger cachedFileCount = new AtomicInteger();
public AtomicLong cachedFileSize = new AtomicLong();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void destroy() {
}
}

private JSONObject getLocalPlatformSdkMappings(String hash) throws IOException, ParseException {
private JSONObject getLocalPlatformSdkMappings() throws IOException, ParseException {
JSONParser parser = new JSONParser();
return (JSONObject)parser.parse(new FileReader(Path.of(getLocalSdk().toFile().getAbsolutePath(), "platform.sdks.json").toFile()));
}
Expand Down Expand Up @@ -391,7 +391,7 @@ private JSONObject getRemotePlatformSdkMappings(String hash) throws IOException,
}

public JSONObject getPlatformSdkMappings(String hash) throws IOException, ExtenderException, ParseException {
return isLocalSdk(hash) ? getLocalPlatformSdkMappings(hash) : getRemotePlatformSdkMappings(hash);
return isLocalSdk(hash) ? getLocalPlatformSdkMappings() : getRemotePlatformSdkMappings(hash);
}

public void acquireSdk(String hash) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static MainPodfile mainPodfileFromParseResult(PodfileParser.ParseResult parseRes
return res;
}

private class InstalledPods {
private static class InstalledPods {
public Map<String, PodSpec> podsMap = new HashMap<>();
// set of pod's specs to present build order
public Set<String> pods = new LinkedHashSet<>();
Expand Down Expand Up @@ -207,13 +207,10 @@ private Set<String> getPodDeps(Map<String, List<String>> specDepsMap, List<Strin

/**
* Install pods from a podfile and create PodSpec instances for each installed pod.
* @param buildState Extender's build state
* @param cocoapodsBuildState Cocoapod's service build state
* @param jobEnvContext Job environment context which contains all the job environment variables with `env.*` keys
* @return An InstalledPods object with installed pods
*/
private InstalledPods installPods(ExtenderBuildState buildState, CocoaPodsServiceBuildState cocoapodsBuildState,
Map<String, Object> jobEnvContext) throws IOException, ExtenderException {
private InstalledPods installPods(CocoaPodsServiceBuildState cocoapodsBuildState) throws IOException, ExtenderException {
LOGGER.info("Installing pods");
Path cacheDir;
// store current cache dir into local variable to use the same value for all 'pod' runs
Expand Down Expand Up @@ -390,7 +387,7 @@ public ResolvedPods resolveDependencies(PlatformConfig config, ExtenderBuildStat

CocoaPodsServiceBuildState cocoapodsBuildState = new CocoaPodsServiceBuildState(buildState);
MainPodfile mainPodfile = createMainPodfile(buildState, cocoapodsBuildState, platformPodfiles, jobEnvContext);
InstalledPods installedPods = installPods(buildState, cocoapodsBuildState, jobEnvContext);
InstalledPods installedPods = installPods(cocoapodsBuildState);


XCConfigParser parser = new XCConfigParser(buildState, cocoapodsBuildState);
Expand Down
8 changes: 3 additions & 5 deletions server/src/test/java/com/defold/extender/ExtenderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,16 @@ public void testExtender(@TempDir File jobDir) throws IOException, InterruptedEx

Map<String, String> env = createEnv();

Extender extender = new Extender.Builder()
assertDoesNotThrow(() -> new Extender.Builder()
.setPlatform("x86_64-osx")
.setSdk(sdk)
.setJobDirectory(jobDir)
.setUploadDirectory(uploadDir)
.setBuildDirectory(buildDir)
.setEnv(env)
.build();
.build());

uploadDir.delete();
assertTrue(true);
assertTrue(uploadDir.delete());
}

public static MultipartHttpServletRequest createMultipartHttpRequest(List<MockMultipartFile> files) throws IOException {
Expand Down Expand Up @@ -376,7 +375,6 @@ public void testMergedContexts() throws IOException, ExtenderException {
.build();
Map<String, Object> mergedAppContext = extender.getMergedAppContext();

List<String> libsOriginal = Arrays.asList("engine_release", "engine_service_null", "profile_null", "remotery_null", "profilerext_null", "record_null");
List<String> libsExpected = Arrays.asList("clang_rt.osx", "engine_release", "engine_service_null", "remotery_null", "record_null");
assertEquals(libsExpected, mergedAppContext.getOrDefault("libs", new ArrayList<String>()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void testWhitelistCheckPatterns() {
public void testWhitelistCheckContext() throws ExtenderException, IOException {

String[] allowedLibsTemplatesArray = new String[]{"dtrace_dyld", "AccountPolicyTranslation", "alias.A", "alias", "apr-1.0", "apr-1", "aprutil-1.0", "aprutil-1", "archive.2", "archive", "ATCommandStudioDynamic", "auditd.0", "auditd", "auto", "AVFAudio", "blas", "BSDPClient.A", "BSDPClient", "bsm.0", "bsm", "bz2.1.0.5", "bz2.1.0", "bz2", "c\\+\\+.1", "c\\+\\+", "c\\+\\+abi", "c", "cblas", "charset.1.0.0", "charset.1", "charset", "ChineseTokenizer", "clapack", "cmph", "com_err", "compression", "CoreStorage", "CRFSuite", "CRFSuite0.12", "crypto.0.9.7", "crypto.0.9.8", "crypto.35", "crypto", "csfde", "cups.2", "cups", "cupscgi.1", "cupscgi", "cupsimage.2", "cupsimage", "cupsmime.1", "cupsmime", "cupsppdc.1", "cupsppdc", "curl.3", "curl.4", "curl", "curses", "dbm", "des425", "DHCPServer.A", "DHCPServer", "DiagnosticMessagesClient", "dl", "dns_services", "dtrace", "ecpg.6.5", "ecpg.6", "ecpg", "ecpg_compat.3.5", "ecpg_compat.3", "ecpg_compat", "edit.2", "edit.3.0", "edit.3", "edit", "energytrace", "expat.1", "expat", "exslt.0", "exslt", "extension", "f77lapack", "ffi", "form.5.4", "form", "Fosl_dynamic", "gcc_s.1", "gcc_s.10.4", "gcc_s.10.5", "germantok", "gmalloc", "gssapi_krb5", "heimdal-asn1", "hunspell-1.2.0.0.0", "hunspell-1.2.0", "hunspell-1.2", "IASAuthReboot", "IASUnifiedProgress", "iconv.2.4.0", "iconv.2", "iconv", "icucore.A", "icucore", "info", "iodbc.2.1.18", "iodbc.2", "iodbc", "iodbcinst.2.1.18", "iodbcinst.2", "iodbcinst", "ipconfig", "ipsec.A", "ipsec", "k5crypto", "krb4", "krb5", "krb524", "krb5support", "ktrace", "langid", "lapack", "lber", "ldap", "ldap_r", "lzma.5", "lzma", "m", "marisa", "Match.1", "Match", "mecab.1.0.0", "mecab", "mecabra", "menu.5.4", "menu", "mx.A", "mx", "ncurses.5.4", "ncurses.5", "ncurses", "netsnmp.15.1.2", "netsnmp.15", "netsnmp.25", "netsnmp.5.2.1", "netsnmp.5", "netsnmp", "netsnmpagent.25", "netsnmpagent", "netsnmphelpers.25", "netsnmphelpers", "netsnmpmibs.25", "netsnmpmibs", "netsnmptrapd.25", "netsnmptrapd", "network", "objc.A", "objc", "odfde", "odmodule", "OpenScriptingUtil", "pam.1", "pam.2", "pam", "panel.5.4", "panel", "pcap.A", "pcap", "pcre.0", "pcre", "pcreposix.0", "pcreposix", "pgtypes.3.4", "pgtypes.3", "pgtypes", "pmenergy", "pmsample", "poll", "pq.5.6", "pq.5", "pq", "prequelite", "proc", "pthread", "python", "python2.6", "python2.7", "QMIParserDynamic", "quit", "readline", "resolv.9", "resolv", "rpcsvc", "ruby.2.0.0", "ruby.2.0", "ruby", "sandbox.1", "sandbox", "sasl2.2.0.1", "sasl2.2.0.15", "sasl2.2.0.21", "sasl2.2.0.22", "sasl2.2", "sasl2", "ScreenReader", "spindump", "sqlite3.0", "sqlite3", "ssl.0.9.7", "ssl.0.9.8", "ssl.35", "ssl", "stdc\\+\\+.6.0.9", "stdc\\+\\+.6", "stdc\\+\\+", "sysmon", "System.B", "System.B_debug", "System", "System_debug", "systemstats", "tcl", "tcl8.5", "TelephonyUtilDynamic", "termcap", "ThaiTokenizer", "tidy.A", "tidy", "tk", "tk8.5", "tls.6", "tls", "UniversalAccess", "util", "util1.0", "xar.1", "xar", "xcselect", "xml2.2", "xml2", "Xplugin.1", "Xplugin", "XSEvent", "xslt.1", "xslt", "z.1.1.3", "z.1.2.5", "z.1", "z", "ssh-keychain", "dispatch", "system_pthread", "cache", "commonCrypto", "compiler_rt", "copyfile", "corecrypto", "dispatch", "dyld", "keymgr", "kxld", "launch", "macho", "mathCommon.A", "mathCommon", "quarantine", "removefile", "system_asl", "system_blocks", "system_c", "system_configuration", "system_coreservices", "system_coretls", "system_dnssd", "system_info", "system_kernel", "system_m", "system_malloc", "system_network", "system_networkextension", "system_notify", "system_platform", "system_pthread", "system_sandbox", "system_secinit", "system_trace", "unc", "unwind", "xpc", "AGL", "AVFoundation", "AVKit", "Accelerate", "Accounts", "AddressBook", "AppKit", "AppKitScripting", "AppleScriptKit", "AppleScriptObjC", "ApplicationServices", "AudioToolbox", "AudioUnit", "AudioVideoBridging", "Automator", "CFNetwork", "CalendarStore", "Carbon", "CloudKit", "Cocoa", "Collaboration", "Contacts", "ContactsUI", "CoreAudio", "CoreAudioKit", "CoreBluetooth", "CoreData", "CoreFoundation", "CoreGraphics", "CoreImage", "CoreLocation", "CoreMIDI", "CoreMIDIServer", "CoreMedia", "CoreMediaIO", "CoreServices", "CoreTelephony", "CoreText", "CoreVideo", "CoreWLAN", "CryptoTokenKit", "DVComponentGlue", "DVDPlayback", "DirectoryService", "DiscRecording", "DiscRecordingUI", "DiskArbitration", "DrawSprocket", "EventKit", "ExceptionHandling", "FWAUserLib", "FinderSync", "ForceFeedback", "Foundation", "GLKit", "GLUT", "GSS", "GameController", "GameKit", "GameplayKit", "Hypervisor", "ICADevices", "IMServicePlugIn", "IOBluetooth", "IOBluetoothUI", "IOKit", "IOSurface", "ImageCaptureCore", "ImageIO", "InputMethodKit", "InstallerPlugins", "InstantMessage", "JavaFrameEmbedding", "JavaScriptCore", "JavaVM", "Kerberos", "Kernel", "LDAP", "LatentSemanticMapping", "LocalAuthentication", "MapKit", "MediaAccessibility", "MediaLibrary", "MediaToolbox", "Message", "Metal", "MetalKit", "ModelIO", "MultipeerConnectivity", "NetFS", "NetworkExtension", "NotificationCenter", "OSAKit", "OpenAL", "OpenCL", "OpenDirectory", "OpenGL", "PCSC", "Photos", "PhotosUI", "PreferencePanes", "PubSub", "Python", "QTKit", "Quartz", "QuartzCore", "QuickLook", "QuickTime", "Ruby", "SceneKit", "ScreenSaver", "Scripting", "ScriptingBridge", "Security", "SecurityFoundation", "SecurityInterface", "ServiceManagement", "Social", "SpriteKit", "StoreKit", "SyncServices", "System", "SystemConfiguration", "TWAIN", "Tcl", "Tk", "VideoDecodeAcceleration", "VideoToolbox", "WebKit", "vecLib", "vmnet"};
List<String> allowedLibsTemplates = Arrays.asList(allowedLibsTemplatesArray);

String[] allowedFlagsTemplatesArray = new String[]{"-ObjC", "-ObjC++", "-Wa,{{comma_separated_arg}}", "-W{{warning}}", "-ansi", "--ansi", "-std-default={{arg}}", "-stdlib=(libstdc\\+\\+|libc\\+\\+)", "-w", "-std=(c89|c99|c\\+\\+0x|c\\+\\+11|c\\+\\+14|c\\+\\+17|c\\+\\+20)", "-Wp,{{comma_separated_arg}}", "-W{{warning}}", "--extra-warnings", "--warn-{{warning}}", "--warn-={{warning}}", "-ferror-limit={{number}}", "-O([0-4]?|fast|s|z)"};
List<String> allowedFlagsTemplates = Arrays.asList(allowedFlagsTemplatesArray);
Expand Down
5 changes: 5 additions & 0 deletions server/src/test/java/com/defold/extender/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public DefoldVersion(String sha1, Version version, String[] platforms)
this.version = version;
this.platforms = platforms;
}

@Override
public String toString() {
return version.toString();
}
}

private static class TestConfiguration {
Expand Down
Loading
Loading