[platform] drops linux-arm build of fsnotifier; links to compilation instructions on exotic architectures

GitOrigin-RevId: d06b2e1f53e2645dc31f2541a8bd194fdecfb29b
This commit is contained in:
Roman Shevchenko
2019-10-18 16:43:19 +02:00
committed by intellij-monorepo-bot
parent 3717428e19
commit c3e404caf7
6 changed files with 36 additions and 22 deletions

Binary file not shown.

View File

@@ -1,16 +1,23 @@
#!/bin/sh #!/bin/sh
CC_FLAGS="-O2 -Wall -Wextra -Wpedantic -std=c11 -D_DEFAULT_SOURCE" compile_clang() { clang -O2 -Wall -Wextra -Wpedantic -std=c11 -D_DEFAULT_SOURCE "$@"; }
compile_cc() { cc -O2 -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -std=c11 -D_DEFAULT_SOURCE "$@"; }
VER=$(date "+%Y%m%d.%H%M") VER=$(date "+%Y%m%d.%H%M")
sed -i.bak "s/#define VERSION .*/#define VERSION \"${VER}\"/" fsnotifier.h && rm fsnotifier.h.bak sed -i.bak "s/#define VERSION .*/#define VERSION \"${VER}\"/" fsnotifier.h && rm fsnotifier.h.bak
ARCH=$(uname -m)
if [ -f "/usr/include/gnu/stubs-32.h" ] ; then if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
echo "compiling 32-bit version" echo "*** Compiling amd64 version (fsnotifier64) ..."
clang -m32 ${CC_FLAGS} -o fsnotifier main.c inotify.c util.c && chmod 755 fsnotifier compile_clang -o fsnotifier64 main.c inotify.c util.c && \
fi chmod 755 fsnotifier64
if [ -f "/usr/include/gnu/stubs-64.h" ] ; then # dependencies: libc6-dev:i386 libgcc-9-dev:i386
echo "compiling 64-bit version" printf "\n\n*** Compiling i386 version (fsnotifier) ...\n"
clang -m64 ${CC_FLAGS} -o fsnotifier64 main.c inotify.c util.c && chmod 755 fsnotifier64 compile_clang -target i686-linux-elf -o fsnotifier main.c inotify.c util.c && \
chmod 755 fsnotifier
else
echo "*** Compiling platform-specific version (fsnotifier-$ARCH)..."
compile_cc -o fsnotifier-"$ARCH" main.c inotify.c util.c && \
chmod 755 fsnotifier-"$ARCH"
fi fi

View File

@@ -214,7 +214,6 @@ class LinuxDistributionBuilder extends OsSpecificDistributionBuilder {
buildContext.ant.copy(todir: unixSnapDistPath) { buildContext.ant.copy(todir: unixSnapDistPath) {
fileset(dir: unixDistPath) { fileset(dir: unixDistPath) {
exclude(name: "bin/fsnotifier") exclude(name: "bin/fsnotifier")
exclude(name: "bin/fsnotifier-arm")
exclude(name: "bin/libyjpagent-linux.so") exclude(name: "bin/libyjpagent-linux.so")
} }
} }

View File

@@ -19,10 +19,12 @@ import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; import com.intellij.openapi.vfs.local.FileWatcherNotificationSink;
import com.intellij.openapi.vfs.local.PluggableFileWatcher; import com.intellij.openapi.vfs.local.PluggableFileWatcher;
import com.intellij.openapi.vfs.newvfs.ManagingFS; import com.intellij.openapi.vfs.newvfs.ManagingFS;
import com.intellij.util.ArrayUtil;
import com.intellij.util.TimeoutUtil; import com.intellij.util.TimeoutUtil;
import com.intellij.util.io.BaseDataReader; import com.intellij.util.io.BaseDataReader;
import com.intellij.util.io.BaseOutputReader; import com.intellij.util.io.BaseOutputReader;
import com.sun.jna.Platform; import com.sun.jna.Platform;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly; import org.jetbrains.annotations.TestOnly;
@@ -45,7 +47,6 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher {
private static final String PROPERTY_WATCHER_DISABLED = "idea.filewatcher.disabled"; private static final String PROPERTY_WATCHER_DISABLED = "idea.filewatcher.disabled";
private static final String PROPERTY_WATCHER_EXECUTABLE_PATH = "idea.filewatcher.executable.path"; private static final String PROPERTY_WATCHER_EXECUTABLE_PATH = "idea.filewatcher.executable.path";
private static final File PLATFORM_NOT_SUPPORTED = new File("(platform not supported)");
private static final String ROOTS_COMMAND = "ROOTS"; private static final String ROOTS_COMMAND = "ROOTS";
private static final String EXIT_COMMAND = "EXIT"; private static final String EXIT_COMMAND = "EXIT";
private static final int MAX_PROCESS_LAUNCH_ATTEMPT_COUNT = 10; private static final int MAX_PROCESS_LAUNCH_ATTEMPT_COUNT = 10;
@@ -73,10 +74,15 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher {
LOG.info("Native file watcher is disabled"); LOG.info("Native file watcher is disabled");
} }
else if (myExecutable == null) { else if (myExecutable == null) {
notifyOnFailure(ApplicationBundle.message("watcher.exe.not.found"), null); if (SystemInfo.isWindows || SystemInfo.isMac || SystemInfo.isLinux && ArrayUtil.contains(Platform.RESOURCE_PREFIX, "linux-x86", "linux-x86-64")) {
} notifyOnFailure(ApplicationBundle.message("watcher.exe.not.found"), null);
else if (myExecutable == PLATFORM_NOT_SUPPORTED) { }
notifyOnFailure(ApplicationBundle.message("watcher.exe.not.exists"), null); else if (SystemInfo.isLinux) {
notifyOnFailure(ApplicationBundle.message("watcher.exe.compile"), NotificationListener.URL_OPENING_LISTENER);
}
else {
notifyOnFailure(ApplicationBundle.message("watcher.exe.not.exists"), null);
}
} }
else if (!myExecutable.canExecute()) { else if (!myExecutable.canExecute()) {
String message = ApplicationBundle.message("watcher.exe.not.exe", myExecutable); String message = ApplicationBundle.message("watcher.exe.not.exe", myExecutable);
@@ -129,10 +135,13 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher {
*/ */
@Nullable @Nullable
protected File getExecutable() { protected File getExecutable() {
String execPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH); String customPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH);
if (execPath != null) return new File(execPath); if (customPath != null) {
File customFile = PathManager.findBinFile(customPath);
return customFile != null ? customFile : new File(customPath);
}
String[] names = null; String[] names = ArrayUtil.EMPTY_STRING_ARRAY;
if (SystemInfo.isWindows) { if (SystemInfo.isWindows) {
if ("win32-x86".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier.exe"}; if ("win32-x86".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier.exe"};
else if ("win32-x86-64".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier64.exe", "fsnotifier.exe"}; else if ("win32-x86-64".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier64.exe", "fsnotifier.exe"};
@@ -143,11 +152,8 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher {
else if (SystemInfo.isLinux) { else if (SystemInfo.isLinux) {
if ("linux-x86".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier"}; if ("linux-x86".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier"};
else if ("linux-x86-64".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier64"}; else if ("linux-x86-64".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier64"};
else if ("linux-arm".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier-arm"};
} }
if (names == null) return PLATFORM_NOT_SUPPORTED; return StreamEx.of(names).map(PathManager::findBinFile).nonNull().findFirst().orElse(null);
return Arrays.stream(names).map(PathManager::findBinFile).filter(o -> o != null).findFirst().orElse(null);
} }
/* internal stuff */ /* internal stuff */

View File

@@ -698,6 +698,8 @@ desktop.entry.sudo.prompt=Please enter your password to create a desktop entry
watcher.slow.sync=External file changes sync may be slow watcher.slow.sync=External file changes sync may be slow
watcher.exe.not.found=Native file watcher executable not found watcher.exe.not.found=Native file watcher executable not found
watcher.exe.compile=Unfortunately, JetBrains does not officially support native file watcher for this architecture. \
Please follow <a href="https://confluence.jetbrains.com/display/IDEADEV/Compiling+File+Watcher">these instructions</a> to compile it yourself.
watcher.exe.not.exists=Native file watcher is not supported on this platform watcher.exe.not.exists=Native file watcher is not supported on this platform
watcher.exe.not.exe=Native file watcher is not executable: <a href="{0}">{0}</a> watcher.exe.not.exe=Native file watcher is not executable: <a href="{0}">{0}</a>
watcher.failed.to.start=File watcher failed to start watcher.failed.to.start=File watcher failed to start

View File

@@ -329,7 +329,7 @@ private val safeToDeleteFilesInHome = setOf(
private val safeToDeleteFilesInBin = setOf( private val safeToDeleteFilesInBin = setOf(
"append.bat", "appletviewer.policy", "format.sh", "format.bat", "append.bat", "appletviewer.policy", "format.sh", "format.bat",
"fsnotifier", "fsnotifier-arm", "fsnotifier64", "fsnotifier", "fsnotifier64",
"inspect.bat", "inspect.sh", "inspect.bat", "inspect.sh",
"restarter" "restarter"
/* /*