Skip to content

Commit

Permalink
Add a fragment that supports linux native polling using panama
Browse files Browse the repository at this point in the history
This adds native polling support for linux with the inotify API.
  • Loading branch information
laeubi committed Mar 6, 2023
1 parent a655c68 commit 4a76567
Show file tree
Hide file tree
Showing 24 changed files with 1,969 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.2">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions resources/bundles/org.eclipse.core.resources.linux.x86_64/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.core.resources.linux.x86_64</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/fragment.properties=ISO-8859-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %linuxFragmentName
Bundle-SymbolicName: org.eclipse.core.resources.linux.x86_64
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=x86_64))
Fragment-Host: org.eclipse.core.resources;bundle-version="3.18.200"
Automatic-Module-Name: org.eclipse.core.resources.linux.x86.64
Bundle-RequiredExecutionEnvironment: JavaSE-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Import-Package: jdk.incubator.foreign
Require-Capability: (&(osgi.ee=JavaSE)(version=17))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Import-Package: jdk.incubator.foreign
Require-Capability: (&(osgi.ee=JavaSE)(version=19))
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Linux native binding for platform.resources

This fragment provides native binding to the linux host system using the [Project Panama](https://openjdk.org/projects/panama/).
The wrapped API is the inotify API (https://man7.org/linux/man-pages/man7/inotify.7.html)

Generate the code:
- sudo apt-get install libinotifytools0-dev
- get a suitable jextract from https://jdk.java.net/panama/ (Java 19) or https://jdk.java.net/panama/17/ (Java 17)
- enter the src<java version> directory
- jextract --source -t org.eclipse.core.internal.resources.refresh.linux.inotify /usr/include/inotifytools/inotify.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>

<p>November 30, 2017</p>
<h3>License</h3>

<p>
The Eclipse Foundation makes available all content in this plug-in
(&quot;Content&quot;). Unless otherwise indicated below, the Content
is provided to you under the terms and conditions of the Eclipse
Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>

<p>
If you did not receive this Content directly from the Eclipse
Foundation, the Content is being redistributed by another party
(&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the
Redistributor's license that was provided with the Content. If no such
license exists, contact the Redistributor. Unless otherwise indicated
below, the terms and conditions of the EPL still apply to any source
code in the Content and such source code may be obtained at <a
href="http://www.eclipse.org/">http://www.eclipse.org</a>.
</p>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###############################################################################
# Copyright (c) 2023 Christoph Läubrich and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Christoph Läubrich - initial API and implementation
###############################################################################
providerName = Eclipse.org
linuxragmentName = Core Resource Management Linux Fragment
linuxMonitorFactoryName = Linux Auto-refresh monitor
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<fragment>
<extension
id="win32"
point="org.eclipse.core.resources.refreshProviders">
<refreshProvider
name="%linuxMonitorFactoryName"
class="org.eclipse.core.internal.resources.refresh.linux.LinuxRefreshProvider">
</refreshProvider>
</extension>
</fragment>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/********************************************************************************
* Copyright (c) 2023 Christoph Läubrich and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Läubrich - initial API and implementation
********************************************************************************/
package org.eclipse.core.internal.resources.refresh.linux;

import org.eclipse.core.resources.refresh.RefreshProvider;

/**
* The default implementation simply do nothing what will result in fallback to
* the plain polling
*/
public class LinuxRefreshProvider extends RefreshProvider {

}
Loading

0 comments on commit 4a76567

Please sign in to comment.