@@ -1366,11 +1366,11 @@ class _PolyglotIsolateResourceProject(mx.JavaProject):
1366
1366
and the resource ID is `<language_id>-isolate-<os>-<arch>`.
1367
1367
"""
1368
1368
1369
- def __init__ (self , language_suite , subDir , language_id , resource_id , os_name , cpu_architecture , placeholder ):
1369
+ def __init__ (self , language_suite , subDir , language_id , all_language_ids , resource_id , os_name , cpu_architecture , placeholder ):
1370
1370
name = f'com.oracle.truffle.isolate.resource.{ language_id } .{ os_name } .{ cpu_architecture } '
1371
1371
javaCompliance = str (mx .distribution ('truffle:TRUFFLE_API' ).javaCompliance ) + '+'
1372
1372
project_dir = os .path .join (language_suite .dir , subDir , name )
1373
- deps = ['truffle:TRUFFLE_API' ]
1373
+ deps = ['truffle:TRUFFLE_API' , 'truffle-enterprise:TRUFFLE_ENTERPRISE' ]
1374
1374
if placeholder :
1375
1375
deps += ['sdk:NATIVEIMAGE' ]
1376
1376
super (_PolyglotIsolateResourceProject , self ).__init__ (language_suite , name , subDir = subDir , srcDirs = [], deps = deps ,
@@ -1380,6 +1380,7 @@ def __init__(self, language_suite, subDir, language_id, resource_id, os_name, cp
1380
1380
self .srcDirs .append (src_gen_dir )
1381
1381
self .declaredAnnotationProcessors = ['truffle:TRUFFLE_DSL_PROCESSOR' ]
1382
1382
self .language_id = language_id
1383
+ self .all_language_ids = all_language_ids
1383
1384
self .resource_id = resource_id
1384
1385
self .os_name = os_name
1385
1386
self .cpu_architecture = cpu_architecture
@@ -1457,6 +1458,7 @@ def build(self):
1457
1458
subst_eng = mx_subst .SubstitutionEngine ()
1458
1459
subst_eng .register_no_arg ('package' , pkg_name )
1459
1460
subst_eng .register_no_arg ('languageId' , prj .language_id )
1461
+ subst_eng .register_no_arg ('languageIds' , ', ' .join ([f'"{ l } "' for l in prj .all_language_ids ]))
1460
1462
subst_eng .register_no_arg ('resourceId' , prj .resource_id )
1461
1463
subst_eng .register_no_arg ('os' , prj .os_name )
1462
1464
subst_eng .register_no_arg ('arch' , prj .cpu_architecture )
@@ -1469,9 +1471,10 @@ def build(self):
1469
1471
1470
1472
1471
1473
1472
- def register_polyglot_isolate_distributions (language_suite , register_project , register_distribution , language_id ,
1474
+ def register_polyglot_isolate_distributions (language_suite , register_project , register_distribution , main_language_id ,
1473
1475
subDir , language_pom_distribution , maven_group_id , language_license ,
1474
- isolate_build_options = None , platforms = None , additional_image_path_artifacts = None ):
1476
+ isolate_build_options = None , platforms = None , additional_image_path_artifacts = None ,
1477
+ additional_language_ids = None ):
1475
1478
"""
1476
1479
Creates and registers the polyglot isolate resource distribution and isolate resource meta-POM distribution.
1477
1480
The created polyglot isolate resource distribution is named `<ID>_ISOLATE_RESOURCES`, inheriting the Maven group ID
@@ -1484,26 +1487,27 @@ def register_polyglot_isolate_distributions(language_suite, register_project, re
1484
1487
:type register_project: (mx.Project) -> None
1485
1488
:param register_distribution: A callback to dynamically register the distribution, obtained as a parameter from `mx_register_dynamic_suite_constituents`.
1486
1489
:type register_distribution: (mx.Distribution) -> None
1487
- :param str language_id : The language ID.
1490
+ :param str main_language_id : The language ID.
1488
1491
:param str subDir: a path relative to `suite.dir` in which the IDE project configuration for this distribution is generated
1489
1492
:param POMDistribution language_pom_distribution: The language meta pom distribution used to set the image builder module-path.
1490
1493
:param str maven_group_id: The maven language group id.
1491
1494
:param str | list | language_license: Language licence(s).
1492
1495
:param list isolate_build_options: additional options passed to a native image to build the isolate library.
1493
1496
:param list platforms: supported platforms, defaults to ['linux-amd64', 'linux-aarch64', 'darwin-amd64', 'darwin-aarch64', 'windows-amd64']
1494
1497
:param list additional_image_path_artifacts: additional artifacts to include in the polyglot isolate library image path
1498
+ :param list additional_language_ids: language ids of additional languages added into polyglot isolate library
1495
1499
"""
1496
1500
assert language_suite
1497
1501
assert register_project
1498
1502
assert register_distribution
1499
- assert language_id
1503
+ assert main_language_id
1500
1504
assert subDir
1501
1505
assert language_pom_distribution
1502
1506
assert maven_group_id
1503
1507
assert language_license
1504
1508
1505
1509
polyglot_isolates_value = mx_sdk_vm_impl ._parse_cmd_arg ('polyglot_isolates' )
1506
- 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 )):
1510
+ if not polyglot_isolates_value or not (polyglot_isolates_value is True or (isinstance (polyglot_isolates_value , list ) and main_language_id in polyglot_isolates_value )):
1507
1511
return False
1508
1512
1509
1513
if not isinstance (language_license , list ):
@@ -1520,7 +1524,14 @@ def _qualname(distribution_name):
1520
1524
additional_image_path_artifacts = [_qualname (d ) for d in additional_image_path_artifacts ]
1521
1525
else :
1522
1526
additional_image_path_artifacts = []
1523
- language_id_upper_case = language_id .upper ()
1527
+ if additional_language_ids :
1528
+ if main_language_id in additional_language_ids :
1529
+ all_language_ids = additional_language_ids
1530
+ else :
1531
+ all_language_ids = [main_language_id ] + additional_language_ids
1532
+ else :
1533
+ all_language_ids = [main_language_id ]
1534
+ language_id_upper_case = main_language_id .upper ()
1524
1535
if platforms is None :
1525
1536
platforms = [
1526
1537
'linux-amd64' ,
@@ -1536,12 +1547,12 @@ def _qualname(distribution_name):
1536
1547
platform_meta_poms = []
1537
1548
for platform in platforms :
1538
1549
build_for_current_platform = platform == current_platform
1539
- resource_id = f'{ language_id } -isolate-{ platform } '
1550
+ resource_id = f'{ main_language_id } -isolate-{ platform } '
1540
1551
os_name , cpu_architecture = platform .split ('-' )
1541
1552
os_name_upper_case = os_name .upper ()
1542
1553
cpu_architecture_upper_case = cpu_architecture .upper ()
1543
1554
# 1. Register a project generating and building an internal resource for polyglot isolate library
1544
- build_internal_resource = _PolyglotIsolateResourceProject (language_suite , subDir , language_id , resource_id ,
1555
+ build_internal_resource = _PolyglotIsolateResourceProject (language_suite , subDir , main_language_id , all_language_ids , resource_id ,
1545
1556
os_name , cpu_architecture , not build_for_current_platform )
1546
1557
register_project (build_internal_resource )
1547
1558
resources_dist_dependencies = [
@@ -1551,13 +1562,13 @@ def _qualname(distribution_name):
1551
1562
if build_for_current_platform :
1552
1563
# 2. Register a project building the isolate library
1553
1564
isolate_deps = [language_pom_distribution , 'truffle-enterprise:TRUFFLE_ENTERPRISE' ] + additional_image_path_artifacts
1554
- build_library = PolyglotIsolateProject (language_suite , language_id , isolate_deps , isolate_build_options )
1565
+ build_library = PolyglotIsolateProject (language_suite , main_language_id , isolate_deps , isolate_build_options )
1555
1566
register_project (build_library )
1556
1567
1557
1568
# 3. Register layout distribution with isolate library and isolate resources
1558
1569
resource_base_folder = f'META-INF/resources/engine/{ resource_id } /libvm'
1559
1570
attrs = {
1560
- 'description' : f'Contains { language_id } language library resources.' ,
1571
+ 'description' : f'Contains { main_language_id } language library resources.' ,
1561
1572
'hashEntry' : f'{ resource_base_folder } /sha256' ,
1562
1573
'fileListEntry' : f'{ resource_base_folder } /files' ,
1563
1574
'maven' : False ,
@@ -1567,7 +1578,7 @@ def _qualname(distribution_name):
1567
1578
name = f'{ language_id_upper_case } _ISOLATE_LAYOUT_{ os_name_upper_case } _{ cpu_architecture_upper_case } ' ,
1568
1579
deps = [],
1569
1580
layout = {
1570
- f'{ resource_base_folder } /' : f'dependency:{ build_library .name } ' ,
1581
+ f'{ resource_base_folder } /{ mx . add_lib_suffix ( "libpolyglotisolate" ) } ' : f'dependency:{ build_library .name } ' ,
1571
1582
f'{ resource_base_folder } /resources/' : {"source_type" : "dependency" ,
1572
1583
"dependency" : f'{ build_library .name } ' ,
1573
1584
"path" : 'language_resources/resources/*' ,
@@ -1596,7 +1607,7 @@ def _qualname(distribution_name):
1596
1607
# We pass directly the license id
1597
1608
licenses .update (['GFTC' ])
1598
1609
attrs = {
1599
- 'description' : f'Polyglot isolate resources for { language_id } for { platform } .' ,
1610
+ 'description' : f'Polyglot isolate resources for { main_language_id } for { platform } .' ,
1600
1611
'moduleInfo' : {
1601
1612
'name' : build_internal_resource .name ,
1602
1613
},
@@ -1617,7 +1628,7 @@ def _qualname(distribution_name):
1617
1628
deps = resources_dist_dependencies ,
1618
1629
mainClass = None ,
1619
1630
excludedLibs = [],
1620
- distDependencies = ['truffle:TRUFFLE_API' ],
1631
+ distDependencies = ['truffle:TRUFFLE_API' , 'truffle-enterprise:TRUFFLE_ENTERPRISE' ],
1621
1632
javaCompliance = str (build_internal_resource .javaCompliance )+ '+' ,
1622
1633
platformDependent = True ,
1623
1634
theLicense = sorted (list (licenses )),
@@ -1629,7 +1640,7 @@ def _qualname(distribution_name):
1629
1640
# 5. Register meta POM distribution for the isolate library jar file for a specific platform.
1630
1641
isolate_dist_name = f'{ language_id_upper_case } _ISOLATE_{ os_name_upper_case } _{ cpu_architecture_upper_case } '
1631
1642
attrs = {
1632
- 'description' : f'The { language_id } polyglot isolate for { platform } .' ,
1643
+ 'description' : f'The { main_language_id } polyglot isolate for { platform } .' ,
1633
1644
'maven' : {
1634
1645
'groupId' : 'org.graalvm.polyglot' ,
1635
1646
'artifactId' : maven_artifact_id ,
@@ -1651,10 +1662,10 @@ def _qualname(distribution_name):
1651
1662
# 6. Register meta POM distribution listing all platform specific meta-POMS.
1652
1663
isolate_dist_name = f'{ language_id_upper_case } _ISOLATE'
1653
1664
attrs = {
1654
- 'description' : f'The { language_id } polyglot isolate.' ,
1665
+ 'description' : f'The { main_language_id } polyglot isolate.' ,
1655
1666
'maven' : {
1656
1667
'groupId' : 'org.graalvm.polyglot' ,
1657
- 'artifactId' : f'{ language_id } -isolate' ,
1668
+ 'artifactId' : f'{ main_language_id } -isolate' ,
1658
1669
'tag' : ['default' , 'public' ],
1659
1670
},
1660
1671
}
0 commit comments