Skip to content

Commit

Permalink
Merge pull request #96 from xpdota/linux-clickthrough
Browse files Browse the repository at this point in the history
Linux clickthrough
  • Loading branch information
xpdota authored Jul 22, 2022
2 parents 35ec898 + dfccdb1 commit d30c73c
Show file tree
Hide file tree
Showing 21 changed files with 2,458 additions and 53 deletions.
32 changes: 32 additions & 0 deletions launcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
<execution>
<id>zip-file-linux</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/bin-linux.xml</descriptor>
</descriptors>
<finalName>triggevent-linux</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -164,6 +178,24 @@

</configuration>
</execution>
<execution>
<id>copy-linux-scripts</id>
<!-- here the phase you need -->
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/windows</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/linux</directory>
<includes>*.sh</includes>
</resource>
</resources>

</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down
19 changes: 19 additions & 0 deletions launcher/src/assembly/bin-linux.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory>${project.basedir}</baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/target/windows</directory>
<outputDirectory>triggevent</outputDirectory>
<excludes>
<exclude>**/src.zip</exclude>
<exclude>jre/</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
1 change: 1 addition & 0 deletions launcher/src/assembly/bin-no-jre.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<excludes>
<exclude>**/src.zip</exclude>
<exclude>jre/</exclude>
<exclude>*.sh</exclude>
</excludes>
</fileSet>
</fileSets>
Expand Down
1 change: 1 addition & 0 deletions launcher/src/assembly/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<outputDirectory>triggevent</outputDirectory>
<excludes>
<exclude>**/src.zip</exclude>
<exclude>*.sh</exclude>
</excludes>
</fileSet>
</fileSets>
Expand Down
9 changes: 9 additions & 0 deletions launcher/src/linux/setup-java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if wget -O /tmp/java.tar.gz https://download.oracle.com/java/17/archive/jdk-17.0.4_linux-x64_bin.tar.gz
then
tar -xzf /tmp/java.tar.gz
mv jdk-* jre
else
echo "Download failed"
fi
19 changes: 19 additions & 0 deletions launcher/src/linux/triggevent-import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ -x jre/bin/java ]
then
java=jre/bin/java
echo "Using directory-supplied Java"
else
java=$(command -v java)
if [ $? -ne 0 ]
then
echo "Found neither a 'jre' dir nor a built in 'java' executable. Please do one of the following to fix it:"
echo "1. Install Java 17 from your distro's package manager, and make sure the 'java' program on your PATH points to the correct java installation."
echo "2. Download Java 17 from https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html and place it in a directory called 'jre' (rename it from jdk-x.y.z)"
echo "3. Run setup-java.sh (requires wget)"
exit 1;
fi
fi

$java -cp './userdata:./preload/*:./deps/*:./user/*:launcher-1.0-SNAPSHOT.jar' @args.txt gg.xp.xivsupport.gui.GuiImportLaunch
19 changes: 19 additions & 0 deletions launcher/src/linux/triggevent-upd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ -x jre/bin/java ]
then
java=jre/bin/java
echo "Using directory-supplied Java"
else
java=$(command -v java)
if [ $? -ne 0 ]
then
echo "Found neither a 'jre' dir nor a built in 'java' executable. Please do one of the following to fix it:"
echo "1. Install Java 17 from your distro's package manager, and make sure the 'java' program on your PATH points to the correct java installation."
echo "2. Download Java 17 from https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html and place it in a directory called 'jre' (rename it from jdk-x.y.z)"
echo "3. Run setup-java.sh (requires wget)"
exit 1;
fi
fi

$java -cp 'launcher-1.0-SNAPSHOT.jar' @args.txt gg.xp.xivsupport.gui.Update
19 changes: 19 additions & 0 deletions launcher/src/linux/triggevent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ -x jre/bin/java ]
then
java=jre/bin/java
echo "Using directory-supplied Java"
else
java=$(command -v java)
if [ $? -ne 0 ]
then
echo "Found neither a 'jre' dir nor a built in 'java' executable. Please do one of the following to fix it:"
echo "1. Install Java 17 from your distro's package manager, and make sure the 'java' program on your PATH points to the correct java installation."
echo "2. Download Java 17 from https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html and place it in a directory called 'jre' (rename it from jdk-x.y.z)"
echo "3. Run setup-java.sh (requires wget)"
exit 1;
fi
fi

$java -cp './userdata:./preload/*:./deps/*:./user/*:launcher-1.0-SNAPSHOT.jar' @args.txt gg.xp.xivsupport.gui.GuiLaunch
11 changes: 10 additions & 1 deletion launcher/src/main/java/gg/xp/xivsupport/gui/Update.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ else if (depsFiles == null) {
if (!updateTheUpdaterItself) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
Runtime.getRuntime().exec(Paths.get(installDir.toString(), "triggevent.exe").toString());
if (isWindows()) {
Runtime.getRuntime().exec(Paths.get(installDir.toString(), "triggevent.exe").toString());
}
else {
Runtime.getRuntime().exec(new String[]{"sh", Paths.get(installDir.toString(), "triggevent.sh").toString()});
}
}
catch (IOException e) {
e.printStackTrace();
Expand Down Expand Up @@ -400,4 +405,8 @@ private static String getStackTrace(final Throwable throwable) {
return sw.getBuffer().toString();
}

private static boolean isWindows() {
return System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
}

}
Binary file added libjawt.so
Binary file not shown.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<threadCount>1</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
<argLine>-Duser.country=US -Duser.language=en -DsequentialTriggerCycleTime=1000</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
Expand Down
Loading

0 comments on commit d30c73c

Please sign in to comment.