Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 5 additions & 38 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,8 @@ on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 21.0.3
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
latestCommit=$(git log -n 1 --pretty=format:"%h")
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
updatedVersion=$VERSION-$startTime-$latestCommit
echo $updatedVersion
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
run: |
./gradlew clean build publish --stacktrace --scan --console=plain
- name: Generate CodeCov Report
uses: codecov/codecov-action@v1
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ballerina-distribution
path: persist-cli-tests/build/ballerina-distribution/
call_workflow:
name: Run Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main
secrets: inherit
4 changes: 2 additions & 2 deletions build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ clean {
enabled = false
}

artifacts.add('default', file("$project.buildDir/checkstyle.xml")) {
artifacts.add('default', layout.buildDirectory.file("checkstyle.xml")) {
builtBy('downloadCheckstyleRuleFiles')
}

artifacts.add('default', file("$project.buildDir/suppressions.xml")) {
artifacts.add('default', layout.buildDirectory.file("suppressions.xml")) {
builtBy('downloadCheckstyleRuleFiles')
}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ task codeCoverageReport(type: JacocoReport) {
xml.required = true
html.required = true
csv.required = true
xml.destination(new File("${buildDir}/reports/jacoco/report.xml"))
html.destination(new File("${buildDir}/reports/jacoco/report.html"))
csv.destination(new File("${buildDir}/reports/jacoco/report.csv"))
xml.outputLocation = file("${buildDir}/reports/jacoco/report.xml")
html.outputLocation = file("${buildDir}/reports/jacoco/report.html")
csv.outputLocation = file("${buildDir}/reports/jacoco/report.csv")
}

onlyIf = {
Expand Down
16 changes: 10 additions & 6 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'java'

description = 'Ballerina - Persist Examples'

def ballerinaDist = "${project.buildDir}/ballerina-distribution"
def ballerinaDist = "${layout.buildDirectory.get()}/ballerina-distribution"
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
def balToolFile = new File("$project.projectDir/resources/bal-tools.toml")
def examples = ["medical-center", "rainier"]
Expand Down Expand Up @@ -62,7 +62,7 @@ task jBallerinaPack {
configurations.balTools.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from project.zipTree(artifact.getFile())
into new File("${project.buildDir}")
into layout.buildDirectory
}
copy {
from(project.zipTree(artifact.getFile())) {
Expand All @@ -71,7 +71,7 @@ task jBallerinaPack {
}
includeEmptyDirs = false
}
into "${project.buildDir}/ballerina-distribution"
into layout.buildDirectory.dir("ballerina-distribution")
}
}
}
Expand All @@ -85,7 +85,7 @@ task unpackStdLibs() {
configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from project.zipTree(artifact.getFile())
into new File("${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip")
into layout.buildDirectory.dir("extracted-stdlibs/" + artifact.name + "-zip")
}
}
}
Expand All @@ -97,7 +97,7 @@ task copyStdlibs() {
/* Standard Libraries */
doLast {
configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def artifactExtractedPath = "${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip"
def artifactExtractedPath = "${layout.buildDirectory.get()}/extracted-stdlibs/" + artifact.name + "-zip"
copy {
into ballerinaDist
into("repo/bala") {
Expand All @@ -108,7 +108,7 @@ task copyStdlibs() {
}
}
copy {
def runtimePath = "${project.buildDir}/ballerina-distribution"
def runtimePath = "${layout.buildDirectory.get()}/ballerina-distribution"
into runtimePath
into("repo/bala") {
from "${artifactExtractedPath}/bala"
Expand Down Expand Up @@ -345,6 +345,10 @@ task generateRedisMockExamples {
}
}

clean {
delete layout.buildDirectory
}

copyPersistTool.dependsOn ":persist-cli-tests:build"
copyPersistTool.dependsOn ":persist-cli:build"
copyPersistTool.dependsOn ":persist-tool:build"
Expand Down
18 changes: 10 additions & 8 deletions persist-cli-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ apply from: "${rootDir}/gradle/docker-compose-helper.gradle"
description = 'Ballerina - persist-tools Tooling Test'

def buildDir = "build";
def ballerinaDist = "$project.buildDir/jballerina-tools-${ballerinaLangVersion}"
def ballerinaDist = "${layout.buildDirectory.get()}/jballerina-tools-${ballerinaLangVersion}"
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
def balToolFile = new File("$project.projectDir/resources/bal-tools.toml")

Expand Down Expand Up @@ -90,7 +90,7 @@ task jBallerinaPack {
configurations.balTools.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from project.zipTree(artifact.getFile())
into new File("${project.buildDir}")
into layout.buildDirectory
}
copy {
from(project.zipTree(artifact.getFile())) {
Expand All @@ -112,7 +112,7 @@ task unpackStdLibs() {
configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from project.zipTree(artifact.getFile())
into new File("${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip")
into layout.buildDirectory.dir("extracted-stdlibs/" + artifact.name + "-zip")
}
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ task copyStdlibs() {
/* Standard Libraries */
doLast {
configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def artifactExtractedPath = "${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip"
def artifactExtractedPath = "${layout.buildDirectory.get()}/extracted-stdlibs/" + artifact.name + "-zip"
copy {
into ballerinaDist
into("repo/bala") {
Expand Down Expand Up @@ -249,10 +249,10 @@ spotbugsTest {
def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort")
effort = SpotBugsEffort.MAX
reportLevel = SpotBugsConfidence.LOW
reportsDir = file("$project.buildDir/reports/spotbugs")
reportsDir = layout.buildDirectory.dir("reports/spotbugs")
reports {
html.enabled true
text.enabled = true
html.required = true
text.required = true
}
def excludeFile = file("${rootDir}/spotbugs-exclude.xml")
if(excludeFile.exists()) {
Expand All @@ -270,9 +270,11 @@ checkstyleMain {

test {
dependsOn(copyTestPack)
systemProperty "ballerina.home", ballerinaDist
dependsOn(copyTestResources)
systemProperty "ballerina.offline.flag", "true"
doFirst {
systemProperty "ballerina.home", file("${buildDir}/ballerina-distribution").absolutePath
}
useTestNG() {
suites 'src/test/resources/testng.xml'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void updateOutputBallerinaToml(String fileName) {

private String collectLogOutput(Path project) throws IOException, InterruptedException {
List<String> buildArgs = new LinkedList<>();
Process process = executeBuild(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs);
Process process = executeBuild("", project, buildArgs);
try (BufferedReader br = new BufferedReader(new InputStreamReader(process.getErrorStream(),
StandardCharsets.UTF_8))) {
Stream<String> logLines = br.lines();
Expand Down
15 changes: 10 additions & 5 deletions persist-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ spotbugsMain {
def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort")
effort = SpotBugsEffort.MAX
reportLevel = SpotBugsConfidence.LOW
reportsDir = file("$project.buildDir/reports/spotbugs")
reportsDir = layout.buildDirectory.dir("reports/spotbugs")
reports {
//html.enabled true
text.enabled = true
text.required = true
}
def excludeFile = file("${rootDir}/spotbugs-exclude.xml")
if (excludeFile.exists()) {
Expand Down Expand Up @@ -140,9 +140,10 @@ compileJava {
}
}

manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
jar {
manifest {
attributes('Implementation-Title': project.name, 'Implementation-Version': project.version)
}
}

task createArtifactZip(type: Zip) {
Expand All @@ -153,6 +154,10 @@ task createArtifactZip(type: Zip) {
destinationDirectory = file("${projectDir}/build/zip")
}

clean {
delete layout.buildDirectory
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down
5 changes: 5 additions & 0 deletions persist-tool/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,10 @@ build.dependsOn updateTomlFiles
build.dependsOn "generatePomFileForMavenPublication"
build.dependsOn ":persist-cli:build"

clean {
delete layout.buildDirectory
delete "$project.projectDir/target"
}

publishToMavenLocal.dependsOn build
publish.dependsOn build
Loading