Exclude all classes from underlying JDK

This commit is contained in:
Alexey Andreev 2020-05-14 16:59:21 +03:00
parent 6a4da94f2e
commit 862e9b846f
2 changed files with 12 additions and 8 deletions

View File

@ -11,5 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
includePackageHierarchy|java=false
stripPrefixFromPackageHierarchyClasses|org.teavm.classlib.java=T stripPrefixFromPackageHierarchyClasses|org.teavm.classlib.java=T
mapPackageHierarchy|org.teavm.classlib.java=java mapPackageHierarchy|org.teavm.classlib.java=java

View File

@ -127,7 +127,9 @@ public class ClasspathResourceMapper implements Function<String, ClassHolder>, C
} }
} }
if (cls == null) { if (cls == null) {
cls = innerMapper.apply(name); if (!classExclusions.apply(name)) {
cls = innerMapper.apply(name);
}
} }
if (cls != null && !elementFilters.isEmpty()) { if (cls != null && !elementFilters.isEmpty()) {
for (ElementFilter filter : elementFilters) { for (ElementFilter filter : elementFilters) {
@ -212,40 +214,41 @@ public class ClasspathResourceMapper implements Function<String, ClassHolder>, C
case STRIP_PREFIX_FROM_PACKAGE_HIERARCHY_PREFIX: case STRIP_PREFIX_FROM_PACKAGE_HIERARCHY_PREFIX:
prefixMapping.setPackageHierarchyClassPrefixRule(instruction[1].split("\\."), prefixMapping.setPackageHierarchyClassPrefixRule(instruction[1].split("\\."),
properties.getProperty(propertyName)); properties.getProperty(propertyName));
continue; break;
case STRIP_PREFIX_FROM_PACKAGE_PREFIX: case STRIP_PREFIX_FROM_PACKAGE_PREFIX:
prefixMapping.setPackageClassPrefixRule(instruction[1].split("\\."), prefixMapping.setPackageClassPrefixRule(instruction[1].split("\\."),
properties.getProperty(propertyName)); properties.getProperty(propertyName));
continue; break;
case MAP_PACKAGE_HIERARCHY_PREFIX: case MAP_PACKAGE_HIERARCHY_PREFIX:
packageMappings.addPackageHierarchyMappingRule(properties.getProperty(propertyName).split("\\."), packageMappings.addPackageHierarchyMappingRule(properties.getProperty(propertyName).split("\\."),
instruction[1]); instruction[1]);
reversePackageMappings.addPackageHierarchyMappingRule(instruction[1].split("\\."), reversePackageMappings.addPackageHierarchyMappingRule(instruction[1].split("\\."),
properties.getProperty(propertyName)); properties.getProperty(propertyName));
continue; break;
case MAP_PACKAGE_PREFIX: case MAP_PACKAGE_PREFIX:
packageMappings packageMappings
.addPackageMappingRule(properties.getProperty(propertyName).split("\\."), instruction[1]); .addPackageMappingRule(properties.getProperty(propertyName).split("\\."), instruction[1]);
reversePackageMappings reversePackageMappings
.addPackageMappingRule(instruction[1].split("\\."), properties.getProperty(propertyName)); .addPackageMappingRule(instruction[1].split("\\."), properties.getProperty(propertyName));
continue; break;
case MAP_CLASS_PREFIX: case MAP_CLASS_PREFIX:
classMappings classMappings
.addClassMappingRule(properties.getProperty(propertyName).split("\\."), instruction[1]); .addClassMappingRule(properties.getProperty(propertyName).split("\\."), instruction[1]);
reverseClassMappings reverseClassMappings
.addClassMappingRule(instruction[1].split("\\."), properties.getProperty(propertyName)); .addClassMappingRule(instruction[1].split("\\."), properties.getProperty(propertyName));
continue; break;
case INCLUDE_PACKAGE_HIERARCHY_PREFIX: case INCLUDE_PACKAGE_HIERARCHY_PREFIX:
classExclusions.setPackageHierarchyExclusion(instruction[1].split("\\."), classExclusions.setPackageHierarchyExclusion(instruction[1].split("\\."),
!Boolean.parseBoolean(properties.getProperty(propertyName))); !Boolean.parseBoolean(properties.getProperty(propertyName)));
continue; break;
case INCLUDE_PACKAGE_PREFIX: case INCLUDE_PACKAGE_PREFIX:
classExclusions.setPackageExclusion(instruction[1].split("\\."), classExclusions.setPackageExclusion(instruction[1].split("\\."),
!Boolean.parseBoolean(properties.getProperty(propertyName))); !Boolean.parseBoolean(properties.getProperty(propertyName)));
continue; break;
case INCLUDE_CLASS_PREFIX: case INCLUDE_CLASS_PREFIX:
classExclusions.setClassExclusion(instruction[1].split("\\."), classExclusions.setClassExclusion(instruction[1].split("\\."),
!Boolean.parseBoolean(properties.getProperty(propertyName))); !Boolean.parseBoolean(properties.getProperty(propertyName)));
break;
} }
} }
} }