Check-in [32d979d6c0]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Default to SpringCoat if no VM was specified; Correct distribution shading so that the service files for the bootstrap are merged.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:32d979d6c07f2c8e90a6483f7a519fbf5ae93134
User & Date: stephanie.gawroriski 2019-05-19 14:05:03
Context
2019-05-19
14:21
Add images to the LCDUI demo programs. check-in: 6425666cef user: stephanie.gawroriski tags: trunk
14:05
Default to SpringCoat if no VM was specified; Correct distribution shading so that the service files for the bootstrap are merged. check-in: 32d979d6c0 user: stephanie.gawroriski tags: trunk
13:42
If no VM was specified, default to SpringCoat rather than the first found one. check-in: a458307b91 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added bldt/libs/builder-support/cc/squirreljme/builder/support/vmshader/ServicesMerge.java.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.builder.support.vmshader;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * This is used for merging services together as one.
 *
 * @since 2019/05/19
 */
public final class ServicesMerge
{
	/** Services available. */
	final Set<String> _implementations =
		new LinkedHashSet<>();
	
	/**
	 * Returns the service implementations.
	 *
	 * @return The service implementations.
	 * @since 2019/05/19
	 */
	public final String[] implementations()
	{
		Set<String> impls = this._implementations;
		return impls.<String>toArray(new String[impls.size()]);
	}
}

Changes to bldt/libs/builder-support/cc/squirreljme/builder/support/vmshader/Shader.java.

12
13
14
15
16
17
18

19
20

21
22
23
24
25
26
27
28
29
30
31

32
33

34
35
36
37
38
39
40
...
130
131
132
133
134
135
136



137
138
139
140
141
142
143
144
145
146
147
148





























149
150
151
152
153
154
155
...
224
225
226
227
228
229
230










231
232
233
234
235
236
237

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.BinaryManager;
import cc.squirreljme.builder.support.NoSourceAvailableException;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;

import java.util.LinkedHashSet;
import java.util.List;

import java.util.Queue;
import java.util.Set;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
................................................................................
	private static final void __bootIn(ZipStreamWriter __zsw,
		BinaryManager __bm, Binary[] __bins, Set<String> __putin)
		throws IOException, NullPointerException
	{
		if (__zsw == null || __bm == null || __bins == null || __putin == null)
			throw new NullPointerException("NARG");
		



		// We want to write and merge all the entries
		byte[] buf = new byte[512];
		for (Binary bin : __bins)
		{
			// Will be copying every single entry to the output
			try (ZipBlockReader zbr = bin.zipBlock())
			{
				// Copy every single entry to the output
				for (ZipBlockEntry e : zbr)
				{
					// Only add entries once!
					String name = e.name();





























					if (__putin.contains(name))
						continue;
					
					// Do not write manifests!
					if (name.equals("META-INF/MANIFEST.MF"))
						continue;
					
................................................................................
		
		// Write manifest to the output
		try (OutputStream os = __zsw.nextEntry(
			"META-INF/SQUIRRELJME-SHADED.MF"))
		{
			man.write(os);
		}










	}
	
	/**
	 * Checks to make sure that the given package should be included.
	 *
	 * @param __name The name of the class to check.
	 * @return If the class can be stored.







>


>











>


>







 







>
>
>










|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283

import cc.squirreljme.builder.support.Binary;
import cc.squirreljme.builder.support.BinaryManager;
import cc.squirreljme.builder.support.NoSourceAvailableException;
import cc.squirreljme.builder.support.ProjectManager;
import cc.squirreljme.builder.support.TimeSpaceType;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifest;
import net.multiphasicapps.tool.manifest.writer.MutableJavaManifestAttributes;
import net.multiphasicapps.zip.blockreader.ZipBlockEntry;
import net.multiphasicapps.zip.blockreader.ZipBlockReader;
import net.multiphasicapps.zip.streamreader.ZipStreamEntry;
................................................................................
	private static final void __bootIn(ZipStreamWriter __zsw,
		BinaryManager __bm, Binary[] __bins, Set<String> __putin)
		throws IOException, NullPointerException
	{
		if (__zsw == null || __bm == null || __bins == null || __putin == null)
			throw new NullPointerException("NARG");
		
		// Services that are available
		Map<String, ServicesMerge> services = new LinkedHashMap<>();
		
		// We want to write and merge all the entries
		byte[] buf = new byte[512];
		for (Binary bin : __bins)
		{
			// Will be copying every single entry to the output
			try (ZipBlockReader zbr = bin.zipBlock())
			{
				// Copy every single entry to the output
				for (ZipBlockEntry e : zbr)
				{
					// Merge in services?
					String name = e.name();
					if (name.startsWith("META-INF/services/"))
					{
						// Get just the name of the class
						name = name.substring(18);
						
						// Setup merge for services
						ServicesMerge merge = services.get(name);
						if (merge == null)
							services.put(name, (merge = new ServicesMerge()));
						
						// Merge in service implementations
						try (BufferedReader br = new BufferedReader(
							new InputStreamReader(e.open())))
						{
							for (;;)
							{
								String ln = br.readLine();
								if (ln == null)
									break;
								
								merge._implementations.add(ln);
							}
						}
						
						// Do not process any further
						continue;
					}
					
					// Only add entries once!
					if (__putin.contains(name))
						continue;
					
					// Do not write manifests!
					if (name.equals("META-INF/MANIFEST.MF"))
						continue;
					
................................................................................
		
		// Write manifest to the output
		try (OutputStream os = __zsw.nextEntry(
			"META-INF/SQUIRRELJME-SHADED.MF"))
		{
			man.write(os);
		}
		
		// Write in any services
		for (Map.Entry<String, ServicesMerge> e : services.entrySet())
			try (PrintStream os = new PrintStream(__zsw.nextEntry(
				"META-INF/services/" + e.getKey()), true))
			{
				for (String s : e.getValue().implementations())
					os.println(s);
				os.flush();
			}
	}
	
	/**
	 * Checks to make sure that the given package should be included.
	 *
	 * @param __name The name of the class to check.
	 * @return If the class can be stored.

Changes to runt/libs/common-vm/cc/squirreljme/vm/VMFactory.java.

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
		
		// Determine the virtual machine to use
		VMFactory factory = null;
		for (VMFactory f : ServiceLoader.<VMFactory>load(VMFactory.class))
		{
			// If no name was specified then use the first one, otherwise
			// use the one which matches the name
			if (__vm == null || __vm.equals(f.name))
			{
				factory = f;
				break;
			}
		}
		
		// {@squirreljme.error AK06 The specified virtual machine does not







|







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
		
		// Determine the virtual machine to use
		VMFactory factory = null;
		for (VMFactory f : ServiceLoader.<VMFactory>load(VMFactory.class))
		{
			// If no name was specified then use the first one, otherwise
			// use the one which matches the name
			if (__vm == null || __vm.equalsIgnoreCase(f.name))
			{
				factory = f;
				break;
			}
		}
		
		// {@squirreljme.error AK06 The specified virtual machine does not