Skip to content

Commit

Permalink
Pepare Maven Central release, fix JavaDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
kristian committed Apr 26, 2020
1 parent 78b2d9e commit ecac4d1
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 96 deletions.
19 changes: 2 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,31 +130,16 @@ Feel free to use the classes `lc.kra.system.keyboard.GobalKeyboardHook` and `lc.
The `LibraryLoader` will first attempt to load the native libraries from the `java.library.path` and fall back checking the archives `/lc/kra/system/lib` package, if no libraries where found.

### Maven Dependency
You can include `system-hook` from this GitHub repository by adding this dependency to your `pom.xml`:
You can include `system-hook` as a dependency from Maven Central by adding it to your `pom.xml`:

```xml
<dependency>
<groupId>lc.kra.system</groupId>
<artifactId>system-hook</artifactId>
<version>3.6</version>
<version>3.7</version>
</dependency>
```

Additionally you will have to add the following repository to your `pom.xml`:

```xml
<repositories>
<repository>
<id>system-hook-mvn-repo</id>
<url>https://raw.github.com/kristian/system-hook/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
```

Build
-----

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 3.6.{build}
version: 3.7.{build}

branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ SOFTWARE.
<property name="ant.native.linker" value="${ant.native.compiler}" />
</target>

<target name="compile" depends="initialize" description="Compiles JNI source files.">
<target name="compile" depends="initialize" description="Compiles JNI source files." unless="skipNativeCompile">
<property name="ant.native.library" value="systemhook-${ant.os}-${ant.os.arch}.dll" />

<cc objdir="${ant.dir.objects}" outfile="${ant.dir.library}/${ant.native.library}" subsystem="console" debug="${ant.native.debug}">
Expand Down
145 changes: 100 additions & 45 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>lc.kra.system</groupId>
<artifactId>system-hook</artifactId>
<version>3.6</version>
<version>3.7</version>

<name>Java System Hook</name>
<description>Global Keyboard / Mouse Hook for Java applications.</description>
<url>https://github.com/kristian/system-hook</url>

Expand All @@ -14,9 +17,9 @@

<distributionManagement>
<repository>
<id>deploy.repo</id>
<name>Staging Repository</name>
<url>file://${project.build.directory}/mvn-repo</url>
<id>ossrh</id>
<name>Maven Central</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -51,7 +54,7 @@
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -61,18 +64,7 @@
<target>1.6</target>
</configuration>
</plugin>

<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.5.2</version>
<extensions>true</extensions>
<configuration>
<!-- dummy dependency which later on gets used in the ant build task -->
<skip>true</skip>
</configuration>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
Expand All @@ -85,7 +77,7 @@
<goal>run</goal>
</goals>
<configuration>
<target>
<target unless="skipNativeCompile">
<delete includeEmptyDirs="true" verbose="true" failonerror="false">
<fileset dir="${project.build.directory}/objects" />
<fileset dir="${project.build.directory}/classes/lc/kra/system/lib" />
Expand Down Expand Up @@ -134,55 +126,118 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<excludes>
<exclude>lc/kra/system/keyboard/example/**</exclude>
<exclude>lc/kra/system/mouse/example/**</exclude>
</excludes>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<excludes>
<exclude>lc/kra/system/keyboard/example/**</exclude>
<exclude>lc/kra/system/mouse/example/**</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<goals>
<goal>deploy</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<altDeploymentRepository>deploy.repo.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<skipStaging>true</skipStaging>
</configuration>
</plugin>

<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.11</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<message>Maven artifacts for ${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
<branch>refs/heads/mvn-repo</branch>
<merge>true</merge>
<includes>
<include>**/*</include>
</includes>
<repositoryName>system-hook</repositoryName>
<repositoryOwner>kristian</repositoryOwner>
<encoding>UTF-8</encoding>
<source>1.6</source>
</configuration>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>site</goal>
<goal>jar</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<licenses>
<license>
<name>MIT License</name>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/lc/kra/system/LibraryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ public class LibraryLoader {
private static boolean libraryLoad;

/**
* Tries to laod the library with the given name
* Tries to load the system hook library with the given name
*
* @param name The name of the library to load
* @throws UnsatisfiedLinkError Thrown in case loading the library fails
*/
public static synchronized void loadLibrary() throws UnsatisfiedLinkError {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/lc/kra/system/keyboard/GlobalKeyboardHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public GlobalKeyboardHook(GlobalHookMode mode) throws UnsatisfiedLinkError {
/**
* Invoke keyPressed (transition state TS_DOWN) for all registered listeners
*
* @param event A global key event
* @param event a global key event
*/
private void keyPressed(GlobalKeyEvent event) {
heldDownKeyCodes.add(event.getVirtualKeyCode());
Expand All @@ -160,7 +160,7 @@ private void keyPressed(GlobalKeyEvent event) {
/**
* Invoke keyReleased (transition state TS_UP) for all registered listeners
*
* @param event A global key event
* @param event a global key event
*/
private void keyReleased(GlobalKeyEvent event) {
heldDownKeyCodes.remove(event.getVirtualKeyCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

public class GlobalKeyAdapter implements GlobalKeyListener {
/**
* Invoked when a key has been pressed.
* @see GlobalKeyListener#keyPressed(GlobalKeyEvent)
*/
@Override public void keyPressed(GlobalKeyEvent event) {}

/**
* Invoked when a key has been released.
* @see GlobalKeyListener#keyReleased(GlobalKeyEvent)
*/
@Override public void keyReleased(GlobalKeyEvent event) {}
}
16 changes: 8 additions & 8 deletions src/main/java/lc/kra/system/keyboard/event/GlobalKeyEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,34 +251,34 @@ public GlobalKeyEvent(Object source, int virtualKeyCode, int transitionState, ch
* Returns the transition state (up or down) for this key event.
*
* @return either one of TS_UP or TS_DOWN.
* @see {@link #TS_UP}
* @see {@link #TS_DOWN}
* @see #TS_UP
* @see #TS_DOWN
*/
public int getTransitionState() { return transitionState; }

/**
* Returns true if the menu key (alt) is pressed on the keyboard.
* @return true if the menu key (alt) is pressed on the keyboard.
*/
public boolean isMenuPressed() { return menuPressed; }
/**
* Returns true if the shift key is pressed on the keyboard.
* @return true if the shift key is pressed on the keyboard.
*/
public boolean isShiftPressed() { return shiftPressed; }
/**
* Returns true if the control key is pressed on the keyboard.
* @return true if the control key is pressed on the keyboard.
*/
public boolean isControlPressed() { return controlPressed; }
/**
* Returns true if the windows key is pressed on the keyboard.
* @return true if the windows key is pressed on the keyboard.
*/
public boolean isWinPressed() { return winPressed; }
/**
* Returns true if the menu/shift/control/win key pressed is an extended key.
* @return true if the menu/shift/control/win key pressed is an extended key.
*/
public boolean isExtendedKey() { return extendedKey; }

/**
* Returns the handle of the keyboard the key was pressed on.
* @return the handle of the keyboard the key was pressed on.
*/
public long getDeviceHandle() { return deviceHandle; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@
public interface GlobalKeyListener extends EventListener {
/**
* Invoked when a key has been pressed.
*
* @param event a global key event
*/
public void keyPressed(GlobalKeyEvent event);

/**
* Invoked when a key has been released.
*
* @param event a global key event
*/
public void keyReleased(GlobalKeyEvent event);
}
Loading

0 comments on commit ecac4d1

Please sign in to comment.