Changeset 13981


Ignore:
Timestamp:
Nov 7, 2019 11:26:45 AM (13 days ago)
Author:
mjohnsson
Message:

#5870 Checksum current version

Location:
branches/dev-mj-2630
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mj-2630

  • branches/dev-mj-2630/.settings/org.eclipse.jdt.core.prefs

    r13444 r13981  
    99org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
    1010org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
     11org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
     12org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
     13org.eclipse.jdt.core.compiler.compliance=1.8
    1114org.eclipse.jdt.core.compiler.doc.comment.support=enabled
    1215org.eclipse.jdt.core.compiler.problem.APILeak=warning
    1316org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
     17org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
    1418org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
    1519org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
     
    2024org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
    2125org.eclipse.jdt.core.compiler.problem.emptyStatement=error
     26org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
    2227org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
    2328org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
     
    114119org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
    115120org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
     121org.eclipse.jdt.core.compiler.source=1.8
  • branches/dev-mj-2630/CHANGELOG.txt

    r13897 r13981  
    11================= Unreleased ==================
     2# Change ; Minor ; Compiler; #5870
     3Debug log now contains checksums of all generated c-files.
     4
    25# Fixed ; Minor ; Compiler; #5864
    36Fixed bug where partial variability propagation lead to unbalanced equation systems.
  • branches/dev-mj-2630/Compiler/ModelicaCompiler/src/jastadd/ModelicaCompiler.jrag

    r13963 r13981  
    13701370        fc.guidManager().setSourceFile(new File(outDir, "modelDescription.xml"));
    13711371        fc.guidManager().processDependentFiles();
     1372        log.debug("Checksum for generated files");
    13721373        fc.guidManager().writeFileMD5(log);
    13731374        log.debug("... code generated.");
     
    21792180           
    21802181            for (File file : stream.files()) {
    2181                 try {
    2182                     fc.guidManager().createFileMD5(outFile, log);
    2183                 } catch (IOException e) {}
    2184                
    21852182                log.debug("Generated file '" + file + "'.");
    21862183                if (fc != null) {
     2184                    try {
     2185                        fc.guidManager().createFileMD5(new FileReader(file), file.getName(), log);
     2186                    } catch (FileNotFoundException e) {
     2187                        throw e;
     2188                    } catch (IOException e) {
     2189                        // Should not happen
     2190                    }
    21872191                    fc.guidManager().addDependentFile(file);
    21882192                }
  • branches/dev-mj-2630/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/GUIDManager.java

    r13963 r13981  
    1212import java.io.OutputStream;
    1313import java.io.PrintWriter;
     14import java.io.Reader;
    1415import java.math.BigInteger;
    1516import java.nio.charset.Charset;
     
    99100    }
    100101
    101     public void createFileMD5(File file, ModelicaLogger log) throws IOException {
     102    public void createFileMD5(Reader file, String fileName, ModelicaLogger log) throws IOException {
    102103        MessageDigest md5;
    103104        try {
     
    107108        }
    108109
    109         try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
     110        try (final BufferedReader reader = new BufferedReader(file)) {
    110111            String line = reader.readLine();
    111112            while (line != null) {
     
    119120       
    120121        String Value = new BigInteger(1,md5.digest()).toString(16);
    121         filesMd5.add("CheckSum of " + file.getName() + " :" + Value);
     122        filesMd5.add("Generated file "+ fileName + " with checksum " + Value);
    122123    }
    123124
  • branches/dev-mj-2630/Compiler/ModelicaFrontEnd/test/junit/org/jmodelica/test/common/GUIDManagerTest.java

    r13963 r13981  
    66import static org.junit.Assert.assertTrue;
    77
    8 import java.io.BufferedOutputStream;
    9 import java.io.BufferedReader;
    108import java.io.ByteArrayOutputStream;
    11 import java.io.File;
    12 import java.io.Reader;
     9import java.io.IOException;
     10import java.io.StringReader;
    1311
    1412import org.jmodelica.common.GUIDManager;
    1513import org.jmodelica.util.logging.Level;
    16 import org.jmodelica.util.logging.ModelicaLogger;
    1714import org.junit.Before;
    1815import org.junit.Test;
     
    136133        guidManager.writeFileMD5(log);
    137134        assertEquals("DEBUG: DummyHash", log.next());
    138 
    139135    }
    140136
     137    @Test
     138    public void checksumFiles() throws IOException {
     139        TestLogger log = new TestLogger(Level.VERBOSE);
     140        String dummyFile = "This is a dummy c-file /n c-stuff";
     141        StringReader reader = new StringReader(dummyFile);
     142        guidManager.createFileMD5(reader, "dummyfile.c", log);
     143        guidManager.writeFileMD5(log);
     144        assertNull(log.next());
     145       
     146        reader = new StringReader(dummyFile);
     147        log = new TestLogger(Level.DEBUG);
     148        guidManager.createFileMD5(reader, "dummyfile.c", log);
     149        guidManager.writeFileMD5(log);
     150        assertEquals("DEBUG: Generated file dummyfile.c with checksum fcde3f483c06e4a10bc5b28ec56214f8", log.next());
     151    }
    141152}
Note: See TracChangeset for help on using the changeset viewer.