Initial checkin

This commit is contained in:
2021-09-25 16:22:15 +02:00
commit 07831ef4fc
41 changed files with 19782 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -0,0 +1,2 @@
/target/
/.settings/

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.minres.coredsl.json.repository</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,95 @@
import static groovy.io.FileType.FILES
import java.nio.file.Files
import java.nio.file.Paths
import java.util.zip.ZipEntry
def needed_jars = [
/org\.eclipse\.xtext/,
/org\.eclipse\.emf\.ecore\.xmi/,
/org\.eclipse\.emf\.ecore/,
/org\.eclipse\.emf\.common/,
/org\.antlr\.runtime/,
/com\.google\.inject/,
/org\.eclipse\.emf\.mwe\.core/,
/org\.apache\.commons\.cli/,
/org\.eclipse\.emf\.mwe2\.runtime/,
/org\.eclipse\.emf\.mwe\.utils/,
/org\.eclipse\.xtext\.util/,
/com\.google\.guava/,
/javax\.inject/,
/org\.eclipse\.xtext\.xbase/,
/org\.eclipse\.xtext\.common\.types/,
/org\.eclipse\.xtend\.lib/,
/org\.eclipse\.xtext\.xbase\.lib/,
/org\.eclipse\.xtend\.lib\.macro/,
/org\.eclipse\.equinox\.common/,
/eclipse-trace/,
/groovy-eclipse/,
/ivy-2\.5\.0\.jar/,
/groovy-3\.0\.\d-indy/,
/groovy-templates-3\.0\.\d/,
/org\.eclipse\.xtext\.xtext\.generator/,
/org\.eclipse\.emf\.codegen\.ecore/,
/org\.eclipse\.emf\.codegen/,
/org\.eclipse\.emf\.mwe2\.launch/,
/org\.eclipse\.emf\.mwe2\.language/,
/org\.eclipse\.emf\.mwe2\.lib/,
/org\.objectweb\.asm/,
/org\.apache\.commons\.logging/,
/org\.apache\.log4j/,
/com\.ibm\.icu/,
/com\.minres\.coredsl/,
/com\.minres\.coredsl\.json\.dbt_rise/
]
// Collect all jars.
def jars = []
def root = new File(project.getBasedir(), 'target/classes')
def libs = new File(project.getBasedir(), 'target/classes/lib')
def meta_inf = new File(project.getBasedir(), 'target/classes/META-INF')
libs.eachFileRecurse (FILES) { file ->
if(file.name =~/org\.codehaus\.groovy_/) { // we need to unpack this one sinc it is already jar in jar
println("Unpacking ${file}")
def zipFile = new java.util.zip.ZipFile(file)
zipFile.entries().findAll {ZipEntry entry -> !entry.directory && entry.name =~/\.jar$/}.each {ZipEntry entry ->
def outFile = new File(libs, entry.name.split(/\//)[-1])
println "Extracting file ${entry.name} to ${outFile.path} with size ${entry.size}bytes (${entry.compressedSize}bytes)"
Files.copy(zipFile.getInputStream(entry), outFile.toPath())
}
}
}
libs.eachFileRecurse (FILES) { file ->
def fileName = file.name.split("/")[-1]
if(needed_jars.find{fileName =~ it}) {
println "Adding $file to the included jars"
jars << root.toURI().relativize(file.toURI()).toString()
} else {
file.delete()
}
}
def zipFile = new java.util.zip.ZipFile(new File(project.getBasedir(), 'jar-in-jar-loader.zip'))
zipFile.entries().each {ZipEntry it ->
def path = Paths.get("${root}/", it.name)
if(it.directory){
Files.createDirectories(path)
} else {
def parentDir = path.getParent()
if (!Files.exists(parentDir)) {
Files.createDirectories(parentDir)
}
Files.deleteIfExists(path)
println "Extracting file ${it.name} to ${path} with size ${it.size}bytes (${it.compressedSize}bytes)"
Files.copy(zipFile.getInputStream(it), path)
}
}
// Write the manifest file.
Files.createDirectories( Paths.get(meta_inf.absolutePath))
def mf = new File(project.getBasedir(), 'target/classes/META-INF/MANIFEST.MF')
mf.write ''
mf << 'Manifest-Version: 1.0\n'
mf << 'Rsrc-Class-Path: ./ ' + jars.join(' ') + '\n'
mf << 'Rsrc-Main-Class: com.minres.coredsl.json.Main\n'
mf << 'Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader\n'

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<bundle id="com.minres.coredsl"/>
<bundle id="com.minres.coredsl.json"/>
</site>

View File

@ -0,0 +1,109 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>com.minres.coredsl.json.parent</artifactId>
<groupId>com.minres.coredsl</groupId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>com.minres.coredsl.json.standalone</artifactId>
<packaging>eclipse-repository</packaging>
<properties>
<jarinjarloader.version>1.5-SNAPSHOT</jarinjarloader.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/repository/plugins</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.alexecollins.maven.plugin</groupId>
<artifactId>script-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<language>groovy</language>
<scriptFile>assemble.groovy</scriptFile>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-bsf</artifactId>
<version>2.4.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<jar manifest="${project.build.directory}/classes/META-INF/MANIFEST.MF"
destfile="${project.build.directory}/com.minres.coredsl.json-${project.version}.jar">
<fileset dir="${project.build.directory}/classes" />
</jar>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jcenter-bintray</id>
<name>Bintray JCenter Maven Repository</name>
<layout>default</layout>
<url>https://jcenter.bintray.com/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>