Skip to content

Commit

Permalink
Bring library back to life
Browse files Browse the repository at this point in the history
  • Loading branch information
ileasile committed Apr 28, 2023
1 parent 58fb611 commit c68b435
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import kotlin.Suppress
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand Down Expand Up @@ -34,22 +33,9 @@ tasks {
from(sourceSets.main.get().allSource)
}

@Suppress("UNUSED_VARIABLE")
val dokka by getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/dokka"
}

val dokkaJavadoc by registering(DokkaTask::class) {
outputFormat = "javadoc"
outputDirectory = this@tasks.javadoc.get().destinationDir!!.path
inputs.dir("src/main/kotlin")
}

@Suppress("UNUSED_VARIABLE")
val javadocJar by registering(Jar::class) {
group = "documentation"
dependsOn(dokkaJavadoc)
archiveClassifier.set("javadoc")
from(this@tasks.javadoc.get().destinationDir!!)
}
Expand All @@ -58,7 +44,7 @@ tasks {
tasks.withType(KotlinCompile::class.java) {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.4"
languageVersion = "1.8"
freeCompilerArgs = listOf("-XXLanguage:+InlineClasses")
}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group=org.ileasile
version=0.0.1-SNAPSHOT
version=0.0.2-SNAPSHOT

kotlin.code.style=official
kotlinVersion=1.4.0-dev-7916
kotlinVersion=1.8.20
ktlintPluginVersion=9.2.1
dokkaVersion=0.10.1
dokkaVersion=1.8.10
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion 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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 3 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand All @@ -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 @@ -129,6 +130,7 @@ fi
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 Down
25 changes: 7 additions & 18 deletions 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 All @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -61,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

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%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/org/ileasile/kformat/generation.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.ileasile.kformat

import org.ileasile.kformat.visitors.AnsiEscapeVisitor
import org.ileasile.kformat.visitors.HtmlVisitor
import org.ileasile.kformat.visitors.PlainTextVisitor

fun TextBlock.asAnsiEscaped() =
accept(AnsiEscapeVisitor())
fun TextBlock.asHTML(prettyPrint: Boolean = false) =
accept(HtmlVisitor(pretty = prettyPrint))
fun TextBlock.asPlainText() =
accept(PlainTextVisitor())
11 changes: 6 additions & 5 deletions src/test/kotlin/org/ileasile/kformat/test/FormatTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import org.ileasile.kformat.RGBColor
import org.ileasile.kformat.adapters.LoggingVisitorAdapter
import org.ileasile.kformat.adapters.StringResultSavingVisitorAdapter
import org.ileasile.kformat.adapters.adapt
import org.ileasile.kformat.asAnsiEscaped
import org.ileasile.kformat.asHTML
import org.ileasile.kformat.asPlainText
import org.ileasile.kformat.kFormat
import org.ileasile.kformat.visitors.AnsiEscapeVisitor
import org.ileasile.kformat.visitors.HtmlVisitor
import org.ileasile.kformat.visitors.PlainTextVisitor
import org.junit.jupiter.api.Test

class FormatTest {
Expand Down Expand Up @@ -60,9 +61,9 @@ class FormatTest {

@Test
fun testConsole() {
println(formatted1.accept(AnsiEscapeVisitor()))
println(formatted1.accept(PlainTextVisitor()))
println(formatted1.accept(HtmlVisitor(pretty = true)))
println(formatted1.asAnsiEscaped())
println(formatted1.asPlainText())
println(formatted1.asHTML(true))
}

@Test
Expand Down

0 comments on commit c68b435

Please sign in to comment.