-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
370 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
plugins { | ||
id("org.metaborg.gradle.config.java-library") | ||
id("org.metaborg.spoofax.compiler.gradle.eclipse") | ||
} | ||
|
||
languageEclipseProject { | ||
adapterProject.set(project(":gpp")) | ||
compilerInput { | ||
languageGroup("mb.spoofax.lwb") | ||
} | ||
} | ||
|
||
tasks { | ||
"jar"(Jar::class) { | ||
val exportPackages = LinkedHashSet<String>() | ||
// Export `strategolib` package. | ||
exportPackages.add("gpp.*") | ||
val existingExportPackages = manifest.attributes.get("Export-Package") | ||
if(existingExportPackages != null) { | ||
exportPackages.add(existingExportPackages.toString()) | ||
} | ||
manifest { | ||
attributes( | ||
Pair("Export-Package", exportPackages.joinToString(", ")) | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import mb.spoofax.compiler.adapter.* | ||
import mb.spoofax.compiler.util.* | ||
|
||
plugins { | ||
id("org.metaborg.gradle.config.java-library") | ||
id("org.metaborg.spoofax.compiler.gradle.spoofax2.language") | ||
id("org.metaborg.spoofax.compiler.gradle.adapter") | ||
} | ||
|
||
fun compositeBuild(name: String) = "$group:$name:$version" | ||
|
||
dependencies { | ||
api(project(":strategolib")) | ||
api("org.metaborg:pie.task.archive") | ||
} | ||
|
||
languageProject { | ||
shared { | ||
name("Gpp") | ||
defaultClassPrefix("Gpp") | ||
defaultPackageId("mb.gpp") | ||
} | ||
compilerInput { | ||
withStrategoRuntime().run { | ||
addStrategyPackageIds("gpp.trans") | ||
addInteropRegisterersByReflection("gpp.trans.InteropRegisterer") | ||
} | ||
withExports().run { | ||
addExports("Stratego", "trans") | ||
addExports("Str2Lib", "src-gen/java/gpp/trans/gpp.str2lib") | ||
} | ||
} | ||
} | ||
spoofax2BasedLanguageProject { | ||
compilerInput { | ||
withStrategoRuntime().run { | ||
copyCtree(false) | ||
copyClasses(true) | ||
} | ||
project.run { | ||
addAdditionalCopyResources( | ||
"trans/**/*.str", | ||
"trans/**/*.str2", | ||
"src-gen/java/gpp/trans/gpp.str2lib" | ||
) | ||
languageSpecificationDependency(GradleDependency.module("org.metaborg.devenv:gpp:${ext["spoofax2DevenvVersion"]}")) | ||
} | ||
} | ||
} | ||
|
||
languageAdapterProject { | ||
compilerInput { | ||
project.configureCompilerInput() | ||
} | ||
} | ||
fun AdapterProjectCompiler.Input.Builder.configureCompilerInput() { | ||
val packageId = "mb.gpp" | ||
|
||
// Extend component | ||
baseComponent(packageId, "BaseGppComponent") | ||
extendComponent(packageId, "GppComponent") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
shared.defaultArtifactId=gpp | ||
shared.defaultClassPrefix=Gpp | ||
shared.defaultGroupId=org.metaborg | ||
shared.defaultPackageId=mb.gpp | ||
shared.defaultVersion=0.1.0 |
22 changes: 22 additions & 0 deletions
22
lwb/metalib/gpp/gpp/src/main/java/mb/gpp/GppComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package mb.gpp; | ||
|
||
import dagger.Component; | ||
import mb.log.dagger.LoggerComponent; | ||
import mb.resource.dagger.ResourceServiceComponent; | ||
import mb.spoofax.core.platform.PlatformComponent; | ||
|
||
@GppScope | ||
@Component( | ||
modules = { | ||
mb.gpp.GppModule.class | ||
}, | ||
dependencies = { | ||
LoggerComponent.class, | ||
mb.gpp.GppResourcesComponent.class, | ||
ResourceServiceComponent.class, | ||
PlatformComponent.class | ||
} | ||
) | ||
public interface GppComponent extends BaseGppComponent { | ||
GppUtil getGppUtil(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package mb.gpp; | ||
|
||
import mb.resource.hierarchical.ResourcePath; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
|
||
/** | ||
* Copy of Stratego2LibInfo because this Java library cannot depend on `stratego.build` due to `gpp.eclipse` | ||
* needing a dependency to `stratego.eclipse` (because that exports `stratego.build`), which would cause a cycle because | ||
* `stratego.eclipse` requires `gpp.eclipse`. | ||
*/ | ||
public class GppInfo implements Serializable { | ||
public final ResourcePath str2libFile; | ||
public final ArrayList<ResourcePath> jarFilesOrDirectories; | ||
|
||
public GppInfo(ResourcePath str2libFile, ArrayList<ResourcePath> jarFilesOrDirectories) { | ||
this.str2libFile = str2libFile; | ||
this.jarFilesOrDirectories = jarFilesOrDirectories; | ||
} | ||
|
||
@Override public boolean equals(@Nullable Object o) { | ||
if(this == o) return true; | ||
if(o == null || getClass() != o.getClass()) return false; | ||
final GppInfo that = (GppInfo)o; | ||
if(!str2libFile.equals(that.str2libFile)) return false; | ||
return jarFilesOrDirectories.equals(that.jarFilesOrDirectories); | ||
} | ||
|
||
@Override public int hashCode() { | ||
int result = str2libFile.hashCode(); | ||
result = 31 * result + jarFilesOrDirectories.hashCode(); | ||
return result; | ||
} | ||
|
||
@Override public String toString() { | ||
return "GppInfo{" + | ||
"str2libFile=" + str2libFile + | ||
", jarFilesOrDirectories=" + jarFilesOrDirectories + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.