Skip to content

Commit

Permalink
Update Kotlin and Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jun 17, 2024
1 parent 80ff302 commit bef3afc
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 69 deletions.
41 changes: 20 additions & 21 deletions pretixscan/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
group 'eu.pretix.pretixscan'
version = project.properties['version']
project.version version

import org.gradle.internal.os.OperatingSystem
apply from: 'libpretixsync-repo/libpretixsync/versions.gradle'

ext {
operatingSystem = OperatingSystem.current()
}

repositories {
jcenter()
mavenCentral()
}

buildscript {
repositories {
jcenter()
Expand All @@ -27,14 +11,29 @@ buildscript {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.17"
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
classpath 'org.openjfx:javafx-plugin:0.0.7'
}
}
plugins {
id 'application'
id 'org.jetbrains.kotlin.jvm' version '1.9.23' apply false
id 'org.jetbrains.kotlin.kapt' version '1.9.23' apply false
}

group 'eu.pretix.pretixscan'
version = project.properties['version']
project.version version

import org.gradle.internal.os.OperatingSystem
apply from: 'libpretixsync-repo/libpretixsync/versions.gradle'

apply plugin: 'base'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'net.ltgt.apt-idea'
ext {
operatingSystem = OperatingSystem.current()
}

repositories {
jcenter()
mavenCentral()
}

subprojects {
apply plugin: 'java'
Expand Down
Binary file modified pretixscan/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pretixscan/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 16 additions & 19 deletions pretixscan/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -125,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -154,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
4 changes: 4 additions & 0 deletions pretixscan/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand Down Expand Up @@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
21 changes: 12 additions & 9 deletions pretixscan/gui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
*/
import org.apache.tools.ant.filters.*

apply plugin: 'application'
apply plugin: 'org.openjfx.javafxplugin'
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.1.0'
}
apply from: '../libpretixsync-repo/libpretixsync/versions.gradle'

mainClassName = "eu.pretix.pretixscan.desktop.PretixScanMain"
Expand Down Expand Up @@ -71,15 +73,15 @@ dependencies {
implementation(project(':libpretixprint')) {
transitive = false
}
testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'junit', name: 'junit', version: '4.12'

javafxCompile "org.openjfx:javafx-base:11.0.2:${platform}"
javafxCompile "org.openjfx:javafx-graphics:11.0.2:${platform}"
javafxCompile "org.openjfx:javafx-controls:11.0.2:${platform}"
javafxCompile "org.openjfx:javafx-fxml:11.0.2:${platform}"
javafxCompile "org.openjfx:javafx-swing:11.0.2:${platform}"
implementation "org.openjfx:javafx-base:11.0.2:${platform}"
implementation "org.openjfx:javafx-graphics:11.0.2:${platform}"
implementation "org.openjfx:javafx-controls:11.0.2:${platform}"
implementation "org.openjfx:javafx-fxml:11.0.2:${platform}"
implementation "org.openjfx:javafx-swing:11.0.2:${platform}"

compileOnly configurations.javafxCompile
//compileOnly configurations.javafxCompile
}

tasks.withType(JavaCompile) {
Expand Down Expand Up @@ -107,5 +109,6 @@ javafx {
modules = [
'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.swing'
]
configurations = [ 'implementation', 'testImplementation' ]
version = '11.0.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,10 @@ fun getBadgeLayout(application: PretixScanMain, position: JSONObject, eventSlug:
}
}

/* Legacy mechanism: Keep around until pretix 2.5 is end of life */
val item = application.data().select(Item::class.java)
.where(Item.SERVER_ID.eq(itemid_server))
.get().firstOrNull() ?: return getDefaultBadgeLayout()
if (item.getBadge_layout_id() != null) {
return application.data().select(BadgeLayout::class.java)
.where(BadgeLayout.SERVER_ID.eq(item.getBadge_layout_id()))
.and(BadgeLayout.EVENT_SLUG.eq(eventSlug))
.get().firstOrNull() ?: getDefaultBadgeLayout()
} else { // Also used for current pretix versions for obtaining the event's default badge layout
return application.data().select(BadgeLayout::class.java)
.where(BadgeLayout.IS_DEFAULT.eq(true))
.and(BadgeLayout.EVENT_SLUG.eq(eventSlug))
.get().firstOrNull() ?: getDefaultBadgeLayout()
}
return application.data().select(BadgeLayout::class.java)
.where(BadgeLayout.IS_DEFAULT.eq(true))
.and(BadgeLayout.EVENT_SLUG.eq(eventSlug))
.get().firstOrNull() ?: getDefaultBadgeLayout()
}

fun printBadge(application: PretixScanMain, position: JSONObject, eventSlug: String) {
Expand Down
4 changes: 2 additions & 2 deletions pretixscan/packaging/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ task recreateIcons(dependsOn: [recreateIconMacApp, recreateIconWindowsApp]) {
}

dependencies {
compile project(':gui')
implementation project(':gui')
}

task copyDependencies(type: Copy) {
from configurations.runtime
//from configurations.runtime
into "${buildDir}/libraries"
}

Expand Down

0 comments on commit bef3afc

Please sign in to comment.