Skip to content

Commit

Permalink
Merge pull request #42276 from gabilang/rm-lang-dep
Browse files Browse the repository at this point in the history
Remove lang dependencies from langlibs
  • Loading branch information
warunalakshitha authored Mar 27, 2024
2 parents 9141e6b + f196979 commit 23620b3
Show file tree
Hide file tree
Showing 48 changed files with 234 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,6 @@ public class BLangCompilerConstants {

// java module version
public static final String JAVA_VERSION = "0.9.0";
// lang lib versions
public static final String INTERNAL_VERSION = "0.1.0";
public static final String ANNOTATIONS_VERSION = "1.0.0";
public static final String ARRAY_VERSION = "1.1.0";
public static final String DECIMAL_VERSION = "1.0.0";
public static final String ERROR_VERSION = "1.0.0";
public static final String FLOAT_VERSION = "1.0.0";
public static final String FUTURE_VERSION = "1.0.0";
public static final String INT_VERSION = "1.1.0";
public static final String MAP_VERSION = "1.1.0";
public static final String OBJECT_VERSION = "1.0.0";
public static final String STREAM_VERSION = "0.4.0";
public static final String STRING_VERSION = "1.1.0";
public static final String TABLE_VERSION = "0.4.0";
public static final String TEST_VERSION = "1.0.0";
public static final String TYPEDESC_VERSION = "1.0.0";
public static final String VALUE_VERSION = "1.0.0";
public static final String XML_VERSION = "0.8.0";
public static final String BOOLEAN_VERSION = "1.0.0";
public static final String QUERY_VERSION = "0.0.1";
public static final String RUNTIME_VERSION = "0.0.1";
public static final String TRANSACTION_VERSION = "0.0.1";
public static final String TRANSACTION_INTERNAL_VERSION = "1.0.15";
public static final String OBSERVE_INTERNAL_VERSION = "1.0.0";
public static final String C2C_VERSION = "1.0.0";

private BLangCompilerConstants() {
}
Expand Down
2 changes: 1 addition & 1 deletion langlib/jballerina.java/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module io.ballerina.java {
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.java;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.__internal/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.internal {
exports org.ballerinalang.langlib.internal;
requires io.ballerina.lang;
requires io.ballerina.runtime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.List;

import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static org.ballerinalang.util.BLangCompilerConstants.INTERNAL_VERSION;

/**
* Native implementation of lang.internal:invokeAsExternal(func, args).
Expand All @@ -35,7 +34,7 @@
public class InvokeAsExternal {

private static final StrandMetadata METADATA = new StrandMetadata(BALLERINA_BUILTIN_PKG_PREFIX, "lang.internal",
INTERNAL_VERSION, "invokeAsExternal");
"0.1.0", "invokeAsExternal");

public static Object invokeAsExternal(Object func, Object[] args) {

Expand Down
3 changes: 1 addition & 2 deletions langlib/lang.array/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.array {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.array;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import static io.ballerina.runtime.api.constants.RuntimeConstants.ARRAY_LANG_LIB;
import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static org.ballerinalang.langlib.array.utils.ArrayUtils.createOpNotSupportedError;
import static org.ballerinalang.util.BLangCompilerConstants.ARRAY_VERSION;
import static org.ballerinalang.langlib.array.utils.Constants.ARRAY_VERSION;

/**
* Native implementation of lang.array:filter(Type[], function).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import static io.ballerina.runtime.api.constants.RuntimeConstants.ARRAY_LANG_LIB;
import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static org.ballerinalang.langlib.array.utils.ArrayUtils.getElementAccessFunction;
import static org.ballerinalang.util.BLangCompilerConstants.ARRAY_VERSION;
import static org.ballerinalang.langlib.array.utils.Constants.ARRAY_VERSION;

/**
* Native implementation of lang.array:forEach(Type[]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import static io.ballerina.runtime.api.constants.RuntimeConstants.ARRAY_LANG_LIB;
import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static org.ballerinalang.langlib.array.utils.ArrayUtils.createOpNotSupportedError;
import static org.ballerinalang.util.BLangCompilerConstants.ARRAY_VERSION;
import static org.ballerinalang.langlib.array.utils.Constants.ARRAY_VERSION;

/**
* Native implementation of lang.array:map(Type[]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import static io.ballerina.runtime.api.constants.RuntimeConstants.ARRAY_LANG_LIB;
import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static org.ballerinalang.langlib.array.utils.ArrayUtils.getElementAccessFunction;
import static org.ballerinalang.util.BLangCompilerConstants.ARRAY_VERSION;
import static org.ballerinalang.langlib.array.utils.Constants.ARRAY_VERSION;

/**
* Native implementation of lang.array:reduce(Type[], function).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://wso2.com).
*
* Licensed 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.
*/

package org.ballerinalang.langlib.array.utils;

/**
* Constants for the langlib array module.
*
* @since 2201.9.0
*/
public class Constants {

public static final String ARRAY_VERSION = "1.1.0";

private Constants() {
}
}
3 changes: 1 addition & 2 deletions langlib/lang.boolean/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.bool {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.bool;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.decimal/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.decimal {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.decimal;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.error/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module io.ballerina.lang.error {
requires io.ballerina.lang;
requires io.ballerina.runtime;
requires io.ballerina.identifier;
exports org.ballerinalang.langlib.error;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.float/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.floatingpoint {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.floatingpoint;
}
}
1 change: 0 additions & 1 deletion langlib/lang.function/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.function {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.function;
}
3 changes: 1 addition & 2 deletions langlib/lang.future/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.future {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.future;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.int/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.integer {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.integer;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.map/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.map {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static io.ballerina.runtime.api.constants.RuntimeConstants.MAP_LANG_LIB;
import static io.ballerina.runtime.internal.MapUtils.createOpNotSupportedError;
import static org.ballerinalang.util.BLangCompilerConstants.MAP_VERSION;
import static org.ballerinalang.langlib.map.util.Constants.MAP_VERSION;

/**
* Native implementation of lang.map:filter(map<Type>, function).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static io.ballerina.runtime.api.constants.RuntimeConstants.MAP_LANG_LIB;
import static org.ballerinalang.util.BLangCompilerConstants.MAP_VERSION;
import static org.ballerinalang.langlib.map.util.Constants.MAP_VERSION;

/**
* Native implementation of lang.map:forEach(map<Type>, function).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static io.ballerina.runtime.api.constants.RuntimeConstants.MAP_LANG_LIB;
import static org.ballerinalang.util.BLangCompilerConstants.MAP_VERSION;
import static org.ballerinalang.langlib.map.util.Constants.MAP_VERSION;

/**
* Native implementation of lang.map:map(map<Type>, function).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static io.ballerina.runtime.api.constants.RuntimeConstants.MAP_LANG_LIB;
import static org.ballerinalang.util.BLangCompilerConstants.MAP_VERSION;
import static org.ballerinalang.langlib.map.util.Constants.MAP_VERSION;

/**
* Native implementation of lang.map:reduce(map<Type>, function, Type1).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

import static io.ballerina.runtime.internal.MapUtils.checkIsMapOnlyOperation;
import static io.ballerina.runtime.internal.errors.ErrorReasons.MAP_KEY_NOT_FOUND_ERROR;
import static org.ballerinalang.langlib.map.util.Constants.REMOVE;
import static org.ballerinalang.langlib.map.util.MapLibUtils.validateRequiredFieldForRecord;
import static org.wso2.ballerinalang.compiler.util.Constants.REMOVE;

/**
* Extern function to remove element from the map.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://wso2.com).
*
* Licensed 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.
*/

package org.ballerinalang.langlib.map.util;

/**
* Constants for the langlib map module.
*
* @since 2201.9.0
*/
public class Constants {

public static final String MAP_VERSION = "1.1.0";
public static final String REMOVE = "remove()";

private Constants() {
}
}
3 changes: 1 addition & 2 deletions langlib/lang.query/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.query {
requires io.ballerina.runtime;
requires io.ballerina.lang;
exports org.ballerinalang.langlib.query;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.regexp/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.regexp {
requires io.ballerina.runtime;
requires io.ballerina.lang;
exports org.ballerinalang.langlib.regexp;
}
}
3 changes: 1 addition & 2 deletions langlib/lang.string/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.string {
requires io.ballerina.lang;
requires io.ballerina.runtime;
exports org.ballerinalang.langlib.string;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.utils.StringUtils;
import org.wso2.ballerinalang.compiler.util.Constants;
import org.ballerinalang.langlib.string.utils.Constants;

/**
* Extern function lang.string:fromCodePointInt(int).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.utils.StringUtils;
import io.ballerina.runtime.api.values.BArray;
import org.wso2.ballerinalang.compiler.util.Constants;
import org.ballerinalang.langlib.string.utils.Constants;

/**
* Extern function lang.string:fromCodePointInts(int[]).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://wso2.com).
*
* Licensed 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.
*/

package org.ballerinalang.langlib.string.utils;

/**
* Constants for the string langlib module.
*
* @since 2201.9.0
*/
public class Constants {

public static final int MIN_UNICODE = 0xD800;
public static final int MIDDLE_LIMIT_UNICODE = 0xDFFF;

private Constants() {
}
}
3 changes: 1 addition & 2 deletions langlib/lang.table/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module io.ballerina.lang.table {
requires io.ballerina.runtime;
requires io.ballerina.lang;
exports org.ballerinalang.langlib.table;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static io.ballerina.runtime.api.constants.RuntimeConstants.TABLE_LANG_LIB;
import static org.ballerinalang.util.BLangCompilerConstants.TABLE_VERSION;
import static org.ballerinalang.langlib.table.utils.Constants.TABLE_VERSION;

/**
* Native implementation of lang.table:filter(table<Type>, function).
Expand Down Expand Up @@ -69,5 +69,4 @@ public static BTable filter(BTable tbl, BFunctionPointer<Object, Boolean> func)
}, () -> newTable, Scheduler.getStrand().scheduler);
return newTable;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import static io.ballerina.runtime.api.constants.RuntimeConstants.BALLERINA_BUILTIN_PKG_PREFIX;
import static io.ballerina.runtime.api.constants.RuntimeConstants.TABLE_LANG_LIB;
import static org.ballerinalang.util.BLangCompilerConstants.TABLE_VERSION;
import static org.ballerinalang.langlib.table.utils.Constants.TABLE_VERSION;

/**
* Native implementation of lang.table:forEach(table&lt;Type&gt;, function).
Expand All @@ -53,5 +53,4 @@ public static void forEach(BTable tbl, BFunctionPointer<Object, Object> func) {
() -> new Object[]{values[index.incrementAndGet()], true}, result -> {
}, () -> null, Scheduler.getStrand().scheduler);
}

}
Loading

0 comments on commit 23620b3

Please sign in to comment.