|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2005, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2009 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 15-21
Link Here
|
| 15 |
|
15 |
|
| 16 |
import java.io.File; |
16 |
import java.io.File; |
| 17 |
import java.io.FilenameFilter; |
17 |
import java.io.FilenameFilter; |
| 18 |
import java.util.ArrayList; |
18 |
import java.util.*; |
| 19 |
import java.util.regex.Matcher; |
19 |
import java.util.regex.Matcher; |
| 20 |
import java.util.regex.Pattern; |
20 |
import java.util.regex.Pattern; |
| 21 |
import org.eclipse.core.resources.*; |
21 |
import org.eclipse.core.resources.*; |
|
Lines 123-128
Link Here
|
| 123 |
IBuildEntry bundleList = null; |
123 |
IBuildEntry bundleList = null; |
| 124 |
ArrayList sourceEntries = new ArrayList(); |
124 |
ArrayList sourceEntries = new ArrayList(); |
| 125 |
ArrayList sourceEntryKeys = new ArrayList(); |
125 |
ArrayList sourceEntryKeys = new ArrayList(); |
|
|
126 |
Map encodingEntries = new HashMap(); |
| 126 |
IBuildEntry[] entries = build.getBuildEntries(); |
127 |
IBuildEntry[] entries = build.getBuildEntries(); |
| 127 |
for (int i = 0; i < entries.length; i++) { |
128 |
for (int i = 0; i < entries.length; i++) { |
| 128 |
String name = entries[i].getName(); |
129 |
String name = entries[i].getName(); |
|
Lines 138-143
Link Here
|
| 138 |
srcExcludes = entries[i]; |
139 |
srcExcludes = entries[i]; |
| 139 |
else if (name.startsWith(PROPERTY_SOURCE_PREFIX)) |
140 |
else if (name.startsWith(PROPERTY_SOURCE_PREFIX)) |
| 140 |
sourceEntries.add(entries[i]); |
141 |
sourceEntries.add(entries[i]); |
|
|
142 |
else if (name.startsWith(PROPERTY_JAVAC_DEFAULT_ENCODING_PREFIX)) |
| 143 |
encodingEntries.put(entries[i].getName(), entries[i].getTokens()[0]); |
| 141 |
else if (name.equals(PROPERTY_JAR_EXTRA_CLASSPATH)) |
144 |
else if (name.equals(PROPERTY_JAR_EXTRA_CLASSPATH)) |
| 142 |
jarsExtra = entries[i]; |
145 |
jarsExtra = entries[i]; |
| 143 |
else if (name.equals(IBuildEntry.SECONDARY_DEPENDENCIES)) |
146 |
else if (name.equals(IBuildEntry.SECONDARY_DEPENDENCIES)) |
|
Lines 185-190
Link Here
|
| 185 |
validateSourceEntries(sourceEntries); |
188 |
validateSourceEntries(sourceEntries); |
| 186 |
validateMissingSourceInBinIncludes(binIncludes, sourceEntryKeys, build); |
189 |
validateMissingSourceInBinIncludes(binIncludes, sourceEntryKeys, build); |
| 187 |
validateBinIncludes(binIncludes); |
190 |
validateBinIncludes(binIncludes); |
|
|
191 |
validateDefaultEncoding(sourceEntries, encodingEntries); |
| 192 |
} |
| 193 |
|
| 194 |
private void validateDefaultEncoding(ArrayList sourceEntries, Map encodingEntries) { |
| 195 |
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ |
| 196 |
for (int i = 0; i < sourceEntries.size(); i++) { |
| 197 |
try { |
| 198 |
String name = ((IBuildEntry) sourceEntries.get(i)).getName(); |
| 199 |
String library = name.substring(name.indexOf('.') + 1, name.length()); |
| 200 |
String encoding = fProject.getDefaultCharset(); |
| 201 |
String encodingId = PROPERTY_JAVAC_DEFAULT_ENCODING_PREFIX + library; |
| 202 |
String libraryEncoding = (String) encodingEntries.get(encodingId); |
| 203 |
if (!defaultEncoding.equalsIgnoreCase(encoding) && libraryEncoding == null) { |
| 204 |
prepareError(encodingId, encoding, NLS.bind(PDECoreMessages.BuildErrorReporter_defaultEncodingMissing, new Object[] {defaultEncoding, encoding}), PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_OTHER); |
| 205 |
} |
| 206 |
} catch (CoreException e) { |
| 207 |
e.printStackTrace(); |
| 208 |
} |
| 209 |
} |
| 188 |
} |
210 |
} |
| 189 |
|
211 |
|
| 190 |
private void validateBinIncludes(IBuildEntry binIncludes) { |
212 |
private void validateBinIncludes(IBuildEntry binIncludes) { |