MTK之基于Perl的工程管理

本文介绍了一种在MTK项目中通过工程拷贝进行高效管理的方法,包括目录结构设计、Perl解析器的使用、以及关键代码流程。详细展示了如何简化繁琐工作,提高维护效率,同时提供了运行环境配置、代码执行流程、错误处理机制等实践经验。

        当一个项目有很多需求时,很有必要做一个工程管理,试想,有十个客户,每个客户又有多个品牌,每个品牌又有不同的市场,要是每个对应的需求都去开个单独的工程代码,这样不仅不利于资源共享,而且难以维护。做程序员就要有一种“懒”的意识,把繁琐的事情简单化,把复杂的事情明了化。这样维护方便快捷,即便你哪天要走了,交接也相当的方便,不必去写长长的文档,接收人还看的云里雾里。当然,我也十分佩服那些没做工程管理但是发布的软件版本不出错的。
        以下是我在MTK项目中做的一个工程拷贝。目录结构如下:

        根目录为project,二级目录为工程名,三级目录为客户,四级目录为市场。在四级目录里面放置了各个工程所需的文件,编译时会拷贝到对应的路径。
        运行需要有Perl解析器,我安装的是ActivePerl-5.8.8.822-MSWin32-x86-280952.msi

运行效果如下:

代码如下:

 

#!/usr/local/bin/perl

use Cwd;

#******************************************************************************#
# File created for select project
# Author: Jerome
# Date: 2012-09-11
#******************************************************************************#

#------------------------ prject file name param --------------------------------------------------#
# If configure new release code from MTK, please remember modify $mak_type and $network_type !
my $mak_type = "MAUI_KHAN50V11_12864_11B";
my $network_type = "GPRS";
my $LCD_SIZE;
my $theme_type;
#--------------------------------------------------------------------------------------------------#

my $curr_dir = getcwd;
my $project_root = "project";
my $project_dir;
my $customer_dir;
my $market_dir;

my $filter_char;
my $input_hint;

my $TBL_PROJECT = "PROJECT";
my $TBL_CUSTOMER = "CUSTOMER";
my $TBL_MARKET = "MARKET";

my %type_tbl = 
(
      $TBL_PROJECT		=> 0,
      $TBL_CUSTOMER		=> 1,
      $TBL_MARKET		=> 2,
);


ListAllType2Select("$project_root", $type_tbl{$TBL_PROJECT});
ListAllType2Select("$project_root\\$project_dir", $type_tbl{$TBL_CUSTOMER});
ListAllType2Select("$project_root\\$project_dir\\$customer_dir",  $type_tbl{$TBL_MARKET});
CopyFiles2UpdateProject("$project_root\\$project_dir\\$customer_dir\\$market_dir");
SaveCurrProjectInfo2Log("$project_dir", "$customer_dir", "$market_dir");

#------------------------------------------------------------------------------------#

sub SaveCurrProjectInfo2Log
{
	my $log_file = $curr_dir."\\project_info.log";
	my ($proj, $customer, $market) = @_;

	GetTypeInfo($type_tbl{$TBL_PROJECT});
	$proj =~ s/$filter_char//g;

	GetTypeInfo($type_tbl{$TBL_CUSTOMER});
	$customer =~s/$filter_char//g;

	GetTypeInfo($type_tbl{$TBL_MARKET});
	$market =~ s/$filter_char//g;

	open(FILE, ">$log_file");
	print FILE "\n";
	print FILE "configure project success !\n\n";
	print FILE "project: $proj \n\n";
	print FILE "customer: $customer \n\n";
	print FILE "market: $market \n\n";
	close(FILE);
}

#------------------------------------------------------------------------------------#

sub CopyFiles2UpdateProject
{
	my ($proj_dir) = @_;
	GetProjectIniFileInfo("$proj_dir");

	my $codegen = "codegen.dws";
	my $codegen_dir = "custom\\codegen\\".$mak_type."_BB\\$codegen";

	my $memorydevice = "custom_memorydevice.h";
	my $memorydevice_dir = "custom\\system\\".$mak_type."_BB\\$memorydevice";

	my $mak_option = $mak_type."_".$network_type.".mak";
	my $mak_option_dir = "make\\".$mak_option;

	my $customer_define = "customer_define.mak";
	my $customer_define_dir = "make\\$customer_define";

	my $version = "Verno_".$mak_type.".bld";
	my $version_dir = "make\\".$version;

	my $feature_config = "MMI_features_switch$mak_type.h";
	my $feature_config_dir = "plutommi\\Customer\\CustResource\\".$mak_type."_MMI\\".$feature_config;

	my $theme = "Themecomponents.h";
	my $theme_dir = "plutommi\\Customer\\LcdResource\\MainLcd$LCD_SIZE\\$theme_type\\$theme";

	my $nvram_audio = "nvram_default_audio.c";
	my $nvram_audio_dir = "custom\\audio\\".$mak_type."_BB\\".$nvram_audio;

	(-e "$proj_dir\\$codegen") ? system("copy /y $proj_dir\\$codegen $codegen_dir") : print "$codegen is not exist !\n";

	(-e "$proj_dir\\$memorydevice") ? system("copy /y $proj_dir\\$memorydevice $memorydevice_dir") : print "$memorydevice is not exist !\n";

	(-e "$proj_dir\\$mak_option") ? system("copy /y $proj_dir\\$mak_option $mak_option_dir") : print "$mak_option is not exist !\n";

	(-e "$proj_dir\\$customer_define") ? system("copy /y $proj_dir\\$customer_define $customer_define_dir") : print "$customer_define is not exist !\n";

	(-e "$proj_dir\\$version") ? system("copy /y $proj_dir\\$version $version_dir") : print "$version is not exist !\n";

	(-e "$proj_dir\\$feature_config") ? system("copy /y $proj_dir\\$feature_config $feature_config_dir") : print "$feature_config is not exist !\n";

	(-e "$proj_dir\\$theme") ? system("copy /y $proj_dir\\$theme $theme_dir") : print "$theme is not exist !\n";

	(-e "$proj_dir\\$nvram_audio") ? system("copy /y $proj_dir\\$nvram_audio $nvram_audio_dir") : print "$nvram_audio is not exist !\n";
}

#------------------------------------------------------------------------------------#

sub GetProjectIniFileInfo
{
	my @MakContent;
	my @ConfigIniContent;

	my ($file_dir) = @_;

	my $ConfigIni = $file_dir."\\configure.ini";
	my $mak = $file_dir."\\".$mak_type."_".$network_type.".mak";
	
	open(MAK, "< $mak") or die "cannot read \"$mak\" file, check please !\n";
	@MakContent=<MAK>;
	close(MAK);

	for my $line (@MakContent)
	{
		$line =~ s/\s//g;

		if ($line =~ /^MAIN_LCD_SIZE\s*=\s*(.*)/)	
		{
			$LCD_SIZE = $1;
			last;
		}	
	}

	open(CONFIG, "< $ConfigIni") or die "cannot read \"$ConfigIni\" file, check please !\n";
	@ConfigIniContent=<CONFIG>;
	close(CONFIG);

	for my $line (@ConfigIniContent)
	{
		$line =~ s/\s//g;

		if ($line =~ /^THEME_TYPE\s*=\s*(.*)/)	
		{
			$theme_type = $1;
			last;
		}	
	}
}

#------------------------------------------------------------------------------------#

sub ListAllType2Select
{
	my $dir;
	my $list_type;
	
	my @list;
	my @name;
	my $num = 0;
	my $sel_index = 0;
	my $sel_content;

	my ($dir, $list_type) = @_;

	GetTypeInfo($list_type);
	opendir(LIST, $dir) or die "Cannot open $dir! \n";
	@list = readdir(LIST);

	foreach (@list)
	{
		if ($_ =~ /$filter_char(.*)/)
		{
			push @name, $_;
			print " $num ";
			$_ =~ s/$filter_char//g;
			print " - ", $_, "\n";			
			$num++;
		}	
	}

	closedir(LIST);

	if($num <= 0)
	{
		print "$input_hint is not exist, please check ! \n";
		exit(0);
	}

	print "$input_hint:";
	chomp($sel_index = <STDIN>);

	CheckInputIndexValid($sel_index, $num);

	$sel_content = @name[$sel_index];
	UpdateCurrSelDir($sel_content, $list_type);	
}

#------------------------------------------------------------------------------------#

sub UpdateCurrSelDir
{
	my ($content, $type) = @_;

	if($type == $type_tbl{$TBL_PROJECT})
	{
		$project_dir = $content;
	}
	elsif($type == $type_tbl{$TBL_CUSTOMER})
	{
		$customer_dir = $content;
	}
	elsif($type == $type_tbl{$TBL_MARKET})
	{
		$market_dir = $content;
	}
}

#------------------------------------------------------------------------------------#

sub GetTypeInfo
{
	$filter_tmp;
	$hint;
	my ($type) = @_;

	if($type == $type_tbl{$TBL_PROJECT})
	{
		$filter_tmp = "project_";
		$hint = "project";
	}
	elsif($type == $type_tbl{$TBL_CUSTOMER})
	{
		$filter_tmp = "customer_";
		$hint = "customer";
	}
	elsif($type == $type_tbl{$TBL_MARKET})
	{
		$filter_tmp = "market_";
		$hint = "market";
	}
	else
	{
		print "Function:ListAllType, error param ! \n";
		exit(0);
	}

	$filter_char = $filter_tmp;
	$input_hint = $hint;
}

#------------------------------------------------------------------------------------#

sub CheckInputIndexValid
{
	my $error_flag = 0;
	my ($sel_index, $max_index) = @_;

	if ( ($sel_index ne "") && ($sel_index !~ /[A-Za-z]/) )
	{
		if($sel_index =~ /^[0-9][0-9]*$/ && $sel_index >= 0 && $sel_index < $max_index)
		{
			# do nothing
		}
		else
		{
			$error_flag = 1;
		}
	}
	else
	{
		$error_flag = 1;
	}

	if($error_flag > 0)
	{
		print "Error input, please configure again ! \n";
		exit(0);
	}
}

#------------------------------------------------------------------------------------#

整个工程可以到我的资源中下载http://download.youkuaiyun.com/detail/jerome_home/4918560

内容概要:本文介绍了ENVI Deep Learning V1.0的操作教程,重点讲解了如何利用ENVI软件进行深度学习模型的训练与应用,以实现遥感图像中特定目标(如集装箱)的自动提取。教程涵盖了从数据准备、标签图像创建、模型初始化与训练,到执行分类及结果优化的完整流程,并介绍了精度评价与通过ENVI Modeler实现一键化建模的方法。系统基于TensorFlow框架,采用ENVINet5(U-Net变体)架构,支持通过点、线、面ROI或分类图生成标签数据,适用于多/高光谱影像的单一类别特征提取。; 适合人群:具备遥感图像处理基础,熟悉ENVI软件操作,从事地理信息、测绘、环境监测等相关领域的技术人员或研究人员,尤其是希望将深度学习技术应用于遥感目标识别的初学者与实践者。; 使用场景及目标:①在遥感影像中自动识别和提取特定地物目标(如车辆、建筑、道路、集装箱等);②掌握ENVI环境下深度学习模型的训练流程与关键参数设置(如Patch Size、Epochs、Class Weight等);③通过模型调优与结果反馈提升分类精度,实现高效自动化信息提取。; 阅读建议:建议结合实际遥感项目边学边练,重点关注标签数据制作、模型参数配置与结果后处理环节,充分利用ENVI Modeler进行自动化建模与参数优化,同时注意软硬件环境(特别是NVIDIA GPU)的配置要求以保障训练效率。
内容概要:本文系统阐述了企业新闻发稿在生成式引擎优化(GEO)时代下的全渠道策略与效果评估体系,涵盖当前企业传播面临的预算、资源、内容与效果评估四大挑战,并深入分析2025年新闻发稿行业五大趋势,包括AI驱动的智能化转型、精准化传播、首发内容价值提升、内容资产化及数据可视化。文章重点解析央媒、地方官媒、综合门户和自媒体四类媒体资源的特性、传播优势与发稿策略,提出基于内容适配性、时间节奏、话题设计的策略制定方法,并构建涵盖品牌价值、销售转化与GEO优化的多维评估框架。此外,结合“传声港”工具实操指南,提供AI智能投放、效果监测、自媒体管理与舆情应对的全流程解决方案,并针对科技、消费、B2B、区域品牌四大行业推出定制化发稿方案。; 适合人群:企业市场/公关负责人、品牌传播管理者、数字营销从业者及中小企业决策者,具备一定媒体传播经验并希望提升发稿效率与ROI的专业人士。; 使用场景及目标:①制定科学的新闻发稿策略,实现从“流量思维”向“价值思维”转型;②构建央媒定调、门户扩散、自媒体互动的立体化传播矩阵;③利用AI工具实现精准投放与GEO优化,提升品牌在AI搜索中的权威性与可见性;④通过数据驱动评估体系量化品牌影响力与销售转化效果。; 阅读建议:建议结合文中提供的实操清单、案例分析与工具指南进行系统学习,重点关注媒体适配性策略与GEO评估指标,在实际发稿中分阶段试点“AI+全渠道”组合策略,并定期复盘优化,以实现品牌传播的长期复利效应。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值