mirror of
https://github.com/InsanusMokrassar/KotlinPublicationScriptsBuilder.git
synced 2025-09-02 22:49:16 +00:00
Compare commits
10 Commits
build-2bbf
...
build-7c50
Author | SHA1 | Date | |
---|---|---|---|
7c50c58a90 | |||
ceff1eb1ef | |||
46d6d429bb | |||
dd9e71c9a2 | |||
6d2ffb8a6e | |||
25767eecb2 | |||
603da9a021 | |||
b43016bb24 | |||
4c4845803d | |||
4ec7d3847f |
17
.github/workflows/build.yml
vendored
Normal file
17
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
on: [push]
|
||||||
|
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-ubuntu:
|
||||||
|
name: Commit release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup JDK
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew build packageUberJarForCurrentOS
|
5
.github/workflows/commit-release.yml
vendored
5
.github/workflows/commit-release.yml
vendored
@@ -1,4 +1,7 @@
|
|||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
name: Commit release
|
name: Commit release
|
||||||
|
|
||||||
|
@@ -2,6 +2,9 @@ package dev.inmo.kmppscriptbuilder.core.models
|
|||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
const val defaultProjectName = "\${project.name}"
|
||||||
|
const val defaultProjectDescription = "\${project.name}"
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class MavenConfig(
|
data class MavenConfig(
|
||||||
val name: String,
|
val name: String,
|
||||||
@@ -22,14 +25,20 @@ data class MavenPublishingRepository(
|
|||||||
name.toUpperCase()
|
name.toUpperCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun build(indent: String) = """maven {
|
fun build(indent: String): String {
|
||||||
name = "$name"
|
val usernameProperty = "${nameCapitalized}_USER"
|
||||||
url = uri("$url")
|
val passwordProperty = "${nameCapitalized}_PASSWORD"
|
||||||
credentials {
|
return """if ((project.hasProperty('${usernameProperty}') || System.getenv('${usernameProperty}') != null) && (project.hasProperty('${passwordProperty}') || System.getenv('${passwordProperty}') != null)) {
|
||||||
username = project.hasProperty('${nameCapitalized}_USER') ? project.property('${nameCapitalized}_USER') : System.getenv('${nameCapitalized}_USER')
|
maven {
|
||||||
password = project.hasProperty('${nameCapitalized}_PASSWORD') ? project.property('${nameCapitalized}_PASSWORD') : System.getenv('${nameCapitalized}_PASSWORD')
|
name = "$name"
|
||||||
|
url = uri("$url")
|
||||||
|
credentials {
|
||||||
|
username = project.hasProperty('${usernameProperty}') ? project.property('${usernameProperty}') : System.getenv('${usernameProperty}')
|
||||||
|
password = project.hasProperty('${passwordProperty}') ? project.property('${passwordProperty}') : System.getenv('${passwordProperty}')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}""".replace("\n", "\n$indent")
|
}""".replace("\n", "\n$indent")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val SonatypeRepository = MavenPublishingRepository("sonatype", "https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
val SonatypeRepository = MavenPublishingRepository("sonatype", "https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
package dev.inmo.kmppscriptbuilder.desktop.utils
|
||||||
|
|
||||||
|
import java.awt.Desktop
|
||||||
|
import java.lang.Exception
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
fun openLink(link: String): Boolean {
|
||||||
|
val desktop = if (Desktop.isDesktopSupported()) Desktop.getDesktop() else null
|
||||||
|
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||||
|
try {
|
||||||
|
desktop.browse(URI(link))
|
||||||
|
return true
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@@ -6,10 +6,18 @@ import androidx.compose.foundation.layout.*
|
|||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
|
import androidx.compose.ui.platform.DesktopPlatform
|
||||||
|
import androidx.compose.ui.res.loadSvgResource
|
||||||
import androidx.compose.ui.res.svgResource
|
import androidx.compose.ui.res.svgResource
|
||||||
|
import androidx.compose.ui.unit.Density
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.Config
|
import dev.inmo.kmppscriptbuilder.core.models.Config
|
||||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||||
|
import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
|
||||||
|
import java.awt.Desktop
|
||||||
|
import java.lang.Exception
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
class BuilderView : View() {
|
class BuilderView : View() {
|
||||||
private val projectTypeView = ProjectTypeView()
|
private val projectTypeView = ProjectTypeView()
|
||||||
|
@@ -2,8 +2,7 @@ package dev.inmo.kmppscriptbuilder.desktop.views
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.MavenConfig
|
import dev.inmo.kmppscriptbuilder.core.models.*
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.SonatypeRepository
|
|
||||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||||
|
|
||||||
class MavenInfoView : VerticalView("Project information") {
|
class MavenInfoView : VerticalView("Project information") {
|
||||||
@@ -18,8 +17,8 @@ class MavenInfoView : VerticalView("Project information") {
|
|||||||
|
|
||||||
var mavenConfig: MavenConfig
|
var mavenConfig: MavenConfig
|
||||||
get() = MavenConfig(
|
get() = MavenConfig(
|
||||||
projectNameProperty,
|
projectNameProperty.ifBlank { defaultProjectName },
|
||||||
projectDescriptionProperty,
|
projectDescriptionProperty.ifBlank { defaultProjectDescription },
|
||||||
projectUrlProperty,
|
projectUrlProperty,
|
||||||
projectVcsUrlProperty,
|
projectVcsUrlProperty,
|
||||||
includeGpgSignProperty,
|
includeGpgSignProperty,
|
||||||
|
@@ -6,13 +6,13 @@ kotlin.incremental.js=true
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|
||||||
kotlin_version=1.4.30
|
kotlin_version=1.4.31
|
||||||
kotlin_coroutines_version=1.4.2
|
kotlin_coroutines_version=1.4.3
|
||||||
kotlin_serialisation_core_version=1.1.0
|
kotlin_serialisation_core_version=1.1.0
|
||||||
ktor_version=1.5.1
|
ktor_version=1.5.2
|
||||||
micro_utils_version=0.4.27
|
micro_utils_version=0.4.36
|
||||||
|
|
||||||
compose_version=0.3.0
|
compose_version=0.3.2
|
||||||
|
|
||||||
# ANDROID
|
# ANDROID
|
||||||
|
|
||||||
|
@@ -14,12 +14,11 @@ fun saveFile(content: String, filename: String) {
|
|||||||
setAttribute("style", "visibility:hidden; display: none")
|
setAttribute("style", "visibility:hidden; display: none")
|
||||||
} as HTMLAnchorElement
|
} as HTMLAnchorElement
|
||||||
val blob = Blob(arrayOf(content), BlobPropertyBag(
|
val blob = Blob(arrayOf(content), BlobPropertyBag(
|
||||||
"text/plain;charset=utf-8"
|
"application/*;charset=utf-8"
|
||||||
))
|
))
|
||||||
val url = URL.createObjectURL(blob)
|
val url = URL.createObjectURL(blob)
|
||||||
a.href = url
|
a.href = url
|
||||||
a.download = filename
|
a.download = filename
|
||||||
a.target = "_blank"
|
|
||||||
a.click()
|
a.click()
|
||||||
URL.revokeObjectURL(url)
|
URL.revokeObjectURL(url)
|
||||||
a.remove()
|
a.remove()
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package dev.inmo.kmppscriptbuilder.web.views
|
package dev.inmo.kmppscriptbuilder.web.views
|
||||||
|
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.MavenConfig
|
import dev.inmo.kmppscriptbuilder.core.models.*
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.SonatypeRepository
|
|
||||||
import kotlinx.browser.document
|
import kotlinx.browser.document
|
||||||
import org.w3c.dom.HTMLElement
|
import org.w3c.dom.HTMLElement
|
||||||
import org.w3c.dom.HTMLInputElement
|
import org.w3c.dom.HTMLInputElement
|
||||||
@@ -18,8 +17,8 @@ class MavenProjectInfoView : View {
|
|||||||
|
|
||||||
var mavenConfig: MavenConfig
|
var mavenConfig: MavenConfig
|
||||||
get() = MavenConfig(
|
get() = MavenConfig(
|
||||||
nameElement.value,
|
nameElement.value.ifBlank { defaultProjectName },
|
||||||
descriptionElement.value,
|
descriptionElement.value.ifBlank { defaultProjectDescription },
|
||||||
urlElement.value,
|
urlElement.value,
|
||||||
vcsUrlElement.value,
|
vcsUrlElement.value,
|
||||||
includeGpgElement.checked,
|
includeGpgElement.checked,
|
||||||
@@ -39,6 +38,6 @@ class MavenProjectInfoView : View {
|
|||||||
developersView.developers = value.developers
|
developersView.developers = value.developers
|
||||||
val reposWithoutSonatype = value.repositories.filter { it != SonatypeRepository }
|
val reposWithoutSonatype = value.repositories.filter { it != SonatypeRepository }
|
||||||
includeMavenCentralElement.checked = value.repositories.size != reposWithoutSonatype.size
|
includeMavenCentralElement.checked = value.repositories.size != reposWithoutSonatype.size
|
||||||
repositoriesView.repositories = value.repositories
|
repositoriesView.repositories = reposWithoutSonatype
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -21,7 +21,7 @@ class RepositoriesView(rootElement: HTMLElement) : MutableListView<MavenPublishi
|
|||||||
|
|
||||||
override fun HTMLElement.addContentBeforeRemoveButton(value: MavenPublishingRepository) {
|
override fun HTMLElement.addContentBeforeRemoveButton(value: MavenPublishingRepository) {
|
||||||
createTextField("Repository name", "This name will be used to identify repository in grade").value = value.name
|
createTextField("Repository name", "This name will be used to identify repository in grade").value = value.name
|
||||||
createTextField("Repository URL", "For example: https://repo.maven.apache.org/maven2/").value = value.name
|
createTextField("Repository URL", "For example: https://repo.maven.apache.org/maven2/").value = value.url
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun HTMLElement.updateElement(from: MavenPublishingRepository, to: MavenPublishingRepository) {
|
override fun HTMLElement.updateElement(from: MavenPublishingRepository, to: MavenPublishingRepository) {
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
<nav class="uk-navbar-container" uk-navbar>
|
<nav class="uk-navbar-container" uk-navbar>
|
||||||
<div class="uk-navbar-left">
|
<div class="uk-navbar-left">
|
||||||
<div class="uk-padding-small uk-text-lead">Kotlin Publication Scripts Builder</div>
|
<div class="uk-padding-small uk-text-lead">Kotlin Publication Scripts Builder</div>
|
||||||
|
<div class="uk-padding-small"><a href="https://github.com/InsanusMokrassar/KotlinPublicationScriptsBuilder"><img src="https://img.shields.io/github/stars/InsanusMokrassar/KotlinPublicationScriptsBuilder?label=Github&style=plastic"/></a></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-navbar-right">
|
<div class="uk-navbar-right">
|
||||||
<ul class="uk-navbar-nav">
|
<ul class="uk-navbar-nav">
|
||||||
|
Reference in New Issue
Block a user