-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Infrastructure to execute code with a project #25
Merged
+1,379
−117
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
08353bb
seperate project for loading idea applications
coolya 57b8623
Merge branch 'master' into project-loader
coolya 6dd17bf
parser: use direct constructor invocation
coolya 7f3c816
build: replace deprecated compile dependencies with implementation
coolya d728a9e
Merge branch 'master' into project-loader
coolya 09fe861
address feedback from code review
coolya 651999d
fix passing the project path
coolya 515f71a
update to gradle 4.10.2 to allow snapshot versions of plugins for tes…
coolya 4ec603f
pass state back if generation was successful
coolya 2452295
add smoke test for generating a build solution in a mps project
coolya d2f2428
add smoke test for generating a simple java class
coolya a14cd58
ignore files related to new mps test projects
coolya faeb340
add parameter to override the version
coolya 5333cf5
bump version to 1.1.*
coolya 5a7371e
Merge branch 'master' into project-loader
coolya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
80 changes: 6 additions & 74 deletions
80
execute-generators/src/main/kotlin/de/itemis/mps/gradle/generate/Main.kt
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,40 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") | ||
`maven-publish` | ||
`java-gradle-plugin` | ||
} | ||
|
||
group = "de.itemis.mps" | ||
|
||
val mpsVersion: String by project | ||
val kotlinArgParserVersion: String by project | ||
|
||
val pluginVersion = "1" | ||
|
||
version = if (project.hasProperty("forceCI") || project.hasProperty("teamcity")) { | ||
de.itemis.mps.gradle.GitBasedVersioning.getVersion(mpsVersion, pluginVersion) | ||
} else { | ||
"$mpsVersion.$pluginVersion-SNAPSHOT" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { | ||
url = uri("https://projects.itemis.de/nexus/content/repositories/mbeddr") | ||
} | ||
} | ||
|
||
val mpsConfiguration = configurations.create("mps") | ||
|
||
dependencies { | ||
implementation(kotlin("stdlib-jdk8")) | ||
mpsConfiguration("com.jetbrains:mps:$mpsVersion") | ||
implementation("com.xenomachina:kotlin-argparser:$kotlinArgParserVersion") | ||
compileOnly(mpsConfiguration.resolve().map { zipTree(it) }.first().matching { include("lib/*.jar")}) | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} |
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,41 @@ | ||
package de.itemis.mps.gradle.project.loader | ||
|
||
import com.xenomachina.argparser.ArgParser | ||
import com.xenomachina.argparser.default | ||
import java.io.File | ||
|
||
private fun <T> splitAndCreate(str: String, creator: (String, String) -> T): T { | ||
val split = str.split(":") | ||
if (split.size < 2) { | ||
throw RuntimeException("string if not of the right format. Expected <key>:<value>") | ||
} | ||
return creator(split[0], split[1]) | ||
} | ||
|
||
private fun toMacro(str: String) = splitAndCreate(str, ::Macro) | ||
private fun toPlugin(str: String) = splitAndCreate(str, ::Plugin) | ||
|
||
/** | ||
* Default set of arguments required to start a "headless" MPS. This class should be used by other users of the | ||
* project-loader in order to establish a somewhat standardised command line interface. Passing instances of this or | ||
* subclasses to [executeWithProject] is directly supported. | ||
*/ | ||
open class Args(parser: ArgParser) { | ||
|
||
val plugins by parser.adding("--plugin", | ||
help = "plugin to to load. The format is --plugin=<path>:<id>") | ||
{ toPlugin(this) } | ||
|
||
val macros by parser.adding("--macro", | ||
help = "macro to define. The format is --macro=<name>:<value>") | ||
{ toMacro(this) } | ||
|
||
val pluginLocation by parser.storing("--plugin-location", | ||
help = "location to load additional plugins from") { File(this) }.default<File?>(null) | ||
|
||
val buildNumber by parser.storing("--build-number", | ||
help = "build number used to determine if the plugins are compatible").default<String?>(null) | ||
|
||
val project by parser.storing("--project", | ||
help = "project to generate from") { File(this) } | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is this
--macros
or--macro
?