@@ -45,6 +45,13 @@ public synchronized void init(ProcessingEnvironment processingEnv) {
4545 elementUtils = processingEnv .getElementUtils ();
4646 filer = processingEnv .getFiler ();
4747 messager = processingEnv .getMessager ();
48+
49+ try {
50+ generateJavaSwift (filer );
51+ } catch (IOException e ) {
52+ e .printStackTrace ();
53+ error (null , "Can't write to file: " + e .getMessage ());
54+ }
4855 }
4956
5057 @ Override
@@ -133,14 +140,6 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
133140 }
134141 }
135142
136- try {
137- generateJavaSwift (filer );
138- } catch (IOException e ) {
139- e .printStackTrace ();
140- error (null , "Can't write to file: " + e .getMessage ());
141- return true ; // Exit processing
142- }
143-
144143 for (SwiftValueDescriptor valueDescriptor : swiftValues .values ()) {
145144
146145 for (SwiftFuncDescriptor function : valueDescriptor .functions ) {
@@ -191,12 +190,14 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
191190
192191 messager .printMessage (Diagnostic .Kind .NOTE , "SwiftJava finished successfully!" );
193192
194- return false ;
193+ return false ;
195194 }
196195
197196 private void generateJavaSwift (Filer filer ) throws IOException {
198- File swiftExtensionFile = new File (filer .createResource (StandardLocation .SOURCE_OUTPUT , FOLDER , "SwiftJava.swift" , (Element []) null ).toUri ().getPath ());
199- swiftExtensionFile .getParentFile ().mkdirs ();
197+ String swiftFilePath = filer .createResource (StandardLocation .SOURCE_OUTPUT , FOLDER , "SwiftJava.swift" , (Element ) null ).toUri ().getPath ();
198+ File swiftExtensionFile = new File (swiftFilePath );
199+ swiftExtensionFile .getParentFile ().mkdir ();
200+ messager .printMessage (Diagnostic .Kind .NOTE , "SwiftJava will generate sources int0: " + swiftExtensionFile .getParent ());
200201 SwiftWriter swiftWriter = new SwiftWriter (swiftExtensionFile );
201202 swiftWriter .emitImports (new String [0 ]);
202203 swiftWriter .emitEmptyLine ();
0 commit comments