Skip to content

Commit

Permalink
Update gradle build with sanitation script validation
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaRanasinghe committed Jul 11, 2024
1 parent 33c224b commit aa2c3ac
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ allprojects {
def moduleVersion = project.version.replace("-SNAPSHOT", "")

task build {
dependsOn(':slack-sanitation:build')
dependsOn(':slack-ballerina:build')
}

Expand Down
42 changes: 42 additions & 0 deletions docs/spec/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.apache.tools.ant.taskdefs.condition.Os

def files = ["sanitations.bal"];

task build {
doLast {
try {
files.each { file ->
println("Building ${file} ...")
exec {
workingDir project.projectDir
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'sh', "/c", "bal build ${file} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', "-c", "bal build ${file}"
}
}
}
} catch (Exception e) {
println("Sanitation Script Build failed: " + e.message)
throw e
}
}
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ plugins {

rootProject.name = 'module-ballerinax-slack'

include ':slack-sanitation'
include ':slack-ballerina'

project(':slack-ballerina').projectDir = file("ballerina")

project(':slack-sanitation').projectDir = file("docs/spec")
gradleEnterprise {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
Expand Down

0 comments on commit aa2c3ac

Please sign in to comment.