mirror of
https://github.com/irmen/prog8.git
synced 2025-04-07 16:41:46 +00:00
cleaned up some buildprocess scripts
This commit is contained in:
parent
845a99d623
commit
7c9b8f7d43
@ -143,32 +143,39 @@ Finally: a **C-64 emulator** (or a real C-64 ofcourse) to run the programs on. T
|
||||
of the `Vice emulator <http://vice-emu.sourceforge.net/>`_.
|
||||
|
||||
.. important::
|
||||
**Building the compiler itself:**
|
||||
**Building the compiler itself:** (*Only needed if you have not downloaded a pre-built 'fat-jar'*)
|
||||
|
||||
(re)building the compiler itself requires a recent Kotlin SDK.
|
||||
The compiler is developed using the `IntelliJ IDEA <https://www.jetbrains.com/idea/>`_
|
||||
IDE from Jetbrains, with the Kotlin plugin (free community edition of this IDE is available).
|
||||
But a bare Kotlin SDK installation should work just as well.
|
||||
|
||||
A shell script (``create_compiler_jar.sh``) is provided to build and package the compiler from the command line.
|
||||
If you have the 'fat-jar' you can run it with ``java -jar prog8compiler.jar``.
|
||||
You can also use the Gradle build system to build the compiler (it will take care of
|
||||
downloading all required libraries for you) by typing ``gradle build`` for instance.
|
||||
The output of this gradle build will appear in the "./compiler/build/install/p8compile/" directory.
|
||||
|
||||
If you have the 'fat-jar' you can run it with ``java -jar prog8compiler.jar`` or just use
|
||||
one of the scripts that are created by Gradle
|
||||
|
||||
The Gradle build system is used to build the compiler.
|
||||
The most interesting gradle commands to run are probably:
|
||||
|
||||
``./gradlew check``
|
||||
Builds the compiler code and runs all available checks and unit-tests.
|
||||
``./gradlew installDist``
|
||||
Builds the compiler and installs it with scripts to run it, in the directory
|
||||
``./compiler/build/install/p8compile``
|
||||
``./gradlew installShadowDist``
|
||||
Creates a 'fat-jar' that contains the compiler and all dependencies,
|
||||
and a few start scripts to run it.
|
||||
Creates a 'fat-jar' that contains the compiler and all dependencies, in a single
|
||||
executable .jar file, and includes few start scripts to run it.
|
||||
The output can be found in ``.compiler/build/install/compiler-shadow/``
|
||||
and you can launch the compiler with the script
|
||||
``./compiler/build/install/compiler-shadow/bin/p8compile``.
|
||||
``./gradlew shadowDistZip``
|
||||
Creates a zipfile with the above in it, for easy distribution.
|
||||
This file can be found in ``./compiler/build/distributions/``
|
||||
|
||||
For normal use, the ``installDist`` target should suffice and ater succesful completion
|
||||
of that build task, you can start the compiler with:
|
||||
|
||||
``./compiler/build/install/p8compile/bin/p8compile <options> <sourcefile>``
|
||||
|
||||
(You should probably make an alias...)
|
||||
|
||||
.. note::
|
||||
Development and testing is done on Linux, but the compiler should run on most
|
||||
|
@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# compile using regular Kotlin sdk command line tool
|
||||
|
||||
echo "Compiling the parser..."
|
||||
java -jar ./parser/antlr/lib/antlr-4.7.2-complete.jar -o ./parser/src/prog8/parser -Xexact-output-dir -no-listener -no-visitor ./parser/antlr/prog8.g4
|
||||
|
||||
|
||||
PARSER_CLASSES=./out/production/parser
|
||||
COMPILER_JAR=prog8compiler.jar
|
||||
ANTLR_RUNTIME=./parser/antlr/lib/antlr-runtime-4.7.2.jar
|
||||
|
||||
mkdir -p ${PARSER_CLASSES}
|
||||
javac -d ${PARSER_CLASSES} -cp ${ANTLR_RUNTIME} ./parser/src/prog8/parser/prog8Lexer.java ./parser/src/prog8/parser/prog8Parser.java
|
||||
|
||||
echo "Compiling the compiler itself..."
|
||||
JAVA_OPTS="-Xmx3G -Xms300M" kotlinc -verbose -include-runtime -d ${COMPILER_JAR} -jvm-target 1.8 -cp ${ANTLR_RUNTIME}:${PARSER_CLASSES} ./compiler/src/prog8
|
||||
|
||||
echo "Finalizing the compiler jar file..."
|
||||
# add the antlr parser classes
|
||||
jar ufe ${COMPILER_JAR} prog8.CompilerMainKt -C ${PARSER_CLASSES} prog8
|
||||
|
||||
# add the resources
|
||||
jar uf ${COMPILER_JAR} -C ./compiler/res .
|
||||
|
||||
# add the antlr runtime classes
|
||||
rm -rf antlr_runtime_extraction
|
||||
mkdir antlr_runtime_extraction
|
||||
(cd antlr_runtime_extraction; jar xf ../${ANTLR_RUNTIME})
|
||||
jar uf ${COMPILER_JAR} -C antlr_runtime_extraction org
|
||||
rm -rf antlr_runtime_extraction
|
||||
|
||||
echo "Done!"
|
@ -1,9 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set PROG8CLASSPATH=./compiler/build/classes/kotlin/main;./compiler/build/resources/main;./parser/build/classes/java/main
|
||||
set KOTLINPATH=%USERPROFILE%/.IdeaIC2019.1/config/plugins/Kotlin
|
||||
set LIBJARS=%KOTLINPATH%/lib/kotlin-stdlib.jar;%KOTLINPATH%/lib/kotlin-reflect.jar;./parser/antlr/lib/antlr-runtime-4.7.2.jar
|
||||
|
||||
java -cp %PROG8CLASSPATH%;%LIBJARS% prog8.CompilerMainKt %*
|
||||
|
||||
@REM if you have created a .jar file using the 'create_compiler_jar' script, you can simply do: java -jar prog8compiler.jar
|
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
PROG8CLASSPATH=./compiler/build/classes/kotlin/main:./compiler/build/resources/main:./parser/build/classes/java/main
|
||||
KOTLINPATH=${HOME}/.IntelliJIdea2019.1/config/plugins/Kotlin
|
||||
LIBJARS=${KOTLINPATH}/lib/kotlin-stdlib.jar:${KOTLINPATH}/lib/kotlin-reflect.jar:./parser/antlr/lib/antlr-runtime-4.7.2.jar
|
||||
|
||||
java -cp ${PROG8CLASSPATH}:${LIBJARS} prog8.CompilerMainKt $*
|
||||
|
||||
# if you have created a .jar file using the 'create_compiler_jar' script, you can simply do: java -jar prog8compiler.jar
|
9
p8vm.cmd
9
p8vm.cmd
@ -1,9 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set PROG8CLASSPATH=./compiler/build/classes/kotlin/main;./compiler/build/resources/main
|
||||
set KOTLINPATH=%USERPROFILE%/.IdeaIC2019.1/config/plugins/Kotlin
|
||||
set LIBJARS=%KOTLINPATH%/lib/kotlin-stdlib.jar;%KOTLINPATH%/lib/kotlin-reflect.jar
|
||||
|
||||
java -cp %PROG8CLASSPATH%;%LIBJARS% prog8.vm.stackvm.MainKt %*
|
||||
|
||||
@REM if you have created a .jar file using the 'create_compiler_jar' script, you can simply do: java -jar prog8compiler.jar -vm
|
9
p8vm.sh
9
p8vm.sh
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
PROG8CLASSPATH=./compiler/build/classes/kotlin/main:./compiler/build/resources/main
|
||||
KOTLINPATH=${HOME}/.IntelliJIdea2019.1/config/plugins/Kotlin
|
||||
LIBJARS=${KOTLINPATH}/lib/kotlin-stdlib.jar:${KOTLINPATH}/lib/kotlin-reflect.jar
|
||||
|
||||
java -cp ${PROG8CLASSPATH}:${LIBJARS} prog8.vm.stackvm.MainKt $*
|
||||
|
||||
# if you have created a .jar file using the 'create_compiler_jar' script, you can simply do: java -jar prog8compiler.jar -vm
|
Loading…
x
Reference in New Issue
Block a user