Skip to content

Commit

Permalink
fun
Browse files Browse the repository at this point in the history
  • Loading branch information
mareklangiewicz committed May 19, 2024
1 parent a3050d1 commit b4cee6f
Show file tree
Hide file tree
Showing 36 changed files with 1,969 additions and 1,493 deletions.
61 changes: 61 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
root = true

# Let's keep it short/minimal, with comments, so it's clear what is enforced in .editorconfig and why.


[*]

charset = utf-8
end_of_line = lf

# file size; diffs on small devices
indent_size = 2

indent_style = space

# simpler adhoc regular expressions search/replace
insert_final_newline = true

max_line_length = 120
tab_width = 2
trim_trailing_whitespace = true
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true

ij_any_keep_blank_lines_in_code = 3
ij_properties_keep_blank_lines = true


[{*.kt,*.kts}]

# new most official defaults on top so can be overridden below
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL

# No aligns at all - too fancy/problematic
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_line_break_after_multiline_when_entry = false

# Trailing commas great for diffs; rearranging lines
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

ij_kotlin_imports_layout = *

# Let's try to avoid conflicts with files generated by github-workflows-kt
# https://github.com/typesafegithub/github-workflows-kt
[{*.yaml,*.yml}]
ij_yaml_indent_sequence_value = false
ij_yaml_spaces_within_braces = false
ij_yaml_spaces_within_brackets = false

# Let's try to avoid conflicts with files generated by IntelliJ Run Configurations.
# (Edit Configurations... -> Store as project file)
[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}]
ij_xml_space_inside_empty_tag = true
insert_final_newline = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.gradle
/local.properties
/.idea
/.kotlin
.DS_Store
/build
/captures
Expand Down
80 changes: 44 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,45 @@ import pl.mareklangiewicz.deps.*
import pl.mareklangiewicz.utils.*

plugins {
plug(plugs.NexusPublish)
plug(plugs.KotlinMulti) apply false
plug(plugs.KotlinJvm) apply false
plug(plugs.NexusPublish)
plug(plugs.KotlinMulti) apply false
plug(plugs.KotlinJvm) apply false
}

val enableJs = true
val enableNative = true

defaultBuildTemplateForRootProject(
langaraLibDetails(
name = "SMokK",
description = "A bit scary library for mocking suspendable functions in Kotlin :-)",
githubUrl = "https://github.com/langara/SMokK",
version = Ver(0, 0, 8)
// https://s01.oss.sonatype.org/content/repositories/releases/pl/mareklangiewicz/smokk/
// https://github.com/langara/SMokK/releases
myLibDetails(
name = "SMokK",
description = "A bit scary library for mocking suspendable functions in Kotlin :-)",
githubUrl = "https://github.com/langara/SMokK",
version = Ver(0, 0, 9),
// https://s01.oss.sonatype.org/content/repositories/releases/pl/mareklangiewicz/smokk/
// https://github.com/langara/SMokK/releases
settings = LibSettings(
withJs = enableJs,
withNativeLinux64 = enableNative,
compose = null,
withSonatypeOssPublishing = true,
),
withSonatypeOssPublishing = true,
),
)

// region [Root Build Template]
// region [[Root Build Template]]

/** Publishing to Sonatype OSSRH has to be explicitly allowed here, by setting withSonatypeOssPublishing to true. */
fun Project.defaultBuildTemplateForRootProject(details: LibDetails? = null) {
ext.addDefaultStuffFromSystemEnvs()
details?.let {
rootExtLibDetails = it
defaultGroupAndVerAndDescription(it)
if (it.settings.withSonatypeOssPublishing) defaultSonatypeOssNexusPublishing()
}
ext.addDefaultStuffFromSystemEnvs()
details?.let {
rootExtLibDetails = it
defaultGroupAndVerAndDescription(it)
if (it.settings.withSonatypeOssPublishing) defaultSonatypeOssNexusPublishing()
}

// kinda workaround for kinda issue with kotlin native
// https://youtrack.jetbrains.com/issue/KT-48410/Sync-failed.-Could-not-determine-the-dependencies-of-task-commonizeNativeDistribution.#focus=Comments-27-5144160.0-0
repositories { mavenCentral() }
// kinda workaround for kinda issue with kotlin native
// https://youtrack.jetbrains.com/issue/KT-48410/Sync-failed.-Could-not-determine-the-dependencies-of-task-commonizeNativeDistribution.#focus=Comments-27-5144160.0-0
repositories { mavenCentral() }
}

/**
Expand All @@ -48,24 +56,24 @@ fun Project.defaultBuildTemplateForRootProject(details: LibDetails? = null) {
* * See DepsKt/template-mpp/template-mpp-lib/build.gradle.kts
*/
fun ExtraPropertiesExtension.addDefaultStuffFromSystemEnvs(envKeyMatchPrefix: String = "MYKOTLIBS_") =
addAllFromSystemEnvs(envKeyMatchPrefix)
addAllFromSystemEnvs(envKeyMatchPrefix)

fun Project.defaultSonatypeOssNexusPublishing(
sonatypeStagingProfileId: String = rootExtString["sonatypeStagingProfileId"],
ossrhUsername: String = rootExtString["ossrhUsername"],
ossrhPassword: String = rootExtString["ossrhPassword"],
sonatypeStagingProfileId: String = rootExtString["sonatypeStagingProfileId"],
ossrhUsername: String = rootExtString["ossrhUsername"],
ossrhPassword: String = rootExtString["ossrhPassword"],
) {
nexusPublishing {
this.repositories {
sonatype { // only for users registered in Sonatype after 24 Feb 2021
stagingProfileId put sonatypeStagingProfileId
username put ossrhUsername
password put ossrhPassword
nexusUrl put repos.sonatypeOssNexus
snapshotRepositoryUrl put repos.sonatypeOssSnapshots
}
}
nexusPublishing {
this.repositories {
sonatype { // only for users registered in Sonatype after 24 Feb 2021
stagingProfileId put sonatypeStagingProfileId
username put ossrhUsername
password put ossrhPassword
nexusUrl put repos.sonatypeOssNexus
snapshotRepositoryUrl put repos.sonatypeOssSnapshots
}
}
}
}

// endregion [Root Build Template]
// endregion [[Root Build Template]]
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-rc-2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit b4cee6f

Please sign in to comment.