Skip to content

Instantly share code, notes, and snippets.

@zilti
Created October 13, 2018 14:27
Show Gist options
  • Save zilti/b08e73841f17a899e5730d901ca8ced1 to your computer and use it in GitHub Desktop.
Save zilti/b08e73841f17a899e5730d901ca8ced1 to your computer and use it in GitHub Desktop.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.15'
}
}
plugins {
id 'gradle-clojure.clojure' version '0.4.0'
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'maven-publish'
}
apply plugin: 'org.javafxports.jfxmobile'
group = 'lyrion'
version = '0.1.0-SNAPSHOT'
mainClassName = 'lyrion.cec'
repositories {
mavenCentral()
jcenter()
maven {
name = 'clojars'
url = 'https://repo.clojars.org'
}
}
dependencies {
implementation 'org.clojure:clojure:1.9.0'
implementation 'clojurefx:clojurefx:0.5.0-SNAPSHOT'
testImplementation 'junit:junit:4.12'
devImplementation 'org.clojure:tools.namespace:0.3.0-alpha4'
}
clojure {
builds {
main {
aotAll()
}
}
}
jfxmobile {
android {
applicationPackage = 'lyrion.cec'
}
}
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
repositories {
maven {
name = 'clojars'
url = 'https://repo.clojars.org'
credentials {
username = System.env['CLOJARS_USER']
password = System.env['CLOJARS_PASSWORD']
}
}
}
}
(ns lyrion.cec
(:gen-class
:extends javafx.application.Application
:prefix "fx-")
(:require [clojurefx.clojurefx :as fx])
(:import (javafx.stage Stage Screen)
(javafx.scene Scene)
(javafx.scene.control Label)
(javafx.geometry Rectangle2D)))
(defn fx-start [^Stage stage]
(fx/run-now (let [content ^Label (Label. "Hello World")
visual-bounds ^Rectangle2D (.getVisualBounds (.getPrimary Screen))
scene ^Scene (Scene. content (.getWidth visual-bounds) (.getHeight visual-bounds))]
(.setScene stage)
(.show stage))))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment