@@ -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,24 @@ 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+ if ( isPreRelease ) {
393+ console . warn ( ` ⚠️ Failed to fetch SHA256SUM: ${ sha256Error . message } ` ) ;
394+ console . warn ( " ⚠️ Pre-release build: skipping fallback assets (server unreachable)" ) ;
395+ console . warn ( " 📦 Assets are bundled, so runtime downloads are not required" ) ;
396+ return pkg ;
397+ }
398+ console . error ( ` ❌ Failed to fetch SHA256SUM: ${ sha256Error . message } ` ) ;
370399 console . error (
371- " ❌ Build failed: sha256sum.txt is required for secure asset downloads" ,
400+ " ❌ Build failed: SHA256SUM is required for secure asset downloads" ,
372401 ) ;
373402 process . exit ( 1 ) ;
374403 }
@@ -430,14 +459,20 @@ async function generateFallbackAssets(pkg) {
430459
431460 pkg . fallbackAssets = {
432461 baseUrl : FALLBACK_ASSETS_URL ,
433- sha256sumFile : "sha256sum.txt " ,
462+ sha256sumFile : "SHA256SUM " ,
434463 assets,
435464 } ;
436465
437466 console . log (
438467 ` ✅ Generated fallback assets for ${ Object . keys ( assets ) . length } platforms` ,
439468 ) ;
440469 } catch ( error ) {
470+ if ( isPreRelease ) {
471+ console . warn ( ` ⚠️ Failed to generate fallback assets: ${ error . message } ` ) ;
472+ console . warn ( " ⚠️ Pre-release build: skipping fallback assets (server unreachable)" ) ;
473+ console . warn ( " 📦 Assets are bundled, so runtime downloads are not required" ) ;
474+ return pkg ;
475+ }
441476 console . error ( ` ❌ Failed to generate fallback assets: ${ error . message } ` ) ;
442477 console . error (
443478 " ❌ Build failed: fallback assets are required for extension functionality" ,
@@ -498,6 +533,46 @@ const isDirectExecution =
498533if ( isDirectExecution ) {
499534 console . log ( "🔄 Running MTA prebuild for multi-extension architecture...\n" ) ;
500535
536+ // Show loud warning for pre-release builds
537+ if ( isPreRelease ) {
538+ console . log ( "🚨🚨🚨 PRE-RELEASE BUILD DETECTED 🚨🚨🚨" ) ;
539+ console . log ( " Using candidate release assets that require VPN access:" ) ;
540+ console . log ( ` ${ fallbackAssetsUrl } ` ) ;
541+ console . log ( " Assets will be BUNDLED to avoid runtime download failures" ) ;
542+ console . log ( " 📝 TODO: Update to GA URL when MTA 8.1.0 is officially released:" ) ;
543+ console . log ( " https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.1.0/" ) ;
544+ console . log ( "🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n" ) ;
545+ }
546+
547+ // 0. Set version across all workspaces BEFORE webpack runs
548+ // This ensures webpack's DefinePlugin bakes the correct MTA version
549+ // into EXTENSION_VERSION constants at compile time.
550+ console . log ( `📝 Setting version ${ extensionVersion } across all workspaces...` ) ;
551+ const workspacePaths = [
552+ "package.json" ,
553+ "extra-types/package.json" ,
554+ "shared/package.json" ,
555+ "webview-ui/package.json" ,
556+ "agentic/package.json" ,
557+ "vscode/core/package.json" ,
558+ "vscode/java/package.json" ,
559+ "vscode/javascript/package.json" ,
560+ "vscode/go/package.json" ,
561+ "vscode/csharp/package.json" ,
562+ "vscode/konveyor/package.json" ,
563+ ] ;
564+
565+ for ( const ws of workspacePaths ) {
566+ const fullPath = path . join ( __dirname , ".." , ws ) ;
567+ if ( fs . existsSync ( fullPath ) ) {
568+ const pkg = JSON . parse ( fs . readFileSync ( fullPath , "utf8" ) ) ;
569+ pkg . version = extensionVersion ;
570+ fs . writeFileSync ( fullPath , JSON . stringify ( pkg , null , 2 ) ) ;
571+ console . log ( ` ✅ ${ ws } ` ) ;
572+ }
573+ }
574+ console . log ( "" ) ;
575+
501576 // 1. Transform core extension
502577 console . log ( "📦 Branding core extension (vscode/core)..." ) ;
503578 let corePkg = readPackageJson ( "vscode/core/package.json" ) ;
0 commit comments