Skip to content

Commit

Permalink
Wireframe for multiplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus committed Jan 25, 2024
1 parent bc17377 commit 64b8fee
Show file tree
Hide file tree
Showing 19 changed files with 476 additions and 195 deletions.
265 changes: 144 additions & 121 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,131 +1,154 @@
plugins {
kotlin("jvm") version "1.9.21"
`java-library`
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("org.jetbrains.dokka") version "1.9.10"
id("signing")
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21")
classpath("com.android.tools.build:gradle:8.2.2")
}
}

nexusPublishing {
subprojects {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
mavenCentral()
}
}

apply(plugin = "io.github.gradle-nexus.publish-plugin")

group = "io.exoquery"
version = "1.1.0"

apply(plugin = "kotlin")
apply(plugin = "maven-publish")

repositories {
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
maven(url = "https://jitpack.io")
}

dependencies {
testImplementation("io.kotest:kotest-runner-junit5:5.8.0")
implementation(kotlin("reflect"))
}

// Needed for Kotest
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}

kotlin {
jvmToolchain(8)
}

// backward compat for users on older versions of Kotlin
// we use "data objects" in test code, so limit this to production code
tasks.named<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>("compileKotlin") {
compilerOptions.apply {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6)
}
}

allprojects {

val varintName = project.name

apply {
plugin("org.jetbrains.kotlin.jvm")
plugin("org.jetbrains.dokka")
}

val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)

tasks {
val javadocJar by creating(Jar::class) {
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaHtml.outputDirectory)
}
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["kotlin"])
artifactId = varintName

artifact(tasks["javadocJar"])
artifact(tasks["sourcesJar"])

pom {
name.set("decomat")
description.set("DecoMat - Deconstructive Pattern Matching for Kotlin")
url.set("https://github.com/deusaquilus/pprint-kotlin")

licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}

developers {
developer {
name.set("Alexander Ioffe")
email.set("[email protected]")
organization.set("github")
organizationUrl.set("http://www.github.com")
}
}

scm {
url.set("https://github.com/exoquery/decomat/tree/main")
connection.set("scm:git:git://github.com/ExoQuery/DecoMat.git")
developerConnection.set("scm:git:ssh://github.com:ExoQuery/DecoMat.git")
}
}
}
}
}

// Check the 'skipSigning' project property
if (!project.hasProperty("nosign")) {
// If 'skipSigning' is not present, apply the signing plugin and configure it
apply(plugin = "signing")

signing {
// use the properties passed as command line args
// -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
sign(publishing.publications["mavenJava"])
}
}
}
//plugins {
// kotlin("jvm") version "1.9.21"
// `java-library`
// `maven-publish`
// id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
// id("org.jetbrains.dokka") version "1.9.10"
// id("signing")
//}
//
//nexusPublishing {
// repositories {
// sonatype {
// nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
// snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
// }
// }
//}
//
//apply(plugin = "io.github.gradle-nexus.publish-plugin")
//
//group = "io.exoquery"
//version = "1.1.0"
//
//apply(plugin = "kotlin")
//apply(plugin = "maven-publish")
//
//repositories {
// mavenCentral()
// maven(url = "https://plugins.gradle.org/m2/")
// maven(url = "https://jitpack.io")
//}
//
//dependencies {
// testImplementation("io.kotest:kotest-runner-junit5:5.8.0")
// implementation(kotlin("reflect"))
//}
//
//// Needed for Kotest
//tasks.withType<Test>().configureEach {
// useJUnitPlatform()
//}
//
//kotlin {
// jvmToolchain(8)
//}
//
//// backward compat for users on older versions of Kotlin
//// we use "data objects" in test code, so limit this to production code
//tasks.named<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>("compileKotlin") {
// compilerOptions.apply {
// apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6)
// languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6)
// }
//}
//
//allprojects {
//
// val varintName = project.name
//
// apply {
// plugin("org.jetbrains.kotlin.jvm")
// plugin("org.jetbrains.dokka")
// }
//
// val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)
//
// tasks {
// val javadocJar by creating(Jar::class) {
// dependsOn(dokkaHtml)
// archiveClassifier.set("javadoc")
// from(dokkaHtml.outputDirectory)
// }
// val sourcesJar by creating(Jar::class) {
// archiveClassifier.set("sources")
// from(sourceSets["main"].allSource)
// }
// }
//
// publishing {
// publications {
// create<MavenPublication>("mavenJava") {
// from(components["kotlin"])
// artifactId = varintName
//
// artifact(tasks["javadocJar"])
// artifact(tasks["sourcesJar"])
//
// pom {
// name.set("decomat")
// description.set("DecoMat - Deconstructive Pattern Matching for Kotlin")
// url.set("https://github.com/deusaquilus/pprint-kotlin")
//
// licenses {
// license {
// name.set("The Apache Software License, Version 2.0")
// url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
// distribution.set("repo")
// }
// }
//
// developers {
// developer {
// name.set("Alexander Ioffe")
// email.set("[email protected]")
// organization.set("github")
// organizationUrl.set("http://www.github.com")
// }
// }
//
// scm {
// url.set("https://github.com/exoquery/decomat/tree/main")
// connection.set("scm:git:git://github.com/ExoQuery/DecoMat.git")
// developerConnection.set("scm:git:ssh://github.com:ExoQuery/DecoMat.git")
// }
// }
// }
// }
// }
//
// // Check the 'skipSigning' project property
// if (!project.hasProperty("nosign")) {
// // If 'skipSigning' is not present, apply the signing plugin and configure it
// apply(plugin = "signing")
//
// signing {
// // use the properties passed as command line args
// // -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
// sign(publishing.publications["mavenJava"])
// }
// }
//}
46 changes: 46 additions & 0 deletions pprint-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
kotlin("multiplatform")
id("com.android.library")
}

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}

js()
android()

sourceSets {
val commonMain by getting {
dependencies {
// Common dependencies for all platforms
}
}
val jvmMain by getting {
dependencies {
// JVM specific dependencies
}
}
val androidMain by getting {
dependencies {
// Android specific dependencies
}
}
val jsMain by getting {
dependencies {
// JS specific dependencies
}
}
}
}

android {
compileSdk = 32
namespace = "io.exoquery.pprint"
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data class PPrinterConfig(
* @param additionalHandlers Provide this to override how certain types are
* pretty-printed at runtime
*/
open class PPrinter(val config: PPrinterConfig): Walker {
abstract class PPrinterBase(open val config: PPrinterConfig): Walker {
override val showGenericForCollections get() = config.showGenericForCollections

/**
Expand Down Expand Up @@ -103,15 +103,5 @@ open class PPrinter(val config: PPrinterConfig): Walker {
val truncated = Truncated(rendered, width, height)
return truncated
}

companion object {
val Color = PPrinter(PPrinterConfig())
val BlackWhite = PPrinter(
PPrinterConfig().copy(
colorLiteral = Attrs.Empty,
colorApplyPrefix = Attrs.Empty
)
)
}
}

File renamed without changes.
Loading

0 comments on commit 64b8fee

Please sign in to comment.