Skip to content

Commit

Permalink
update to gradle kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Jul 16, 2023
1 parent 84e96a4 commit 9a4b942
Show file tree
Hide file tree
Showing 22 changed files with 294 additions and 273 deletions.
106 changes: 0 additions & 106 deletions build.gradle

This file was deleted.

110 changes: 110 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
plugins {
id("java")
id("maven-publish")
id("signing")
}

buildscript {
repositories {
mavenCentral()
}

dependencies {
}
}

allprojects {
apply {
plugin("java")
plugin("maven-publish")
}
apply(plugin = "maven-publish")

java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/releases/") }
}
}

var libProjects = mutableSetOf( project(":jParser:core"),
project(":jParser:idl"),
project(":jParser:loader"),
project(":jParser:cpp"),
project(":jParser:teavm"))

configure(libProjects) {

group = LibExt.groupId
version = LibExt.libVersion

publishing {
repositories {
maven {
url = uri {
val ver = project.version.toString()
val isSnapshot = ver.toUpperCase().contains("SNAPSHOT")
val repoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val repoUrlSnapshot = "https://oss.sonatype.org/content/repositories/snapshots/"
if(isSnapshot) repoUrlSnapshot else repoUrl
}
credentials {
username = System.getenv("USER")
password = System.getenv("PASSWORD")
}
}
}
}

// javadoc {
// options.encoding = 'UTF-8'
// options.addStringOption('Xdoclint:none', '-quiet')
// }
////
// java {
// withJavadocJar()
// withSourcesJar()
// }

publishing.publications.configureEach {
if (this is MavenPublication) {
pom {
name = "jParser"
description = "Java JNI code parser"
url = "http://github.com/xpenatan/jParser"
developers {
developer {
id = "Xpe"
name = "Natan"
}
}
scm {
connection = "scm:git:git://github.com/xpenatan/jParser.git"
developerConnection = "scm:git:ssh://github.com/xpenatan/jParser.git"
url = "http://github.com/xpenatan/jParser/tree/master"
}
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
}
}
}

val signingKey = System.getenv("SIGNING_KEY")
val signingPassword = System.getenv("SIGNING_PASSWORD")
if(signingKey != null && signingPassword != null) {
signing {
useInMemoryPgpKeys(signingKey, signingPassword)
publishing.publications.configureEach {
sign(this)
}
}
}
}
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
17 changes: 17 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
object LibExt {
val libVersion: String = this.getVersion()
const val jniGenVersion = "2.3.1"
const val javaparserVersion = "3.24.7"
const val jUnitVersion = "4.12"
const val groupId = "com.github.xpenatan.jParser"

private fun getVersion(): String {
var isRelease = System.getenv("RELEASE")
var libVersion = "1.0.0-SNAPSHOT"
if(isRelease != null && isRelease.toBoolean()) {
libVersion = "1.0.0-b3"
}
System.out.println("jParser Version: " + libVersion)
return libVersion
}
}
17 changes: 0 additions & 17 deletions dependencies.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions example/example-base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
group = project.groupId

dependencies {
}
19 changes: 0 additions & 19 deletions example/example-build/build.gradle

This file was deleted.

20 changes: 20 additions & 0 deletions example/example-build/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id("java")
}

val mainClassName = "com.github.xpenatan.jparser.example.Main"

dependencies {
implementation(project(":example:example-base"))
implementation(project(":jParser:core"))
implementation(project(":jParser:idl"))
implementation(project(":jParser:teavm"))
implementation(project(":jParser:cpp"))
}

tasks.register<JavaExec>("generateNativeProject") {
group = "gen"
description = "Generate native project"
mainClass.set(mainClassName)
classpath = sourceSets["main"].runtimeClasspath
}
12 changes: 0 additions & 12 deletions example/example-core/build.gradle

This file was deleted.

13 changes: 13 additions & 0 deletions example/example-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("java")
}

dependencies {
}

tasks.named("clean") {
doFirst {
val srcPath = "$projectDir/src/main/"
project.delete(files(srcPath))
}
}
25 changes: 0 additions & 25 deletions example/example-desktop/build.gradle

This file was deleted.

Loading

0 comments on commit 9a4b942

Please sign in to comment.