Skip to content

Commit

Permalink
build: add missing build, initialize java code
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed May 27, 2024
1 parent ad1c97c commit 4b1f643
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions cli-console/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ dependencies {
testImplementation(libs.junit.jupiter)
testImplementation(libs.hamcrest)
}

plugins { application }

tasks.withType<AbstractCopyTask>().configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

tasks.withType<JavaCompile>().configureEach { CommonTasks.picocli(this) }
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
import org.aya.cli.library.source.LibrarySource;
import org.aya.cli.utils.CompilerUtil;
import org.aya.compiler.CompiledModule;
import org.aya.compiler.FileSerializer;
import org.aya.compiler.ModuleSerializer;
import org.aya.resolve.ResolveInfo;
import org.aya.resolve.context.EmptyContext;
import org.aya.resolve.module.DumbModuleLoader;
import org.aya.resolve.module.ModuleLoader;
import org.aya.syntax.core.def.TopLevelDef;
import org.aya.syntax.core.def.TyckDef;
import org.aya.syntax.ref.ModulePath;
import org.aya.util.FileUtil;
Expand Down Expand Up @@ -75,6 +79,10 @@ public class DiskCompilerAdvisor implements CompilerAdvisor {
@NotNull ResolveInfo resolveInfo,
@NotNull ImmutableSeq<TyckDef> defs
) throws IOException {
var javaCode = new FileSerializer(resolveInfo.shapeFactory())
.serialize(new FileSerializer.FileResult(file.moduleName().dropLast(1), new ModuleSerializer.ModuleResult(
file.moduleName().last(), defs.filterIsInstance(TopLevelDef.class), ImmutableSeq.empty())))
.result();
// TODO: compile defs
var coreFile = file.compiledCorePath();
CompilerUtil.saveCompiledCore(coreFile, resolveInfo);
Expand Down
4 changes: 1 addition & 3 deletions jit-compiler/src/test/java/CompileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def plus (a b : Nat) : Nat elim a
System.out.println(out);
}

public record TyckResult(@NotNull ImmutableSeq<TyckDef> defs, @NotNull ResolveInfo info) {

}
public record TyckResult(@NotNull ImmutableSeq<TyckDef> defs, @NotNull ResolveInfo info) { }

private static final @NotNull Path FILE = Path.of("/home/senpai/1919810.aya");
public static final ThrowingReporter REPORTER = new ThrowingReporter(AyaPrettierOptions.pretty());
Expand Down
1 change: 1 addition & 0 deletions syntax/src/main/java/org/aya/syntax/ref/ModulePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ public boolean sameElements(ModulePath other) {
@Override public String toString() { return QualifiedID.join(module); }
public boolean isEmpty() { return module.isEmpty(); }
public int size() { return module.size(); }
public @NotNull String last() { return module.getLast(); }
}

0 comments on commit 4b1f643

Please sign in to comment.