@@ -61,7 +61,7 @@ export class TruffleClient extends PluginClient {
6161 }
6262
6363 private async processArtifact ( ) {
64- const folderFiles = await fs . readdir ( this . buildPath )
64+ const folderFiles = await fs . readdir ( this . buildPath )
6565 // name of folders are file names
6666 for ( const file of folderFiles ) {
6767 if ( file . endsWith ( '.json' ) ) {
@@ -77,7 +77,6 @@ export class TruffleClient extends PluginClient {
7777 const content = await fs . readFile ( join ( this . buildPath , file ) , { encoding : 'utf-8' } )
7878 await this . feedContractArtifactFile ( file , content , compilationResult )
7979 this . emit ( 'compilationFinished' , compilationResult . compilationTarget , { sources : compilationResult . input } , 'soljson' , compilationResult . output , compilationResult . solcVersion )
80-
8180 }
8281 }
8382 if ( ! this . warnLog ) {
@@ -104,10 +103,12 @@ export class TruffleClient extends PluginClient {
104103 const contentJSON = JSON . parse ( content )
105104 const contractName = basename ( path ) . replace ( '.json' , '' )
106105 compilationResultPart . solcVersion = contentJSON . compiler . version
107- compilationResultPart . compilationTarget = contentJSON . ast . absolutePath
106+ // file name in artifacts starts with `project:/`
107+ const filepath = contentJSON . ast . absolutePath . startsWith ( 'project:/' ) ? contentJSON . ast . absolutePath . replace ( 'project:/' , '' ) : contentJSON . ast . absolutePath
108+ compilationResultPart . compilationTarget = filepath
108109 compilationResultPart . input [ path ] = { content : contentJSON . source }
109110 // extract data
110- const relPath = utils . relativePath ( contentJSON . ast . absolutePath , this . currentSharedFolder )
111+ const relPath = utils . relativePath ( filepath , this . currentSharedFolder )
111112 if ( ! compilationResultPart . output [ 'sources' ] [ relPath ] ) compilationResultPart . output [ 'sources' ] [ relPath ] = { }
112113
113114 const location = contentJSON . ast . src . split ( ':' )
0 commit comments