Skip to content

Commit

Permalink
log file path support for IJ (#70)
Browse files Browse the repository at this point in the history
* log file path support for IJ

* use static import

* add logFilePath gradle property
  • Loading branch information
amircodota authored Nov 8, 2020
1 parent ec27d4b commit 454c62d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ tasks.create("currentVersion") {
println version
}
}

tasks.getByName("runIde").configure {
if (project.hasProperty('logFilePath')) {
systemProperty("TABNINE_LOG_FILE_PATH", logFilePath)
}
}
9 changes: 9 additions & 0 deletions src/main/java/com/tabnine/binary/BinaryRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import com.tabnine.binary.exceptions.TabNineDeadException;
import com.tabnine.binary.fetch.BinaryVersionFetcher;
import com.tabnine.config.Config;
import com.tabnine.general.StaticConfig;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import static com.tabnine.general.StaticConfig.*;
import static com.tabnine.general.StaticConfig.UNINSTALLING_FLAG;
import static com.tabnine.general.Utils.cmdSanitize;
import static com.tabnine.general.Utils.getTabNinePluginVersion;
Expand Down Expand Up @@ -69,6 +72,12 @@ private ArrayList<String> getBinaryConstantParameters() {
metadata.add("clientVersion=" + cmdSanitize(applicationInfo.getFullVersion()));
metadata.add("clientApiVersion=" + cmdSanitize(applicationInfo.getApiVersion()));
}

getLogFilePath().ifPresent(v -> {
constantParameters.add("--log-file-path");
constantParameters.add(v);
});

constantParameters.addAll(metadata);
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/tabnine/general/StaticConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ public class StaticConfig {
public static final String REMOTE_BASE_URL_PROPERTY = "TABNINE_REMOTE_BASE_URL";
public static final String REMOTE_VERSION_URL_PROPERTY = "TABNINE_REMOTE_VERSION_URL";
public static final String REMOTE_BETA_VERSION_URL_PROPERTY = "TABNINE_REMOTE_BETA_VERSION_URL";
public static final String LOG_FILE_PATH_PROPERTY = "TABNINE_LOG_FILE_PATH";

public static final Icon ICON = IconLoader.findIcon("/icons/tabnine-icon-13px.png");

public static final Optional<String> getLogFilePath() {
return Optional.ofNullable(System.getProperty(LOG_FILE_PATH_PROPERTY));
}

public static String getServerUrl() {
return Optional.ofNullable(System.getProperty(REMOTE_BASE_URL_PROPERTY)).orElse("https://update.tabnine.com");
}
Expand Down

0 comments on commit 454c62d

Please sign in to comment.