summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-05-02 16:49:17 +0800
committerGitHub <noreply@github.com>2023-05-02 10:49:17 +0200
commitafc30ca87948c11f603f6686d4b10d3dcc27776a (patch)
treed52781ac11128914f43fce51fa8c59fb54bb7acf /compiler
parent2844ac8b5eb6efce18e10b246e874719b20d36b2 (diff)
downloadNim-afc30ca87948c11f603f6686d4b10d3dcc27776a.tar.gz
fixes #19863; move sha1, md5 to nimble packages for 2.0 (#21702)
* move sha1, md5 to nimble packages

* boot the compiler

* fixes tests

* build the documentation

* fixes docs

* lol, I forgot koch.nim

* add `nimHasChecksums` define

* clone checksums but maybe copying is better

* bump nimble hash

* use ChecksumsStableCommit

* fixes tests

* deprecate them

* fixes paths

* fixes koch
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgtypes.nim2
-rw-r--r--compiler/condsyms.nim2
-rw-r--r--compiler/extccomp.nim4
-rw-r--r--compiler/gorgeimpl.nim4
-rw-r--r--compiler/ic/ic.nim4
-rw-r--r--compiler/installer.ini1
-rw-r--r--compiler/main.nim4
-rw-r--r--compiler/modulegraphs.nim3
-rw-r--r--compiler/nimblecmd.nim4
-rw-r--r--compiler/passes.nim2
-rw-r--r--compiler/sighashes.nim3
11 files changed, 24 insertions, 9 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index adefffc8b..c164a80d7 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -12,7 +12,7 @@
 # ------------------------- Name Mangling --------------------------------
 
 import sighashes, modulegraphs
-import std/md5
+import ../dist/checksums/src/checksums/md5
 
 proc isKeyword(w: PIdent): bool =
   # Nim and C++ share some keywords
diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim
index a499b7142..fa7f56504 100644
--- a/compiler/condsyms.nim
+++ b/compiler/condsyms.nim
@@ -154,3 +154,5 @@ proc initDefines*(symbols: StringTableRef) =
   defineSymbol("nimHasGenericDefine")
   defineSymbol("nimHasDefineAliases")
   defineSymbol("nimHasWarnBareExcept")
+
+  defineSymbol("nimHasChecksums")
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 45a531852..040fe35e1 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -14,13 +14,15 @@
 
 import ropes, platform, condsyms, options, msgs, lineinfos, pathutils, modulepaths
 
-import std/[os, osproc, sha1, streams, sequtils, times, strtabs, json, jsonutils, sugar, parseutils]
+import std/[os, osproc, streams, sequtils, times, strtabs, json, jsonutils, sugar, parseutils]
 
 import std / strutils except addf
 
 when defined(nimPreviewSlimSystem):
   import std/syncio
 
+import ../dist/checksums/src/checksums/sha1
+
 type
   TInfoCCProp* = enum         # properties of the C compiler:
     hasSwitchRange,           # CC allows ranges in switch statements (GNU C)
diff --git a/compiler/gorgeimpl.nim b/compiler/gorgeimpl.nim
index 8fac06971..558a6c9a3 100644
--- a/compiler/gorgeimpl.nim
+++ b/compiler/gorgeimpl.nim
@@ -9,12 +9,14 @@
 
 ## Module that implements ``gorge`` for the compiler.
 
-import msgs, std / sha1, os, osproc, streams, options,
+import msgs, os, osproc, streams, options,
   lineinfos, pathutils
 
 when defined(nimPreviewSlimSystem):
   import std/syncio
 
+import ../dist/checksums/src/checksums/sha1
+
 proc readOutput(p: Process): (string, int) =
   result[0] = ""
   var output = p.outputStream
diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim
index 793ece80a..324782b54 100644
--- a/compiler/ic/ic.nim
+++ b/compiler/ic/ic.nim
@@ -7,13 +7,15 @@
 #    distribution, for details about the copyright.
 #
 
-import hashes, tables, intsets, std/sha1
+import hashes, tables, intsets
 import packed_ast, bitabs, rodfiles
 import ".." / [ast, idents, lineinfos, msgs, ropes, options,
   pathutils, condsyms, packages, modulepaths]
 #import ".." / [renderer, astalgo]
 from os import removeFile, isAbsolute
 
+import ../../dist/checksums/src/checksums/sha1
+
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions, formatfloat]
 
diff --git a/compiler/installer.ini b/compiler/installer.ini
index 226682715..4d0eab86d 100644
--- a/compiler/installer.ini
+++ b/compiler/installer.ini
@@ -78,6 +78,7 @@ Files: "lib"
 [Other]
 Files: "examples"
 Files: "dist/nimble"
+Files: "dist/checksums"
 
 Files: "tests"
 
diff --git a/compiler/main.nim b/compiler/main.nim
index ff870a14a..bc4b89147 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -13,7 +13,7 @@ when not defined(nimcore):
   {.error: "nimcore MUST be defined for Nim's core tooling".}
 
 import
-  std/[strutils, os, times, tables, sha1, with, json],
+  std/[strutils, os, times, tables, with, json],
   llstream, ast, lexer, syntaxes, options, msgs,
   condsyms,
   idents, extccomp,
@@ -29,6 +29,8 @@ when defined(nimPreviewSlimSystem):
 import ic / [cbackend, integrity, navigator]
 from ic / ic import rodViewer
 
+import ../dist/checksums/src/checksums/sha1
+
 import pipelines
 
 when not defined(leanCompiler):
diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim
index 4fdeb354e..5cb6a1c34 100644
--- a/compiler/modulegraphs.nim
+++ b/compiler/modulegraphs.nim
@@ -11,7 +11,8 @@
 ## represents a complete Nim project. Single modules can either be kept in RAM
 ## or stored in a rod-file.
 
-import intsets, tables, hashes, md5
+import intsets, tables, hashes
+import ../dist/checksums/src/checksums/md5
 import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils, packages
 import ic / [packed_ast, ic]
 
diff --git a/compiler/nimblecmd.nim b/compiler/nimblecmd.nim
index b6b08ccd4..440d35fe5 100644
--- a/compiler/nimblecmd.nim
+++ b/compiler/nimblecmd.nim
@@ -10,11 +10,13 @@
 ## Implements some helper procs for Nimble (Nim's package manager) support.
 
 import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils,
-  std/sha1, tables
+  tables
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
 
+import ../dist/checksums/src/checksums/sha1
+
 proc addPath*(conf: ConfigRef; path: AbsoluteDir, info: TLineInfo) =
   if not conf.searchPaths.contains(path):
     conf.searchPaths.insert(path, 0)
diff --git a/compiler/passes.nim b/compiler/passes.nim
index 536a64714..87a9d05c8 100644
--- a/compiler/passes.nim
+++ b/compiler/passes.nim
@@ -24,7 +24,7 @@ import ic/replayer
 export skipCodegen, resolveMod, prepareConfigNotes
 
 when defined(nimsuggest):
-  import std/sha1
+  import ../dist/checksums/src/checksums/sha1
 
 when defined(nimPreviewSlimSystem):
   import std/[syncio, assertions]
diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim
index 4f945da5f..2d91fb2a0 100644
--- a/compiler/sighashes.nim
+++ b/compiler/sighashes.nim
@@ -9,9 +9,10 @@
 
 ## Computes hash values for routine (proc, method etc) signatures.
 
-import ast, tables, ropes, md5, modulegraphs, options, msgs, pathutils
+import ast, tables, ropes, modulegraphs, options, msgs, pathutils
 from hashes import Hash
 import types
+import ../dist/checksums/src/checksums/md5
 
 
 when defined(nimPreviewSlimSystem):