Skip to content

Commit

Permalink
Allow custom Idris 2 boot home directory, integrate idris build into …
Browse files Browse the repository at this point in the history
…maven
  • Loading branch information
mmhelloworld committed Dec 30, 2020
1 parent 786152d commit ab289e5
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 12 deletions.
17 changes: 14 additions & 3 deletions Makefile
Expand Up @@ -71,9 +71,20 @@ idris2: src/YafflePaths.idr check_version
idris2c: dist/idris2.c
${MAKE} -C dist

src/YafflePaths.idr:
echo 'module YafflePaths; export yversion : ((Nat,Nat,Nat), String); yversion = ((${MAJOR},${MINOR},${PATCH}), "${GIT_SHA1}")' > src/YafflePaths.idr
echo 'export yprefix : String; yprefix = "${PREFIX}"' >> src/YafflePaths.idr
src/YafflePaths.idr: FORCE
echo 'module YafflePaths; import IdrisJvm.IO; import Java.Lang; export yversion : ((Nat,Nat,Nat), String); yversion = ((${MAJOR},${MINOR},${PATCH}), "${GIT_SHA1}")' > src/YafflePaths.idr
echo 'export yprefix : String' >> src/YafflePaths.idr
echo 'yprefix = home ++ "/.idris2boot" where' >> src/YafflePaths.idr
echo ' home : String' >> src/YafflePaths.idr
echo ' home = unsafePerformIO $$ do' >> src/YafflePaths.idr
echo ' idrisHomeProperty <- System.getProperty "IDRIS2_BOOT_HOME"' >> src/YafflePaths.idr
echo ' case idrisHomeProperty of' >> src/YafflePaths.idr
echo ' Just propertyValue => pure propertyValue' >> src/YafflePaths.idr
echo ' Nothing => do' >> src/YafflePaths.idr
echo ' idrisHomeEnv <- System.getenv "IDRIS2_BOOT_HOME"' >> src/YafflePaths.idr
echo ' maybe (System.getPropertyWithDefault "user.home" "") pure idrisHomeEnv' >> src/YafflePaths.idr

FORCE:

prelude:
${MAKE} -C libs/prelude IDRIS2=../../idris2boot
Expand Down
127 changes: 127 additions & 0 deletions compiler/pom.xml
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.github.mmhelloworld.idris2boot</groupId>
<artifactId>idris2-boot</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>compiler</artifactId>
<name>Idris 2 JVM Bootstrap Compiler</name>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<idris.tests></idris.tests>
<skipIdrisCompile>false</skipIdrisCompile>
<skipTests>false</skipTests>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>idris-compile</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipIdrisCompile}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>idris2</argument>
</arguments>
<environmentVariables>
<PREFIX>${project.build.directory}</PREFIX>
<IDRIS2_BOOT_HOME>${project.build.directory}</IDRIS2_BOOT_HOME>
</environmentVariables>
</configuration>
</execution>
<execution>
<id>idris-install-libs</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipIdrisCompile}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>install-libs</argument>
</arguments>
<environmentVariables>
<PREFIX>${project.build.directory}</PREFIX>
<IDRIS2_BOOT_HOME>${project.build.directory}</IDRIS2_BOOT_HOME>
</environmentVariables>
</configuration>
</execution>
<execution>
<id>idris-test</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>test</argument>
<argument>${idris.tests}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>idris-clean</id>
<phase>clean</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>make</executable>
<workingDirectory>${project.parent.basedir}</workingDirectory>
<arguments>
<argument>clean</argument>
</arguments>
<environmentVariables>
<PREFIX>${project.build.directory}</PREFIX>
<IDRIS2_BOOT_HOME>${project.build.directory}</IDRIS2_BOOT_HOME>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-idris2-classes</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<skip>${skipIdrisCompile}</skip>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.parent.basedir}/idris2-classes</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion idris2.ipkg
Expand Up @@ -154,7 +154,7 @@ modules =
Yaffle.REPL

sourcedir = src
executable = idris2
executable = idris2boot
opts = "--partial-eval --portable-codegen jvm"

pkgs = idrisjvmffi, contrib
Expand Down
21 changes: 13 additions & 8 deletions jvm-assembler/pom.xml
Expand Up @@ -18,29 +18,28 @@
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-idris2-classes</id>
<id>copy-idris2-libs</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<outputDirectory>${project.build.directory}/idris2-boot-jvm/.idris2boot/idris2-0.1.1</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.parent.basedir}/idris2-classes</directory>
<directory>${user.home}/.idris2boot/idris2-0.1.1</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<extraJvmArguments>-Xss10m</extraJvmArguments>
<extraJvmArguments>-Xss10m -DIDRIS2_BOOT_HOME=@BASEDIR@</extraJvmArguments>
<repositoryName>lib</repositoryName>
<assembleDirectory>${project.build.directory}/idris2-boot-jvm</assembleDirectory>
<programs>
Expand Down Expand Up @@ -83,9 +82,9 @@

<dependencies>
<dependency>
<groupId>io.github.mmhelloworld</groupId>
<artifactId>idris-jvm-runtime</artifactId>
<scope>runtime</scope>
<groupId>io.github.mmhelloworld.idris2boot</groupId>
<artifactId>compiler</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
Expand All @@ -94,6 +93,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.github.mmhelloworld</groupId>
<artifactId>idris-jvm-runtime</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -11,6 +11,7 @@
<name>Idris 2 JVM Bootstrap</name>

<modules>
<module>compiler</module>
<module>jvm-assembler</module>
<module>runtime</module>
</modules>
Expand Down

0 comments on commit ab289e5

Please sign in to comment.