use of io.crnk.gen.typescript.TSGeneratorConfig in project crnk-framework by crnk-project.
the class RuntimeClassLoaderFactory method getProjectLibraries.
public Set<File> getProjectLibraries() {
Set<File> classpath = new HashSet<>();
SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");
if (sourceSets != null) {
SortedSet<String> availableSourceSetNames = sourceSets.getNames();
for (String sourceSetName : Arrays.asList("main", "test", "integrationTest")) {
if (availableSourceSetNames.contains(sourceSetName)) {
SourceSet sourceSet = sourceSets.getByName(sourceSetName);
classpath.add(sourceSet.getOutput().getClassesDir());
}
}
}
// add dependencies from configured gradle configuration to url (usually test or integrationTest)
TSGeneratorConfig generatorConfiguration = project.getExtensions().getByType(TSGeneratorConfig.class);
String configurationName = generatorConfiguration.getRuntime().getConfiguration();
ConfigurationContainer configurations = project.getConfigurations();
Configuration runtimeConfiguration = configurations.findByName(configurationName + "Runtime");
if (runtimeConfiguration == null) {
runtimeConfiguration = configurations.getByName(configurationName);
}
classpath.addAll(runtimeConfiguration.getFiles());
for (File file : classpath) {
LOGGER.debug("classpath entry: {}", file);
}
return classpath;
}
use of io.crnk.gen.typescript.TSGeneratorConfig in project crnk-framework by crnk-project.
the class GeneratorExecutor method run.
public void run(File outputDir) {
TSGeneratorConfig config = new TSGeneratorConfig();
config.setGenerateExpressions(true);
config.getNpm().setPackagingEnabled(false);
config.getNpm().setPackageName("@crnk/angular-ngrx");
config.getNpm().getPackageMapping().put(MetaElement.class.getPackage().getName(), "@crnk/angular-ngrx/meta");
MetaModule metaModule = MetaModule.create();
metaModule.addMetaProvider(new ResourceMetaProvider());
CrnkBoot boot = new CrnkBoot();
boot.setServiceDiscovery(new EmptyServiceDiscovery());
boot.addModule(metaModule);
boot.boot();
TSGenerator generator = new TSGenerator(outputDir, metaModule.getLookup(), config);
try {
generator.run();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
Aggregations