Initialize Gradle project without wrapper and add basic main

This commit is contained in:
Jonas Tobias Hopusch 2021-09-02 17:04:56 +02:00
parent e96a5f901a
commit 25cf56c551
Failed to generate hash of commit
7 changed files with 121 additions and 0 deletions

6
.gitattributes vendored Normal file
View file

@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

15
.gitignore vendored
View file

@ -23,3 +23,18 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build
# Ignore gradle wrapper
/gradle
/gradlew
/gradlew.bat
# Ignore manual compilation results
/de/jotoho/
/META-INF

42
app/build.gradle.kts Normal file
View file

@ -0,0 +1,42 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin application project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.2/userguide/building_java_projects.html
*/
plugins {
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.5.0"
// Apply the application plugin to add support for building a CLI application in Java.
application
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// This dependency is used by the application.
implementation("com.google.guava:guava:30.1.1-jre")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
application {
// Define the main class for the application.
mainClass.set("de.jotoho.waituntil.StartKt")
}

View file

@ -0,0 +1,32 @@
package de.jotoho.waituntil
// This file contains the main function and other utility function necessary for interpreting the terminal arguments.
// See README.md and LICENSE.md for license information
// Author: Jonas Tobias Hopusch (@jotoho)
fun main(args: Array<String>) {
val optionDictionary = mapOf(Pair("-h", "--help"));
val options = HashSet<String>();
val words = HashSet<String>();
for (arg in args) {
if (arg.startsWith("--")) {
options.add(arg.substring(startIndex=2))
}
else if (arg.startsWith('-')) {
val translation = optionDictionary.get(arg);
if (translation != null)
options.add(translation.substring(startIndex=2));
else
System.err.println("Short-hand '$arg' does not exist. Ignoring!");
}
else
words.add(arg);
}
println("Content of options:");
println(options.toString());
println("Content of words:");
println(words.toString());
}

View file

@ -0,0 +1,14 @@
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package de.jotoho.waituntil
import kotlin.test.Test
import kotlin.test.assertNotNull
class AppTest {
@Test fun appHasAGreeting() {
val classUnderTest = App()
assertNotNull(classUnderTest.greeting, "app should have a greeting")
}
}

1
gradle.properties Normal file
View file

@ -0,0 +1 @@
org.gradle.daemon=false

11
settings.gradle.kts Normal file
View file

@ -0,0 +1,11 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/7.2/userguide/multi_project_builds.html
*/
rootProject.name = "de.jotoho.waituntil"
include("app")