Skip to content

Commit

Permalink
added generic configuration for BigProject generator
Browse files Browse the repository at this point in the history
* BigProject can be used as convenient way to create MPS project with all
modules in the repository to run migrations at once for the complete repository
  • Loading branch information
wsafonov committed May 20, 2021
1 parent 0c7638f commit 2677dba
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 3 deletions.
5 changes: 5 additions & 0 deletions tools/BigProject/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
.idea
.mps
_spreferences
8 changes: 8 additions & 0 deletions tools/BigProject/.idea/modules.xml

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

6 changes: 6 additions & 0 deletions tools/BigProject/.idea/vcs.xml

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

17 changes: 17 additions & 0 deletions tools/BigProject/.mps/libraries.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLibraryManager">
<option name="libraries">
<map>
<entry key="mps-extensions">
<value>
<Library>
<option name="name" value="mps-extensions" />
<option name="path" value="${mbeddr.github.core.home}/artifacts/de.itemis.mps.extensions" />
</Library>
</value>
</entry>
</map>
</option>
</component>
</project>
6 changes: 6 additions & 0 deletions tools/BigProject/.mps/vcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$mbeddr.github.core.home$" vcs="Git" />
</component>
</project>
15 changes: 15 additions & 0 deletions tools/BigProject/.run/BigProjectGenerator.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BigProjectGenerator" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.mbeddr.BigProjectGenerator" />
<module name="BigProject" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.mbeddr.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
11 changes: 11 additions & 0 deletions tools/BigProject/BigProject.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,30 @@

public class BigProjectGenerator {

private static File projectDir = new File("P:\\mbeddr.core-2020.1");
private static File modulesXml = new File(projectDir + "/tmp/allProject/.mps/modules.xml");
private static final String MODULES_XML_PATH = "/tools/BigProject/.mps/modules.xml";

private static int totalLanguages = 0;
private static int totalSolutions = 0;
private static int totalDevkits = 0;

public static void main(String[] args) throws Exception {
modulesXml.getParentFile().mkdirs();

File projectDir = new File(System.getProperty("user.dir"));
while (!new File(projectDir, ".git").exists()) {
projectDir = projectDir.getParentFile();
if (projectDir == null) {
System.err.print("Error: could not determine project directory root");
System.exit(-1);
}
}

System.out.println("Searching for modules under " + projectDir);

File langDir = new File(projectDir + "/code/languages");
File testsDir = new File(projectDir + "/code/tests");

File modulesXml = new File(projectDir + MODULES_XML_PATH);
modulesXml.getParentFile().mkdirs();
BufferedWriter w = new BufferedWriter(new FileWriter(modulesXml));

w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
Expand All @@ -38,6 +48,7 @@ public static void main(String[] args) throws Exception {

w.close();

System.out.println("Updated " + modulesXml);
System.out.println("=== TOTAL ===");
System.out.println("Languages: " + totalLanguages);
System.out.println("Solutions: " + totalSolutions);
Expand Down

0 comments on commit 2677dba

Please sign in to comment.