@@ -186,45 +186,30 @@ tasks.register("prepareAssets") {
186186
187187 // Copy vap.sh
188188 val vapSh = File (toolsSrc, " vap.sh" )
189- if (vapSh.exists()) {
190- vapSh.copyTo(File (assetTools, " vap.sh" ), overwrite = true )
191- println (" prepareAssets: copied vap.sh" )
192- } else {
193- println (" prepareAssets: vap.sh not found at ${vapSh.absolutePath} , skipping." )
194- }
189+ require(vapSh.exists()) { " prepareAssets: vap.sh not found at ${vapSh.absolutePath} " }
190+ vapSh.copyTo(File (assetTools, " vap.sh" ), overwrite = true )
191+ println (" prepareAssets: copied vap.sh" )
195192
196193 // Copy start-ap
197194 val startAp = File (toolsSrc, " start-ap" )
198- if (startAp.exists()) {
199- startAp.copyTo(File (assetTools, " start-ap" ), overwrite = true )
200- println (" prepareAssets: copied start-ap" )
201- } else {
202- println (" prepareAssets: start-ap not found at ${startAp.absolutePath} , skipping." )
203- }
195+ require(startAp.exists()) { " prepareAssets: start-ap not found at ${startAp.absolutePath} " }
196+ startAp.copyTo(File (assetTools, " start-ap" ), overwrite = true )
197+ println (" prepareAssets: copied start-ap" )
204198
205- // Copy busybox
199+ // Copy busybox (extracted from rootfs by build_rootfs.sh)
206200 val busybox = File (toolsSrc, " bin/busybox" )
207- if (busybox.exists()) {
208- busybox.copyTo(File (assetBin, " busybox" ), overwrite = true )
209- println (" prepareAssets: copied busybox" )
210- } else {
211- println (" prepareAssets: busybox not found at ${busybox.absolutePath} , skipping." )
212- }
201+ require(busybox.exists()) { " prepareAssets: busybox not found at ${busybox.absolutePath} . Run rootfs-builder/build_rootfs.sh first." }
202+ busybox.copyTo(File (assetBin, " busybox" ), overwrite = true )
203+ println (" prepareAssets: copied busybox" )
213204
214205 // Copy latest rootfs tarball
215- if (outDir.exists()) {
216- val tarballs = outDir.listFiles()?.filter { it.name.endsWith(" .tar.xz" ) }
217- ?.sortedByDescending { it.lastModified() }
218- val latest = tarballs?.firstOrNull()
219- if (latest != null ) {
220- latest.copyTo(File (assetRootfs, latest.name), overwrite = true )
221- println (" prepareAssets: copied rootfs tarball ${latest.name} " )
222- } else {
223- println (" prepareAssets: no .tar.xz tarball found in ${outDir.absolutePath} , skipping." )
224- }
225- } else {
226- println (" prepareAssets: out/ directory not found at ${outDir.absolutePath} , skipping." )
227- }
206+ require(outDir.exists()) { " prepareAssets: out/ directory not found at ${outDir.absolutePath} . Run rootfs-builder/build_rootfs.sh first." }
207+ val tarballs = outDir.listFiles()?.filter { it.name.endsWith(" .tar.xz" ) }
208+ ?.sortedByDescending { it.lastModified() }
209+ val latest = tarballs?.firstOrNull()
210+ require(latest != null ) { " prepareAssets: no .tar.xz tarball found in ${outDir.absolutePath} . Run rootfs-builder/build_rootfs.sh first." }
211+ latest.copyTo(File (assetRootfs, latest.name), overwrite = true )
212+ println (" prepareAssets: copied rootfs tarball ${latest.name} " )
228213 }
229214}
230215
0 commit comments