mirror of
https://github.com/InsanusMokrassar/KotlinPublicationScriptsBuilder.git
synced 2025-09-02 22:49:16 +00:00
Compare commits
12 Commits
build-2bbf
...
build-ac87
Author | SHA1 | Date | |
---|---|---|---|
ac87a140cc | |||
0dbe3a866b | |||
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
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
@@ -8,7 +7,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.2'
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version"
|
||||
@@ -19,10 +18,8 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
google()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
|
||||
}
|
||||
}
|
||||
|
@@ -30,19 +30,19 @@ suspend fun HttpClient.getLicenses(): Map<String, License> {
|
||||
|
||||
suspend fun HttpClient.searchLicense(name: String): List<License> {
|
||||
val licenses = licenses ?: getLicenses()
|
||||
val lowerCase = name.toLowerCase()
|
||||
val upperCase = name.toUpperCase()
|
||||
val lowerCase = name.lowercase()
|
||||
val upperCase = name.uppercase()
|
||||
return licenses.values.filter {
|
||||
it.title.toLowerCase().contains(lowerCase) || it.title.toUpperCase().contains(upperCase) || it.title.contains(name)
|
||||
|| it.id.toLowerCase().contains(lowerCase) || it.id.toUpperCase().contains(upperCase) || it.id.contains(name)
|
||||
it.title.lowercase().contains(lowerCase) || it.title.uppercase().contains(upperCase) || it.title.contains(name)
|
||||
|| it.id.lowercase().contains(lowerCase) || it.id.uppercase().contains(upperCase) || it.id.contains(name)
|
||||
}
|
||||
}
|
||||
|
||||
fun Map<String, License>.searchLicense(name: String): List<License> {
|
||||
val lowerCase = name.toLowerCase()
|
||||
val upperCase = name.toUpperCase()
|
||||
val lowerCase = name.lowercase()
|
||||
val upperCase = name.uppercase()
|
||||
return values.filter {
|
||||
it.title.toLowerCase().contains(lowerCase) || it.title.toUpperCase().contains(upperCase) || it.title.contains(name)
|
||||
|| it.id.toLowerCase().contains(lowerCase) || it.id.toUpperCase().contains(upperCase) || it.id.contains(name)
|
||||
it.title.lowercase().contains(lowerCase) || it.title.uppercase().contains(upperCase) || it.title.contains(name)
|
||||
|| it.id.lowercase().contains(lowerCase) || it.id.uppercase().contains(upperCase) || it.id.contains(name)
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,9 @@ package dev.inmo.kmppscriptbuilder.core.models
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
const val defaultProjectName = "\${project.name}"
|
||||
const val defaultProjectDescription = "\${project.name}"
|
||||
|
||||
@Serializable
|
||||
data class MavenConfig(
|
||||
val name: String,
|
||||
@@ -22,14 +25,20 @@ data class MavenPublishingRepository(
|
||||
name.toUpperCase()
|
||||
}
|
||||
|
||||
fun build(indent: String) = """maven {
|
||||
name = "$name"
|
||||
url = uri("$url")
|
||||
credentials {
|
||||
username = project.hasProperty('${nameCapitalized}_USER') ? project.property('${nameCapitalized}_USER') : System.getenv('${nameCapitalized}_USER')
|
||||
password = project.hasProperty('${nameCapitalized}_PASSWORD') ? project.property('${nameCapitalized}_PASSWORD') : System.getenv('${nameCapitalized}_PASSWORD')
|
||||
fun build(indent: String): String {
|
||||
val usernameProperty = "${nameCapitalized}_USER"
|
||||
val passwordProperty = "${nameCapitalized}_PASSWORD"
|
||||
return """if ((project.hasProperty('${usernameProperty}') || System.getenv('${usernameProperty}') != null) && (project.hasProperty('${passwordProperty}') || System.getenv('${passwordProperty}') != null)) {
|
||||
maven {
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
val SonatypeRepository = MavenPublishingRepository("sonatype", "https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||
|
@@ -3,12 +3,14 @@ package dev.inmo.kmppscriptbuilder.desktop
|
||||
import androidx.compose.desktop.Window
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.Colors
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||
import dev.inmo.kmppscriptbuilder.desktop.views.*
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.init
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.loadConfigFile
|
||||
import dev.inmo.kmppscriptbuilder.desktop.views.BuilderView
|
||||
import java.io.File
|
||||
|
||||
//private val uncaughtExceptionsBC = BroadcastChannel<DefaultErrorHandler.ErrorEvent>(Channel.CONFLATED)
|
||||
|
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.kmppscriptbuilder.desktop.utils
|
||||
|
||||
import java.awt.Desktop
|
||||
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,7 +6,7 @@ import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.svgResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.inmo.kmppscriptbuilder.core.models.Config
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||
@@ -45,7 +45,7 @@ class BuilderView : View() {
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = svgResource("images/open_file.svg"),
|
||||
painter = painterResource("images/open_file.svg"),
|
||||
contentDescription = "Open file"
|
||||
)
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class BuilderView : View() {
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = svgResource("images/save_file.svg"),
|
||||
painter = painterResource("images/save_file.svg"),
|
||||
contentDescription = "Save file"
|
||||
)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class BuilderView : View() {
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = svgResource("images/export_gradle.svg"),
|
||||
painter = painterResource("images/export_gradle.svg"),
|
||||
contentDescription = "Export Gradle script"
|
||||
)
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class BuilderView : View() {
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = svgResource("images/save_as.svg"),
|
||||
painter = painterResource("images/save_as.svg"),
|
||||
contentDescription = "Export Gradle script"
|
||||
)
|
||||
}
|
||||
@@ -100,4 +100,4 @@ class BuilderView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package dev.inmo.kmppscriptbuilder.desktop.views
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
import dev.inmo.kmppscriptbuilder.core.models.Developer
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.CommonTextField
|
||||
|
||||
class DeveloperState(
|
||||
id: String = "",
|
||||
|
@@ -53,7 +53,7 @@ class LicensesView: VerticalView("Licenses") {
|
||||
licensesOffersToShow.clear()
|
||||
if (licenseSearchFilter.isNotEmpty()) {
|
||||
licensesOffersToShow.addAll(
|
||||
availableLicensesState.filter { filterText.all { symbol -> symbol.toLowerCase() in it.title } }
|
||||
availableLicensesState.filter { filterText.all { symbol -> symbol.lowercaseChar() in it.title } }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,13 @@
|
||||
package dev.inmo.kmppscriptbuilder.desktop.views
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.CommonText
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.VerticalView
|
||||
|
||||
abstract class ListView<T>(title: String) : VerticalView(title) {
|
||||
protected val itemsList = mutableStateListOf<T>()
|
||||
|
@@ -2,8 +2,7 @@ package dev.inmo.kmppscriptbuilder.desktop.views
|
||||
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.runtime.*
|
||||
import dev.inmo.kmppscriptbuilder.core.models.MavenConfig
|
||||
import dev.inmo.kmppscriptbuilder.core.models.SonatypeRepository
|
||||
import dev.inmo.kmppscriptbuilder.core.models.*
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||
|
||||
class MavenInfoView : VerticalView("Project information") {
|
||||
@@ -18,8 +17,8 @@ class MavenInfoView : VerticalView("Project information") {
|
||||
|
||||
var mavenConfig: MavenConfig
|
||||
get() = MavenConfig(
|
||||
projectNameProperty,
|
||||
projectDescriptionProperty,
|
||||
projectNameProperty.ifBlank { defaultProjectName },
|
||||
projectDescriptionProperty.ifBlank { defaultProjectDescription },
|
||||
projectUrlProperty,
|
||||
projectVcsUrlProperty,
|
||||
includeGpgSignProperty,
|
||||
|
@@ -2,7 +2,7 @@ package dev.inmo.kmppscriptbuilder.desktop.views
|
||||
|
||||
import androidx.compose.runtime.*
|
||||
import dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.*
|
||||
import dev.inmo.kmppscriptbuilder.desktop.utils.CommonTextField
|
||||
|
||||
class RepositoryState(
|
||||
name: String = "",
|
||||
|
@@ -6,27 +6,27 @@ kotlin.incremental.js=true
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
kotlin_version=1.4.30
|
||||
kotlin_coroutines_version=1.4.2
|
||||
kotlin_serialisation_core_version=1.1.0
|
||||
ktor_version=1.5.1
|
||||
micro_utils_version=0.4.27
|
||||
kotlin_version=1.5.21
|
||||
kotlin_coroutines_version=1.5.2
|
||||
kotlin_serialisation_core_version=1.2.2
|
||||
ktor_version=1.6.3
|
||||
micro_utils_version=0.5.24
|
||||
|
||||
compose_version=0.3.0
|
||||
compose_version=1.0.0-alpha3
|
||||
|
||||
# ANDROID
|
||||
|
||||
android_minSdkVersion=21
|
||||
android_compileSdkVersion=30
|
||||
android_buildToolsVersion=30.0.2
|
||||
dexcount_version=2.0.0
|
||||
android_buildToolsVersion=30.0.3
|
||||
dexcount_version=3.0.0
|
||||
junit_version=4.12
|
||||
test_ext_junit_version=1.1.2
|
||||
espresso_core=3.3.0
|
||||
|
||||
# Dokka
|
||||
|
||||
dokka_version=1.4.20
|
||||
dokka_version=1.5.0
|
||||
|
||||
# Project data
|
||||
|
||||
|
@@ -14,12 +14,11 @@ fun saveFile(content: String, filename: String) {
|
||||
setAttribute("style", "visibility:hidden; display: none")
|
||||
} as HTMLAnchorElement
|
||||
val blob = Blob(arrayOf(content), BlobPropertyBag(
|
||||
"text/plain;charset=utf-8"
|
||||
"application/*;charset=utf-8"
|
||||
))
|
||||
val url = URL.createObjectURL(blob)
|
||||
a.href = url
|
||||
a.download = filename
|
||||
a.target = "_blank"
|
||||
a.click()
|
||||
URL.revokeObjectURL(url)
|
||||
a.remove()
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package dev.inmo.kmppscriptbuilder.web.views
|
||||
|
||||
import dev.inmo.kmppscriptbuilder.core.models.MavenConfig
|
||||
import dev.inmo.kmppscriptbuilder.core.models.SonatypeRepository
|
||||
import dev.inmo.kmppscriptbuilder.core.models.*
|
||||
import kotlinx.browser.document
|
||||
import org.w3c.dom.HTMLElement
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
@@ -18,8 +17,8 @@ class MavenProjectInfoView : View {
|
||||
|
||||
var mavenConfig: MavenConfig
|
||||
get() = MavenConfig(
|
||||
nameElement.value,
|
||||
descriptionElement.value,
|
||||
nameElement.value.ifBlank { defaultProjectName },
|
||||
descriptionElement.value.ifBlank { defaultProjectDescription },
|
||||
urlElement.value,
|
||||
vcsUrlElement.value,
|
||||
includeGpgElement.checked,
|
||||
@@ -39,6 +38,6 @@ class MavenProjectInfoView : View {
|
||||
developersView.developers = value.developers
|
||||
val reposWithoutSonatype = value.repositories.filter { it != SonatypeRepository }
|
||||
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) {
|
||||
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) {
|
||||
|
@@ -10,6 +10,7 @@
|
||||
<nav class="uk-navbar-container" uk-navbar>
|
||||
<div class="uk-navbar-left">
|
||||
<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 class="uk-navbar-right">
|
||||
<ul class="uk-navbar-nav">
|
||||
|
Reference in New Issue
Block a user