Skip to content

Commit c8767ef

Browse files
committed
[GR-48481] Resolved review comments.
1 parent c3ed4e1 commit c8767ef

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

truffle/mx.truffle/mx_truffle.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import mx_native
5858
import mx_sdk
5959
import mx_sdk_vm
60+
import mx_sdk_vm_impl
6061
import mx_subst
6162
import mx_unittest
6263
import mx_jardistribution
@@ -1302,11 +1303,13 @@ def build(self):
13021303
pkg_name = prj.name
13031304
with open(_PolyglotIsolateResourceBuildTask._template_file(prj.placeholder), 'r', encoding='utf-8') as f:
13041305
file_content = f.read()
1305-
file_content = (file_content.replace('${package}', pkg_name)
1306-
.replace('${languageId}', prj.language_id)
1307-
.replace('${resourceId}', prj.resource_id)
1308-
.replace('${os}', prj.os_name)
1309-
.replace('${arch}', prj.cpu_architecture))
1306+
subst_eng = mx_subst.SubstitutionEngine()
1307+
subst_eng.register_no_arg('package', pkg_name)
1308+
subst_eng.register_no_arg('languageId', prj.language_id)
1309+
subst_eng.register_no_arg('resourceId', prj.resource_id)
1310+
subst_eng.register_no_arg('os', prj.os_name)
1311+
subst_eng.register_no_arg('arch', prj.cpu_architecture)
1312+
file_content = subst_eng.substitute(file_content)
13101313
target_file = _PolyglotIsolateResourceBuildTask._target_file(prj.source_gen_dir(), pkg_name)
13111314
mx_util.ensure_dir_exists(dirname(target_file))
13121315
with mx_util.SafeFileCreation(target_file) as sfc, open(sfc.tmpPath, 'w', encoding='utf-8') as f:
@@ -1347,10 +1350,8 @@ def register_polyglot_isolate_distributions(language_suite, register_project, re
13471350
assert maven_group_id
13481351
assert language_license
13491352

1350-
polyglot_isolates_value = mx.get_opts().polyglot_isolates
1351-
if polyglot_isolates_value is None:
1352-
polyglot_isolates_value = os.getenv('POLYGLOT_ISOLATES')
1353-
if not polyglot_isolates_value or (polyglot_isolates_value != 'true' and language_id not in polyglot_isolates_value.split(',')):
1353+
polyglot_isolates_value = mx_sdk_vm_impl._parse_cmd_arg('polyglot_isolates')
1354+
if not polyglot_isolates_value or not (polyglot_isolates_value is True or (isinstance(polyglot_isolates_value, list) and language_id in polyglot_isolates_value)):
13541355
return False
13551356

13561357
if not isinstance(language_license, list):
@@ -1394,7 +1395,6 @@ def _qualname(distribution_name):
13941395
if build_for_current_platform:
13951396
# 2. Register a project building the isolate library
13961397
isolate_deps = [language_pom_distribution, 'graal-enterprise:TRUFFLE_ENTERPRISE']
1397-
import mx_sdk_vm_impl
13981398
build_library = mx_sdk_vm_impl.PolyglotIsolateLibrary(language_suite, language_id, isolate_deps, isolate_build_options)
13991399
register_project(build_library)
14001400

truffle/mx.truffle/polyglot_isolate_resource.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3939
* SOFTWARE.
4040
*/
41-
package ${package};
41+
package <package>;
4242

4343
import com.oracle.truffle.api.CompilerDirectives;
4444
import com.oracle.truffle.api.InternalResource;
@@ -49,7 +49,7 @@ import java.nio.file.Path;
4949
@InternalResource.Id(value = PolyglotIsolateResource.ID, componentId = "engine", optional = true)
5050
public final class PolyglotIsolateResource implements InternalResource {
5151

52-
static final String ID = "${resourceId}";
52+
static final String ID = "<resourceId>";
5353

5454
@Override
5555
public void unpackFiles(Env env, Path targetDirectory) throws IOException {

truffle/mx.truffle/polyglot_isolate_resource_invalid.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3939
* SOFTWARE.
4040
*/
41-
package ${package};
41+
package <package>;
4242

4343
import com.oracle.truffle.api.CompilerDirectives;
4444
import com.oracle.truffle.api.InternalResource;
@@ -50,7 +50,7 @@ import org.graalvm.nativeimage.ImageInfo;
5050
@InternalResource.Id(value = PolyglotIsolateResource.ID, componentId = "engine", optional = true)
5151
public final class PolyglotIsolateResource implements InternalResource {
5252

53-
static final String ID = "${resourceId}";
53+
static final String ID = "<resourceId>";
5454

5555
@Override
5656
public void unpackFiles(Env env, Path targetDirectory) throws IOException {

0 commit comments

Comments
 (0)