Skip to content

Commit

Permalink
Initial refactoring for Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
cpurdy committed Jun 25, 2020
1 parent 1259f39 commit b207e47
Show file tree
Hide file tree
Showing 907 changed files with 1,374 additions and 587 deletions.
11 changes: 1 addition & 10 deletions .idea/xvm.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _(Our apologies in advance for the hassle, but we need to be very careful about
## Contribution guidelines ##

* _Cleanliness is next to godliness._ It is very difficult to clean things up, and very easy to make a mess, so we ask that contributions always move us in the direction of cleaning things up, and we will have to respectfully decline contributions that fail to meet that measure.
* Fixes should include a test, and features should include a working example. We apologize in advance for the lack of having followed this rule in the early stages of the project.
* Fixes should include a test, and features should include a working example. We apologize in advance for not having followed this rule in the early stages of the project.
* Until an official style guide is published, please respect the styles already in use.
* We are attempting to follow the [Git Strict Flow and GitHub Project Guidelines](https://gist.github.com/rsp/057481db4dbd999bb7077f211f53f212)

Expand Down
88 changes: 24 additions & 64 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,79 +1,39 @@
/*
* Main build file for the XDK.
* Main build file for the XVM project, producing the XDK.
*/

plugins {
java
}

tasks.withType<AbstractArchiveTask> {
setProperty("archiveFileName", "xvm.jar")
}

tasks.withType(Jar::class) {
manifest {
attributes["Manifest-Version"] = "1.0"
attributes["Sealed"] = "true"
attributes["Main-Class"] = "org.xvm.tool.Launcher"
attributes["Name"] = "/org/xvm/"
attributes["Specification-Title"] = "xvm"
attributes["Specification-Version"] = "0.1"
attributes["Specification-Vendor"] = "xtclang.org"
attributes["Implementation-Title"] = "xvm-prototype"
attributes["Implementation-Version"] = "0.1"
attributes["Implementation-Vendor"] = "xtclang.org"
}
}

sourceSets {
main {
java {
exclude("./src/main/java")
srcDir("./src")
}
resources {
exclude("./src/main/resources")
srcDir("./resources")
allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("org.xtclang.xvm:utils")).with(project(":utils"))
substitute(module("org.xtclang.xvm:unicode")).with(project(":unicode"))
substitute(module("org.xtclang.xvm:ecstasy")).with(project(":ecstasy"))
substitute(module("org.xtclang.xvm:javatools_bridge")).with(project(":javatools_bridge"))
substitute(module("org.xtclang.xvm:javatools")).with(project(":javatools"))
substitute(module("org.xtclang.xvm:javatools_launcher")).with(project(":javatools_launcher"))
substitute(module("org.xtclang.xvm:xdk")).with(project(":xdk"))
}
}
test {
java {
exclude("./src/test/java")
// TODO srcDir("./tests")
}
resources {
exclude("./src/test/resources")
srcDir("./resources")

repositories {
jcenter {
content {
excludeGroup("org.xtclang.xvm")
}
}
}
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}

dependencies {
// dependencies exported to consumers (found on their compile classpath), e.g.:
// api("org.apache.commons:commons-math3:3.6.1")

// dependencies used internally (not exposed to consumers on their own compile classpath), e.g.:
// implementation("com.google.guava:guava:28.2-jre")

// Use JUnit test framework
testImplementation("junit:junit:4.12")
}

tasks.register<Copy>("copyJar") {
description = "Copy the prototype JAR after it is built."
dependsOn("build")
from(file("${buildDir}/lib/xvm.jar"))
into(file("${buildDir}/xdk/prototype"))
implementation("org.xtclang.xvm:utils:")
implementation("org.xtclang.xvm:unicode:")
implementation("org.xtclang.xvm:ecstasy:")
implementation("org.xtclang.xvm:javatools_bridge:")
implementation("org.xtclang.xvm:javatools:")
implementation("org.xtclang.xvm:javatools_launcher:")
implementation("org.xtclang.xvm:xdk:")
}

File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions ecstasy/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Build file for the Ecstasy core library of the XDK.
*
* This project does NOT build the Ecstasy.xtc file. (The :xdk project builds it.)
*
* This project can update the Unicode data files, if a Unicode release has occurred and provided
* a new `ucd.all.flat.zip`; that is the only time that the Unicode data files have to be updated.
*/

tasks.register<Copy>("importUnicodeFiles") {
description = "Copy the various Unicode data files from :unicode to :ecstasy project."
from(file("${project(":unicode").buildDir}/resources/"))
include("Char*.txt", "Char*.dat")
into(file("src/main/resources/text/"))
}

tasks.register("rebuildUnicodeFiles") {
description = "Force the rebuild of the `./src/main/resources/text` data files by running the :unicode project and copying the results."
val make = project(":unicode").tasks["run"]
val copy = tasks["importUnicodeFiles"]
dependsOn(make)
dependsOn(copy)
copy.mustRunAfter(make)
}

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Blocks: [index] "str" (freq)
Blocks: [index] "str" (freq)
--------------------
[0] "ASCII" (128x)
[1] "Adlam" (96x)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Nums: [index] "str" (freq)
Nums: [index] "str" (freq)
--------------------
[0] "-1/2" (1x)
[1] "0" (83x)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
60 changes: 60 additions & 0 deletions javatools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Directory: ./javatools/ #

This directory contains the "javatools" project, which is a
set of Java classes that implement the Ecstasy lexer, parser,
compiler, IR, runtime, etc.

This project uses the library produced by the "utils" project,
and the `implicit.x` resource file from the "ecstasy" project.

Long term, this project will be used to help support IDE
plug-ins for common Java-based IDEs, such as IntelliJ IDEA.

(Note: The test portion of this project may have dependencies
on test frameworks.)

This project produces the `javatools.jar` file.

The License is the Apache License, Version 2.0.

## Compiler

Status: Suitable for use

* Driven by `org.xvm.tool.Compiler`
* (The original command line tool for the compiler is
`org.xvm.compiler.CommandLine`)
* Lexed by `org.xvm.compiler.Lexer` into
`org.xvm.compiler.Token` objects
* Recursive descent parsed by `org.xvm.compiler.Parser` into
`org.xvm.compiler.ast.AstNode` objects
* AST nodes are multi-pass compiled (with optional re-queuing)
via `org.xvm.compiler.ast.StageManager`

## Assembler

Status: Suitable for use

* Structures are all based on `org.xvm.asm.XvmStructure`
* Constant values and persistent identity references encoded
as `org.xvm.asm.Constant` objects
* Inheritance tree of component types starting with
`org.xvm.asm.Component`
* Virtual machine instructions encoded as `org.xvm.asm.Op`
objects (see the `ops.txt` file in the documentation)

## Runtime

Status: Working proof-of-concept (will be replaced by an
LLVM-based adaptive compiler).

* Command line is `org.xvm.tool.Runner`
* Implementation in `org.xvm.runtime` package

**Warning:** This runtime is not speedy, by any stretch; this
is expected, because it is only intended as a proof-of-concept.
The runtime is currently implemented as an interpreter, and
the interpreter (which would be naturally slow to begin with)
has not been optimized. Its pupose is to be malleable and easy
to test, so that we could prove out the design of the compiler
and the Ecstasy IR.
32 changes: 32 additions & 0 deletions javatools/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Build file for the Java tools portion of the XDK.
*/

plugins {
java
}

tasks.withType(Jar::class) {
manifest {
attributes["Manifest-Version"] = "1.0"
attributes["Sealed"] = "true"
attributes["Main-Class"] = "org.xvm.tool.Launcher"
attributes["Name"] = "/org/xvm/"
attributes["Specification-Title"] = "xvm"
attributes["Specification-Version"] = "0.1.0"
attributes["Specification-Vendor"] = "xtclang.org"
attributes["Implementation-Title"] = "xvm-prototype"
attributes["Implementation-Version"] = "0.1.0"
attributes["Implementation-Vendor"] = "xtclang.org"
}
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
// Use JUnit test framework
testImplementation("junit:junit:4.12")
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3702,7 +3702,7 @@ public static Auto withPool(ConstantPool pool) {
try
{
Source src;
File file = new File("implicit.x");
File file = new File("ecstasy/src/main/resources/implicit.x");
if (file.exists() && file.isFile() && file.canRead())
{
src = new Source(file, 0);
Expand All @@ -3714,7 +3714,7 @@ public static Auto withPool(ConstantPool pool) {
{
loader = ClassLoader.getSystemClassLoader();
}
src = new Source(loader.getResourceAsStream("implicit.x"));
src = new Source(loader.getResourceAsStream("ecstasy/src/main/resources/implicit.x"));
}

ErrorList errs = new ErrorList(1);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b207e47

Please sign in to comment.