offline compilers

pull/4346/head
filip mertens 1 year ago
parent 7817878719
commit 151e4a324b
  1. 2
      apps/remixdesktop/src/plugins/compilerLoader.ts
  2. 1
      apps/remixdesktop/src/utils/config.ts
  3. 2
      libs/remix-lib/src/types/ICompilerApi.ts
  4. 14
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  5. 4
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx

@ -75,7 +75,7 @@ class CompilerLoaderPluginClient extends ElectronBasePluginClient {
async downloadCompiler(url: string): Promise<void> {
console.log('downloadCompiler', url)
if(url.includes('localhost')) return
const plugin = this
try {
const fileName = url.split('/').pop()

@ -8,7 +8,6 @@ console.log('cacheDir', cacheDir)
export const createDefaultConfigLocations = async() => {
try {
console.log('mdkir', cacheDir, fs.existsSync(cacheDir))
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir)
}

@ -58,7 +58,7 @@ export interface iSolJsonBinDataBuild {
longVersion: string,
binURL: string,
wasmURL: string,
isDownloaded: boolean,
isDownloaded: boolean
}
export interface iSolJsonBinData {
baseURLWasm: string,

@ -109,6 +109,10 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
}, [state.useFileConfiguration])
useEffect(() => {
if(online && state.onlyDownloaded){
// @ts-ignore
api.call('compilerloader','getJsonBinData')
}
setState((prevState) => {
return {...prevState, onlyDownloaded: !online}
})
@ -128,7 +132,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
document.removeEventListener('mousedown', listener)
document.removeEventListener('touchstart', listener)
}
})
}, [])
useEffect(() => {
if(!state.updatedVersionSelectorFromUrlQuery && solJsonBinData.binList && solJsonBinData.binList.length) {
@ -144,6 +148,13 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
setState((prevState) => {
return {...prevState, updatedVersionSelectorFromUrlQuery: true}
})
} else if(!solJsonBinData.binList || (solJsonBinData.binList && solJsonBinData.binList.length == 0)){
const version = 'builtin'
setState((prevState) => {
return {...prevState, selectedVersion: version}
})
updateCurrentVersion(version)
_updateVersionSelector(version)
}
}, [solJsonBinData])
@ -616,6 +627,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
}
const handleLoadVersion = (value) => {
if(value !== 'builtin' && !pathToURL[value]) return
setState((prevState) => {
return {...prevState, selectedVersion: value, matomoAutocompileOnce: true}
})

@ -153,12 +153,12 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
longVersion: 'latest local version - ' + state.defaultVersion,
binURL: '',
wasmURL: '',
isDownloaded: false,
isDownloaded: true,
version: 'builtin',
build: '',
prerelease: ''
}
const binVersions = data.binList
const binVersions = [...data.binList]
const selectorList = binVersions
const wasmVersions = data.wasmList

Loading…
Cancel
Save