Introduce K2MetadataCompiler, extract MetadataSerializer out of BuiltInsSerializer

K2MetadataCompiler is a compiler facade similar to K2JVMCompiler and
K2JSCompiler and it produces .kotlin_metadata files. Each .kotlin_metadata file
contains the binary data which is a serialized BuiltIns protobuf message.

There's no 'kotlinc-***' script yet though, so to run this compiler currently
invoke this:

    KOTLIN_COMPILER=org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler kotlinc
This commit is contained in:
Alexander Udalov
2016-11-21 12:18:26 +03:00
parent b007306740
commit ec03c6decb
6 changed files with 313 additions and 116 deletions
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* 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.jetbrains.kotlin.cli.common.arguments;
import com.sampullara.cli.Argument;
public class K2MetadataCompilerArguments extends CommonCompilerArguments {
@Argument(value = "d", description = "Destination for generated .kotlin_metadata files")
@ValueDescription("<directory|jar>")
public String destination;
@Argument(value = "classpath", alias = "cp", description = "Paths where to find library .kotlin_metadata files")
@ValueDescription("<path>")
public String classpath;
}