From 6d45862b2b34bb678ca878233d58348fc8361671 Mon Sep 17 00:00:00 2001 From: Scott Murphy Date: Tue, 4 Oct 2022 11:26:13 -0700 Subject: [PATCH] Groovy Sample Application --- samples/groovy-application/build.gradle | 59 +++++++++++++++++++ samples/groovy-application/gradle.properties | 4 ++ samples/groovy-application/settings.gradle | 52 ++++++++++++++++ .../org/graalvm/demo/Application.groovy | 12 ++++ 4 files changed, 127 insertions(+) create mode 100644 samples/groovy-application/build.gradle create mode 100644 samples/groovy-application/gradle.properties create mode 100644 samples/groovy-application/settings.gradle create mode 100644 samples/groovy-application/src/main/groovy/org/graalvm/demo/Application.groovy diff --git a/samples/groovy-application/build.gradle b/samples/groovy-application/build.gradle new file mode 100644 index 000000000..4c7351777 --- /dev/null +++ b/samples/groovy-application/build.gradle @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +plugins { + id 'groovy' + id 'application' + id 'org.graalvm.buildtools.native' +} + +application { + mainClass.set('org.graalvm.demo.Application') +} + +repositories { + mavenCentral() +} + +dependencies { + implementation "org.apache.groovy:groovy-all:${groovyVersion}" + implementation 'org.apache.commons:commons-lang3:3.8.1' +} diff --git a/samples/groovy-application/gradle.properties b/samples/groovy-application/gradle.properties new file mode 100644 index 000000000..bf41680ff --- /dev/null +++ b/samples/groovy-application/gradle.properties @@ -0,0 +1,4 @@ +native.gradle.plugin.version = 0.9.15-SNAPSHOT +junit.jupiter.version = 5.8.1 +junit.platform.version = 1.8.1 +groovyVersion = 4.0.5 diff --git a/samples/groovy-application/settings.gradle b/samples/groovy-application/settings.gradle new file mode 100644 index 000000000..0db7616ea --- /dev/null +++ b/samples/groovy-application/settings.gradle @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +pluginManagement { + plugins { + id 'org.graalvm.buildtools.native' version getProperty('native.gradle.plugin.version') + } + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +rootProject.name = 'groovy-application' diff --git a/samples/groovy-application/src/main/groovy/org/graalvm/demo/Application.groovy b/samples/groovy-application/src/main/groovy/org/graalvm/demo/Application.groovy new file mode 100644 index 000000000..5c3c6dd43 --- /dev/null +++ b/samples/groovy-application/src/main/groovy/org/graalvm/demo/Application.groovy @@ -0,0 +1,12 @@ +package org.graalvm.demo + +import groovy.transform.CompileStatic + +@CompileStatic +class Application { + private static final String MESSAGE = System.getenv("CUSTOM_MESSAGE") + + static void main(String[] args) { + System.out.println(MESSAGE != null ? MESSAGE : "Hello, native!") + } +}