Skip to content

Commit

Permalink
Make build compatible with gradle v8.1.1 and java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
gabilang committed May 31, 2023
1 parent 6075db7 commit 7f6422b
Show file tree
Hide file tree
Showing 27 changed files with 91 additions and 93 deletions.
2 changes: 1 addition & 1 deletion build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "de.undercouch.download" version "3.4.3"
id "de.undercouch.download" version "5.4.0"
id 'base'
}

Expand Down
7 changes: 0 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
plugins {
id 'base'
// id 'com.gradle.build-scan' version '3.6.4'
// id "com.gradle.enterprise" version "3.13.2"
// id "com.github.spotbugs" version "4.7.3"
id "com.github.spotbugs" version "4.7.3"
id "com.dorongold.task-tree" version "1.3.1"
id "com.github.johnrengelman.shadow" version "8.1.0"
Expand All @@ -23,10 +20,6 @@ allprojects {
println projectDir
}
}

tasks.withType(Jar){
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

subprojects {
Expand Down
7 changes: 7 additions & 0 deletions cli/ballerina-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ dependencies {
implementation project(':toml-parser')
implementation project(':identifier-util')
testImplementation project(':ballerina-test-utils')
implementation 'org.ow2.asm:asm'
implementation "org.ow2.asm:asm-commons:${project.ow2AsmCommonsVersion}"
implementation "org.jacoco:org.jacoco.core:${project.jacocoVersion}"
implementation "org.jacoco:org.jacoco.report:${project.jacocoVersion}"
// implementation group: 'org.jacoco', name: 'org.jacoco.core', version: "${project.jacocoVersion}"

testImplementation 'org.testng:testng'
testImplementation 'org.mockito:mockito-all'
Expand Down Expand Up @@ -105,3 +110,5 @@ compileJava {
classpath = files()
}
}

tasks.compileJava.dependsOn(':testerina:testerina-core:copyInteropImports')
1 change: 0 additions & 1 deletion cli/ballerina-cli/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
requires io.ballerina.toml;
requires io.ballerina.identifier;
requires org.objectweb.asm;
requires org.objectweb.asm.commons;
}
8 changes: 4 additions & 4 deletions distribution/zip/jballerina-tools/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ballerina-time-1.0.0-java.jar
ballerina-transactions-0.5.0-java.jar jar apache2
maven-resolver-2.0.0-Preview1.jar jar apache2
ballerina-lang.value-1.0.0-java.jar jar apache2
asm-analysis-7.1.jar bundle bsd
asm-analysis-9.5.jar bundle bsd
ballerina-lang.boolean-1.0.0.jar jar apache2
ballerina-transactions-0.5.0.jar jar apache2
ballerina-runtime-0.5.0-java.jar jar apache2
Expand Down Expand Up @@ -81,7 +81,7 @@ ballerina-lang.annotations-1.0.0-java.jar
ballerina-logging-2.0.0-Preview1.jar jar apache2
jaxen-1.1.6.jar bundle apache2
ballerina-http-1.0.0.jar jar apache2
asm-tree-7.1.jar bundle bsd
asm-tree-9.5.jar bundle bsd
ballerina-lang.typedesc-1.0.0.jar jar apache2
commons-collections-3.2.2.jar bundle apache2
ballerina-java.arrays-0.9.0.jar jar apache2
Expand Down Expand Up @@ -117,7 +117,7 @@ ballerina-rabbitmq-1.0.0.jar
ballerina-cli-utils-2.0.0-Preview1.jar jar apache2
kafka-clients-2.3.1.jar jar apache2
ballerina-encoding-1.0.0-java.jar jar apache2
asm-7.1.jar bundle bsd
asm-9.5.jar bundle bsd
netty-resolver-4.1.39.Final.jar bundle apache2
ballerina-lang.int-1.1.0-java.jar jar apache2
ballerina-lang.stream-0.4.0.jar jar apache2
Expand Down Expand Up @@ -187,7 +187,7 @@ netty-transport-4.1.39.Final.jar
ballerina-stringutils-0.5.0.jar jar apache2
axiom-impl-1.4.0.jar bundle apache2
ballerina-file-0.5.0-java.jar jar apache2
asm-util-7.1.jar bundle bsd
asm-util-9.5.jar bundle bsd
broker-common-0.970.0.jar bundle apache2
ballerina-cli-module-2.0.0-Preview1.jar jar apache2
jackson-datatype-jsr310-2.9.5.jar bundle apache2
Expand Down
8 changes: 4 additions & 4 deletions distribution/zip/jballerina/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ballerina-jaeger-extension-1.1.0.jar
value-1.1.0.jar jar apache2
module_cli_token_updater.jar jar apache2
jsonutils.jar jar apache2
asm-analysis-7.1.jar bundle bsd
asm-analysis-9.5.jar bundle bsd
ballerina-openshift-1.1.0.jar jar apache2
kafka-clients-2.0.1.jar jar apache2
openshift.jar jar apache2
Expand All @@ -82,7 +82,7 @@ openapi-to-ballerina-generator-1.1.0.jar
kubernetes-extension-1.1.0.jar jar apache2
jaxen-1.1.6.jar bundle apache2
math.jar jar apache2
asm-tree-7.1.jar bundle bsd
asm-tree-9.5.jar bundle bsd
test.jar jar apache2
xmlutils.jar jar apache2
ballerina-openapi-1.1.0.jar jar apache2
Expand Down Expand Up @@ -116,7 +116,7 @@ lang.table.jar
ballerina-prometheus-extension-1.1.0.jar jar apache2
ballerina-jvm-1.1.0.jar jar apache2
filepath.jar jar apache2
asm-7.1.jar bundle bsd
asm-9.5.jar bundle bsd
netty-resolver-4.1.39.Final.jar bundle apache2
llvm.jar jar apache2
java.jar jar apache2
Expand Down Expand Up @@ -178,7 +178,7 @@ netty-transport-4.1.39.Final.jar
encoding.jar jar apache2
axiom-impl-1.4.0.jar bundle apache2
ballerina-jdbc-1.1.0.jar jar apache2
asm-util-7.1.jar bundle bsd
asm-util-9.5.jar bundle bsd
streams.jar jar apache2
broker-common-0.970.0.jar bundle apache2
integer-1.1.0.jar jar apache2
Expand Down
11 changes: 6 additions & 5 deletions gradle/ballerinaLangLibBuild.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ compileJava {
}

class BallerinaLangLibBuildTask extends JavaExec {
def projectDir = ''
def distCache = ''
def pkgName = project.name
def skipBootstrap = 'false'
@Internal def projectDir = ''
@Internal def distCache = ''
@Internal def pkgName = project.name
@Internal def skipBootstrap = 'false'

BallerinaLangLibBuildTask() {
setMain('org.ballerinalang.stdlib.utils.BuildLangLib')
// setMain('org.ballerinalang.stdlib.utils.BuildLangLib')
getMainClass().set('org.ballerinalang.stdlib.utils.BuildLangLib')
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions gradle/ballerinaNativeStdLibBuild.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ compileJava {
}

class BallerinaLangLibBuildTask extends JavaExec {
def projectDir = ''
def distCache = ''
def pkgName = project.name
def skipBootstrap = 'false'
@Internal def projectDir = ''
@Internal def distCache = ''
@Internal def pkgName = project.name
@Internal def skipBootstrap = 'false'

BallerinaLangLibBuildTask() {
setMain('org.ballerinalang.stdlib.utils.BuildLangLib')
Expand Down
8 changes: 4 additions & 4 deletions gradle/ballerinaStdLibBuild.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ compileJava {
}

class BallerinaLangLibBuildTask extends JavaExec {
def projectDir = ''
def distCache = ''
def pkgName = project.name
def skipBootstrap = 'false'
@Internal def projectDir = ''
@Internal def distCache = ''
@Internal def pkgName = project.name
@Internal def skipBootstrap = 'false'

BallerinaLangLibBuildTask() {
setMain('org.ballerinalang.stdlib.utils.BuildLangLib')
Expand Down
8 changes: 4 additions & 4 deletions gradle/ballerinaStdLibBuildInternal.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ compileJava {
}

class BallerinaLangLibBuildTask extends JavaExec {
def projectDir = ''
def distCache = ''
def pkgName = project.name
def skipBootstrap = 'false'
@Internal def projectDir = ''
@Internal def distCache = ''
@Internal def pkgName = project.name
@Internal def skipBootstrap = 'false'

BallerinaLangLibBuildTask() {
setMain('org.ballerinalang.stdlib.utils.BuildLangLib')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void testFromHexString() {
BError err = (BError) result.get(1);
assertEquals(err.getErrorMessage().getValue(),
getModulePrefixedReason(INT_LANG_LIB, NUMBER_PARSING_ERROR_IDENTIFIER).getValue());
assertEquals(err.getDetails().toString(), "{\"message\":\"For input string: \"12invalid34\"\"}");
assertEquals(err.getDetails().toString(), "{\"message\":\"For input string: \"12invalid34\" under radix 16\"}");
}

@DataProvider(name = "MaxNumList")
Expand Down
1 change: 1 addition & 0 deletions language-server/modules/langserver-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,4 @@ task buildAndCopy(type: Copy) {
'/bre/lib'
}

tasks.compileJava.dependsOn(':language-server:language-server-stdlib:copyInteropImports')
23 changes: 9 additions & 14 deletions misc/diagram-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ configurations {
dist {
transitive false
}
dependency {
transitive false
}
// dependency {
// transitive false
// }
libs
distributionBala
}
Expand All @@ -32,7 +32,7 @@ dependencies {
implementation project(':ballerina-lang')
implementation project(':ballerina-parser')
implementation project(':ballerina-tools-api')
implementation project(':docerina')
implementation(project(':docerina'))
implementation project(':central-client')

implementation 'org.apache.commons:commons-lang3'
Expand All @@ -45,16 +45,6 @@ description = 'Diagram utils for Syntax tree JSON generation'

ext.moduleName = 'diagram-util'

compileJava {
inputs.property("moduleName", moduleName)
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
classpath = files()
}
}

test {
dependsOn loadDistributionCache
systemProperty "ballerina.home", "$buildDir/"
Expand All @@ -64,3 +54,8 @@ test {
suites 'src/test/resources/testng.xml'
}
}

///*this is to let gradle infer the locations of the modules*/
//java {
// modularity.inferModulePath.set(true)
//}
56 changes: 28 additions & 28 deletions misc/docerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

apply plugin: 'base'
apply plugin: 'com.github.johnrengelman.shadow'
//apply plugin: 'com.github.johnrengelman.shadow'

apply from: "$rootDir/gradle/javaProject.gradle"
apply from: "$rootDir/gradle/ballerinaLangLibLoad.gradle"
Expand Down Expand Up @@ -90,21 +90,21 @@ artifacts {
file("$sourceSets.main.output.resourcesDir/doc-ui/")
}

jar {
enabled = false
dependsOn(shadowJar { archiveClassifier = null })
manifest {
attributes(
'Main-Class': 'org.ballerinalang.docgen.docs.BallerinaDocGeneratorMain',
'Implementation-Title': 'Ballerina - Docerina',
'Specification-Title': 'Ballerina - Docerina',
'Specification-Vendor': 'WSO2',
'Implementation-Vendor-Id': 'org.ballerinalang',
'Implementation-Vendor': 'WSO2',
'Implementation-URL': 'https://ballerina.io/misc/docerina/'
)
}
}
//jar {
// enabled = false
// dependsOn(shadowJar { archiveClassifier = null })
// manifest {
// attributes(
// 'Main-Class': 'org.ballerinalang.docgen.docs.BallerinaDocGeneratorMain',
// 'Implementation-Title': 'Ballerina - Docerina',
// 'Specification-Title': 'Ballerina - Docerina',
// 'Specification-Vendor': 'WSO2',
// 'Implementation-Vendor-Id': 'org.ballerinalang',
// 'Implementation-Vendor': 'WSO2',
// 'Implementation-URL': 'https://ballerina.io/misc/docerina/'
// )
// }
//}

processResources {
include '**/properties'
Expand All @@ -115,18 +115,18 @@ processResources {
filter { String line -> line.replace('${short.version}', "${project.version}")}
}

shadowJar {
configurations = [project.configurations.runtimeClasspath]
dependencies {
include(dependency('com.atlassian.commonmark:commonmark'))
include(dependency('com.atlassian.commonmark:commonmark-ext-gfm-tables'))
include(dependency(':ballerina-lang'))
include(dependency(':ballerina-parser'))
exclude('META-INF/*.SF')
exclude('META-INF/*.DSA')
exclude('META-INF/*.RSA')
}
}
//shadowJar {
// configurations = [project.configurations.runtimeClasspath]
// dependencies {
// include(dependency('com.atlassian.commonmark:commonmark'))
// include(dependency('com.atlassian.commonmark:commonmark-ext-gfm-tables'))
//// include(dependency(':ballerina-lang'))
//// include(dependency(':ballerina-parser'))
// exclude('META-INF/*.SF')
// exclude('META-INF/*.DSA')
// exclude('META-INF/*.RSA')
// }
//}

task copyBala(type: Copy) {
from configurations.distBal
Expand Down
1 change: 1 addition & 0 deletions misc/lib-creator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ description = 'Ballerina - Library creation utility'

// Creating uber jar of lib-creator to avoid windows gradle build issue with long class path with java commands.
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.dist.collect { it.isDirectory() ? it : zipTree(it) }
} {
Expand Down
1 change: 1 addition & 0 deletions misc/ls-extensions/modules/bal-shell-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ compileJava {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes "Main-Class": "io.ballerina.shell.service.BalShellService"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ compileJava {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes "Main-Class": "io.ballerina.converters.JsonToRecordConverterService"
}
Expand Down
1 change: 1 addition & 0 deletions misc/ls-extensions/modules/partial-parser/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ compileJava {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes "Main-Class": "io.ballerina.parsers.PartialParserService"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ compileJava {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes "Main-Class": "io.ballerina.PerformanceAnalyzer"
}
Expand Down
1 change: 1 addition & 0 deletions misc/ls-extensions/modules/trigger-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ compileJava {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes "Main-Class": "io.ballerina.trigger.BallerinaTriggerService"
}
Expand Down
1 change: 1 addition & 0 deletions misc/maven-resolver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ configurations {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes(
'Implementation-Title': 'Maven Resolver',
Expand Down
4 changes: 3 additions & 1 deletion misc/testerina/modules/testerina-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ dependencies {
implementation group: 'io.github.java-diff-utils', name: 'java-diff-utils', version: "${project.javaDiffUtilsVersion}"
}

jar.archiveFileName = "${project.name}-${project.version}.jar"
jar {
archiveFileName.set("${project.name}-${project.version}.jar")
}

task updateVersion {
doLast {
Expand Down
Loading

0 comments on commit 7f6422b

Please sign in to comment.