this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove engine sha tracking

+12 -56
+2 -7
src/main/java/assets/archive/DioramaConfig.kt
··· 7 7 /** Target configuration for Diorama package. */ 8 8 data class DioramaConfig( 9 9 val assetsArchiveRomStart: Int, 10 - val engineSha: String 11 10 ) { 12 - companion object { 13 - /** Standard ROM address for AssetsArchive in papermario-dx builds. */ 14 - const val DEFAULT_ROM_START = 0x1E40000 15 - } 16 11 /** 17 12 * Generates target.json content. 18 13 */ 19 14 fun toJson(): String { 20 15 val json = Json { prettyPrint = false } 21 16 val target = TargetJson( 17 + version = 1, 22 18 engine = PapermarioDxConfig( 23 - sha = engineSha, 24 19 assets_archive_ROM_START = assetsArchiveRomStart 25 20 ) 26 21 ) ··· 29 24 30 25 @Serializable 31 26 internal data class TargetJson( 27 + val version: Int, 32 28 val engine: PapermarioDxConfig 33 29 ) 34 30 35 31 @Serializable 36 32 internal data class PapermarioDxConfig( 37 - val sha: String, 38 33 val assets_archive_ROM_START: Int 39 34 ) 40 35 }
+5 -32
src/main/java/project/Build.kt
··· 7 7 import assets.archive.AssetsArchiveCompressor 8 8 import assets.archive.DioramaArchiver 9 9 import assets.archive.DioramaConfig 10 + import assets.archive.readMapfsRomStart 10 11 import kotlinx.coroutines.* 11 12 import kotlinx.coroutines.channels.Channel 12 13 import kotlinx.coroutines.future.future ··· 127 128 headersDir.createDirectories() 128 129 129 130 val stateFile = project.directory.toPath() / ".starrod" / "build-state" / "state.json" 130 - val engineSha = getEngineSha() 131 131 132 132 // Load or create build state 133 - var buildState = BuildState.load(stateFile, engineSha) 133 + var buildState = BuildState.load(stateFile) 134 134 if (buildState == null) { 135 135 Logger.log("Build state invalidated or missing, rebuilding all assets") 136 - buildState = BuildState.create(engineSha) 136 + buildState = BuildState.create() 137 137 } 138 138 139 139 // Discover all assets ··· 171 171 val ctx = BuildCtx( 172 172 buildDir = buildDir, 173 173 project = project, 174 - engineSha = engineSha, 175 - buildStateVersion = BuildState.CURRENT_VERSION, 176 174 headersDir = headersDir 177 175 ) 178 176 ··· 278 276 } 279 277 280 278 /** 281 - * Gets the current engine git SHA for cache invalidation. 282 - * Returns "unknown" if not in a git repository. 283 - */ 284 - private fun getEngineSha(): String { 285 - return try { 286 - val process = ProcessBuilder("git", "rev-parse", "HEAD") 287 - .directory(project.directory) 288 - .redirectErrorStream(true) 289 - .start() 290 - 291 - val sha = process.inputStream.bufferedReader().readText().trim() 292 - process.waitFor() 293 - 294 - if (process.exitValue() == 0) sha else "unknown" 295 - } catch (e: Exception) { 296 - "unknown" 297 - } 298 - } 299 - 300 - /** 301 279 * Generates an AssetsArchive binary from built artifacts. 302 280 * @return Path to the generated assets.bin 303 281 */ ··· 335 313 Logger.log("Packaging Diorama...") 336 314 337 315 val projectManifest = project.directory.toPath() / Manifest.FILENAME 338 - val engineSha = getEngineSha() 339 - val config = DioramaConfig( 340 - assetsArchiveRomStart = DioramaConfig.DEFAULT_ROM_START, 341 - engineSha = engineSha 342 - ) 316 + val start = readMapfsRomStart(project.engine.directory.resolve("ver/us/build/syms.ld")); 317 + val config = DioramaConfig(start) 343 318 val modId = project.manifest.id ?: "unknown" 344 319 val outputPath = project.directory.toPath() / ".starrod" / "build" / "$modId.diorama" 345 320 346 321 val archiver = DioramaArchiver(projectManifest, config, archivePath) 347 322 archiver.createArchive(outputPath) 348 - 349 - Logger.log("Diorama engine SHA: $engineSha") 350 323 } 351 324 } 352 325 }
-4
src/main/java/project/Project.kt
··· 42 42 val engineAssetsDir: AssetsDir.Engine 43 43 get() = assetDirectories.last() as AssetsDir.Engine 44 44 45 - fun build() { 46 - // TODO 47 - } 48 - 49 45 companion object { 50 46 /** Creates a new project from a template. */ 51 47 @JvmStatic
-6
src/main/java/project/build/BuildCtx.kt
··· 16 16 /** Current project being built. */ 17 17 val project: Project, 18 18 19 - /** Engine SHA for cache invalidation. */ 20 - val engineSha: String, 21 - 22 - /** Build state format version for migration. */ 23 - val buildStateVersion: Int, 24 - 25 19 /** Directory containing generated headers. */ 26 20 val headersDir: Path 27 21 ) {
+5 -7
src/main/java/project/build/BuildState.kt
··· 14 14 */ 15 15 @Serializable 16 16 data class BuildState( 17 - val engineSha: String, 18 17 val version: Int, 19 18 val assetTimestamps: MutableMap<String, Long> = mutableMapOf(), 20 19 val assetClassTimestamps: MutableMap<String, Long> = mutableMapOf() ··· 129 128 130 129 /** 131 130 * Load build state from disk, or create a fresh state if the file doesn't exist. 132 - * Returns null if the state is invalid (wrong engine SHA or version). 131 + * Returns null if the state is invalid. 133 132 */ 134 - fun load(stateFile: Path, currentEngineSha: String): BuildState? { 133 + fun load(stateFile: Path): BuildState? { 135 134 if (!stateFile.exists()) 136 135 return null 137 136 138 137 return try { 139 138 val state = json.decodeFromString<BuildState>(stateFile.readText()) 140 - // Invalidate if engine changed or version mismatch 141 - if (state.engineSha != currentEngineSha || state.version != CURRENT_VERSION) { 139 + if (state.version != CURRENT_VERSION) { 142 140 null 143 141 } else { 144 142 state ··· 152 150 /** 153 151 * Create a fresh build state. 154 152 */ 155 - fun create(engineSha: String): BuildState { 156 - return BuildState(engineSha, CURRENT_VERSION) 153 + fun create(): BuildState { 154 + return BuildState(CURRENT_VERSION) 157 155 } 158 156 } 159 157 }