Improve kotlin recipe, still not working

LEPILLER JulienWed May 15 19:16:28+0200 2019

96cfb76

Improve kotlin recipe, still not working

kotlin-Update-for-dependencies.patch unknown status 1

1+
From 0a2f04444a7cf9e23c8d54ca06f56975e04682d4 Mon Sep 17 00:00:00 2001
2+
From: LEPILLER Julien <julien.lepiller@irisa.fr>
3+
Date: Wed, 15 May 2019 13:21:32 +0200
4+
Subject: [PATCH] Update for newer dependencies.
5+
6+
---
7+
 build.xml                                     | 181 ++++--------------
8+
 .../cli/jvm/compiler/JetCoreEnvironment.java  |  24 ++-
9+
 .../resolve/lazy/IdentitySmartPointer.java    |   5 +
10+
 .../JetCodeBlockModificationListener.java     |   2 +-
11+
 .../asJava/KotlinJavaFileStubProvider.java    |   5 +-
12+
 ...otlinLightClassForExplicitDeclaration.java |   2 +-
13+
 .../jet/asJava/StubClassBuilder.java          |   4 +-
14+
 .../java/util/concurrent/annotations.xml      |  10 -
15+
 8 files changed, 71 insertions(+), 162 deletions(-)
16+
17+
diff --git a/build.xml b/build.xml
18+
index b71942d..1d5f46b 100644
19+
--- a/build.xml
20+
+++ b/build.xml
21+
@@ -108,52 +108,46 @@
22+
     </target>
23+
 
24+
     <target name="compilerSources">
25+
-        <if>
26+
-            <istrue value="${generate.javadoc}"/>
27+
+        <jar jarfile="${output}/kotlin-compiler-sources.jar">
28+
+            <!-- TODO How to convert it from pathset or dirset ? -->
29+
+            <fileset dir="compiler/frontend/src"/>
30+
+            <fileset dir="compiler/frontend.java/src"/>
31+
+            <fileset dir="compiler/backend/src"/>
32+
+            <fileset dir="compiler/cli/src"/>
33+
+            <fileset dir="j2k/src"/>
34+
+            <fileset dir="compiler/util/src"/>
35+
+            <fileset dir="compiler/jet.as.java.psi/src"/>
36+
+            <fileset dir="runtime/src"/>
37+
+            <fileset dir="js/js.translator/src"/>
38+
+            <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
39+
 
40+
-            <then>
41+
-                <jar jarfile="${output}/kotlin-compiler-sources.jar">
42+
-                    <!-- TODO How to convert it from pathset or dirset ? -->
43+
-                    <fileset dir="compiler/frontend/src"/>
44+
-                    <fileset dir="compiler/frontend.java/src"/>
45+
-                    <fileset dir="compiler/backend/src"/>
46+
-                    <fileset dir="compiler/cli/src"/>
47+
-                    <fileset dir="j2k/src"/>
48+
-                    <fileset dir="compiler/util/src"/>
49+
-                    <fileset dir="compiler/jet.as.java.psi/src"/>
50+
-                    <fileset dir="runtime/src"/>
51+
-                    <fileset dir="js/js.translator/src"/>
52+
-                    <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
53+
+            <manifest>
54+
+                <attribute name="Built-By" value="JetBrains"/>
55+
 
56+
-                    <manifest>
57+
-                        <attribute name="Built-By" value="JetBrains"/>
58+
+                <attribute name="Implementation-Vendor" value="JetBrains"/>
59+
+                <attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
60+
+                <attribute name="Implementation-Version" value="${build.number}"/>
61+
+            </manifest>
62+
+        </jar>
63+
 
64+
-                        <attribute name="Implementation-Vendor" value="JetBrains"/>
65+
-                        <attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
66+
-                        <attribute name="Implementation-Version" value="${build.number}"/>
67+
-                    </manifest>
68+
-                </jar>
69+
+        <delete dir="${output}/kotlin-compiler-javadoc" failonerror="false" />
70+
+        <javadoc destdir="${output}/kotlin-compiler-javadoc"
71+
+                 sourcepathref="compilerSources.path"
72+
+                 classpathref="classpath"
73+
+                 linksource="yes"
74+
+                 windowtitle="Kotlin Compiler"/>
75+
+        <jar jarfile="${output}/kotlin-compiler-javadoc.jar">
76+
+            <fileset dir="${output}/kotlin-compiler-javadoc"/>
77+
+            <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
78+
 
79+
-                <delete dir="${output}/kotlin-compiler-javadoc" failonerror="false" />
80+
-                <javadoc destdir="${output}/kotlin-compiler-javadoc"
81+
-                         sourcepathref="compilerSources.path"
82+
-                         classpathref="classpath"
83+
-                         linksource="yes"
84+
-                         windowtitle="Kotlin Compiler"/>
85+
-                <jar jarfile="${output}/kotlin-compiler-javadoc.jar">
86+
-                    <fileset dir="${output}/kotlin-compiler-javadoc"/>
87+
-                    <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
88+
+            <manifest>
89+
+                <attribute name="Built-By" value="JetBrains"/>
90+
 
91+
-                    <manifest>
92+
-                        <attribute name="Built-By" value="JetBrains"/>
93+
-
94+
-                        <attribute name="Implementation-Vendor" value="JetBrains"/>
95+
-                        <attribute name="Implementation-Title" value="Kotlin Compiler Javadoc"/>
96+
-                        <attribute name="Implementation-Version" value="${build.number}"/>
97+
-                    </manifest>
98+
-                </jar>
99+
-            </then>
100+
-        </if>
101+
+                <attribute name="Implementation-Vendor" value="JetBrains"/>
102+
+                <attribute name="Implementation-Title" value="Kotlin Compiler Javadoc"/>
103+
+                <attribute name="Implementation-Version" value="${build.number}"/>
104+
+            </manifest>
105+
+        </jar>
106+
     </target>
107+
 
108+
   <target name="jslib">
109+
@@ -278,109 +272,8 @@
110+
 
111+
         <delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
112+
 
113+
-        <if>
114+
-            <isfalse value="${shrink}"/>
115+
-
116+
-            <then>
117+
-                <copy file="${output}/kotlin-compiler-jarjar.jar"
118+
-                      tofile="${kotlin-home}/lib/kotlin-compiler.jar"/>
119+
-            </then>
120+
-
121+
-            <else>
122+
-                <cleandir dir="${output}/kotlin-compiler.exploded"/>
123+
-                <unzip src="${output}/kotlin-compiler-jarjar.jar" dest="${output}/kotlin-compiler.exploded"/>
124+
-
125+
-                <!-- Clean JarJar result -->
126+
-                <jar jarfile="${output}/kotlin-compiler-before-proguard.jar"
127+
-                     manifest="${output}/kotlin-compiler.exploded/META-INF/MANIFEST.MF">
128+
-
129+
-                    <fileset dir="${output}/kotlin-compiler.exploded">
130+
-                        <include name="**/*.class"/>
131+
-                        <include name="**/*.properties"/>
132+
-                        <include name="**/*.jet"/>
133+
-                        <include name="**/*.kt"/>
134+
-                        <include name="META-INF/services/**"/>
135+
-                        <include name="META-INF/native/**"/>
136+
-                        <include name="messages/**"/>
137+
-                    </fileset>
138+
-                    <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
139+
-                </jar>
140+
-                <delete dir="${output}/kotlin-compiler.exploded"/>
141+
-
142+
-                <available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
143+
-                <available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
144+
-
145+
-                <proguard><![CDATA[
146+
-                    -injars '${output}/kotlin-compiler-before-proguard.jar'
147+
-                    -outjars '${kotlin-home}/lib/kotlin-compiler.jar'
148+
-
149+
-                    -dontwarn org.jetbrains.jet.internal.com.intellij.util.**
150+
-                    -dontwarn org.jetbrains.jet.internal.com.intellij.codeInsight.**
151+
-                    -dontwarn org.jetbrains.jet.internal.com.thoughtworks.xstream.**
152+
-                    -dontwarn org.fusesource.**
153+
-
154+
-                    -libraryjars '${rtjar}'
155+
-
156+
-                    -target 1.6
157+
-                    -dontoptimize
158+
-                    -dontobfuscate
159+
-
160+
-                    -keep class org.fusesource.** { *; }
161+
-
162+
-                    -keepclasseswithmembers public class * {
163+
-                        public static void main(java.lang.String[]);
164+
-                    }
165+
-
166+
-                    -keep class org.jetbrains.annotations.** {
167+
-                        public protected *;
168+
-                    }
169+
-
170+
-                    -keep class org.jetbrains.k2js.** {
171+
-                        public protected *;
172+
-                    }
173+
-
174+
-                    -keep class org.jetbrains.jet.** {
175+
-                        public protected *;
176+
-                    }
177+
-
178+
-                    -keep class jet.** {
179+
-                        public protected *;
180+
-                    }
181+
-
182+
-                    -keepclasseswithmembers class * { void start(); }
183+
-
184+
-                    -keepclasseswithmembers class * { void stop(); }
185+
-                    -keepclasseswithmembers class * { void dispose(); }
186+
-
187+
-                    -keepclasseswithmembers class * { ** getFileSystem(); }
188+
-                    -keepclasseswithmembers class * { ** isVarArgs(); }
189+
-                    -keepclasseswithmembers class * { ** getApplication(); }
190+
-                    -keepclasseswithmembers class * { ** finalizeReferent(); }
191+
-                    -keepclasseswithmembers class * { ** newBuilder(); }
192+
-                    -keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
193+
-                    -keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
194+
-                    -keepclasseswithmembers class * { ** getUserData(java.lang.String); }
195+
-                    -keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
196+
-
197+
-                    -keepclasseswithmembers class * { ** project(); }
198+
-
199+
-                    -keepclasseswithmembers class * { ** TYPE; }
200+
-                    -keepclasseswithmembers class * { ** ourInstance; }
201+
-
202+
-                    -keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); }
203+
-
204+
-                    -keepclassmembers enum * {
205+
-                        public static **[] values();
206+
-                        public static ** valueOf(java.lang.String);
207+
-                    }
208+
-
209+
-                    -keepclassmembers class * {
210+
-                        ** toString();
211+
-                        ** hashCode();
212+
-                    }
213+
-                ]]></proguard>
214+
-            </else>
215+
-        </if>
216+
+        <copy file="${output}/kotlin-compiler-jarjar.jar"
217+
+            tofile="${kotlin-home}/lib/kotlin-compiler.jar" />
218+
     </target>
219+
 
220+
     <target name="antTools">
221+
diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
222+
index 880a288..c786c7b 100644
223+
--- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
224+
+++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
225+
@@ -16,6 +16,12 @@
226+
 
227+
 package org.jetbrains.jet.cli.jvm.compiler;
228+
 
229+
+import com.intellij.openapi.fileTypes.PlainTextFileType;
230+
+import com.intellij.psi.augment.PsiAugmentProvider;
231+
+import com.intellij.psi.compiled.ClassFileDecompilers;
232+
+import com.intellij.codeInsight.ContainerProvider;
233+
+import com.intellij.lang.jvm.facade.JvmElementProvider;
234+
+import com.intellij.psi.PsiElementFinder;
235+
 import com.intellij.codeInsight.ExternalAnnotationsManager;
236+
 import com.intellij.core.CoreApplicationEnvironment;
237+
 import com.intellij.core.CoreJavaFileManager;
238+
@@ -72,7 +78,15 @@ public class JetCoreEnvironment {
239+
         this.configuration = configuration.copy();
240+
         this.configuration.setReadOnly(true);
241+
 
242+
+        CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME,
243+
+                                                          ContainerProvider.class);
244+
+        CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME,
245+
+                                                          ClassFileDecompilers.Decompiler.class);
246+
+        CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME,
247+
+                                                          PsiAugmentProvider.class);
248+
+
249+
         this.applicationEnvironment = new JavaCoreApplicationEnvironment(parentDisposable);
250+
+        applicationEnvironment.registerFileType(PlainTextFileType.INSTANCE, "xml");
251+
         applicationEnvironment.registerFileType(JetFileType.INSTANCE, "kt");
252+
         applicationEnvironment.registerFileType(JetFileType.INSTANCE, "kts");
253+
         applicationEnvironment.registerFileType(JetFileType.INSTANCE, "ktm");
254+
@@ -81,7 +95,15 @@ public class JetCoreEnvironment {
255+
         applicationEnvironment.registerParserDefinition(new JavaParserDefinition());
256+
         applicationEnvironment.registerParserDefinition(new JetParserDefinition());
257+
 
258+
-        projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment);
259+
+        projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment) {
260+
+            @Override
261+
+            protected void preregisterServices() {
262+
+                CoreApplicationEnvironment.registerExtensionPoint(Extensions.getArea(myProject),
263+
+                        JvmElementProvider.EP_NAME, JvmElementProvider.class);
264+
+                CoreApplicationEnvironment.registerExtensionPoint(Extensions.getArea(myProject),
265+
+                        PsiElementFinder.EP_NAME, PsiElementFinder.class);
266+
+            }
267+
+        };
268+
 
269+
         MockProject project = projectEnvironment.getProject();
270+
         project.registerService(JetScriptDefinitionProvider.class, new JetScriptDefinitionProvider());
271+
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java
272+
index dca7927..e5310b3 100644
273+
--- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java
274+
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java
275+
@@ -56,4 +56,9 @@ public class IdentitySmartPointer<E extends PsiElement> implements SmartPsiEleme
276+
     public Segment getRange() {
277+
         return element.getTextRange();
278+
     }
279+
+
280+
+    @Override
281+
+    public Segment getPsiRange() {
282+
+        return element.getTextRange();
283+
+    }
284+
 }
285+
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java
286+
index 863ebfd..1d99aaa 100644
287+
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java
288+
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java
289+
@@ -55,7 +55,7 @@ public class JetCodeBlockModificationListener implements PsiTreeChangePreprocess
290+
 
291+
             case CHILDREN_CHANGED:
292+
                 // general childrenChanged() event after each change
293+
-                if (!event.isGenericChildrenChange()) {
294+
+                if (!event.isGenericChange()) {
295+
                     processChange(event.getParent(), event.getParent(), null);
296+
                 }
297+
                 break;
298+
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java
299+
index 73ef03d..1b80776 100644
300+
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java
301+
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java
302+
@@ -167,7 +167,7 @@ public class KotlinJavaFileStubProvider implements CachedValueProvider<PsiJavaFi
303+
         javaFileStub.setPsiFactory(new ClsWrapperStubPsiFactory());
304+
 
305+
         ClsFileImpl fakeFile =
306+
-                new ClsFileImpl((PsiManagerImpl) manager, new ClassFileViewProvider(manager, virtualFile)) {
307+
+                new ClsFileImpl(new ClassFileViewProvider(manager, virtualFile)) {
308+
                     @NotNull
309+
                     @Override
310+
                     public PsiClassHolderFileStub getStub() {
311+
@@ -181,7 +181,6 @@ public class KotlinJavaFileStubProvider implements CachedValueProvider<PsiJavaFi
312+
                     }
313+
                 };
314+
 
315+
-        fakeFile.setPhysical(false);
316+
         javaFileStub.setPsi(fakeFile);
317+
         return javaFileStub;
318+
     }
319+
@@ -243,4 +242,4 @@ public class KotlinJavaFileStubProvider implements CachedValueProvider<PsiJavaFi
320+
             }
321+
         }
322+
     }
323+
-}
324+
\ No newline at end of file
325+
+}
326+
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java
327+
index ce76c14..177a0ef 100644
328+
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java
329+
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java
330+
@@ -171,7 +171,7 @@ public class KotlinLightClassForExplicitDeclaration extends AbstractLightClass i
331+
         protected PsiFile compute() {
332+
             VirtualFile virtualFile = classOrObject.getContainingFile().getVirtualFile();
333+
             assert virtualFile != null : "No virtual file for " + classOrObject.getText();
334+
-            return new ClsFileImpl((PsiManagerImpl) getManager(), new ClassFileViewProvider(getManager(), virtualFile)) {
335+
+            return new ClsFileImpl(new ClassFileViewProvider(getManager(), virtualFile)) {
336+
                 @NotNull
337+
                 @Override
338+
                 public String getPackageName() {
339+
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java
340+
index 5bc1a79..59edee5 100644
341+
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java
342+
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java
343+
@@ -44,7 +44,7 @@ public class StubClassBuilder extends ClassBuilder {
344+
         }
345+
 
346+
         @Override
347+
-        public ClassReader readerForInnerClass(Object o) {
348+
+        public void accept(Object o, StubBuildingVisitor<Object> visitor) {
349+
             throw new UnsupportedOperationException("Shall not be called!");
350+
         }
351+
     };
352+
@@ -67,7 +67,7 @@ public class StubClassBuilder extends ClassBuilder {
353+
     @Override
354+
     public void defineClass(PsiElement origin, int version, int access, String name, @Nullable String signature, String superName, String[] interfaces) {
355+
         assert v == null : "defineClass() called twice?";
356+
-        v = new StubBuildingVisitor<Object>(null, EMPTY_STRATEGY, parent, access);
357+
+        v = new StubBuildingVisitor<Object>(null, EMPTY_STRATEGY, parent, access, name);
358+
 
359+
         super.defineClass(origin, version, access, name, signature, superName, interfaces);
360+
 
361+
diff --git a/jdk-annotations/java/util/concurrent/annotations.xml b/jdk-annotations/java/util/concurrent/annotations.xml
362+
index a6681b0..c47e09d 100644
363+
--- a/jdk-annotations/java/util/concurrent/annotations.xml
364+
+++ b/jdk-annotations/java/util/concurrent/annotations.xml
365+
@@ -1,14 +1,4 @@
366+
 <root>
367+
-  <item name='java.util.concurrent.BlockingQueue int drainTo(java.util.Collection&lt;? super E&gt;, int)'>
368+
-    <annotation name='jet.runtime.typeinfo.KotlinSignature'>
369+
-      <val name="value" val="&quot;fun drainTo(c : MutableCollection<in E>, maxElements: Int) : Int&quot;"/>
370+
-    </annotation>
371+
-  </item>
372+
-  <item name='java.util.concurrent.BlockingQueue int drainTo(java.util.Collection&lt;? super E&gt;)'>
373+
-    <annotation name='jet.runtime.typeinfo.KotlinSignature'>
374+
-      <val name="value" val="&quot;fun drainTo(c : MutableCollection<in E>) : Int&quot;"/>
375+
-    </annotation>
376+
-  </item>
377+
 
378+
     <item name='java.util.concurrent.ConcurrentNavigableMap java.util.concurrent.ConcurrentNavigableMap&lt;K,V&gt; headMap(K, boolean) 0'>
379+
         <annotation name='org.jetbrains.annotations.NotNull'/>
380+
-- 
381+
2.21.0
382+

more/packages/intellij.scm

158158
       #:tests? #f
159159
       #:phases
160160
       (modify-phases %standard-phases
161+
         (add-before 'build 'copy-resources
162+
           (lambda _
163+
             (copy-recursively "platform/util/resources" "build/classes")
164+
             #t))
161165
         (add-before 'build 'remove-apple
162166
           (lambda _
163167
             (delete-file "platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java")

217221
    (propagated-inputs
218222
     `(("java-automaton" ,java-automaton)
219223
       ("java-intellij-platform-extensions" ,java-intellij-platform-extensions)
224+
       ("java-intellij-platform-resources" ,java-intellij-platform-resources)
220225
       ("java-intellij-platform-util" ,java-intellij-platform-util)
226+
       ("java-intellij-resources" ,java-intellij-resources)
221227
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)
222228
       ("java-trove4j-intellij" ,java-trove4j-intellij)))
223229
    (home-page "https://github.com/JetBrains/intellij-community")

254260
     `(#:source-dir "java/java-psi-api/src"
255261
       #:jar-name "intellij.java.psi-api.jar"
256262
       ;; No test
257-
       #:tests? #f))
263+
       #:tests? #f
264+
       #:phases
265+
       (modify-phases %standard-phases
266+
         (add-before 'build 'copy-resources
267+
           (lambda _
268+
             (copy-recursively "java/java-psi-api/src/messages"
269+
                               "build/classes/messages")
270+
             #t)))))
258271
    (propagated-inputs
259272
     `(("java-intellij-platform-core-api" ,java-intellij-platform-core-api)
260273
       ("java-intellij-platform-util" ,java-intellij-platform-util)

287300
                 (("org.jetbrains.org.objectweb") "org.objectweb")
288301
                 ;; As in build/asm/3_api_version.patch
289302
                 (("API_VERSION") "ASM6")))
303+
             #t))
304+
         (add-before 'build 'copy-resources
305+
           (lambda _
306+
             (copy-recursively "java/java-psi-impl/src/META-INF"
307+
                               "build/classes/META-INF")
308+
             (copy-recursively "java/java-psi-impl/src/messages"
309+
                               "build/classes/intellij/java/resources/en")
290310
             #t)))))
291311
    (propagated-inputs
292312
     `(("java-asm" ,java-asm)

299319
    (description "")
300320
    (license license:asl2.0)))
301321
322+
(define-public java-intellij-platform-resources
323+
  (package
324+
    (name "java-intellij-platform-resources")
325+
    (version intellij-community-version)
326+
    (source (intellij-community-source intellij-community-commit version))
327+
    (build-system ant-build-system)
328+
    (arguments
329+
      ;; TODO: remove these auto-generated files and generate them with
330+
      ;; java-flex from the same-named file in src, with .flex extension
331+
      ;; (_JavaLexer, _JavaDocLexer)
332+
     `(#:source-dir "platform/platform-resources"
333+
       #:jar-name "intellij.platform.resources.jar"
334+
       ;; No test
335+
       #:tests? #f
336+
       #:phases
337+
       (modify-phases %standard-phases
338+
         (add-before 'build 'copy-resources
339+
           (lambda _
340+
             (copy-recursively "platform/platform-resources/src"
341+
                               "build/classes")
342+
             #t)))))
343+
    (propagated-inputs '())
344+
    (native-inputs '())
345+
    (inputs '())
346+
    (home-page "https://github.com/JetBrains/intellij-community")
347+
    (synopsis "")
348+
    (description "")
349+
    (license license:asl2.0)))
350+
351+
(define-public java-intellij-resources
352+
  (package
353+
    (name "java-intellij-resources")
354+
    (version intellij-community-version)
355+
    (source (intellij-community-source intellij-community-commit version))
356+
    (build-system ant-build-system)
357+
    (arguments
358+
      ;; TODO: remove these auto-generated files and generate them with
359+
      ;; java-flex from the same-named file in src, with .flex extension
360+
      ;; (_JavaLexer, _JavaDocLexer)
361+
     `(#:source-dir "resources"
362+
       #:jar-name "intellij.resources.jar"
363+
       ;; No test
364+
       #:tests? #f
365+
       #:phases
366+
       (modify-phases %standard-phases
367+
         (add-before 'build 'copy-resources
368+
           (lambda _
369+
             (copy-recursively "resources/src" "build/classes")
370+
             #t)))))
371+
    (propagated-inputs '())
372+
    (native-inputs '())
373+
    (inputs '())
374+
    (home-page "https://github.com/JetBrains/intellij-community")
375+
    (synopsis "")
376+
    (description "")
377+
    (license license:asl2.0)))
378+
302379
;; Newer versions are not free software anymore
303380
;; latest free versions are 1.8.1 and 1.8.0. We require something older for
304381
;; intellij though.

more/packages/java.scm

83338333
    (synopsis "")
83348334
    (description "")
83358335
    (license license:asl2.0)))
8336+
8337+
(define-public java-spullara-cli-parser
8338+
  (package
8339+
    (name "java-spullara-cli-parser")
8340+
    (version "1.1.5")
8341+
    (source (origin
8342+
              (method git-fetch)
8343+
              (uri (git-reference
8344+
                     (url "https://github.com/spullara/cli-parser")
8345+
                     (commit (string-append "cli-parser-" version))))
8346+
              (file-name (git-file-name name version))
8347+
              (sha256
8348+
               (base32
8349+
                "1viysb4aws6nsbp4lil1fwwc69rr9s5z66g17iygmbq5lincz35y"))))
8350+
    (build-system ant-build-system)
8351+
    (arguments
8352+
     `(#:jar-name "spullara-cli-parser.jar"
8353+
       #:test-dir "src/test"
8354+
       #:source-dir "src/main/java"))
8355+
    (native-inputs
8356+
     `(("java-hamcrest-core" ,java-hamcrest-core)
8357+
       ("java-junit" ,java-junit)))
8358+
    (home-page "https://github.com/spullara/cli-parser")
8359+
    (synopsis "")
8360+
    (description "")
8361+
    (license license:asl2.0)))

more/packages/kotlin.scm

4141
  #:use-module (more packages intellij)
4242
  #:use-module (more packages java))
4343
44+
(define-public java-former-dart-ast
45+
  (let ((commit "845189ca287c96b864bd1442fe31e591a9c6f883"))
46+
    (package
47+
      (name "java-former-dart-ast")
48+
      (version (git-version "0.0.0" "1" commit))
49+
      (source (origin
50+
                (method git-fetch)
51+
                (uri (git-reference
52+
                       (url "https://github.com/develar/former-dast-ast")
53+
                       (commit commit)))
54+
                (file-name (git-file-name name version))
55+
                (sha256
56+
                 (base32
57+
                  "0hl3rij3kdl0c8l6avwg1ibscjpymdqg6irwbqric6sl5fawlhwz"))))
58+
    (build-system ant-build-system)
59+
    (arguments
60+
     `(#:jar-name "dart-ast.jar"
61+
       ;; No tests
62+
       #:tests? #f))
63+
    (propagated-inputs
64+
     `(("java-intellij-platform-util" ,java-intellij-platform-util)
65+
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)))
66+
    (home-page "https://github.com/develar/former-dast-ast")
67+
    (synopsis "")
68+
    (description "")
69+
    (license license:bsd-3))))
70+
4471
(define-public kotlin-0
4572
  (package
4673
    (name "kotlin")

4976
              (method git-fetch)
5077
              (uri (git-reference
5178
                     (url "https://github.com/JetBrains/kotlin")
79+
                     ;; build-0.4.424
5280
                     (commit "2f47e30a1a12347759dbb8707f5137178de65696")))
5381
              (file-name (git-file-name name version))
5482
              (sha256
5583
               (base32
5684
                "0f60v3swyrkh41c4lhha64njivvsnr7p6yz7i1vjmvs697pjvqg2"))
85+
              (patches
86+
                (search-patches "kotlin-Update-for-dependencies.patch"))
5787
              (modules '((guix build utils)))
5888
              (snippet
5989
                `(begin
6090
                   (for-each delete-file (find-files "." ".*.jar$"))
61-
                   (mkdir "ideaSDK")
91+
                   ;; TODO:??Remove these files, but they are needed by the
92+
                   ;; process that generate them...
93+
                   ;(for-each delete-file (find-files "." ".*Generated.java$"))
94+
                   (mkdir-p "ideaSDK/core")
95+
                   (mkdir "ideaSDK/lib")
6296
                   (mkdir "dependencies")
6397
                   #t))))
6498
    (build-system ant-build-system)
6599
    (arguments
66100
     `(#:build-target "dist"
101+
       #:make-flags (list "-Dshrink=false")
67102
       #:phases
68103
       (modify-phases %standard-phases
69104
         (add-before 'build 'copy-jars

75110
                 (map (lambda (input)
76111
                        (find-files (assoc-ref inputs input) ".*.jar$"))
77112
                   '("java-asm" "java-asm-commons"
113+
                     "java-former-dart-ast"
78114
                     "java-guava"
79115
                     "java-intellij-java-psi-api"
80116
                     "java-intellij-java-psi-impl"

84120
                     "java-intellij-platform-util"
85121
                     "java-intellij-platform-util-rt"
86122
                     "java-javax-inject"
123+
                     "java-jline-2"
87124
                     "java-jsr305"
88125
                     "java-jetbrains-annotations"
89-
                     "java-trove4j-intellij"))))
126+
                     "java-spullara-cli-parser"
127+
                     "java-trove4j-intellij"
128+
                     ;; propagated inputs
129+
                     "java-intellij-platform-resources"
130+
                     "java-intellij-resources"
131+
                     "java-picocontainer-1"
132+
                     ;; implicit input
133+
                     "ant"))))
134+
             #t))
135+
         (add-before 'build 'fix-write-permission
136+
           (lambda _
137+
             (with-directory-excursion "compiler/frontend.java/src/org/jetbrains/jet"
138+
               (chmod
139+
                 "lang/resolve/java/JavaToKotlinMethodMapGenerated.java"
140+
                 #o644))
90141
             #t))
91142
         (add-before 'build 'fix-asm
92143
           (lambda _

96147
    (inputs
97148
     `(("java-asm" ,java-asm)
98149
       ("java-asm-commons" ,java-asm-commons-7)
150+
       ("java-former-dart-ast" ,java-former-dart-ast)
99151
       ("java-guava" ,java-guava)
100152
       ("java-intellij-java-psi-api" ,java-intellij-java-psi-api)
101153
       ("java-intellij-java-psi-impl" ,java-intellij-java-psi-impl)

105157
       ("java-intellij-platform-util" ,java-intellij-platform-util)
106158
       ("java-intellij-platform-util-rt" ,java-intellij-platform-util-rt)
107159
       ("java-javax-inject" ,java-javax-inject)
160+
       ("java-jline-2" ,java-jline-2)
108161
       ("java-jsr305" ,java-jsr305)
109162
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)
163+
       ("java-spullara-cli-parser" ,java-spullara-cli-parser)
110164
       ("java-trove4j-intellij" ,java-trove4j-intellij)))
165+
    (native-inputs
166+
     `(("java-jarjar" ,java-jarjar)))
111167
    (home-page "")
112168
    (synopsis "")
113169
    (description "")