Skip to content

Commit

Permalink
Merge branch 'master' into update_workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gabilang authored Aug 11, 2023
2 parents a885627 + 624a2aa commit 2d51316
Show file tree
Hide file tree
Showing 17 changed files with 323 additions and 218 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ensure all Java files use LF.
*.java eol=lf
16 changes: 16 additions & 0 deletions .github/workflows/fossa_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Fossa Scan
on:
workflow_dispatch:
schedule:
- cron: '30 18 * * *' # 00:00 in LK time (GMT+5:30)
jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
api-key: ${{secrets.FOSSA_APIKEY}}
28 changes: 8 additions & 20 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
[package]
org = "ballerina"
name = "os"
version = "1.7.0"
version = "1.8.0"
authors = ["Ballerina"]
keywords = ["environment"]
repository = "https://github.com/ballerina-platform/module-ballerina-os"
icon = "icon.png"
license = ["Apache-2.0"]
distribution = "2201.7.0"
distribution = "2201.8.0"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
groupId = "org.burningwave"
artifactId = "core"
version = "12.62.7"
path = "./lib/core-12.62.7.jar"

[[platform.java17.dependency]]
groupId = "io.github.toolfactory"
artifactId = "jvm-driver"
version = "9.4.3"
path = "./lib/jvm-driver-9.4.3.jar"

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "os-native"
version = "1.7.0"
path = "../native/build/libs/os-native-1.7.0.jar"
version = "1.8.0"
path = "../native/build/libs/os-native-1.8.0-SNAPSHOT.jar"

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "io-native"
version = "1.5.0"
path = "./lib/io-native-1.5.0.jar"
version = "1.6.0"
path = "./lib/io-native-1.6.0-20230810-115500-2e569f5.jar"

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "os-test-utils"
version = "1.7.0"
path = "../test-utils/build/libs/os-test-utils-1.7.0.jar"
version = "1.8.0"
path = "../test-utils/build/libs/os-test-utils-1.8.0-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.7.0"
distribution-version = "2201.8.0-20230726-145300-b2bdf796"

[[package]]
org = "ballerina"
name = "io"
version = "1.5.0"
version = "1.6.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
Expand Down Expand Up @@ -47,7 +47,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "os"
version = "1.7.0"
version = "1.8.0"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand Down
13 changes: 4 additions & 9 deletions ballerina/os.bal
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ public type EnvProperties record {|
# + name - Name of the environment variable
# + return - Environment variable value if it exists or else, an empty string
public isolated function getEnv(string name) returns string {
var value = java:toString(nativeGetEnv(java:fromString(name)));
if value is string {
return value;
}
return "";
return nativeGetEnv(name);
}

isolated function nativeGetEnv(handle key) returns handle = @java:Method {
name: "getenv",
'class: "java.lang.System",
paramTypes: ["java.lang.String"]
isolated function nativeGetEnv(string key) returns string = @java:Method {
name: "getEnv",
'class: "io.ballerina.stdlib.os.nativeimpl.GetEnv"
} external;

# Returns the current user's name.
Expand Down
7 changes: 1 addition & 6 deletions ballerina/tests/os_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ import ballerina/io;

configurable string bal_exec_path = ?;

@test:Config {
enable:false
}
function testGetEnv() {
string expectedValue = getExpectedValidEnv();
test:assertEquals(getEnv("JAVA_HOME"), expectedValue);
Expand Down Expand Up @@ -53,7 +50,6 @@ function setEnvDataProvider() returns (string[][]) {
}

@test:Config {
enable: false,
dataProvider: setEnvDataProvider
}
function testSetEnv(string key, string value) {
Expand Down Expand Up @@ -94,7 +90,6 @@ function unsetEnvDataProvider() returns (string[][]) {
}

@test:Config {
enable: false,
dataProvider: unsetEnvDataProvider
}
function testUnsetEnv(string key, string value) {
Expand Down Expand Up @@ -213,7 +208,7 @@ function testExecWithOutputStdErr() returns error? {
}

@test:Config {
enable: false
enable:false
}
function testExecWithEnvironmentVariable() returns error? {
Process process = check exec({value: bal_exec_path, arguments: ["run", "tests/resources/hello3.bal"]}, BAL_CONFIG_FILES = "tests/resources/config/Config.toml");
Expand Down
4 changes: 2 additions & 2 deletions ballerina/tests/resources/hello3.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// specific language governing permissions and limitations
// under the License.

import ballerina/log;
import ballerina/io;

public function main() {
log:printDebug("debug message");
io:println("debug message");
}
2 changes: 1 addition & 1 deletion build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords = ["environment"]
repository = "https://github.com/ballerina-platform/module-ballerina-os"
icon = "icon.png"
license = ["Apache-2.0"]
distribution = "2201.7.0"
distribution = "2201.8.0"

[platform.java17]
graalvmCompatible = true
Expand Down
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
org.gradle.caching=true
group=io.ballerina.stdlib
version=1.7.1-SNAPSHOT
version=1.8.0-SNAPSHOT

ballerinaGradlePluginVersion=2.0.0
ballerinaGradlePluginVersion=2.0.1
githubSpotBugsVersion=5.0.14
shadowJarVersion=7.1.2
undercouchDownloadVersion=5.4.0
researchgateReleaseVersion=2.8.0
puppycrawlCheckstyleVersion=10.12.0


ballerinaLangVersion= 2201.7.0
stdlibIoVersion=1.5.0
ballerinaLangVersion=2201.8.0-20230726-145300-b2bdf796
stdlibIoVersion=1.6.0-20230810-115500-2e569f5
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2d51316

Please sign in to comment.