diff --git a/bin/linux/fsnotifier-arm b/bin/linux/fsnotifier-arm deleted file mode 100755 index a71b5823454e..000000000000 Binary files a/bin/linux/fsnotifier-arm and /dev/null differ diff --git a/native/fsNotifier/linux/make.sh b/native/fsNotifier/linux/make.sh index 4aae5a0ced88..ac005e449084 100755 --- a/native/fsNotifier/linux/make.sh +++ b/native/fsNotifier/linux/make.sh @@ -1,16 +1,23 @@ #!/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") 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 - echo "compiling 32-bit version" - clang -m32 ${CC_FLAGS} -o fsnotifier main.c inotify.c util.c && chmod 755 fsnotifier -fi +if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then + echo "*** Compiling amd64 version (fsnotifier64) ..." + compile_clang -o fsnotifier64 main.c inotify.c util.c && \ + chmod 755 fsnotifier64 -if [ -f "/usr/include/gnu/stubs-64.h" ] ; then - echo "compiling 64-bit version" - clang -m64 ${CC_FLAGS} -o fsnotifier64 main.c inotify.c util.c && chmod 755 fsnotifier64 + # dependencies: libc6-dev:i386 libgcc-9-dev:i386 + printf "\n\n*** Compiling i386 version (fsnotifier) ...\n" + 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 \ No newline at end of file diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy index bf49ea625cb8..82999aaf37a8 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy @@ -214,7 +214,6 @@ class LinuxDistributionBuilder extends OsSpecificDistributionBuilder { buildContext.ant.copy(todir: unixSnapDistPath) { fileset(dir: unixDistPath) { exclude(name: "bin/fsnotifier") - exclude(name: "bin/fsnotifier-arm") exclude(name: "bin/libyjpagent-linux.so") } } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java index c07c432a7e7d..52af14a4168f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java @@ -19,10 +19,12 @@ import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; import com.intellij.openapi.vfs.local.PluggableFileWatcher; import com.intellij.openapi.vfs.newvfs.ManagingFS; +import com.intellij.util.ArrayUtil; import com.intellij.util.TimeoutUtil; import com.intellij.util.io.BaseDataReader; import com.intellij.util.io.BaseOutputReader; import com.sun.jna.Platform; +import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; 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_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 EXIT_COMMAND = "EXIT"; 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"); } else if (myExecutable == null) { - notifyOnFailure(ApplicationBundle.message("watcher.exe.not.found"), null); - } - else if (myExecutable == PLATFORM_NOT_SUPPORTED) { - notifyOnFailure(ApplicationBundle.message("watcher.exe.not.exists"), 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 (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()) { String message = ApplicationBundle.message("watcher.exe.not.exe", myExecutable); @@ -129,10 +135,13 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher { */ @Nullable protected File getExecutable() { - String execPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH); - if (execPath != null) return new File(execPath); + String customPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH); + 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 ("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"}; @@ -143,11 +152,8 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher { else if (SystemInfo.isLinux) { 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-arm".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier-arm"}; } - if (names == null) return PLATFORM_NOT_SUPPORTED; - - return Arrays.stream(names).map(PathManager::findBinFile).filter(o -> o != null).findFirst().orElse(null); + return StreamEx.of(names).map(PathManager::findBinFile).nonNull().findFirst().orElse(null); } /* internal stuff */ diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties index ccf4546946f6..44bbed37b83a 100644 --- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties +++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties @@ -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.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 these instructions to compile it yourself. watcher.exe.not.exists=Native file watcher is not supported on this platform watcher.exe.not.exe=Native file watcher is not executable: {0} watcher.failed.to.start=File watcher failed to start diff --git a/plugins/devkit/devkit-core/src/actions/updateFromSources/UpdateIdeFromSourcesAction.kt b/plugins/devkit/devkit-core/src/actions/updateFromSources/UpdateIdeFromSourcesAction.kt index 8410180c2644..5fbff4dbd693 100644 --- a/plugins/devkit/devkit-core/src/actions/updateFromSources/UpdateIdeFromSourcesAction.kt +++ b/plugins/devkit/devkit-core/src/actions/updateFromSources/UpdateIdeFromSourcesAction.kt @@ -329,7 +329,7 @@ private val safeToDeleteFilesInHome = setOf( private val safeToDeleteFilesInBin = setOf( "append.bat", "appletviewer.policy", "format.sh", "format.bat", - "fsnotifier", "fsnotifier-arm", "fsnotifier64", + "fsnotifier", "fsnotifier64", "inspect.bat", "inspect.sh", "restarter" /*