Add link to posts because IFTTT really hates feeds without links.
[SquirrelJME.git] / modules / cldc-compact / build.gradle
blob543de9cd5b1c1570b5ba1089fbe25ed64f299e50
1 import cc.squirreljme.plugin.swm.JavaMEConfiguration
2 import cc.squirreljme.plugin.swm.JavaMEMidletType
4 // Setup plugins
5 plugins
7         id "java"
10 version = "1.8.$squirreljmeVMVersion"
11 description = "This is the standard JavaME 8 Connection " +
12         "Limited Device Configuration which contains the core classes used " +
13         "by Java ME."
15 squirreljme
17         javaDocErrorCode = "ZZ"
18         swmType = JavaMEMidletType.API
19         swmName = "Connected Limited Device Configuration (Compact)"
20         swmVendor = "Stephanie Gawroriski"
21         definedConfigurations += new JavaMEConfiguration("CLDC-1.8-Compact")
22         definedConfigurations += new JavaMEConfiguration("CLDC-1.1.1")
23         definedConfigurations += new JavaMEConfiguration("CLDC-1.1")
24         definedConfigurations += new JavaMEConfiguration("CLDC-1.0")
25         tags += "required"
26         tags += "lite"
27         noEmitConfiguration = true
28         
29         // Needed for SquirrelJME VMs to start and operate properly, as this is
30         // the entry point into any code that starts and otherwise
31         proGuardOptions += ["-keep", "class", "java.lang.__Start__"]
32         proGuardOptions += ["-keepnames", "class", "java.lang.__Start__"]
33         proGuardOptions += ["-keepclassmembers", "class", 
34                 "java.lang.__Start__", "{",
35                         "void", "__base", "(", ")", ";",
36                         "void", "__main", "(", ")", ";",
37                 "}"]
38         proGuardOptions += ["-keepclassmembernames", "class",
39                 "java.lang.__Start__", "{",
40                         "void", "__base", "(", ")", ";",
41                         "void", "__main", "(", ")", ";",
42                 "}"]
43         
44         // There are some hidden fields in Thread that need to be kept
45         proGuardOptions += ["-keepclassmembers", "class",
46                 "java.lang.Thread", "{",
47                         "boolean", "_started", ";",
48                         "boolean", "_isAlive", ";",
49                         "boolean", "_interrupted", ";",
50                         "java.lang.Runnable", "_runnable", ";",
51                         "cc.squirreljme.jvm.mle.brackets.VMThreadBracket", "_vmThread",
52                                 ";",
53                 "}"]
54         proGuardOptions += ["-keepclassmembernames", "class",
55                 "java.lang.Thread", "{",
56                         "boolean", "_started", ";",
57                         "boolean", "_isAlive", ";",
58                         "boolean", "_interrupted", ";",
59                         "java.lang.Runnable", "_runnable", ";",
60                         "cc.squirreljme.jvm.mle.brackets.VMThreadBracket", "_vmThread",
61                                 ";",
62                 "}"]
63         
64         // Throwable has the internal stack trace
65         proGuardOptions += ["-keepclassmembers", "class",
66                 "java.lang.Throwable", "{",
67                         "cc.squirreljme.jvm.mle.brackets.TracePointBracket[]",
68                                 "_stack", ";",
69                 "}"]
70         proGuardOptions += ["-keepclassmembernames", "class",
71                 "java.lang.Throwable", "{",
72                         "cc.squirreljme.jvm.mle.brackets.TracePointBracket[]",
73                                 "_stack", ";",
74                 "}"]
75         
76         // Class has hidden fields that are directly accessed
77         proGuardOptions += ["-keepclassmembers", "class",
78                 "java.lang.Class", "{",
79                         "cc.squirreljme.jvm.mle.brackets.TypeBracket", "_type", ";",
80                 
81                         // Constructor used internally
82                         "Class", "(", "cc.squirreljme.jvm.mle.brackets.TypeBracket",
83                                 ")", ";",
84                 "}"]
85         proGuardOptions += ["-keepclassmembernames", "class",
86                 "java.lang.Class", "{",
87                         "cc.squirreljme.jvm.mle.brackets.TypeBracket", "_type", ";",
88                 "}"]
89         
90         // String information that needs to be kept
91         proGuardOptions += ["-keepclassmembers", "class",
92                 "java.lang.String", "{",
93                         "char[]", "_chars", ";",
94                         "int", "_hashCode", ";",
95                 "}"]
96         proGuardOptions += ["-keepclassmembernames", "class",
97                 "java.lang.String", "{",
98                         "char[]", "_chars", ";",
99                         "int", "_hashCode", ";",
100                 "}"]
101         
102         // Prevent certain java.lang.Boolean optimizations
103         proGuardOptions += ["-keepclassmembers,includecode", "class",
104                 "java.lang.Boolean", "{",
105                         "java.lang.Boolean", "TRUE", ";",
106                         "java.lang.Boolean", "FALSE", ";",
107                         "boolean", "_value", ";",
108                         "void", "<clinit>", "(", ")", ";",
109                         "java.lang.Boolean", "valueOf", "(", "boolean", ")", ";",
110                 "}"]
111         proGuardOptions += ["-keepclassmembernames", "class",
112                 "java.lang.Boolean", "{",
113                         "boolean", "_value", ";",
114                 "}"]
115         
116         // Prevent certain java.lang.Character optimizations
117         proGuardOptions += ["-keepclassmembers,includecode", "class",
118                 "java.lang.Character", "{",
119                         "char", "_value", ";",
120                         "java.lang.Character", "valueOf", "(", "char", ")", ";",
121                 "}"]
122         proGuardOptions += ["-keepclassmembernames", "class",
123                 "java.lang.Character", "{",
124                         "char", "_value", ";",
125                 "}"]
126         
127         // Prevent certain java.lang.Byte optimizations
128         proGuardOptions += ["-keepclassmembers,includecode", "class",
129                 "java.lang.Byte", "{",
130                         "byte", "_value", ";",
131                         "java.lang.Byte", "valueOf", "(", "byte", ")", ";",
132                 "}"]
133         proGuardOptions += ["-keepclassmembernames", "class",
134                 "java.lang.Byte", "{",
135                         "byte", "_value", ";",
136                 "}"]
137         
138         // Prevent certain java.lang.Short optimizations
139         proGuardOptions += ["-keepclassmembers,includecode", "class",
140                 "java.lang.Short", "{",
141                         "short", "_value", ";",
142                         "java.lang.Short", "valueOf", "(", "short", ")", ";",
143                 "}"]
144         proGuardOptions += ["-keepclassmembernames", "class",
145                 "java.lang.Short", "{",
146                         "short", "_value", ";",
147                 "}"]
148         
149         // Prevent certain java.lang.Integer optimizations
150         proGuardOptions += ["-keepclassmembers,includecode", "class",
151                 "java.lang.Integer", "{",
152                         "int", "_value", ";",
153                         "java.lang.Integer", "valueOf", "(", "int", ")", ";",
154                 "}"]
155         proGuardOptions += ["-keepclassmembernames", "class",
156                 "java.lang.Integer", "{",
157                         "int", "_value", ";",
158                 "}"]
159         
160         // Prevent certain java.lang.Long optimizations
161         proGuardOptions += ["-keepclassmembers,includecode", "class",
162                 "java.lang.Long", "{",
163                         "long", "_value", ";",
164                         "java.lang.Long", "valueOf", "(", "long", ")", ";",
165                 "}"]
166         proGuardOptions += ["-keepclassmembernames", "class",
167                 "java.lang.Long", "{",
168                         "long", "_value", ";",
169                 "}"]
170         
171         // Prevent certain java.lang.Float optimizations
172         proGuardOptions += ["-keepclassmembers,includecode", "class",
173                 "java.lang.Float", "{",
174                         "float", "_value", ";",
175                         "java.lang.Float", "valueOf", "(", "float", ")", ";",
176                 "}"]
177         proGuardOptions += ["-keepclassmembernames", "class",
178                 "java.lang.Float", "{",
179                         "float", "_value", ";",
180                 "}"]
181         
182         // Prevent certain java.lang.Double optimizations
183         proGuardOptions += ["-keepclassmembers,includecode", "class",
184                 "java.lang.Double", "{",
185                         "double", "_value", ";",
186                         "java.lang.Double", "valueOf", "(", "double", ")", ";",
187                 "}"]
188         proGuardOptions += ["-keepclassmembernames", "class",
189                 "java.lang.Double", "{",
190                         "double", "_value", ";",
191                 "}"]
192         
193         // Prevent software math methods from being changed, these are called
194         
195         // Optimizing this method seems to break the launcher somehow...
196         proGuardOptions += ["-keepclassmembers,includecode",
197                 "class", "cc.squirreljme.jvm.launch.SuiteScanner", "{",
198                         "cc.squirreljme.jvm.launch.AvailableSuites", "scanSuites", "(",
199                                 ")", ";",
200                         "cc.squirreljme.jvm.launch.AvailableSuites", "scanSuites", "(",
201                                 "cc.squirreljme.jvm.launch.SuiteScanListener", ")", ";",
202                 "}"]
203         
204         // Keep this and do not optimize it out, otherwise it breaks the launcher
205         // and stops it from working
206         proGuardOptions += ["-keep,allowobfuscation",
207                 "class", "cc.squirreljme.jvm.launch.SuiteScanListener"]
208         proGuardOptions += ["-keepclassmembers,allowobfuscation",
209                 "class", "cc.squirreljme.jvm.launch.SuiteScanListener", "{",
210                         "void", "scanned", "(",
211                                         "cc.squirreljme.jvm.launch.Application", ",",
212                                         "int", ",",
213                                         "int",
214                                 ")", ";",
215                 "}"]
216         
217         // The test method that takes 255 arguments completely breaks ProGuard
218         // so disable optimizations for it
219         proGuardOptionsTest += ["-keep", "class",
220                 "lang.bytecode.TestInvoke255"]
221         proGuardOptionsTest += ["-keepnames", "class",
222                 "lang.bytecode.TestInvoke255"]
223         proGuardOptionsTest += ["-keep,includecode",
224                 "class", "lang.bytecode.TestInvoke255", "{",
225                         "<fields>", ";",
226                         "<methods>", ";",
227                 "}"
228         ]
229         
230         // This is considered a boot loader for SummerCoat
231         isBootLoader = true
232         bootLoaderMainClass = "cc.squirreljme.jvm.summercoat.Bootstrap"
235 java
237         // No classes are available for this project
238         compileJava.options.bootstrapClasspath = project.objects.fileCollection()
241 dependencies
243         // For IDE related information
244         api "org.jetbrains:annotations:24.0.1"