Improve build script to properly recognize debug assertions

This commit is contained in:
Konrad Borowski 2022-05-08 08:58:40 +02:00
parent 5cdac38b1f
commit 3b25942444
1 changed files with 16 additions and 16 deletions

View File

@ -14,23 +14,23 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use serde::Deserialize;
use std::env;
#[derive(Deserialize)]
struct Manifest {
#[serde(rename = "js/index.ts")]
index: Index,
}
#[derive(Deserialize)]
struct Index {
file: String,
css: [String; 1],
}
fn main() -> serde_json::Result<()> {
if env::var("PROFILE").as_deref() == Ok("release") {
#[cfg(not(debug_assertions))]
{
use serde::Deserialize;
#[derive(Deserialize)]
struct Manifest {
#[serde(rename = "js/index.ts")]
index: Index,
}
#[derive(Deserialize)]
struct Index {
file: String,
css: [String; 1],
}
let Manifest {
index: Index { file, css: [css] },
} = serde_json::from_str(include_str!("dist/manifest.json"))?;