Skip to content

Commit

Permalink
[GR-48481] Resolved review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzezula committed Apr 25, 2024
1 parent c3ed4e1 commit c8767ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions truffle/mx.truffle/mx_truffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import mx_native
import mx_sdk
import mx_sdk_vm
import mx_sdk_vm_impl
import mx_subst
import mx_unittest
import mx_jardistribution
Expand Down Expand Up @@ -1302,11 +1303,13 @@ def build(self):
pkg_name = prj.name
with open(_PolyglotIsolateResourceBuildTask._template_file(prj.placeholder), 'r', encoding='utf-8') as f:
file_content = f.read()
file_content = (file_content.replace('${package}', pkg_name)
.replace('${languageId}', prj.language_id)
.replace('${resourceId}', prj.resource_id)
.replace('${os}', prj.os_name)
.replace('${arch}', prj.cpu_architecture))
subst_eng = mx_subst.SubstitutionEngine()
subst_eng.register_no_arg('package', pkg_name)
subst_eng.register_no_arg('languageId', prj.language_id)
subst_eng.register_no_arg('resourceId', prj.resource_id)
subst_eng.register_no_arg('os', prj.os_name)
subst_eng.register_no_arg('arch', prj.cpu_architecture)
file_content = subst_eng.substitute(file_content)
target_file = _PolyglotIsolateResourceBuildTask._target_file(prj.source_gen_dir(), pkg_name)
mx_util.ensure_dir_exists(dirname(target_file))
with mx_util.SafeFileCreation(target_file) as sfc, open(sfc.tmpPath, 'w', encoding='utf-8') as f:
Expand Down Expand Up @@ -1347,10 +1350,8 @@ def register_polyglot_isolate_distributions(language_suite, register_project, re
assert maven_group_id
assert language_license

polyglot_isolates_value = mx.get_opts().polyglot_isolates
if polyglot_isolates_value is None:
polyglot_isolates_value = os.getenv('POLYGLOT_ISOLATES')
if not polyglot_isolates_value or (polyglot_isolates_value != 'true' and language_id not in polyglot_isolates_value.split(',')):
polyglot_isolates_value = mx_sdk_vm_impl._parse_cmd_arg('polyglot_isolates')
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)):
return False

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

Expand Down
4 changes: 2 additions & 2 deletions truffle/mx.truffle/polyglot_isolate_resource.template
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package ${package};
package <package>;

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

static final String ID = "${resourceId}";
static final String ID = "<resourceId>";

@Override
public void unpackFiles(Env env, Path targetDirectory) throws IOException {
Expand Down
4 changes: 2 additions & 2 deletions truffle/mx.truffle/polyglot_isolate_resource_invalid.template
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package ${package};
package <package>;

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

static final String ID = "${resourceId}";
static final String ID = "<resourceId>";

@Override
public void unpackFiles(Env env, Path targetDirectory) throws IOException {
Expand Down

0 comments on commit c8767ef

Please sign in to comment.