Skip to content

Commit

Permalink
update gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Jul 16, 2023
1 parent f6741f1 commit 6169c3d
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 400 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
env:
USER: ${{ secrets.USER }}
PASSWORD: ${{ secrets.PASSWORD }}
signingKey: ${{ secrets.PGP_SECRET }}
signingPassword: ${{ secrets.PGP_PASSPHRASE }}
SIGNING_KEY: ${{ secrets.PGP_SECRET }}
SIGNING_PASSWORD: ${{ secrets.PGP_PASSPHRASE }}
90 changes: 67 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,96 @@ buildscript {
}

allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: 'maven-publish'
apply plugin: 'java'

sourceCompatibility = 11
targetCompatibility = 11

group = project.groupId

ext {
repoUser = System.getenv('USER')
repoPass = System.getenv('PASSWORD')
repoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
repoUrlSnapshot = 'https://oss.sonatype.org/content/repositories/snapshots/'

def localFile = project.rootProject.file("local.properties")
if (localFile.exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
repoUser = properties.getProperty("xUser")
repoPass = properties.getProperty("xPass")
}
}

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

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

configure(libProjects) {
apply plugin: 'maven-publish'
apply plugin: 'signing'

group = project.groupId

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

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

java {
withJavadocJar()
withSourcesJar()
}


publishing.publications.configureEach { mav ->
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"
}
}
}
}

def signingKey = System.getenv("SIGNING_KEY")
def signingPassword = System.getenv("SIGNING_PASSWORD")
if(signingKey != null && signingPassword != null) {
signing {
useInMemoryPgpKeys(signingKey, signingPassword)
publishing.publications.configureEach { pub ->
sign pub
}
}
}
}
11 changes: 0 additions & 11 deletions example/example-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,10 @@ apply plugin: "java"
group = project.groupId
version = "1.0.0"

def module_name = "example-core"

dependencies {
}

clean.doFirst {
def srcPath = projectDir.toString() + "/src/main/"
project.delete(files(srcPath))
}

publishing {
publications {
maven(MavenPublication) {
artifactId = module_name
from components.java
}
}
}
11 changes: 0 additions & 11 deletions example/example-desktop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ apply plugin: "java"
group = project.groupId
version = "1.0.0"

def module_name = "example-core"

dependencies {
testImplementation project(":jParser:loader")
testImplementation project(":example:example-core")
Expand All @@ -16,15 +14,6 @@ clean.doFirst {
project.delete(files(srcPath))
}

publishing {
publications {
maven(MavenPublication) {
artifactId = module_name
from components.java
}
}
}

tasks.register("prepareTest", GradleBuild) {
tasks = [
":example:example-build:clean",
Expand Down
79 changes: 5 additions & 74 deletions jParser/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,88 +1,19 @@
apply plugin: "java"
apply plugin: 'java-library'
apply plugin: 'signing'

def module_name = "jParser-core"

configurations {
includeDep
api.extendsFrom includeDep
}
def module_name = "core"

dependencies {
api project(":jParser:idl")
includeDep "com.github.javaparser:javaparser-symbol-solver-core:$project.javaparserVersion"
includeDep "com.github.javaparser:javaparser-core:$project.javaparserVersion"
}

task fromClasses(type: Jar) {
from(sourceSets.main.output) {
}
}

task javadocJar(type: Jar) {
archiveClassifier.set("javadoc")
from javadoc
}

task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}

javadoc {
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
api "com.github.javaparser:javaparser-symbol-solver-core:$project.javaparserVersion"
api "com.github.javaparser:javaparser-core:$project.javaparserVersion"
}

publishing {
publications {
maven(MavenPublication) {
version project.jParserVersion + project.jParserType
project.version = project.jParserVersion + project.jParserType
artifactId module_name
artifact fromClasses
artifact javadocJar
artifact sourcesJar

pom {
name = "jParser"
description = "Java 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"
}
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.includeDep.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
artifactId = module_name
from components.java
}
}
}

signing {
def signingKey = System.getenv("signingKey")
def signingPassword = System.getenv("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.body.BodyDeclaration;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.TypeDeclaration;
import com.github.javaparser.ast.comments.BlockComment;
Expand Down
82 changes: 4 additions & 78 deletions jParser/cpp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,96 +1,22 @@
apply plugin: "java"
apply plugin: 'java-library'
apply plugin: 'signing'

def module_name = "jParser-cpp"

configurations {
includeDep
implementation.extendsFrom includeDep
}
def module_name = "cpp"

dependencies {
api project(":jParser:idl")
implementation project(":jParser:core")
includeDep "com.badlogicgames.gdx:gdx-jnigen:$project.jniGenVersion"
implementation "com.badlogicgames.gdx:gdx-jnigen:$project.jniGenVersion"

testImplementation project(":jParser:loader")
testImplementation "junit:junit:$project.jUnitVersion"
}

task fromClasses(type: Jar) {
from(sourceSets.main.output) {
}
}

task javadocJar(type: Jar) {
archiveClassifier.set("javadoc")
from javadoc
}

task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}

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

configurations {
provided
implementation.extendsFrom provided
}

publishing {
publications {
maven(MavenPublication) {
version project.jParserVersion + project.jParserType
project.version = project.jParserVersion + project.jParserType
artifactId module_name
artifact fromClasses
artifact javadocJar
artifact sourcesJar

pom {
name = "jParser cpp"
description = "Java 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"
}
}
withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.includeDep.allDependencies.each {
def dependencyNode = dependencies.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
artifactId = module_name
from components.java
}
}
}

signing {
def signingKey = System.getenv("signingKey")
def signingPassword = System.getenv("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
Loading

0 comments on commit 6169c3d

Please sign in to comment.