@@ -17,6 +17,14 @@ export const shortName = "MTA";
1717export const repositoryUrl = "https://github.com/migtools/editor-extensions" ;
1818export const bugsUrl = "https://github.com/migtools/editor-extensions/issues" ;
1919export const homepageUrl = "https://developers.redhat.com/products/mta/overview" ;
20+ // export const fallbackAssetsUrl = "https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.0.1/"
21+ export const fallbackAssetsUrl = "https://download.devel.redhat.com/devel/candidates/middleware/migrationtoolkit/MTA-8.1.0.CR2/"
22+
23+ // ─── TEMPORARY PRE-RELEASE ASSET HANDLING ───────────────────────────────────
24+ // TODO: REMOVE THIS SECTION WHEN MTA 8.1.0 GOES GA AND ASSETS ARE PUBLIC
25+ // Currently using CR2 (candidate release) which requires VPN access
26+ const isPreRelease = fallbackAssetsUrl . includes ( 'candidates' ) || fallbackAssetsUrl . includes ( 'CR' ) ;
27+ // ─────────────────────────────────────────────────────────────────────────────
2028
2129// Extension name mapping: upstream → downstream
2230const NAME_MAP = {
@@ -207,10 +215,26 @@ function brandCoreExtension(pkg) {
207215 } ) ) ;
208216 }
209217
210- // Remove kai from includedAssetPaths (runtime download via fallback)
211- if ( pkg . includedAssetPaths ?. kai !== undefined ) {
212- delete pkg . includedAssetPaths . kai ;
213- console . log ( " ✅ Removed kai binary assets from package (runtime download enabled)" ) ;
218+ // Asset management strategy for production vs pre-release builds
219+ if ( isPreRelease && pkg . includedAssetPaths ?. kai !== undefined ) {
220+ // Pre-release builds: Keep assets bundled to avoid VPN requirements
221+ console . log ( " 📦 Keeping kai binary assets bundled (pre-release build)" ) ;
222+ console . log ( " 🚨 Pre-release mode: Assets bundled to avoid VPN requirement at runtime" ) ;
223+ } else if ( ! isPreRelease && pkg . includedAssetPaths ?. kai !== undefined ) {
224+ // Production builds: Fail hard if dev assets are still bundled
225+ console . error ( " ❌ PRODUCTION BUILD ERROR: Dev assets still bundled!" ) ;
226+ console . error ( " ❌ Found bundled kai assets in production build" ) ;
227+ console . error ( " ❌ This would ship dev/internal assets to end users" ) ;
228+ console . error ( " 💡 Solution: Remove kai assets from upstream package.json" ) ;
229+ console . error ( " or verify fallbackAssetsUrl points to public release" ) ;
230+ process . exit ( 1 ) ;
231+ } else if ( ! isPreRelease ) {
232+ // Production builds: Assets removed, runtime download enabled
233+ console . log ( " ✅ No bundled assets (runtime download from public servers)" ) ;
234+ } else {
235+ // Pre-release but no assets found
236+ console . log ( " ⚠️ Pre-release mode but no kai assets found" ) ;
237+ console . log ( " ⚠️ Extension may fail at runtime without bundled or downloadable assets" ) ;
214238 }
215239
216240 return pkg ;
@@ -333,8 +357,7 @@ function transformSourceCode() {
333357async function generateFallbackAssets ( pkg ) {
334358 console . log ( " 🔧 Generating fallback assets configuration..." ) ;
335359
336- const FALLBACK_ASSETS_URL =
337- "https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.0.0/" ;
360+ const FALLBACK_ASSETS_URL = fallbackAssetsUrl ;
338361
339362 const PLATFORM_MAPPING = {
340363 "linux-x64" : "linux-amd64" ,
@@ -357,18 +380,18 @@ async function generateFallbackAssets(pkg) {
357380 try {
358381 console . log ( ` Fetching from: ${ FALLBACK_ASSETS_URL } ` ) ;
359382
360- // Verify sha256sum.txt exists
361- console . log ( " 🔍 Verifying sha256sum.txt exists..." ) ;
383+ // Verify SHA256SUM exists
384+ console . log ( " 🔍 Verifying SHA256SUM exists..." ) ;
362385 try {
363- const sha256Response = await fetchText ( `${ FALLBACK_ASSETS_URL } sha256sum.txt ` ) ;
386+ const sha256Response = await fetchText ( `${ FALLBACK_ASSETS_URL } SHA256SUM ` ) ;
364387 if ( ! sha256Response || sha256Response . trim ( ) . length === 0 ) {
365- throw new Error ( "sha256sum.txt is empty" ) ;
388+ throw new Error ( "SHA256SUM is empty" ) ;
366389 }
367- console . log ( " ✅ sha256sum.txt found and not empty" ) ;
390+ console . log ( " ✅ SHA256SUM found and not empty" ) ;
368391 } catch ( sha256Error ) {
369- console . error ( ` ❌ Failed to fetch sha256sum.txt : ${ sha256Error . message } ` ) ;
392+ console . error ( ` ❌ Failed to fetch SHA256SUM : ${ sha256Error . message } ` ) ;
370393 console . error (
371- " ❌ Build failed: sha256sum.txt is required for secure asset downloads" ,
394+ " ❌ Build failed: SHA256SUM is required for secure asset downloads" ,
372395 ) ;
373396 process . exit ( 1 ) ;
374397 }
@@ -430,13 +453,20 @@ async function generateFallbackAssets(pkg) {
430453
431454 pkg . fallbackAssets = {
432455 baseUrl : FALLBACK_ASSETS_URL ,
433- sha256sumFile : "sha256sum.txt " ,
456+ sha256sumFile : "SHA256SUM " ,
434457 assets,
435458 } ;
436459
437460 console . log (
438461 ` ✅ Generated fallback assets for ${ Object . keys ( assets ) . length } platforms` ,
439462 ) ;
463+
464+ // Reminder about GA transition
465+ if ( isPreRelease ) {
466+ console . log ( " 🚨 When MTA 8.1.0 goes GA, update fallbackAssetsUrl to:" ) ;
467+ console . log ( " https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.1.0/" ) ;
468+ console . log ( " This will auto-disable bundled assets and enable runtime downloads" ) ;
469+ }
440470 } catch ( error ) {
441471 console . error ( ` ❌ Failed to generate fallback assets: ${ error . message } ` ) ;
442472 console . error (
@@ -498,6 +528,46 @@ const isDirectExecution =
498528if ( isDirectExecution ) {
499529 console . log ( "🔄 Running MTA prebuild for multi-extension architecture...\n" ) ;
500530
531+ // Show loud warning for pre-release builds
532+ if ( isPreRelease ) {
533+ console . log ( "🚨🚨🚨 PRE-RELEASE BUILD DETECTED 🚨🚨🚨" ) ;
534+ console . log ( " Using candidate release assets that require VPN access:" ) ;
535+ console . log ( ` ${ fallbackAssetsUrl } ` ) ;
536+ console . log ( " Assets will be BUNDLED to avoid runtime download failures" ) ;
537+ console . log ( " 📝 TODO: Update to GA URL when MTA 8.1.0 is officially released:" ) ;
538+ console . log ( " https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.1.0/" ) ;
539+ console . log ( "🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n" ) ;
540+ }
541+
542+ // 0. Set version across all workspaces BEFORE webpack runs
543+ // This ensures webpack's DefinePlugin bakes the correct MTA version
544+ // into EXTENSION_VERSION constants at compile time.
545+ console . log ( `📝 Setting version ${ extensionVersion } across all workspaces...` ) ;
546+ const workspacePaths = [
547+ "package.json" ,
548+ "extra-types/package.json" ,
549+ "shared/package.json" ,
550+ "webview-ui/package.json" ,
551+ "agentic/package.json" ,
552+ "vscode/core/package.json" ,
553+ "vscode/java/package.json" ,
554+ "vscode/javascript/package.json" ,
555+ "vscode/go/package.json" ,
556+ "vscode/csharp/package.json" ,
557+ "vscode/konveyor/package.json" ,
558+ ] ;
559+
560+ for ( const ws of workspacePaths ) {
561+ const fullPath = path . join ( __dirname , ".." , ws ) ;
562+ if ( fs . existsSync ( fullPath ) ) {
563+ const pkg = JSON . parse ( fs . readFileSync ( fullPath , "utf8" ) ) ;
564+ pkg . version = extensionVersion ;
565+ fs . writeFileSync ( fullPath , JSON . stringify ( pkg , null , 2 ) ) ;
566+ console . log ( ` ✅ ${ ws } ` ) ;
567+ }
568+ }
569+ console . log ( "" ) ;
570+
501571 // 1. Transform core extension
502572 console . log ( "📦 Branding core extension (vscode/core)..." ) ;
503573 let corePkg = readPackageJson ( "vscode/core/package.json" ) ;
0 commit comments